/* RTF — Robotic Tech Frox · shared design system
   Palette: #FF7003 accent · #D95400 deep orange · #EAEAEA cloud · #C0C0C0 silver · #111111 ink
   Dark is the default theme; light overrides via html[data-theme="light"]. */

:root {
  --accent: #FF7003;
  --accent-2: #D95400;
  --cloud: #EAEAEA;
  --silver: #C0C0C0;
  --ink: #111111;

  --font-display: "Bebas Neue", "Inter", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --maxw: 1180px;
  --radius: 14px;
  --radius-lg: 20px;
  --pad-x: clamp(20px, 5vw, 44px);
  --section-y: clamp(56px, 8vw, 100px);
  --ease: 170ms ease;

  /* dark (default) */
  color-scheme: dark;
  --bg: #0e0e11;
  --bg-soft: #16161a;
  --panel: #1a1a1f;
  --panel-2: #212127;
  --line: #2b2b33;
  --text: #f2f2f5;
  --text-soft: #a6a6b2;
  --stage-bg: #101018;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f6;
  --bg-soft: #ececee;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --line: #e2e2e7;
  --text: var(--ink);
  --text-soft: #5c5c66;
  --stage-bg: #e9e9ee;
  --shadow: 0 18px 40px -26px rgba(17, 17, 17, 0.18);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--ease), color var(--ease);
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }

::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad-x);
}

/* ---------- Header ---------- */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  line-height: 1;
}

.brand:hover { color: var(--text); }

.brand img { width: 46px; height: 46px; object-fit: contain; flex-shrink: 0; }
.brand .brand-fallback {
  display: none;
  width: 46px; height: 46px;
  align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 0.95rem;
}
.brand.logo-failed img { display: none; }
.brand.logo-failed .brand-fallback { display: inline-flex; }

/* Full Frox peeks in from the right viewport edge on desktop only. */
.frox-peek { display: none; }
@media (min-width: 1280px) and (pointer: fine) {
  /* Added by the desktop scroll script: the Frox replaces the native bar. */
  html.frox-scroll,
  html.frox-scroll body {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  html.frox-scroll::-webkit-scrollbar,
  html.frox-scroll body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .frox-peek {
    display: block;
    position: fixed;
    top: 52%;
    right: clamp(-110px, -6vw, -60px);
    width: clamp(150px, 13vw, 200px);
    height: auto;
    z-index: 4;
    pointer-events: none;
    user-select: none;
    transform: translate(var(--fox-pull, 0px), -50%) rotate(calc(-90deg + var(--fox-lean, 0deg)));
    transform-origin: center;
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.35)) drop-shadow(0 16px 26px rgba(0, 0, 0, 0.25));
    opacity: 0.94;
    will-change: top, transform;
  }
}

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav a {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color var(--ease), background var(--ease);
}

.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a[aria-current="page"] { color: var(--accent); }
.nav .ext::after { content: " ↗"; font-size: 0.75em; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease);
}

.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }
html[data-theme="dark"] .icon-btn .sun { display: none; }
html[data-theme="light"] .icon-btn .moon { display: none; }

.lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  background: var(--panel);
}

.lang button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: 600 0.78rem/1 var(--font-body);
  letter-spacing: 0.06em;
  padding: 10px 11px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}

.lang button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}
.menu-btn svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */

.hero {
  padding: clamp(40px, 6vw, 80px) 0 clamp(36px, 5vw, 64px);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  /* align copy with .container while the 3D stage bleeds to the right edge */
  padding-left: max(var(--pad-x), calc((100% - var(--maxw)) / 2 + var(--pad-x)));
}

.hero-copy { padding-right: clamp(0px, 2vw, 24px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}

.eyebrow::before {
  content: "";
  width: 28px; height: 2px;
  background: var(--accent);
}

h1, h2, h3 { margin: 0; }

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 7.5vw, 5.8rem);
  line-height: 0.92;
  letter-spacing: 0.015em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.hero h1 .accent { color: var(--accent); }

