/* Robocon 25 — project site
   Design tokens: dark-first, court-orange accent, technical slate ground. */

:root {
  --bg: #0d1017;
  --bg-raised: #141822;
  --bg-sunken: #090b10;
  --panel: #171c27;
  --line: #242c3a;
  --line-soft: #1c2230;

  --ink: #e8ecf4;
  --ink-dim: #9aa6bb;
  --ink-faint: #6b7688;

  --accent: #ff7a1a;
  --accent-soft: rgba(255, 122, 26, 0.14);
  --accent-line: rgba(255, 122, 26, 0.42);

  --cyan: #35d0d8;
  --green: #47d18b;
  --amber: #ffc247;
  --red: #ff5f56;
  --violet: #a986ff;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1120px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f7fa;
    --bg-raised: #ffffff;
    --bg-sunken: #eceef3;
    --panel: #ffffff;
    --line: #d9dde6;
    --line-soft: #e6e9f0;
    --ink: #131722;
    --ink-dim: #4e5768;
    --ink-faint: #788296;
    --accent: #d9560a;
    --accent-soft: rgba(217, 86, 10, 0.1);
    --accent-line: rgba(217, 86, 10, 0.35);
    --cyan: #0f8f97;
    --green: #16875a;
    --amber: #a9750a;
    --red: #cf3b32;
    --violet: #6b48c9;
    --shadow: 0 14px 34px rgba(16, 22, 38, 0.1);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- layout ---------- */
.wrap { width: min(100% - 2.5rem, var(--maxw)); margin-inline: auto; }
section { padding: 4rem 0; border-top: 1px solid var(--line-soft); }
section:first-of-type { border-top: 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 1.5rem; height: 60px; }
.brand {
  display: flex; align-items: center; gap: .6rem;
  font-weight: 700; letter-spacing: -.01em; color: var(--ink);
  text-decoration: none; font-size: .98rem; white-space: nowrap;
}
.brand-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ff9c4d, var(--accent));
  position: relative; flex: none;
}
.brand-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    linear-gradient(to right, transparent 47%, rgba(0,0,0,.45) 47%, rgba(0,0,0,.45) 53%, transparent 53%),
    linear-gradient(to bottom, transparent 47%, rgba(0,0,0,.45) 47%, rgba(0,0,0,.45) 53%, transparent 53%);
}
.nav-links { display: flex; gap: .35rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
  color: var(--ink-dim); text-decoration: none; font-size: .87rem;
  padding: .35rem .7rem; border-radius: 8px; white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); background: var(--bg-raised); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* ---------- type ---------- */
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .6rem; }
h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.16rem; font-weight: 650; }
p { margin: 0 0 1rem; color: var(--ink-dim); }
a { color: var(--accent); }
.lede { font-size: 1.1rem; color: var(--ink-dim); max-width: 68ch; }

.eyebrow {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .7rem;
}
code, .mono { font-family: var(--mono); font-size: .88em; }
p code, li code, td code {
  background: var(--bg-sunken); border: 1px solid var(--line-soft);
  padding: .08em .38em; border-radius: 5px; color: var(--ink);
}

/* ---------- hero ---------- */
.hero { padding: clamp(2.4rem, 6vw, 4.2rem) 0 4rem; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% 20% auto -10%; height: 520px;
  background: radial-gradient(ellipse at center, var(--accent-soft), transparent 62%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.4rem 0 1.7rem; }
.chip {
  font-family: var(--mono); font-size: .76rem; color: var(--ink-dim);
  border: 1px solid var(--line); background: var(--bg-raised);
  padding: .3rem .65rem; border-radius: 999px;
}
.chip strong { color: var(--ink); font-weight: 600; }

.btn-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .62rem 1.15rem; border-radius: 10px; font-size: .9rem; font-weight: 600;
  text-decoration: none; border: 1px solid var(--line); color: var(--ink);
  background: var(--bg-raised); transition: transform .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent-line); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #14100c; }
