/* ==========================================================================
   6Wire Live — foundations: fonts, design tokens, reset, shared controls
   ========================================================================== */

/* Self-hosted fonts (SIL Open Font License — see assets/fonts/*-OFL.txt). */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-latin-800.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --red: #E10600;
  --red-deep: #B80500;
  --black: #111111;
  --slate: #1E293B;
  --ice: #F2F4F7;
  --up: #22C55E;
  --down: #EF4444;
  --amber: #F59E0B;

  /* Dark theme (default) */
  --bg: #111111;
  --bg-accent: #0B0F17;
  --panel: #171D29;
  --panel-raised: #1E293B;
  --line: rgba(242, 244, 247, 0.10);
  --line-strong: rgba(242, 244, 247, 0.22);
  --text: #F2F4F7;
  --text-soft: #C9D1DC;
  --muted: #94A0B4;
  --up-text: #4ADE80;
  --down-text: #F87171;
  --amber-text: #FBBF24;
  --shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.35);

  --font-display: 'Montserrat', 'Arial Black', 'Segoe UI', system-ui, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 0.6rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme='light'] {
  --bg: #F2F4F7;
  --bg-accent: #E4E8EE;
  --panel: #FFFFFF;
  --panel-raised: #EEF1F5;
  --line: rgba(17, 17, 17, 0.10);
  --line-strong: rgba(17, 17, 17, 0.25);
  --text: #111111;
  --text-soft: #1E293B;
  --muted: #4B5768;
  --up-text: #15803D;
  --down-text: #B91C1C;
  --amber-text: #92400E;
  --shadow: 0 0.4rem 1.5rem rgba(30, 41, 59, 0.12);
}

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

/*
  Broadcast scaling: the whole interface is sized in rem, and 1rem tracks the
  viewport so a 1920×1080 screen gets 16px and a 3840×2160 screen gets 32px.
  Using the smaller of the width/height ratios keeps everything on screen at
  16:10, 4:3 and ultrawide too.
*/
html {
  font-size: clamp(9px, min(0.8333vw, 1.4815vh), 48px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.4;
  font-feature-settings: 'tnum' 1, 'cv11' 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, figure { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

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

.skip-link {
  position: fixed; top: 0.5rem; left: 0.5rem; z-index: 100;
  padding: 0.6rem 1rem; border-radius: var(--radius);
  background: var(--red); color: #fff; font-weight: 700; text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

:focus-visible {
  outline: 0.2rem solid var(--text);
  outline-offset: 0.15rem;
  box-shadow: 0 0 0 0.4rem var(--red);
  border-radius: 0.3rem;
}

/* ---------- Buttons ---------- */
.icon-btn {
  display: inline-grid; place-items: center;
  width: 2.75rem; height: 2.75rem; padding: 0;
  border: 1px solid var(--line-strong); border-radius: 50%;
  background: transparent; color: var(--text); cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--panel-raised); border-color: var(--text); }
.icon-btn svg { width: 1.25rem; height: 1.25rem; }
.icon-btn--sm { width: 2.2rem; height: 2.2rem; }
.icon-btn--sm svg { width: 1rem; height: 1rem; }
.icon-btn[aria-pressed='true'] { background: var(--red); border-color: var(--red); color: #fff; }

.btn {
  padding: 0.7rem 1.4rem; border: 1px solid var(--red); border-radius: 999px;
  background: var(--red); color: #fff; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--panel-raised); border-color: var(--text); }

/* ---------- Loading indicator ---------- */
.loader {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 1rem; color: var(--muted); font-size: 1rem;
}
.loader--hero { height: 100%; justify-content: center; font-size: 1.3rem; }
.loader__bars {
  width: 2.4rem; height: 1.4rem; flex: none;
  background:
    linear-gradient(var(--red), var(--red)) 0 100% / 0.45rem 40% no-repeat,
    linear-gradient(var(--red), var(--red)) 50% 100% / 0.45rem 100% no-repeat,
    linear-gradient(var(--red), var(--red)) 100% 100% / 0.45rem 60% no-repeat;
  animation: loader-bars 0.9s ease-in-out infinite alternate;
}
@keyframes loader-bars {
  to { background-size: 0.45rem 100%, 0.45rem 35%, 0.45rem 90%; }
}

/* ---------- Motion preferences ---------- */
@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;
  }
}

.noscript {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  padding: 2rem; background: var(--bg); color: var(--text);
  font-size: 1.25rem; text-align: center;
}