.hero h1 .hero-frox {
  display: inline-block;
  width: 0.86em;
  height: auto;
  margin-left: 0.14em;
  vertical-align: -0.06em;
  pointer-events: none;
  user-select: none;
}

.hero-sub {
  font-size: 1.12rem;
  color: var(--text-soft);
  max-width: 46ch;
  margin: 0 0 30px;
}

.hero-facts {
  display: flex;
  gap: clamp(20px, 4vw, 44px);
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 22px;
}

.fact .value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--text);
}

.fact .label {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.rotate-hint {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 28px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.rotate-hint .dot {
  width: 18px; height: 18px;
  border: 1px solid var(--line);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rotate-hint .dot::after {
  content: "";
  width: 4px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 22px;
  border-radius: 11px;
  border: 1px solid transparent;
  transition: transform var(--ease), background var(--ease), border-color var(--ease), color var(--ease);
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); color: #fff; transform: translateY(-2px); }

.btn-ghost { border-color: var(--line); color: var(--text); background: var(--panel); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(22px, 3.4vw, 42px);
  align-items: start;
}

.about-copy p { color: var(--text-soft); max-width: 62ch; margin: 0 0 16px; }
.about-copy p:first-child { color: var(--text); font-size: 1.06rem; }
.about-copy strong { color: var(--accent); font-weight: 700; }

.mission-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 26px;
}

.mission-card h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mission-card p { color: var(--text-soft); margin: 14px 0 0; font-size: 0.95rem; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
}

/* 3D stage — dark panel bleeding to the right edge (Quantum-style) */

.hero-stage-wrap {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.stage {
  position: relative;
  height: clamp(420px, 60vw, 620px);
  min-width: 0;
  background: var(--stage-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  /* The .stage panel background follows the page theme so the
     WebGL renderer's plastic robot reads correctly in both light
     and dark modes. */
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
  touch-action: none;
}

/* keep the canvas inside the panel (right edge, no clipping) */
.stage-wrap { position: relative; overflow: hidden; }
.stage canvas:active { cursor: grabbing; }

.stage-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12%;
  color: #6f7084;
}
.stage.is-live .stage-fallback { display: none; }

.stage-tag {
  position: absolute;
  right: 18px; top: 16px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9a9ab0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 12px;
  pointer-events: none;
}

.stage-foot {
  position: absolute;
  right: 18px; bottom: 14px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7d7e92;
  pointer-events: none;
}

/* Shown only when an explicitly linked model fails to load. */
.stage-note {
  position: absolute;
  left: 16px; bottom: 14px;
  max-width: 72%;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a9ab0;
  pointer-events: none;
}

/* Loading overlay — covers the stage until the GLB is ready. */
.stage-loader {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.07), transparent 62%),
    var(--stage-bg);
  transition: opacity 340ms ease, visibility 340ms ease;
}

.stage-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.stage-loader-ring {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  animation: stage-spin 0.8s linear infinite;
}

.stage-loader-text {
  font: 700 0.68rem/1 var(--font-body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.stage-loader-bar {
  width: 132px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.stage-loader-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 220ms ease;
}

.stage-loader.is-indeterminate .stage-loader-bar i {
  width: 42%;
  animation: stage-bar 1.1s ease-in-out infinite;
}

@keyframes stage-spin {
  to { transform: rotate(360deg); }
}

@keyframes stage-bar {
  0% { transform: translateX(-115%); }
  100% { transform: translateX(255%); }
}

@media (prefers-reduced-motion: reduce) {
  .stage-loader-ring { animation-duration: 1.6s; }
  .stage-loader.is-indeterminate .stage-loader-bar i { animation: none; width: 100%; }
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    padding-left: var(--pad-x);
    gap: 30px;
  }
  .hero-copy { padding-right: 0; }
  .stage { height: clamp(320px, 70vw, 460px); }
}

/* ---------- Sections ---------- */

.section { padding: var(--section-y) 0; }
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.section-head h2,
.section-head h1 {
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4.5vw, 3.15rem);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-head p {
  margin: 10px 0 0;
  color: var(--text-soft);
  max-width: 56ch;
}

.section-link {
  font-weight: 700;
  font-size: 0.92rem;
  white-space: nowrap;
}

/* ---------- Team ---------- */

.team-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  justify-content: center;
}

@media (max-width: 1080px) {
  .team-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .team-grid { grid-template-columns: repeat(1, 1fr); }
}

/* Toggleable title: grid ↔ single team-photo blob */
.team-title { margin: 0; }

.team-toggle {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: color var(--ease);
}

.team-toggle:hover { color: var(--accent); }
.team-toggle:focus-visible { outline-offset: 6px; }

.team-toggle-icon {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-soft);
  transition: color var(--ease), border-color var(--ease), background var(--ease);
}