.btn-primary:hover { filter: brightness(1.07); }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 1.1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.35rem;
}
.card h3 { margin-bottom: .35rem; }
.card p:last-child { margin-bottom: 0; }
.card-link { text-decoration: none; display: block; transition: border-color .14s ease, transform .14s ease; }
.card-link:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.card-link h3 { color: var(--ink); }

.stat { text-align: left; }
.stat .num {
  font-family: var(--mono); font-size: 1.9rem; font-weight: 700;
  color: var(--accent); line-height: 1.1; display: block;
}
.stat .lbl { font-size: .8rem; color: var(--ink-faint); }

/* ---------- figures / diagrams ---------- */
figure { margin: 1.6rem 0; }
.diagram {
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem; overflow-x: auto;
}
.diagram svg { display: block; width: 100%; height: auto; min-width: 620px; }
figcaption { font-size: .84rem; color: var(--ink-faint); margin-top: .7rem; }
figcaption strong { color: var(--ink-dim); }

/* svg helper classes */
.svg-box { fill: var(--panel); stroke: var(--line); stroke-width: 1.5; }
.svg-box-accent { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1.5; }
.svg-label { fill: var(--ink); font-family: var(--sans); font-size: 13px; font-weight: 600; }
.svg-sub { fill: var(--ink-faint); font-family: var(--mono); font-size: 10.5px; }
.svg-edge { stroke: var(--line); stroke-width: 1.6; fill: none; }
.svg-edge-live { stroke: var(--accent); stroke-width: 1.8; fill: none; }
.svg-edge-txt { fill: var(--ink-dim); font-family: var(--mono); font-size: 10px; }

/* ---------- tables ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; min-width: 520px; }
th, td { text-align: left; padding: .62rem .85rem; border-bottom: 1px solid var(--line-soft); }
th {
  background: var(--bg-sunken); font-family: var(--mono); font-size: .74rem;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600;
}
tbody tr:last-child td { border-bottom: 0; }
td.mono, th.mono { font-family: var(--mono); }

/* ---------- code blocks ---------- */
pre {
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1rem 1.1rem; overflow-x: auto;
  font-family: var(--mono); font-size: .82rem; line-height: 1.6; color: var(--ink-dim);
  margin: 0 0 1rem;
}
pre .k { color: var(--violet); }
pre .s { color: var(--green); }
pre .c { color: var(--ink-faint); font-style: italic; }
pre .n { color: var(--amber); }
pre .f { color: var(--cyan); }

.srcref {
  font-family: var(--mono); font-size: .76rem; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: .3rem;
}
.srcref a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px dotted var(--line); }
.srcref a:hover { color: var(--accent); }

/* ---------- callouts ---------- */
.note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  padding: .9rem 1.1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.2rem 0;
}
.note p:last-child { margin-bottom: 0; }
.note.warn { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 11%, transparent); }
.note.bug { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.note-title { font-weight: 700; color: var(--ink); font-size: .9rem; margin-bottom: .25rem; }

.tag {
  display: inline-block; font-family: var(--mono); font-size: .7rem; font-weight: 600;
  padding: .16rem .5rem; border-radius: 5px; letter-spacing: .04em; vertical-align: middle;
}
.tag-bug { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }
.tag-warn { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }
.tag-ok { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.tag-info { background: color-mix(in srgb, var(--cyan) 16%, transparent); color: var(--cyan); }

/* ---------- simulator shell ---------- */
.sim {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 1.5rem 0;
}
.sim-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1.15rem; border-bottom: 1px solid var(--line); background: var(--bg-raised);
}
.sim-head h3 { margin: 0; font-size: .98rem; }
.sim-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr); }
@media (max-width: 820px) { .sim-body { grid-template-columns: 1fr; } }
.sim-stage { background: var(--bg-sunken); padding: 1rem; display: grid; place-items: center; min-height: 300px; }
.sim-stage canvas { width: 100%; height: auto; display: block; touch-action: none; border-radius: var(--radius-sm); }
.sim-panel { padding: 1.1rem; border-left: 1px solid var(--line); }
@media (max-width: 820px) { .sim-panel { border-left: 0; border-top: 1px solid var(--line); } }

