@import url("./fonts.css");

/* ==========================================================================
   GR Heroes e-Racing Championship — design tokens
   Every value below is lifted from inputDocs/SVG/leaderboard.svg so the build
   matches the supplied artwork rather than approximating it.
   ========================================================================== */
:root {
  /* Brand palette (exact fills from the source artwork) */
  --gr-red:        #ed1c24;   /* .cls-18 / primary brand red            */
  --gr-red-bright: #eb1e30;   /* .cls-38                                */
  --gr-red-deep:   #a5121a;
  --ink:           #000;      /* background plate                       */
  --surface:       #161616;   /* .cls-43                                */
  --surface-2:     #1e1e1e;
  --surface-3:     #262626;
  --steel:         #58595b;   /* .cls-* row gradient base               */
  --white:         #fff;
  --muted:         #9a9a9c;
  --muted-dim:     #6c6c6e;
  --line:          #2e2e2e;
  --ok:            #1fbf6b;
  --warn:          #f0a02a;
  --danger:        #e0323c;

  /* Row bar skew — derived from the artwork: the 57.86px-tall row polygons
     shift 14.56px left over their height, i.e. atan(14.56 / 57.86). */
  --skew: -14.12deg;

  /* Type */
  --font-display: "Chakra Petch", "Eurostile", "Bank Gothic", "Trebuchet MS", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", "DecimaMono Pro", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout — the artwork's table spans x 62.72 → 1220.52 on a 1920 canvas */
  --shell-max: 1600px;
  --gutter: clamp(14px, 3.2vw, 48px);
  --radius: 3px;

  /* Motion */
  --ease: cubic-bezier(.22, .61, .36, 1);
  color-scheme: dark;
}

/* ── reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
body {
  min-height: 100svh;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--gr-red); text-decoration-thickness: 1px; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gr-red); outline-offset: 2px; border-radius: 2px; }

/* Screen-reader-only, but focusable (skip links) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--gr-red); color: #fff; padding: 10px 16px;
  font-weight: 700; text-decoration: none; transition: top .18s var(--ease);
}
.skip-link:focus { top: 8px; }

/* ── page plate: black ground + the artwork's brush/GR watermark ─────────── */
.plate { position: relative; isolation: isolate; min-height: 100svh; display: flex; flex-direction: column; }
.plate::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(80% 46% at 88% 4%, rgba(237, 28, 36, .16), transparent 68%),
    radial-gradient(70% 44% at 4% 96%, rgba(237, 28, 36, .07), transparent 62%),
    var(--ink);
}
.plate::after {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: url("../img/bg-art.svg") center / cover no-repeat;
  opacity: .5;              /* source art is already drawn at .15 opacity */
  pointer-events: none;
}
/* The watermark is a 36 KB decorative asset — skip it on small screens. */
@media (max-width: 720px) { .plate::after { display: none; } }

/* Fine dot texture visible in the artwork's left column */
.dots {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.14) .9px, transparent .9px);
  background-size: 13px 13px;
  -webkit-mask-image: linear-gradient(100deg, #000 0 18%, transparent 46%);
          mask-image: linear-gradient(100deg, #000 0 18%, transparent 46%);
}

/* ── masthead ────────────────────────────────────────────────────────────── */
.masthead {
  position: relative;
  display: flex; align-items: center; gap: clamp(12px, 2.4vw, 34px);
  padding: clamp(12px, 1.8vw, 22px) var(--gutter);
}
.masthead::before {                    /* the artwork's 217.92px red header band */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg,
    rgba(237,28,36,0) 0%, rgba(237,28,36,.10) 30%,
    rgba(237,28,36,.22) 64%, rgba(237,28,36,.31) 100%);
}
.masthead__logo { width: clamp(104px, 13vw, 186px); height: auto; flex: none; }
.masthead__label {
  margin: 0;
  font-size: clamp(15px, 2.1vw, 30px); font-weight: 700; font-style: italic;
  letter-spacing: .01em; white-space: nowrap;
}
.masthead__rule { flex: 1 1 auto; height: 3px; background: var(--white); min-width: 10px; }
.masthead__title {
  color: var(--gr-red); font-weight: 700; font-style: italic;
  font-size: clamp(15px, 2.9vw, 46px); letter-spacing: -.01em; white-space: nowrap;
}
@media (max-width: 640px) {
  .masthead { flex-wrap: wrap; row-gap: 6px; }
  .masthead__rule { display: none; }
  .masthead__label { order: 3; font-size: 13px; color: var(--muted); }
  .masthead__title { margin-inline-start: auto; }
}

/* ── skewed bar primitive ────────────────────────────────────────────────── */
/* Matches the row polygons in the artwork: a parallelogram leaning back 14.12°.
   Content sits in a counter-skewed child so text stays upright.             */
.bar { position: relative; transform: skewX(var(--skew)); }
.bar > * { transform: skewX(calc(var(--skew) * -1)); }

/* ── footer ──────────────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  display: flex; align-items: center; gap: clamp(12px, 2vw, 26px);
  padding: clamp(14px, 2vw, 26px) var(--gutter);
  border-top: 1px solid rgba(255,255,255,.08);
}
.footer__toyota { width: clamp(96px, 11vw, 158px); }
.footer__divider { width: 1px; align-self: stretch; background: rgba(255,255,255,.28); }
.footer__ekk { width: clamp(100px, 11.5vw, 164px); }
.footer__gr { width: clamp(150px, 20vw, 300px); margin-inline-start: auto; }
@media (max-width: 560px) {
  .footer { flex-wrap: wrap; justify-content: center; row-gap: 16px; }
  .footer__gr { margin-inline-start: 0; flex-basis: 100%; display: flex; justify-content: center; }
  .footer__gr img { width: min(260px, 72vw); }
}

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: var(--gr-red);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 26px; border: 0; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 700; font-style: italic; font-size: 15px;
  letter-spacing: .04em; text-transform: uppercase; text-decoration: none;
  clip-path: polygon(11px 0, 100% 0, calc(100% - 11px) 100%, 0 100%);
  transition: filter .16s var(--ease), transform .16s var(--ease);
}
.btn:hover:not(:disabled) { filter: brightness(1.14); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { --btn-bg: transparent; --btn-fg: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.35); }
.btn--ghost:hover:not(:disabled) { --btn-bg: rgba(255,255,255,.08); }
.btn--ok { --btn-bg: var(--ok); }
.btn--sm { padding: 8px 16px; font-size: 13px; }
.btn--block { width: 100%; }

/* ── live status pill ────────────────────────────────────────────────────── */
.live {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-dim); flex: none; }
.live[data-state="live"]    { color: #fff; }
.live[data-state="live"] .live__dot { background: var(--ok); animation: pulse 2s infinite; }
.live[data-state="loading"] .live__dot { background: var(--warn); animation: pulse 1s infinite; }
.live[data-state="error"]   { color: #ffc9cc; border-color: rgba(224,50,60,.5); }
.live[data-state="error"] .live__dot { background: var(--danger); }
.live[data-state="mock"] .live__dot { background: var(--warn); }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }

/* ── notice banner ───────────────────────────────────────────────────────── */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; margin: 0 var(--gutter) 14px;
  background: rgba(240,160,42,.12); border-inline-start: 3px solid var(--warn);
  font-size: 13.5px; font-weight: 600; line-height: 1.5;
}
.notice--error { background: rgba(224,50,60,.13); border-color: var(--danger); }
.notice[hidden] { display: none; }