.team-toggle:hover .team-toggle-icon {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.team-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  transition: opacity 260ms ease, transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.team-icon-photo {
  opacity: 0;
  transform: scale(0.65) rotate(-18deg);
}

.team-toggle[aria-expanded="false"] .team-icon-grid {
  opacity: 0;
  transform: scale(0.65) rotate(18deg);
}

.team-toggle[aria-expanded="false"] .team-icon-photo {
  opacity: 1;
  transform: none;
}

.team-stage { position: relative; }
.team-stage.is-ready { transition: height 760ms cubic-bezier(0.2, 0.8, 0.2, 1); }

.team-blob {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: min(100%, 900px);
  height: clamp(300px, 42vw, 500px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.22) rotate(-7deg);
  background:
    radial-gradient(90% 120% at 20% 10%, rgba(255, 255, 255, 0.22), transparent 50%),
    linear-gradient(145deg, #ff8b36, var(--accent) 48%, #b94500 100%);
  box-shadow:
    0 34px 90px -46px rgba(255, 112, 3, 0.55),
    0 20px 60px -40px rgba(0, 0, 0, 0.7);
  transition:
    opacity 360ms ease,
    transform 600ms cubic-bezier(0.16, 0.8, 0.2, 1),
    border-radius 600ms ease,
    visibility 0s linear 600ms;
}

.team-stage.is-collapsed .team-blob {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1) rotate(0);
  border-radius: 42% 58% 61% 39% / 46% 39% 61% 54%;
  transition:
    opacity 420ms ease 100ms,
    transform 820ms cubic-bezier(0.16, 0.8, 0.2, 1) 60ms,
    border-radius 820ms cubic-bezier(0.16, 0.8, 0.2, 1) 60ms,
    visibility 0s linear 0s;
}

.team-photo-placeholder {
  position: absolute;
  inset: 11px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 112, 3, 0.18), transparent 55%),
    linear-gradient(155deg, #1b1b22, #09090c 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.team-photo-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 90% at 50% 10%, rgba(255, 255, 255, 0.09), transparent 70%),
    linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.045) 50%, transparent 65%);
}

.team-photo-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.58), transparent 58%);
}

.team-photo-people {
  position: absolute;
  left: 50%;
  bottom: -2%;
  z-index: 0;
  width: min(94%, 620px);
  height: auto;
  color: rgba(255, 255, 255, 0.14);
  transform: translateX(-50%);
  pointer-events: none;
}

.team-photo-people .team-photo-accent {
  fill: var(--accent);
  opacity: 0.55;
}

.team-photo-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 22px;
}