.ctrl { margin-bottom: .95rem; }
.ctrl label {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-size: .8rem; color: var(--ink-dim); margin-bottom: .3rem;
}
.ctrl label .val { font-family: var(--mono); color: var(--accent); font-size: .82rem; }
input[type="range"] {
  width: 100%; -webkit-appearance: none; appearance: none; height: 4px;
  background: var(--line); border-radius: 3px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--panel);
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%; background: var(--accent);
  cursor: pointer; border: 2px solid var(--panel);
}
.btn-sm {
  font-family: var(--sans); font-size: .78rem; font-weight: 600; cursor: pointer;
  padding: .34rem .7rem; border-radius: 7px;
  border: 1px solid var(--line); background: var(--bg-sunken); color: var(--ink-dim);
}
.btn-sm:hover { border-color: var(--accent-line); color: var(--ink); }
.btn-sm.on { background: var(--accent); border-color: var(--accent); color: #14100c; }

.readout { font-family: var(--mono); font-size: .78rem; border-top: 1px solid var(--line-soft); padding-top: .8rem; }
.readout div { display: flex; justify-content: space-between; padding: .16rem 0; color: var(--ink-faint); }
.readout div b { color: var(--ink); font-weight: 600; }
.readout div.hl b { color: var(--accent); }

/* ---------- media / annotations ---------- */
.media-figure { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; }
.media-figure img, .media-figure video { display: block; width: 100%; height: auto; }
.anno-layer { position: absolute; inset: 0; pointer-events: none; }
.anno-box {
  position: absolute; border: 2px solid var(--accent); border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.55);
}
.anno-box[data-c="cyan"] { border-color: var(--cyan); }
.anno-box[data-c="green"] { border-color: var(--green); }
.anno-box[data-c="violet"] { border-color: var(--violet); }
.anno-tag {
  position: absolute; top: -1.55rem; left: -2px; white-space: nowrap;
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  background: var(--accent); color: #14100c; padding: .12rem .42rem; border-radius: 4px;
}
.anno-box[data-c="cyan"] .anno-tag { background: var(--cyan); }
.anno-box[data-c="green"] .anno-tag { background: var(--green); }
.anno-box[data-c="violet"] .anno-tag { background: var(--violet); }

.slot {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 2.4rem 1.4rem; text-align: center; background: var(--bg-sunken);
}
.slot .slot-icon { font-size: 1.6rem; opacity: .5; }
.slot p { margin: .5rem 0 0; font-size: .88rem; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line); padding: 2.5rem 0 3.5rem;
  color: var(--ink-faint); font-size: .85rem;
}
footer a { color: var(--ink-dim); }
.foot-grid { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; }

ul.tight { margin: 0 0 1rem; padding-left: 1.15rem; color: var(--ink-dim); }
ul.tight li { margin-bottom: .35rem; }
.no-bullet { list-style: none; padding-left: 0; }

/* ---------- hero reel ---------- */
.hero-reel {
  margin: 2.2rem 0 0;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
  aspect-ratio: 2 / 1;          /* cinematic strip — the arena shot has dead ceiling and floor */
}
.hero-reel video {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 45%;  /* bias up so the hoop and the ball's arc stay in frame */
}
@media (max-width: 640px) {
  .hero-reel { aspect-ratio: 16 / 10; }
}

/* scrim so the caption bar stays readable over bright arena footage */
.hero-reel::after {
  content: "";
  position: absolute; inset: auto 0 0 0; height: 46%;
  background: linear-gradient(to top, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.reel-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.15rem;
  font-family: var(--mono); font-size: .78rem; color: #eef1f7;
}
.reel-bar a {
  color: #fff; text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, .45);
  white-space: nowrap;
}
.reel-bar a:hover { color: #ff9c4d; border-color: #ff9c4d; }

.reel-live { display: inline-flex; align-items: center; gap: .55rem; }
.reel-live i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: none;
  animation: reelPulse 2.4s ease-out infinite;
}
@keyframes reelPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 122, 26, .65); }
  70%  { box-shadow: 0 0 0 9px rgba(255, 122, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 122, 26, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .reel-live i { animation: none; }
}
