:root {
  --paper: #f3f7fa;
  --ice: #e6eef4;
  --rail: #14202e;
  --rail-2: #1d2d40;
  --ink: #142030;
  --muted: #55667a;
  --line: #cdd9e3;
  --red: #d62839;
  --blue: #2563c9;
  --yellow: #e9b520;
  --violet: #7c4dff;
  --wrap: 1180px;
  --pad: clamp(1.1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variation-settings: "wdth" 100;
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { margin: 0; line-height: 1.05; font-weight: 800; }
h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-variation-settings: "wdth" 115;
  letter-spacing: -0.015em;
  max-width: 19em;
}
h2 {
  font-size: clamp(1.75rem, 3.6vw, 2.6rem);
  font-variation-settings: "wdth" 112;
  letter-spacing: -0.01em;
  margin-bottom: 0.7em;
  max-width: 18em;
}
h3 { font-size: 1.25rem; font-variation-settings: "wdth" 108; }
p { margin: 0 0 1em; max-width: 36em; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.7rem var(--pad);
  background: rgba(243, 247, 250, 0.88);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  color: var(--ink); text-decoration: none; font-weight: 800;
  font-variation-settings: "wdth" 115; font-size: 1.05rem;
  display: inline-flex; align-items: center; gap: 0.55rem;
}
.brand::before {
  content: ""; width: 0.95rem; height: 0.95rem; border-radius: 50%;
  background: var(--red); box-shadow: inset 0 0 0 3px rgba(255,255,255,0.35);
}
.bar nav { display: flex; gap: clamp(0.8rem, 2.4vw, 1.8rem); }
.bar nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.bar nav a:hover { color: var(--ink); }
@media (max-width: 640px) { .bar nav { display: none; } }

section { padding: clamp(3.5rem, 8vw, 6.5rem) var(--pad); }
section > * { max-width: var(--wrap); margin-left: auto; margin-right: auto; }

/* hero */
.hero { padding-top: clamp(2.2rem, 5vw, 4rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.hero-text { margin-bottom: clamp(1.4rem, 2.6vw, 2rem); }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: #2a3a4d; margin-top: 0.9rem; max-width: 44em; }

.hero { --rinkw: max(min(var(--wrap), calc((100vh - 420px) * 2.03)), min(100%, 700px)); }
.hero > .hero-text, .hero > .rink-wrap { max-width: var(--rinkw); }
.rink-wrap { margin: 0 auto; }
.rail {
  position: relative;
  background: var(--rail);
  border-radius: clamp(14px, 2.4vw, 28px);
  padding: clamp(10px, 1.6vw, 18px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 24px 60px -28px rgba(20, 32, 46, 0.55);
}
#rink {
  display: block; width: 100%;
  aspect-ratio: 1499 / 737;
  border-radius: clamp(6px, 1vw, 12px);
  touch-action: none;
  cursor: grab;
  background: var(--ice);
}
#rink.aiming { cursor: grabbing; }
.flash {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.92);
  font-weight: 900; font-variation-settings: "wdth" 120;
  font-size: clamp(1.05rem, 2.4vw, 1.6rem);
  top: 16%;
  background: #fff; border-radius: 999px; padding: 0.3em 1em;
  box-shadow: 0 6px 20px -8px rgba(20,32,46,0.45);
  color: var(--rail); opacity: 0; pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.flash.goal { color: var(--red); }
@media (prefers-reduced-motion: reduce) { .flash { transition: none; } }

.rink-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.6rem 1.5rem; margin-top: 1rem;
}
.howto { margin: 0; font-weight: 600; }
.score { margin: 0; display: flex; align-items: center; gap: 1.2rem; color: var(--muted); }
.score b {
  color: var(--ink); font-size: 1.35rem; font-variation-settings: "wdth" 75;
  font-variant-numeric: tabular-nums; margin-left: 0.3rem;
}
.score button {
  font: inherit; font-weight: 600; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.95rem; cursor: pointer;
}
.score button:hover { border-color: var(--ink); }

.key { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1.3rem; color: var(--muted); font-size: 0.92rem; margin: 0.8rem 0 0; max-width: none; }
.ki { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.k { display: inline-block; width: 1.4rem; height: 4px; border-radius: 2px; }
.k-forecast { background: var(--violet); }
.k-string { background: var(--yellow); height: 2px; }
.k-paddle { background: var(--blue); width: 0.8rem; height: 0.8rem; border-radius: 50%; }
.fine { color: var(--muted); font-size: 0.9rem; margin-top: 0.45rem; max-width: 52em; }

/* columns */
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(1.8rem, 4vw, 4rem); align-items: center; }
@media (max-width: 880px) { .cols { grid-template-columns: 1fr; } }

/* working today */
.today { border-top: 1px solid var(--line); }
.clip { margin: 0; }
.clip video {
  display: block; width: 100%; height: auto; aspect-ratio: 1628 / 400;
  border-radius: 12px; background: var(--rail);
}
.clip.tall video { aspect-ratio: 720 / 726; max-width: 420px; }
.clip figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.6rem; }

.numbers {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(2.5rem, 5vw, 4rem); margin-bottom: 0;
  border-top: 2px solid var(--ink);
}
.numbers > div { padding: 1.1rem 1.4rem 0 0; }
.numbers > div + div { padding-left: 1.4rem; border-left: 1px solid var(--line); }
.numbers dt {
  font-size: clamp(3rem, 7vw, 5.2rem); line-height: 1; font-weight: 800;
  font-variation-settings: "wdth" 68; font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.numbers dd { margin: 0.5rem 0 0; color: #2a3a4d; max-width: 17em; }
.numbers .note { display: block; margin-top: 0.7rem; color: var(--muted); font-size: 0.88rem; line-height: 1.5; max-width: 26em; }
.numbers > div:last-child dt { color: var(--violet); }
@media (max-width: 640px) {
  .numbers { grid-template-columns: 1fr; }
  .numbers > div, .numbers > div + div { padding: 1rem 0; border-left: 0; border-bottom: 1px solid var(--line); }
}

/* steps */
.steps { padding-top: 0; }
.steps ol { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.2rem, 3vw, 2.5rem); counter-reset: step; }
.steps li { counter-increment: step; border-top: 1px solid var(--line); padding-top: 1rem; }
.steps li::before {
  content: counter(step); display: block;
  font-weight: 800; font-variation-settings: "wdth" 68; font-size: 2.6rem; line-height: 1;
  color: var(--blue); margin-bottom: 0.6rem;
}
.steps li.next::before { color: var(--muted); }
.steps h3 { margin-bottom: 0.45rem; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.tag {
  font-size: 0.78rem; font-weight: 600; font-variation-settings: "wdth" 100;
  border: 1px solid currentColor; color: var(--muted);
  border-radius: 999px; padding: 0.05rem 0.55rem;
}
@media (max-width: 760px) { .steps ol { grid-template-columns: 1fr; } }

/* robot */
.robot { background: var(--rail); color: #dfe8ef; }
.robot h2 { color: #fff; }
.robot a { color: #9ec0ff; }
.robot .goal {
  color: #fff; font-weight: 700; font-variation-settings: "wdth" 108;
  font-size: 1.2rem; border-left: 3px solid var(--yellow); padding-left: 0.9rem;
}
.plan { margin: 0; }
.plan svg { display: block; width: 100%; height: auto; }
.p-rail { fill: var(--rail-2); }
.p-ice { fill: var(--ice); }
.p-centre { stroke: var(--red); stroke-width: 3; opacity: 0.7; }
.p-goal { fill: var(--rail); }
.p-def { stroke: var(--blue); stroke-width: 1.5; stroke-dasharray: 5 6; opacity: 0.55; }
.p-strings line { stroke: var(--yellow); stroke-width: 2.2; }
.p-motor rect { fill: #0d1622; stroke: #7d8fa3; stroke-width: 1.5; }
.p-paddle { fill: var(--blue); }
.p-knob { fill: #cfe0ff; }
.p-puck { fill: var(--red); }
.p-forecast { fill: none; stroke: var(--violet); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2 7; }
.p-lab { font-family: "Archivo", system-ui, sans-serif; font-size: 19px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--ice); stroke-width: 5px; stroke-linejoin: round; }
.p-lab.p-on { fill: #dfe8ef; stroke: none; }
.p-you { fill: var(--muted); }

.motors {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 1.6rem;
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 0.4rem 2rem;
}
.motors h3 { color: #fff; }
.motors p { grid-column: 2; }
@media (max-width: 760px) { .motors { grid-template-columns: 1fr; } .motors p { grid-column: 1; } }

/* timeline */
.timeline { list-style: none; padding: 0; margin-top: 0.5rem; }
.timeline li {
  position: relative; display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 0.2rem 1.5rem;
  padding: 0 0 1.6rem 2rem;
}
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 0.45rem;
  width: 0.8rem; height: 0.8rem; border-radius: 50%;
  border: 2px solid var(--muted); background: var(--paper);
}
.timeline li::after {
  content: ""; position: absolute; left: calc(0.4rem - 1px); top: 1.45rem; bottom: 0.1rem;
  width: 2px; background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--blue); border-color: var(--blue); }
.timeline li.now::before { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 201, 0.18); }
.when { font-weight: 700; font-variation-settings: "wdth" 108; }
.timeline p { margin: 0; }
@media (max-width: 640px) { .timeline li { grid-template-columns: 1fr; } }

/* team */
.team { border-top: 1px solid var(--line); }
.team p { font-size: 1.15rem; max-width: 36em; }

.foot { padding: 1.5rem var(--pad) 2.5rem; color: var(--muted); font-size: 0.9rem; }
.foot p { max-width: var(--wrap); margin: 0 auto; }

/* phones: the table stands upright, robot at the top */
@media (max-width: 640px) {
  .rail { width: fit-content; margin: 0 auto; }
}
