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

/*
 * Global fix for a recurring footgun in this codebase: an author stylesheet
 * rule that sets `display` on an element (e.g. `.btn { display: inline-flex }`,
 * `.notif-panel { display: flex }`) has equal specificity to the browser's
 * own `[hidden] { display: none }` UA-stylesheet rule, and author rules win
 * ties over UA rules — so any element that's both hideable via the `hidden`
 * attribute/property AND matched by a class that sets `display` renders
 * visible even while `hidden` is true. watch.css's `.watch-up-next-overlay`
 * carries a hand-written one-off fix for exactly this (see its own comment);
 * this global `!important` rule covers every other case going forward —
 * discovered 2026-08-04 via a live QA pass that found the Phase 4 frontend's
 * "Load more comments" button, comment/reply composers, and notification
 * panel all rendering permanently visible despite `hidden` being set.
 */
[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--color-void);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background var(--duration-med) var(--ease-out), color var(--duration-med) var(--ease-out);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); color: var(--color-muted); }

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

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

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

/* tokens.css sets `color-scheme` (dark/light, tracking the [data-theme]
   toggle) so the browser's own dark-mode palette applies to browser-drawn
   UI in general — but that's only a hint at "use some dark palette";
   testing live 2026-08-10 showed it wasn't enough on its own to reliably
   theme a <select>'s OPEN option-list popup to match this app's actual
   surface/ink colors (that popup is drawn by the browser/OS, not by the
   rest of this app's CSS, and color-scheme support for it varies by
   browser/platform). Explicitly styling `option`/`optgroup` background and
   text color is the more direct, reliable fix and is broadly supported —
   applies to every <select> site-wide (every .input-classed one, plus
   watch.php's #watch-speed), not just the Studio Upload page where this
   was first reported. */
select option,
select optgroup {
  background-color: var(--color-void-raised);
  color: var(--color-ink);
}

ul { margin: 0; padding: 0; list-style: none; }

.mono { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--color-signal-strong);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

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

/* MPS Phase 9 (Accessibility) — "skip to content" link, the first focusable
   element on every page (see layouts/app.php/layouts/auth.php). Off-screen
   until it receives keyboard focus, at which point it needs to become fully
   visible (unlike .sr-only above, which is never meant to be seen) so a
   keyboard/screen-reader user can jump straight past the topnav instead of
   tabbing through the logo, search box, primary nav, theme toggle, and
   notification bell on every single page load. */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-3);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--color-signal);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-3);
}

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

@media (max-width: 640px) {
  .container { padding: 0 var(--space-4); }
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
}
