/* Material 3 Expressive foundations: type, shape, motion, elevation, layout. */

@font-face {
  font-family: "Roboto Flex";
  font-style: oblique 0deg 10deg;
  font-display: swap;
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  src: url("../assets/fonts/roboto-flex-latin.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Roboto Flex";
  font-style: oblique 0deg 10deg;
  font-display: swap;
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  src: url("../assets/fonts/roboto-flex-latin-ext.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --md-font: "Roboto Flex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Shape scale (M3 Expressive). */
  --shape-xs: 4px;
  --shape-s: 8px;
  --shape-m: 12px;
  --shape-l: 16px;
  --shape-l-plus: 20px;
  --shape-xl: 28px;
  --shape-xl-plus: 32px;
  --shape-xxl: 48px;
  --shape-full: 999px;

  /* Motion: expressive springs (spatial overshoot) and effects (no overshoot). */
  --spring-fast: cubic-bezier(0.42, 1.67, 0.21, 0.9);
  --spring: cubic-bezier(0.38, 1.21, 0.22, 1);
  --spring-slow: cubic-bezier(0.39, 1.29, 0.35, 0.98);
  --effect-fast: cubic-bezier(0.31, 0.94, 0.34, 1);
  --effect: cubic-bezier(0.34, 0.8, 0.34, 1);
  --effect-slow: cubic-bezier(0.34, 0.88, 0.34, 1);
  --dur-fast: 180ms;
  --dur: 320ms;
  --dur-slow: 560ms;

  /* Elevation (tinted by the scheme's shadow colour). */
  --shadow-1: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 24%, transparent), 0 1px 3px 1px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  --shadow-2: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 24%, transparent), 0 2px 6px 2px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  --shadow-3: 0 4px 8px 3px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent), 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 24%, transparent);

  /* State layer opacities. */
  --state-hover: 8%;
  --state-focus: 10%;
  --state-press: 12%;

  /* Semantic extras not in the M3 role set. */
  --success: #1b6d3a;
  --on-success: #ffffff;
  --success-container: #a8f5b8;
  --on-success-container: #00210c;

  --gutter: clamp(16px, 4vw, 32px);
  --content-max: 1440px;
  --app-bar-height: 64px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) { --success: #8cd89d; --on-success: #003919; --success-container: #005227; --on-success-container: #a8f5b8; }
}
[data-scheme="dark"], [data-scheme="tv"] { --success: #8cd89d; --on-success: #003919; --success-container: #005227; --on-success-container: #a8f5b8; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--app-bar-height) + 16px); }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--md-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--effect), color var(--dur) var(--effect);
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--md-sys-color-primary); text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
ol, ul { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }

:focus-visible {
  outline: 3px solid var(--md-sys-color-secondary);
  outline-offset: 2px;
}
#app:focus { outline: none; }

.skip-link {
  position: fixed; left: 16px; top: -64px; z-index: 100;
  padding: 12px 20px; border-radius: var(--shape-full);
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface);
  font-weight: 600; text-decoration: none; transition: top var(--dur-fast) var(--effect);
}
.skip-link:focus-visible { top: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Type scale ------------------------------------------------------------ */
.display-hero {
  font-size: clamp(3.2rem, 9vw, 7rem);
  line-height: 0.92;
  font-weight: 860;
  font-stretch: 118%;
  letter-spacing: -0.035em;
}
.display-large { font-size: clamp(2.6rem, 5vw, 3.5625rem); line-height: 1.1; font-weight: 700; font-stretch: 112%; letter-spacing: -0.02em; }
.display-small { font-size: 2.25rem; line-height: 1.22; font-weight: 700; font-stretch: 110%; }
.display-champion { font-size: clamp(2.2rem, 7vw, 4rem); line-height: 1; font-weight: 850; font-stretch: 120%; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.headline-large { font-size: clamp(1.75rem, 3.2vw, 2rem); line-height: 1.2; font-weight: 700; font-stretch: 108%; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.headline-medium { font-size: 1.75rem; line-height: 1.28; font-weight: 650; font-stretch: 106%; overflow-wrap: anywhere; }
.headline-small { font-size: 1.5rem; line-height: 1.33; font-weight: 650; }
.title-large { font-size: 1.375rem; line-height: 1.27; font-weight: 600; }
.title-medium { font-size: 1rem; line-height: 1.5; font-weight: 600; letter-spacing: 0.01em; }
.title-small { font-size: 0.875rem; line-height: 1.43; font-weight: 600; letter-spacing: 0.01em; }
.body-large { font-size: 1rem; line-height: 1.5; }
.body-medium { font-size: 0.875rem; line-height: 1.43; letter-spacing: 0.015em; }
.body-small { font-size: 0.75rem; line-height: 1.33; letter-spacing: 0.03em; }
.label-large { font-size: 0.875rem; line-height: 1.43; font-weight: 600; letter-spacing: 0.01em; }
.label-medium { font-size: 0.75rem; line-height: 1.33; font-weight: 600; letter-spacing: 0.04em; }
.eyebrow {
  display: block;
  font-size: 0.75rem; line-height: 1.33; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--md-sys-color-primary);
}
.muted { color: var(--md-sys-color-on-surface-variant); }

/* ---- Icons ------------------------------------------------------------------ */
.icon { width: 24px; height: 24px; flex: none; fill: currentColor; }

/* ---- App bar ---------------------------------------------------------------- */
.top-app-bar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--app-bar-height);
  padding: 8px var(--gutter);
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--md-sys-color-surface);
  transition: background-color var(--dur) var(--effect), box-shadow var(--dur) var(--effect);
}
body.is-scrolled .top-app-bar { background: var(--md-sys-color-surface-container); }
.app-bar-brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; margin-right: auto; border-radius: var(--shape-full); padding-right: 8px; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--shape-m);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; }
.app-bar-name { display: grid; line-height: 1.2; min-width: 0; }
.app-bar-name strong { font-size: 1.125rem; font-weight: 750; font-stretch: 112%; letter-spacing: -0.01em; }
.app-bar-name small { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }
.app-bar-actions { display: flex; align-items: center; gap: 4px; }
body[data-view="watch"] .app-bar, body[data-view="tv"] .app-bar { display: none; }

.sync-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border-radius: var(--shape-s);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
.sync-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--md-sys-color-outline); }
.sync-chip[data-tone="live"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.sync-chip[data-tone="live"] i { background: var(--md-sys-color-primary); animation: pulse 1.8s var(--effect) infinite; }
.sync-chip[data-tone="offline"], .sync-chip[data-tone="error"] { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.sync-chip[data-tone="offline"] i, .sync-chip[data-tone="error"] i { background: var(--md-sys-color-error); }
body[data-view="home"] .sync-chip { display: none; }

@media (max-width: 599px) {
  .app-bar-name small { display: none; }
  .sync-chip { padding: 0 10px; font-size: 0.75rem; }
  .sync-chip span { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 380px) {
  .app-bar-name { display: none; }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

/* ---- Page layout ------------------------------------------------------------- */
.page {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 16px var(--gutter) 48px;
  display: grid; gap: 24px;
}
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-header > div { display: grid; gap: 4px; min-width: 0; }

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