/* Modern CSS Reset — Editorial Precision */

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  tab-size: 4;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  line-height: inherit;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

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

/* Text-entry controls carry the iOS focus-zoom floor (--control-min-font-size,
   see base/tokens.css). Declared at ELEMENT specificity (0,0,1) on purpose: any
   control that names its own size in a class rule still wins here and composes
   the same floor itself via max() — this rule exists so the fields that simply
   inherit (`font: inherit` above) are covered too, without a class having to
   opt in. `1em` is the inherited size, so on a precise pointer the floor is 0
   and this resolves to exactly what the element rendered before.
   `button` is excluded: it is not a text-entry control and never zooms. */
input,
textarea,
select,
[contenteditable] {
  font-size: max(var(--control-min-font-size), 1em);
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

fieldset {
  border: none;
}

dialog {
  padding: 0;
  border: none;
}

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

/* ── FOCUS CONTAINERS NEVER RING ────────────────────────────────────────────
   A focus ring belongs on a control the user REACHED — i.e. something they can
   tab to. An element that is focusable only so script can move focus INTO it —
   a <dialog>, or any tabindex="-1" container — is by definition not
   keyboard-reachable, so a ring around it is always a bug: the user gets a box
   they never asked for, around a whole panel, that no keypress explains.

   This is the SOURCE fix for a bug the app had been patching one component at a
   time (.sheet:focus, .modal__close:focus/-visible, …): opening a surface moves
   focus inside it, the UA decides that focus should be visible, and a ring
   appears the instant the panel opens (reported on the mobile Rail's close icon,
   2026-07-23).

   Keyboard-reachable controls are deliberately untouched — they keep the
   :focus-visible ring above, which is the WCAG 2.4.7 (Focus Visible)
   requirement. Element+attribute specificity (0,1,1 / 0,2,0) beats the
   :focus-visible rule above, so order here is not load-bearing. */
dialog:focus,
dialog:focus-visible,
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none;
}

::selection {
  background: var(--accent-primary);
  color: var(--surface-base);
}

/* Utility: hidden — used by Stimulus controllers to toggle visibility */
.hidden {
  display: none !important;
}

/* Canonical: HTML's [hidden] attribute always wins, regardless of which
   component CSS sets `display`. The UA stylesheet's `[hidden] { display: none }`
   has attribute-selector specificity (0,1,0) and is clobbered by any
   class-selector display rule (e.g. .copy-field { display: flex }).
   Marking the rule !important here ensures the HTML semantic always works
   so the field-reveal pattern (and every other Stimulus reveal/hide)
   composes reliably. */
[hidden] {
  display: none !important;
}

/* Skip navigation link — visible only on focus */
.skip-nav {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 10000;
  padding: var(--space-2) var(--space-4);
  background: var(--accent-primary);
  color: var(--surface-base);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}
.skip-nav:focus {
  top: var(--space-4);
}

/* Remove default spinner for number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Smooth scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Material Symbols — @font-face in base/fonts.css; structural + axis tuning here.
   Matches Google CDN defaults + coachOS wght 300 / GRAD -25 / opsz 20 on dev. */
.material-symbols-rounded {
  font-family: 'Material Symbols Rounded';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings:
    'FILL' 0,
    'wght' 300,
    'GRAD' -25,
    'opsz' 20;
}

/* SVG icon utility */
.svg-icon {
  fill: currentColor;
  width: 18px;
  height: 18px;
  display: inline-block;
  font-size: 18px;
}