.team-photo-kicker {
  font: 700 0.68rem/1 var(--font-body);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.team-photo-copy strong {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.team-photo-note {
  margin-top: 5px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font: 700 0.64rem/1 var(--font-body);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.team-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.member {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 18px 22px;
  text-align: center;
  transition: transform var(--ease), border-color var(--ease), background var(--ease);
}

.member:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--panel-2);
}

.team-stage.is-animating .member {
  will-change: transform, opacity;
  transition:
    transform 760ms cubic-bezier(0.18, 0.78, 0.2, 1),
    opacity 520ms ease,
    border-radius 760ms cubic-bezier(0.18, 0.78, 0.2, 1),
    background var(--ease),
    border-color var(--ease);
}

.team-stage.is-collapsed .member {
  transform: translate(var(--merge-x, 0px), var(--merge-y, 0px)) scale(0.13) rotate(var(--merge-rot, 0deg));
  opacity: 0;
  border-radius: 50%;
  border-color: var(--accent);
  background: var(--accent);
  pointer-events: none;
}

.team-stage.is-collapsed .team-grid { pointer-events: none; }

.avatar {
  width: 84px; height: 84px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: 0.04em;
  color: #fff;
  background:
    linear-gradient(145deg, var(--accent) 0%, var(--accent-2) 58%, #7a2d00 100%);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--bg) 40%, transparent);
}

.member .name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.member .role {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}

.member .role {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}

/* Role badge: station icon + letter (drive team & coach only) */
.role-badge {
  position: absolute;
  top: 12px; right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, var(--accent) 13%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 999px;
  padding: 5px 9px 5px 8px;
  line-height: 1;
}

.role-badge .badge-icon {
  width: 17px; height: 17px;
  background: var(--accent);
  display: inline-block;
}
.role-badge.driver .badge-icon {
  -webkit-mask: url("driver.svg") center / contain no-repeat;
  mask: url("driver.svg") center / contain no-repeat;
}
.role-badge.coach .badge-icon {
  -webkit-mask: url("coach.svg") center / contain no-repeat;
  mask: url("coach.svg") center / contain no-repeat;
}
.role-badge b {
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  color: var(--accent-2);
}
html[data-theme="dark"] .role-badge b { color: var(--accent); }

/* ---------- Achievements (season rail) ---------- */

.season-rail {
  display: grid;
  gap: 20px;
  position: relative;
}

.season-block {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 30px);
  transition: border-color var(--ease), background var(--ease);
}

.season-block:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--panel-2);
}

.season-mark .season-year {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--text);
}

.season-block[data-current="true"] .season-year { color: var(--accent); }

.season-mark .game-chip {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 5px 12px;
}

.season-mark .win-rate {
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-soft);
}
.season-mark .win-rate b { color: var(--accent); font-size: 1.02rem; }

/* "Best season" flag: star below the OPR bubble */
.season-block.best .best-flag {
  margin-top: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.season-block.best .best-flag::before {
  content: "★";
  font-size: 1.1em;
}

/* Season tabs: switch between current-season card and earlier-seasons view */
.tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--panel);
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: 600 0.78rem/1 var(--font-body);
  letter-spacing: 0.08em;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.tabs button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
}
.tabs + .season-block {
  display: none;
}
.tabs + .season-block.active {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: clamp(18px, 3vw, 34px);
}

@media (max-width: 760px) {
  .tabs + .season-block { grid-template-columns: 1fr; }
}

.event-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  align-content: start;
}

.event {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.event:last-child { border-bottom: 0; padding-bottom: 0; }

.event-name { font-weight: 700; font-size: 0.96rem; }
.event-name .place { color: var(--text-soft); font-weight: 500; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-soft);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}

.chip.win {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

html[data-theme="dark"] .chip.win { color: var(--accent); }

.chip .medal { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

@media (max-width: 760px) {
  .season-block { grid-template-columns: 1fr; }
  .chips { justify-content: flex-start; }
}

/* ---------- Stats (FTCScout) ---------- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.stat-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-card h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat-card .team-line {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* Headline OPR row: big orange number + rank PERCENTAGE on the right */
.stat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.stat-head .opr-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--accent);
  font-weight: 700;
}
.stat-head .rank-badge {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
}
.stat-head .rank-badge b { color: var(--text); }

