/* kita-index design language.
 *
 * Intent: Swiss public-utility, not SaaS.
 * Cues: SBB timetable, Swiss Post directory, federal info pages — but
 * warmer because parents aren't doing taxes.
 *
 * Rules of the house, enforced via tokens:
 *   - No filled brand-orange buttons. Orange is a wayfinding mark, not paint.
 *   - No rounded cards. Rows with rules instead.
 *   - No shadows. Edges and weight carry hierarchy.
 *   - No #fff / #000 — paper white + warm near-black, tinted toward signal.
 *   - Tabular numerals everywhere data appears.
 */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  /* — Palette (OKLCH, restrained) ——————————————————————————— */
  /* Warmer-than-white paper. Slightly tinted toward signal so the page
     reads as a single material, not as a panel-on-white. */
  --paper:        oklch(98% 0.006 65);
  --paper-warm:   oklch(96.5% 0.010 65);
  --paper-line:   oklch(89% 0.012 65);    /* hairline rules */
  --paper-edge:   oklch(82% 0.014 65);    /* heavier rules */

  --ink:          oklch(22% 0.012 50);    /* body */
  --ink-soft:     oklch(38% 0.014 50);    /* secondary */
  --ink-muted:    oklch(55% 0.012 60);    /* meta, captions */

  /* Signal orange — Bern-orange, but pitched to a more SBB-orange hue and
     reserved for wayfinding marks, not button paint. */
  --signal:       oklch(63% 0.17 50);
  --signal-ink:   oklch(46% 0.16 48);     /* signal text on paper */
  --signal-soft:  oklch(95% 0.04 55);     /* tinted background, rare */

  /* Single shared focus ring. Visible, not garish. */
  --focus-ring:   0 0 0 2px var(--paper), 0 0 0 4px var(--signal-ink);

  /* — Type ————————————————————————————————————————————————— */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SF Mono, Menlo, monospace;

  /* Scale — geometric, 1.25 ratio between text steps, 1.5 between display. */
  --text-xs:   0.75rem;     /* 12 — meta caps */
  --text-sm:   0.875rem;    /* 14 — secondary */
  --text-base: 1rem;        /* 16 — body */
  --text-md:   1.125rem;    /* 18 — emphasis */
  --text-lg:   1.4rem;      /* 22 — sub-heading */
  --text-xl:   2.1rem;      /* 33 — section title */
  --text-2xl:  clamp(2.4rem, 5.5vw, 3.8rem);  /* display */

  --lh-tight: 1.1;
  --lh-snug:  1.25;
  --lh-body:  1.5;

  /* — Layout ——————————————————————————————————————————————— */
  --gutter:        clamp(16px, 4vw, 28px);
  --measure:       72ch;
  --max-w:         1100px;
  --max-w-narrow:  720px;
}

@media (prefers-color-scheme: dark) {
  /* Defer dark mode for now — the brand sits on paper. The shared tokens
     are explicit so a future dark theme has somewhere to swap in. */
}

/* ————————————————————————————————————————————————————————————————
   Base reset / element defaults
   ———————————————————————————————————————————————————————————————— */
*, *::before, *::after { box-sizing: border-box; }

html { font-feature-settings: "ss01", "cv11"; }  /* Inter alt forms */
body {
  margin: 0; padding: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--signal-ink); text-decoration-thickness: 2px; }

button { font-family: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 2px; }

/* Number formatting on anything that holds data. */
.num, [data-num], .meta, .row .distance, table { font-variant-numeric: tabular-nums lining-nums; }

/* ————————————————————————————————————————————————————————————————
   Type primitives
   ———————————————————————————————————————————————————————————————— */
.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
}

.display {
  font-size: var(--text-2xl);
  line-height: var(--lh-tight);
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0; line-height: var(--lh-snug); }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); font-weight: 600; }

p { margin: 0 0 1em; max-width: var(--measure); }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }

/* ————————————————————————————————————————————————————————————————
   Page chrome — masthead + footer
   ———————————————————————————————————————————————————————————————— */
