/*
 * A2B Tools — one stylesheet for the whole site.
 *
 * Direction: warm paper against a cold Nordic blue. The paper keeps a dense utility from feeling
 * clinical; the blue is the only interactive colour. Every other colour in here means something
 * specific — evergreen is the Christmas closure, ochre the summer closure, plum the exam deadline —
 * so colour is never decoration, and a marker can be trusted on sight.
 */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  --paper: #f6f3ee;
  --surface: #ffffff;
  --surface-sunk: #fbf9f6;
  --ink: #1b1f24;
  --ink-2: #4a5158;
  --ink-3: #767e86;
  --line: #e3ded6;
  --line-strong: #cdc6bb;

  --accent: #23608f;
  --accent-hover: #1b4d73;
  --accent-on: #ffffff;
  --accent-soft: #e7f0f7;

  --christmas: #2c6a4c;
  --christmas-soft: #e2efe8;
  --summer: #8a5a0b;
  --summer-soft: #f7eddb;
  --deadline: #7a3b8c;
  --deadline-soft: #f2e8f5;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow: 0 1px 2px rgb(27 31 36 / 6%), 0 4px 12px rgb(27 31 36 / 4%);
  --shadow-lift: 0 2px 4px rgb(27 31 36 / 8%), 0 8px 24px rgb(27 31 36 / 8%);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;

  --measure: 66ch;
  --page: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14161a;
    --surface: #1c1f24;
    --surface-sunk: #22262c;
    --ink: #e9e6e1;
    --ink-2: #a9b0b8;
    --ink-3: #7d858d;
    --line: #2f343b;
    --line-strong: #444b53;

    --accent: #74b0e2;
    --accent-hover: #93c3ec;
    --accent-on: #0e1620;
    --accent-soft: #1a2b3a;

    --christmas: #74c39a;
    --christmas-soft: #17281f;
    --summer: #dda94f;
    --summer-soft: #2a2114;
    --deadline: #cb9edb;
    --deadline-soft: #271b2c;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 12px rgb(0 0 0 / 30%);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 45%), 0 8px 24px rgb(0 0 0 / 40%);
  }
}

/* ----------------------------------------------------------------- reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  /* Dates only ever line up if the digits are the same width. */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
figure,
fieldset {
  margin: 0;
}

fieldset {
  border: 0;
  padding: 0;
  min-inline-size: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection {
  background: var(--accent-soft);
}

/* ---------------------------------------------------------------- layout */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-on);
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}

.skip:focus {
  left: 0;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar__inner {
  max-width: var(--page);
  margin-inline: auto;
  padding: 12px clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-sm);
}

.brand__mark {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 1.0625rem;
  color: var(--accent);
}

.brand__name {
  font-size: 0.9375rem;
  color: var(--ink-2);
}

.brand:hover .brand__name {
  color: var(--ink);
}

main {
  max-width: var(--page);
  margin-inline: auto;
  padding: clamp(24px, 5vw, 44px) clamp(16px, 4vw, 32px) 64px;
}

.stack > * + * {
  margin-top: var(--gap, 24px);
}

/* ----------------------------------------------------------------- tabs
 * Links between separate pages, styled as tabs. Semantically a <nav> — see
 * site.js on why role="tab" would be a lie here.
 */