.stat-foot {
  margin: 14px 0 0;
  font-size: 0.79rem;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

.stat .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.stat .value {
  font-family: var(--font-display);
  font-size: 1.95rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.stat:first-child .value { color: var(--accent); }
.stat .rank { font-size: 0.73rem; color: var(--text-soft); }

.stat-foot {
  margin: 14px 0 0;
  font-size: 0.79rem;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-empty {
  grid-column: 1 / -1;
  color: var(--text-soft);
  font-size: 0.92rem;
  padding: 18px 4px 6px;
}

/* Tabbed archive: show earlier seasons in the same stat-card layout */
.year-tabs {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  background: var(--panel);
}
.year-tabs button {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font: 600 0.78rem/1 var(--font-body);
  letter-spacing: 0.08em;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--ease), color var(--ease);
}
.year-tabs button[aria-selected="true"] {
  background: var(--accent);
  color: #fff;
}
/* Tabs sit above the archive card; the archive itself is always visible
 * and its contents are swapped by assets/index.js. */
.year-archive-block {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}
.year-archive-block .season-card { margin-bottom: 0; }

.season-tabs-note {
  margin: 14px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* The 2025 card leads with the total OPR in its stat-head, so its grid
 * holds the three remaining categories in one row. */
.stat-card[data-rtf-stats="2025"] .stat-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) {
  .stat-card[data-rtf-stats="2025"] .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Seasons page ---------- */

.season-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 30px);
  margin-bottom: 18px;
}

.season-card > header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.season-card h2 {
  font-family: var(--font-display);
  font-size: 1.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.season-meta {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-soft);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.season-card .stat-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }

/* Season card headline OPR row: big orange number + rank % on the right */
.season-card .stat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.season-card .stat-head .opr-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--accent);
  font-weight: 700;
}
.season-card .stat-head .rank-badge {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
}
.season-card .stat-head .rank-badge b { color: var(--text); }

@media (max-width: 720px) {
  .season-card .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.season-card h3 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 22px 0 10px;
}

.season-card .chips { justify-content: flex-start; }

/* ---------- Contact ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  width: 100%;
}

/* grid items inherit min-width:auto (the card's min-content width),
   which overflows narrow containers — let them shrink to fit. */
.contact-card {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: var(--text);
  transition: border-color var(--ease), transform var(--ease);
}

/* the text block must be allowed to shrink and wrap, otherwise long
   handles push into the arrow or get clipped at narrow widths */
.contact-card > span:first-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-card .platform { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.contact-card:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.contact-card .platform {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.contact-card .handle {
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.35;
}
.contact-card .arrow { color: var(--accent); font-size: 1.15rem; flex-shrink: 0; }

/* Narrow screens: a single-column layout so no card is forced wider
   than its container (auto-fit + minmax(min, 1fr) can overflow
   sub-220px widths). The handle wraps instead of being clipped. */
@media (max-width: 500px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  padding: 36px 0;
  margin-top: 24px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.footer .brand { font-size: 1.15rem; }
.footer .brand img,
.footer .brand .brand-fallback { width: 36px; height: 36px; }

.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--text-soft); font-size: 0.88rem; font-weight: 500; }
.footer-links a:hover { color: var(--accent); }

.footer-note {
  width: 100%;
  color: var(--text-soft);
  font-size: 0.78rem;
  margin: 6px 0 0;
}

/* ---------- Responsive nav ---------- */

@media (max-width: 720px) {
  .nav {
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 10px var(--pad-x) 16px;
    gap: 2px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 11px 8px; }

  .header-actions { display: flex; gap: 8px; margin-left: auto; }
  .menu-btn { display: inline-flex; }
}

@media (min-width: 721px) {
  .header-actions { display: flex; gap: 8px; margin-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