.masthead {
  border-bottom: 1px solid var(--paper-edge);
  background: var(--paper);
}
.masthead-row {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.masthead-row > * { min-width: 0; }
@media (max-width: 640px) {
  .masthead-row { padding: 12px var(--gutter); gap: 10px; }
  .masthead-meta { order: 3; flex-basis: 100%; }
  .lang-toggle { margin-left: auto; }
}
.brand {
  display: inline-flex; align-items: baseline; gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: var(--text-md);
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  background: var(--signal);
  /* The kita signpost: a small square turned into a diamond. */
  transform: rotate(45deg) translateY(-1px);
  flex-shrink: 0;
}
.masthead-meta {
  font-size: var(--text-xs);
  color: var(--ink-muted);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.lang-toggle {
  display: inline-flex;
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  font-weight: 600;
  gap: 0;
}
.lang-toggle button {
  background: transparent; border: 0; cursor: pointer;
  padding: 4px 8px;
  color: var(--ink-muted);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: inherit;
  border-bottom: 1px solid transparent;
}
.lang-toggle button + button { border-left: 1px solid var(--paper-line); }
.lang-toggle button.on { color: var(--signal-ink); border-bottom-color: var(--signal); }
.lang-toggle button:hover { color: var(--ink); }

.colophon {
  border-top: 1px solid var(--paper-edge);
  margin-top: 64px;
  padding: 32px var(--gutter) 40px;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}
@media (max-width: 640px) { .colophon { margin-top: 40px; padding: 24px var(--gutter) 32px; } }
.colophon-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 32px;
}
/* Colophon column labels are typographic, not heading-level — they're
   <p class="eyebrow"> so the document outline doesn't jump from h1 to h4. */
.colophon .eyebrow {
  color: var(--ink);
  margin: 0 0 8px;
}
.colophon a { color: var(--ink-soft); }
.colophon ul { margin: 0; padding: 0; list-style: none; }
.colophon li { padding: 1px 0; }
@media (max-width: 640px) {
  .colophon-grid { grid-template-columns: 1fr; gap: 18px; }
}

/* ————————————————————————————————————————————————————————————————
   Buttons & links — no filled primary, "primary" is an outlined chip
   with a chevron. Filled colour reads as paint; we want a sign.
   ———————————————————————————————————————————————————————————————— */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 600;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--paper-edge);
  border-radius: 0;
  cursor: pointer;
  min-height: 44px;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.btn:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn .chev { color: var(--signal-ink); font-weight: 700; }
.btn.is-signal { border-color: var(--signal-ink); }
.btn.is-signal:hover { background: var(--signal-soft); }
.btn.is-quiet { border-color: transparent; padding-inline: 6px; }
.btn.is-quiet:hover { border-color: var(--paper-line); }

/* Text-only action link with a leading arrow. Usable on both <a> and <button>
   so we reset all user-agent button chrome before declaring the underline. */
.action {
  display: inline-flex; align-items: baseline; gap: 4px;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--paper-edge);
  padding: 2px 0;
  cursor: pointer;
}
.action:hover { color: var(--signal-ink); border-bottom-color: var(--signal); text-decoration: none; }
.action:disabled { opacity: 0.55; cursor: wait; }

/* ————————————————————————————————————————————————————————————————
   Inputs — flat, line-driven, baseline-aligned.
   ———————————————————————————————————————————————————————————————— */
.field { display: block; }
.field label, .label {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  font: inherit;
  font-size: var(--text-md);
  padding: 10px 0;
  border: 0;
  border-bottom: 2px solid var(--paper-edge);
  background: transparent;
  color: var(--ink);
  border-radius: 0;
  min-height: 44px;
}
.input:focus { outline: none; border-bottom-color: var(--signal-ink); }
.input::placeholder { color: var(--ink-muted); opacity: 0.7; }
.input.is-block {
  padding: 14px 16px;
  border: 1px solid var(--paper-edge);
  border-radius: 2px;
  background: var(--paper);
}
.input.is-block:focus { border-color: var(--signal-ink); box-shadow: var(--focus-ring); }

textarea.input { padding: 12px 14px; border: 1px solid var(--paper-edge); border-radius: 2px; min-height: 120px; resize: vertical; line-height: var(--lh-body); }
textarea.input:focus { border-color: var(--signal-ink); box-shadow: var(--focus-ring); }

