/* =============================================================================
   base.css: page-wide defaults (spec B2 "base.css").
   Element rules that legacy views also style (links, headings) only match
   elements without a class, so legacy components keep their own look while
   the legacy layer is still loaded; plain markup gets the new defaults.
   ========================================================================== */
/* Fonts ("Pinnat", 2026-10-27): Geologica for text, labels, buttons and h2-h3 (--font-ui,
   --font-heading); Mona Sans at font-stretch 110 % for h1, display titles and big numbers
   (--font-display, --font-number). Self-hosted woff2, @font-face in public/css/fonts.css.
   Nothing is downloaded from outside. */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  img, picture, svg, video { max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  [hidden] { display: none !important; }
}

@layer base {
  html {
    font-size: 100%;
    font-synthesis: none;
    scroll-padding-top: calc(var(--topbar-h) + 1rem);
  }
  html[data-text-size="large"] { font-size: 112.5%; }

  /* Fixes the sticky top bar that legacy mobile.css breaks with overflow-x:hidden. */
  html, body { overflow-x: clip; max-width: none; }

  body {
    font: var(--weight-regular) var(--text-base)/var(--leading-body) var(--font-ui);
    background: var(--color-canvas);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
  }

  :where(h1) { font-family: var(--font-display); font-stretch: var(--display-wdth); letter-spacing: var(--tracking-display); line-height: var(--leading-display); }
  :where(h2, h3) { font-family: var(--font-heading); }
  :where(h1, h2, h3, h4):not([class]) {
    color: var(--color-text);
    line-height: var(--leading-tight);
    font-weight: var(--weight-bold);
    text-wrap: balance;
  }
  :where(h1):not([class]) { font-size: var(--text-xl); line-height: var(--leading-display); }
  :where(h2):not([class]) { font-size: var(--text-lg); font-weight: var(--weight-bold); }
  :where(h3):not([class]) { font-size: var(--text-md); font-weight: var(--weight-semibold); }
  :where(h4):not([class]) { font-size: var(--text-base); font-weight: var(--weight-semibold); }

  /* Links are underlined (colour alone never marks a link). */
  :where(a:not([class])) {
    color: var(--color-link);
    text-decoration: underline;
    text-decoration-thickness: 1.5px;
    text-underline-offset: .18em;
  }
  :where(a:not([class])):hover { color: var(--color-action-hover); text-decoration-thickness: 2px; }
  /* Links with a class but no colour of their own (e.g. .reg-row__link) would
     otherwise take the legacy layer's old a { color: #00BFA5 } (2.2:1 on white; now Kuusi).
     Zero specificity, so every component rule that sets a colour still wins;
     pages still wrapped in .legacy-view keep the legacy look. */
  :where(a[class]):not(:where(.legacy-view a)) { color: var(--color-link); }
  :where(a[class]):not(:where(.legacy-view a)):hover { color: var(--color-action-hover); }

  /* Keyboard focus: always visible, never removed. */
  :focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
  }
  :focus:not(:focus-visible) { outline: none; }

  /* Numbers line up. */
  .num, td.num, table, time, .date, .tile__number, .chip__count, .rail__badge { font-variant-numeric: tabular-nums; }

  ::selection { background: var(--color-surface-selected); color: var(--color-text); }

  hr { border: 0; border-top: 1px solid var(--color-border-subtle); margin: var(--space-5) 0; }

  /* Legacy mobile.css sets html,body{overflow-x:hidden}; clip keeps sticky working. */
  .app-body { min-height: 100vh; min-height: 100dvh; }

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