.toolbar {
  border-top: 1px solid var(--line);
  background: var(--surface);
  max-width: var(--page);
  margin-inline: auto;
  padding: 0 clamp(16px, 4vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tabs {
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs__list {
  display: flex;
  gap: 4px;
  list-style: none;
  /* A <ul> carries a browser default padding-inline-start; without this the first tab sits 40px
     right of the brand it should line up with. */
  margin: 0;
  padding: 0;
}

.tab {
  display: block;
  padding: 11px 16px 10px;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 560;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.tab:hover {
  color: var(--ink);
  background: var(--surface-sunk);
}

.tab[aria-current="page"] {
  color: var(--accent);
  font-weight: 640;
  border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------- settings */

.settings {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 6px 0;
}

.select {
  appearance: none;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 30px 6px 14px;
  font-size: 0.875rem;
  color: var(--ink-2);
  cursor: pointer;
  max-width: 24rem;
  text-overflow: ellipsis;
  /* Inlined as a data URI: the CSP allows no external images, and this is one arrow. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23767e86' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 6px;
  transition: border-color 120ms ease, color 120ms ease;
}

.select:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

/* ------------------------------------------------------------- language */

.langpicker {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.langpicker button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.langpicker button:hover {
  color: var(--ink);
}

.langpicker button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 600;
}

/* ------------------------------------------------------------ headings */

.crumb {
  font-size: 0.875rem;
  margin-bottom: 12px;
}

.crumb a {
  color: var(--ink-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.crumb a:hover {
  color: var(--accent);
  text-decoration: underline;
}

h1 {
  font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.375rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 660;
}

h2 {
  font-size: 1.0625rem;
  font-weight: 640;
  letter-spacing: -0.005em;
}

.lede {
  margin-top: 10px;
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 1.0625rem;
}

/* --------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 24px);
}

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.hint {
  color: var(--ink-3);
  font-size: 0.875rem;
  margin-top: 8px;
  max-width: var(--measure);
}

.label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 620;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

/* --------------------------------------------------------------- fields */

.field {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

input[type="date"],
input[type="number"] {
  background: var(--surface-sunk);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 1.0625rem;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input[type="date"] {
  flex: 1 1 13rem;
  max-width: 17rem;
}

input[type="number"] {
  flex: 0 1 9rem;
  max-width: 9rem;
}

input:hover {
  border-color: var(--ink-3);
}

input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

input[aria-invalid="true"] {
  border-color: #b3261e;
}

@media (prefers-color-scheme: dark) {
  input[aria-invalid="true"] {
    border-color: #f2b8b5;
  }
}

.btn {
  appearance: none;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 0.9375rem;
  font-weight: 560;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.btn:hover {
  background: var(--surface-sunk);
  border-color: var(--ink-3);
}

.btn:active {
  transform: translateY(1px);
}

.startecho {
  margin-top: 12px;
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.startecho:empty {
  display: none;
}

.error {
  margin-top: 10px;
  color: #b3261e;
  font-size: 0.875rem;
}

@media (prefers-color-scheme: dark) {
  .error {
    color: #f2b8b5;
  }
}

/* ---------------------------------------------------------------- table */

.results {
  padding: 0;
  overflow: hidden;
}

.results table {
  width: 100%;
  border-collapse: collapse;
}

.results caption {
  text-align: left;
  padding: clamp(16px, 3vw, 22px) clamp(16px, 3vw, 24px) 14px;
  font-size: 1.0625rem;
  font-weight: 640;
}

.results thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-sunk);
  border-block: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 0.8125rem;
  font-weight: 660;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-align: left;
}

/* Equal thirds for the programmes; the module label takes only what it needs. */
.results thead th:first-child,
.results tbody th {
  width: 1%;
  white-space: nowrap;
}

.results thead th:not(:first-child) {
  width: 33%;
  text-align: center;
}

.results tbody th {
  text-align: left;
  padding: 8px 14px 8px 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

/* Line the grid up with the caption above it. */
.results thead th:first-child,
.results tbody th {
  padding-left: clamp(16px, 3vw, 24px);
}

.results thead th:last-child,
.results tbody td:last-child {
  padding-right: clamp(12px, 3vw, 20px);
}

.results tbody td {
  padding: 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.results tbody tr:last-child th,
.results tbody tr:last-child td {
  border-bottom: 0;
}

/* ----------------------------------------------------------------- cell */

/* A radio matrix: the headers say what a cell is, so the cell itself only has to be pickable. */

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Comfortably past the 44px minimum touch target, at every width. */
  min-height: 46px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 120ms ease;
}

.cell:hover {
  background: var(--surface-sunk);
}

/*
 * The radio is transparent but fills the whole cell rather than being shrunk to a hidden pixel:
 * the entire cell is then the hit target, and the control stays a real clickable element instead
 * of something only reachable through its label.
 */
.cell__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.cell__input:disabled {
  cursor: not-allowed;
}

.cell__dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  display: block;
  position: relative;
  /* Decoration only (aria-hidden): it must never swallow a click meant for the radio beneath it. */
  pointer-events: none;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.cell:hover .cell__dot {
  border-color: var(--accent);
}

.cell__input:checked + .cell__dot {
  background: var(--accent);
  border-color: var(--accent);
}

/* The tick is drawn rather than typed: a glyph would inherit the page font and shift about. */
.cell__input:checked + .cell__dot::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid var(--accent-on);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cell__input:focus-visible + .cell__dot {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.cell--unavailable {
  cursor: not-allowed;
}

.cell--unavailable:hover {
  background: transparent;
}

.cell--unavailable .cell__dot {
  border-style: dashed;
  border-color: var(--line);
  background: transparent;
}

.cell--unavailable:hover .cell__dot {
  border-color: var(--line);
}

/* -------------------------------------------------------------- markers */

.marker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px 2px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 620;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.marker__glyph {
  font-size: 0.75rem;
  line-height: 1;
}

.marker--christmas {
  background: var(--christmas-soft);
  color: var(--christmas);
}

.marker--summer {
  background: var(--summer-soft);
  color: var(--summer);
}

.marker--deadline {
  background: var(--deadline-soft);
  color: var(--deadline);
}

/* --------------------------------------------------------------- result
 * The page's answer. It gets the accent border and a tinted surface because
 * it is the one thing on screen the user actually came for.
 */

.result {
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}

.result__empty {
  color: var(--ink-3);
  max-width: var(--measure);
}

.result__for {
  font-size: 0.8125rem;
  font-weight: 660;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

.result__date {
  font-size: clamp(1.5rem, 1.1rem + 1.7vw, 2.125rem);
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-top: 6px;
  /* Danish full dates run long ("onsdag den 30. juni 2027"); let them wrap gracefully. */
  text-wrap: balance;
}

.result__markers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.result__markers:empty {
  display: none;
}

.result__explaintitle {
  font-size: 0.8125rem;
  font-weight: 660;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  margin-bottom: 12px;
}

/* ---------------------------------------------------------- explanation */

.explain__body {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: var(--measure);
}

.explain__body li {
  position: relative;
  padding-left: 20px;
  margin-top: 7px;
}

.explain__body li:first-child {
  margin-top: 0;
}

.explain__body li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
}

.explain__body li:last-child {
  font-weight: 640;
  color: var(--ink);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.explain__body li:last-child::before {
  background: var(--accent);
  top: calc(0.62em + 12px);
}

.copybtn {
  flex: none;
}

/* --------------------------------------------------------------- legend */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  padding: 16px clamp(16px, 3vw, 24px);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.legend h2 {
  width: 100%;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--ink-2);
}

/* -------------------------------------------------------------- landing */

.toolgrid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
}

.toolcard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.toolcard:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.toolcard__icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
}

.toolcard__name {
  font-size: 1.1875rem;
  font-weight: 660;
  letter-spacing: -0.01em;
}

.toolcard__summary {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.toolcard__go {
  margin-top: auto;
  padding-top: 6px;
  color: var(--accent);
  font-weight: 620;
  font-size: 0.9375rem;
}

.note {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 3vw, 22px);
  color: var(--ink-2);
  max-width: var(--measure);
}

.note h2 {
  margin-bottom: 6px;
  color: var(--ink);
}

/* --------------------------------------------------------------- footer */

.sitefoot {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 20px clamp(16px, 4vw, 32px) 32px;
}

.sitefoot__inner {
  max-width: var(--page);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 0.8125rem;
}

/* ------------------------------------------------------------ utilities */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------- narrow: stay a grid
 * The chooser keeps its columns side by side at every width. A cell holds
 * only a control, so three of them fit a phone comfortably — stacking them
 * into one card per module just made the page long for no gain.
 */


/* The format sample is a whole date, so on a phone it needs the row to itself. */
@media (max-width: 620px) {
  .toolbar {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .settings {
    width: 100%;
    padding: 0 0 8px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }

  .select {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 560px) {
  .results caption {
    font-size: 1rem;
  }

  .results thead th {
    padding: 8px 4px;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
  }

  .results tbody th {
    padding-right: 8px;
    font-size: 0.875rem;
  }

  .results tbody td {
    padding: 3px 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