/* ————————————————————————————————————————————————————————————————
   The Row — the page's primary list affordance. Replaces SaaS cards.
   ———————————————————————————————————————————————————————————————— */
.rows { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--paper-line); }
.row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--paper-line);
}
@media (max-width: 520px) {
  .row { grid-template-columns: 16px 1fr; gap: 12px; padding: 16px 0; }
  .row .distance { grid-column: 2; padding-top: 4px; }
  .row .actions { gap: 12px 14px; font-size: var(--text-sm); }
}
.row .marker {
  height: 8px; width: 8px;
  background: var(--signal);
  /* Diamond — same mark as the brand. Scales with parent line-height. */
  transform: rotate(45deg) translateY(4px);
  align-self: start;
}
.row .marker.is-quiet { background: var(--paper-edge); }
.row .title { font-weight: 600; font-size: var(--text-md); line-height: var(--lh-snug); }
.row .meta { color: var(--ink-muted); font-size: var(--text-sm); margin-top: 2px; }
.row .meta .sep { color: var(--paper-edge); margin: 0 6px; }
.row .actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--text-sm); }
.row .actions a { color: var(--ink-soft); }
.row .actions a:hover { color: var(--signal-ink); }
.row .distance {
  font-size: var(--text-sm);
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.row .badges { display: inline-flex; gap: 6px; margin-left: 8px; vertical-align: middle; }
.row.is-verified .marker {
  background: transparent;
  border: 2px solid var(--signal);
  transform: rotate(45deg) translateY(4px);
  width: 7px; height: 7px;
}
.row.is-sponsored .title::after {
  content: "Gesponsert";
  margin-left: 10px;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--signal-ink);
  font-weight: 700;
  vertical-align: 0.15em;
}
.row.is-selected { background: var(--signal-soft); }

/* ————————————————————————————————————————————————————————————————
   Section heads — a sectional rule with eyebrow.
   ———————————————————————————————————————————————————————————————— */
.section {
  border-top: 2px solid var(--ink);
  padding-top: 18px;
  margin-top: 36px;
}
.section > .eyebrow { margin-bottom: 6px; }
.section > h2 { margin-bottom: 14px; }
.section.is-quiet {
  border-top: 1px solid var(--paper-edge);
  margin-top: 24px;
  padding-top: 14px;
}

/* ————————————————————————————————————————————————————————————————
   Misc
   ———————————————————————————————————————————————————————————————— */
.divider { height: 1px; background: var(--paper-line); margin: 24px 0; }
.divider.is-strong { background: var(--ink); height: 2px; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--paper-edge);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
}
.tag.is-signal { border-color: var(--signal-ink); color: var(--signal-ink); }
.tag.is-on   { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Reduce decorative motion entirely if the user opts out. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}


/* Inquiry list (operator dashboard) */
.badge {
  display: inline-block;
  background: var(--signal, #c75a2f);
  color: var(--paper, #fff);
  font: 500 11px/1 var(--font-sans);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  margin-left: 8px;
  vertical-align: middle;
}
.row.is-unread {
  background: rgba(199, 90, 47, 0.05);
  border-left: 3px solid var(--signal, #c75a2f);
  padding-left: calc(var(--row-pad-x, 12px) - 3px);
}
.inquiry-reply {
  font-weight: 400;
  margin-left: 8px;
  color: var(--ink-muted, #58564f);
}
.inquiry-msg {
  margin-top: 6px;
  padding: 6px 10px;
  border-left: 2px solid var(--rule, #d8d6cf);
  color: var(--ink-muted, #58564f);
  font: 400 14px/1.4 var(--font-sans);
}

/* Operator analytics grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}
@media (max-width: 900px) {
  .analytics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .analytics-grid { grid-template-columns: 1fr; }
}
.analytics-grid .stat {
  border-top: 2px solid var(--ink, #1c1c1a);
  padding-top: 8px;
}
.analytics-grid dt {
  font: 500 12px/1.2 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted, #58564f);
}
.analytics-grid dd {
  font: 600 28px/1.1 var(--font-sans, system-ui);
  font-variant-numeric: tabular-nums;
  margin: 4px 0 0;
}
