/**
 * StreamVerse — Global Base Styles
 * Consumes tokens.css. No component-specific styling belongs here.
 */

/* ------------------------------------------------------------------
 * Font loading
 * Design System Section 4: self-hosted Space Grotesk + Inter,
 * font-display: swap, to avoid render-blocking Google Fonts calls.
 * Add @font-face rules here once the actual font files are placed in
 * assets/fonts/ — using the system-font fallback stack from tokens.css
 * until then so nothing breaks in the meantime.
 * ------------------------------------------------------------------
 * @font-face {
 *   font-family: "Space Grotesk";
 *   src: url("../fonts/space-grotesk-700.woff2") format("woff2");
 *   font-weight: 700;
 *   font-display: swap;
 * }
 * @font-face {
 *   font-family: "Inter";
 *   src: url("../fonts/inter-400.woff2") format("woff2");
 *   font-weight: 400;
 *   font-display: swap;
 * }
 * ------------------------------------------------------------------ */

/* ------------------------------------------------------------------
 * Reset
 * ------------------------------------------------------------------ */

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd {
  margin: 0;
}

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

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

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ------------------------------------------------------------------
 * Base document styles
 * ------------------------------------------------------------------ */

body {
  background-color: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--text-body-line-height);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* #main-content wraps Hero, Popular Movies, Live Sports, and Live
 * Channels (see index.html) — it's the correct, narrowly-scoped place
 * to contain the ambient background layers in ambient-glow.css, which
 * deliberately extend past their own section's edges so Movies',
 * Sports', and Channels' glow can bleed into each other with no
 * visible seam at the boundaries between them.
 *
 * This is NOT the same fix as putting overflow-x:hidden on html/body
 * (which was tried and reverted): that produced a real, separate bug.
 * Per the CSS Overflow spec, when overflow-x is set to a non-'visible'
 * value while overflow-y is left unset, the browser is required to
 * compute overflow-y as 'auto' instead of its default 'visible' — you
 * cannot avoid this by writing `overflow-y: visible` explicitly, since
 * it's a used-value transformation, not something the author's
 * stylesheet can override. That silently turned BOTH body and html
 * into their own independent 'auto' (scrollable) containers layered on
 * top of each other — i.e. exactly the nested/duplicate vertical
 * scrollbar this was supposed to prevent, not fix.
 *
 * #main-content has no fixed or max height (its height is intrinsic —
 * exactly the sum of its children's natural heights), so using the
 * real `overflow: hidden` shorthand here (both axes set to the SAME
 * value, so the visible/non-visible mismatch above can't happen) has
 * no vertical side effect: there is never anything for it to clip
 * vertically. It only ever clips the horizontal bleed from the glow
 * layers, at a container that's actually responsible for them, instead
 * of the document root. */
#main-content {
  overflow: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--color-text-primary);
}

/* Max line length for body text per Design System Section 4 (65–75ch) */
p {
  max-width: 75ch;
}

/* ------------------------------------------------------------------
 * Grid container
 * Design System Section 13: 1280px max-width, centered, fluid side
 * padding (--space-5 mobile -> --space-7 desktop), 12-column grid.
 * ------------------------------------------------------------------ */

.container {
  width: 100%;
  max-width: var(--grid-max-width);
  margin-inline: auto;
  padding-inline: var(--space-5); /* <768px */
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-6); /* 768–1023px */
  }
}

@media (min-width: 1024px) {
  .container {
    padding-inline: var(--space-7); /* >=1024px */
  }
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  gap: var(--grid-gap);
}

/* ------------------------------------------------------------------
 * Accessibility helpers
 * ------------------------------------------------------------------ */

.u-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;
}

.skip-link {
  position: absolute;
  top: 0;
  left: var(--space-4);
  z-index: 1000;
  padding: var(--space-3) var(--space-5);
  background-color: var(--color-accent);
  color: var(--color-text-on-accent);
  border-radius: var(--radius-sm);
  font-weight: 600;
  /* translateY(-100%) hides the link by exactly its own rendered
     height, however tall that actually is — unlike the previous fixed
     `top: -48px`, which under-hid the element (its real height is
     ~101px, so ~53px of it stayed visible year-round, showing as a
     stray purple bar behind the header/logo) and would silently
     break again if the padding or text ever changed. */
  transform: translateY(-100%);
  transition: top var(--duration-micro) var(--ease-standard),
    transform var(--duration-micro) var(--ease-standard);
}

.skip-link:focus {
  top: var(--space-4);
  transform: translateY(0);
}

/* Design System Section 18 / 16: visible focus ring, never removed */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------
 * Global motion-sensitivity rule
 * Design System Section 15 / 18: prefers-reduced-motion must be
 * respected everywhere. Component files add their own specific
 * reduced-motion overrides for entrance/scale animations; this is
 * the sitewide floor.
 * ------------------------------------------------------------------ */

@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;
  }
}
