/* ===== SkyRide.net =====
   Colors live here at the top. Change a value once and it updates everywhere.
   Based on Figma's "Arctic reflection" and "Frosted aura" color schemes. */
:root {
  --fog:     #F4FCFB;   /* page background (Arctic reflection) */
  --paper:   #FFFFFF;   /* raised surfaces (Frosted aura) */
  --ink:     #243C4C;   /* main text, console background (Arctic reflection) */
  --slate:   #4F6E7E;   /* secondary text: Frosted aura's #5C7E8F, darkened a touch so it's easy to read */
  --pewter:  #5C7E8F;   /* index lines, quiet accents (Frosted aura) */
  --rule:    #D4DDE2;   /* lines and borders (Frosted aura) */
  --rule-2:  #ACBCBF;   /* the timeline's spine (Arctic reflection) */
  --glacier: #5289AD;   /* the accent: drop-down arrows, story highlight (Arctic reflection) */
  --frost:   #8FB8D3;   /* the accent, lightened for use on the dark console */
  --amber:   #E2A12C;   /* the console's carrier-detect LED, and nothing else */

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  /* Faint topographic contours behind the top of the page. The fade-out is built into the image. */
  background-color: var(--fog);
  background-image: url("../img/contours.svg");
  background-repeat: no-repeat;
  background-position: top center;
  background-size: max(100%, 1300px) auto;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--slate); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { margin: 0; line-height: 1.1; }
h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); font-weight: 750; font-stretch: 112%; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0; }
code { font-family: var(--mono); font-size: 0.9em; }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--fog); padding: 0.5rem 0.75rem; z-index: 10; }
.skip:focus { left: 0.5rem; }

/* Highlight for text that still needs writing. Delete the class once it's real. */
.todo { background: color-mix(in srgb, var(--glacier) 20%, transparent); box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 0.2em; border-radius: 2px; }

/* ----- Header ----- */
.site-header {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1.25rem var(--gutter);
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 1rem;
}
.site-header nav { display: flex; gap: 1.5rem; }
.site-header nav a { text-decoration: none; color: var(--slate); }
.site-header nav a:hover { color: var(--ink); }

/* ----- Hero ----- */
.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 5.5rem) var(--gutter) clamp(3rem, 8vw, 6rem);
}
.hero h1 {
  font-size: clamp(2.6rem, 11vw, 9rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.035em;
  line-height: 0.88;
  margin-left: -0.04em; /* optical alignment of the S with the text below */
}
.hero-body {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* lets the console scroll inside its box on phones */
  gap: 2.5rem;
  align-items: start;
}
@media (min-width: 56rem) {
  .hero-body { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 4rem; }
}
.lede { font-size: clamp(1.2rem, 2vw, 1.4rem); line-height: 1.45; max-width: 30rem; font-stretch: 95%; }

/* ----- Traceroute console ----- */
.trace { margin: 0; }
.trace-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: #1B2F3C;
  color: var(--rule-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.55rem 1rem;
  border-radius: 8px 8px 0 0;
}
.led {
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px 1px color-mix(in srgb, var(--amber) 70%, transparent);
}
.trace-out {
  margin: 0;
  background: var(--ink);
  color: var(--rule);
  font-family: var(--mono);
  font-size: clamp(0.78rem, 1.6vw, 0.9rem);
  line-height: 1.75;
  padding: 1.1rem 1.25rem 1.3rem;
  border-radius: 0 0 8px 8px;
  overflow-x: auto;
  white-space: pre;
}
.trace-out .line { display: block; }
.trace-out .prompt { color: var(--frost); }
.trace-out .dim, .trace-out .hop-timeout { color: #8FA5B0; }
.trace-out .hop-n { color: var(--frost); }
.trace-out .hop-ms { color: var(--rule-2); }
.trace-out .hop-host { color: #FFFFFF; text-decoration: none; border-bottom: 1px dotted var(--pewter); }
.trace-out .hop-host:hover { border-bottom-color: var(--frost); }
.trace-out .hop-host:focus-visible { outline-color: var(--frost); }
.trace-out { overflow: auto; overscroll-behavior: contain; }
.trace-out:focus-within { box-shadow: inset 0 0 0 1px var(--pewter); }
.trace-out .out-dim { color: #8FA5B0; }
.trace-out .out-bright { color: #FFFFFF; font-weight: 500; }
.trace-out .wrap { white-space: pre-wrap; max-width: 62ch; }

/* The prompt at the bottom of the console */
.console-input {
  font: inherit;
  color: #FFFFFF;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  outline: none;
  caret-color: var(--frost);
  width: calc(100% - 2ch);
  min-width: 24ch;
}
.console-input::placeholder { color: #7D93A0; opacity: 1; }

/* Games that take over the console (js/games) */
.game-screen {
  display: block;
  line-height: 1.12;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.game-screen .g-dim { color: #6F8794; }
.game-screen .g-lock { color: var(--frost); }
.game-screen .g-on { color: #FFFFFF; }
.game-screen .g-btn { color: #FFFFFF; text-decoration: underline; text-decoration-color: var(--pewter); cursor: pointer; }
.trace figcaption { margin-top: 0.75rem; color: var(--slate); font-size: 0.9rem; }

/* ----- History timeline ----- */
.history, .speeds, .network {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter);
  border-top: 1px solid var(--rule);
}
.timeline { list-style: none; margin: 2.5rem 0 0; padding: 0; }
.milestone {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.5rem 0 1.5rem 1.25rem;
  border-left: 2px solid var(--rule-2);
  scroll-margin-top: 1.5rem;
}
.milestone:target { border-left-color: var(--glacier); background: linear-gradient(90deg, var(--paper), rgba(255, 255, 255, 0) 70%); }
.milestone-year {
  font-weight: 800;
  font-stretch: 112%;
  font-size: 1.5rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.milestone-body { max-width: 38rem; }
.milestone-body p { margin-top: 0.4rem; color: var(--ink); }
@media (max-width: 34rem) {
  .milestone { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* Years with no records: a quiet break in the line, like a hop that doesn't answer */
.gap {
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.6rem 0 0.6rem 1.25rem;
  border-left: 2px dashed var(--rule-2);
  color: var(--slate);
  font-size: 0.9rem;
}
.gap-stars { font-family: var(--mono); letter-spacing: 0.1em; }

/* Drop-down of monthly updates inside a year */
.more { margin-top: 0.9rem; }
.more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--ink);
  padding: 0.2rem 0;
}
.more summary::-webkit-details-marker { display: none; }
.more summary:hover span:last-child { text-decoration: underline; text-decoration-color: var(--slate); text-underline-offset: 0.2em; }
.chev {
  display: inline-block;
  width: 0.75em;
  color: var(--glacier);
  font-size: 1.35em;
  line-height: 1;
  transition: transform 0.15s ease;
}
.more[open] .chev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }

.months { list-style: none; margin: 1rem 0 0.25rem; padding: 0; }
.month {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--rule);
}
.month h4 { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--slate); line-height: 1.6; }
.updates { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.update p { margin: 0; color: var(--ink); }
.update-story {
  background: var(--paper);
  border-left: 3px solid var(--glacier);
  padding: 0.85rem 1rem;
  box-shadow: 0 1px 0 var(--rule);
  border-radius: 0 6px 6px 0;
}
.update-story p { color: var(--ink); }
.quote {
  margin: 0.7rem 0 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--pewter);
}
.quote p { color: var(--ink); font-size: 1.1rem; font-stretch: 92%; line-height: 1.45; }
@media (max-width: 34rem) {
  .month { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* ----- Then and now ----- */
.speeds[hidden] { display: none; }
.speeds-intro p { margin-top: 0.75rem; color: var(--slate); max-width: 40rem; }
.speeds-list { list-style: none; margin: 2.25rem 0 0; padding: 0; }
.speed-row {
  display: grid;
  grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr) 4.5rem;
  gap: 0.4rem 1.5rem;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}
.speed-row:last-child { border-bottom: 1px solid var(--rule); }
.speed-name { display: grid; line-height: 1.35; }
.speed-label { font-weight: 600; }
.speed-detail { color: var(--slate); font-size: 0.875rem; }
.speed-bar { height: 0.7rem; background: var(--rule); border-radius: 999px; overflow: hidden; }
.speed-fill { display: block; height: 100%; background: var(--glacier); border-radius: inherit; min-width: 3px; }
.speed-you .speed-fill { background: var(--ink); }
.speed-you .speed-label { color: var(--ink); }
.speed-time { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) {
  .speed-row { grid-template-columns: minmax(0, 1fr) 4.5rem; }
  .speed-name { grid-column: 1 / -1; }
}
.speeds-foot {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}
.speeds-note { color: var(--slate); font-size: 0.9rem; max-width: 34rem; }
.race {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  padding: 0.55rem 1rem;
  cursor: pointer;
}
.race:hover { background: var(--ink); color: var(--fog); }
.race:disabled { cursor: progress; opacity: 0.6; background: var(--paper); color: var(--ink); }

/* ----- Network spec sheet ----- */
.network-intro p { margin-top: 0.75rem; color: var(--slate); max-width: 36rem; }
.spec { margin: 2.5rem 0 0; display: grid; border-top: 1px solid var(--rule); }
@media (min-width: 48rem) {
  .spec { grid-template-columns: 1fr 1fr; column-gap: 3rem; }
}
.spec > div {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
}
.spec dt { color: var(--slate); }
.spec dd { margin: 0; }

.diagram { margin: 3rem 0 0; }
.diagram img { display: block; max-width: 100%; height: auto; border-radius: 8px; background: var(--paper); }
.diagram-slot {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2rem;
  color: var(--slate);
  background: var(--paper);
  border: 1.5px dashed var(--rule-2);
  border-radius: 8px;
}
.diagram figcaption { margin-top: 0.75rem; color: var(--slate); font-size: 0.9rem; }

/* ----- Footer ----- */
.site-footer {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--rule);
  color: var(--slate);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
}
.footer-notes { display: grid; gap: 0.25rem; }
@media (min-width: 48rem) { .footer-notes { text-align: right; } }

/* ----- Odometer visitor counter ----- */
.counter { display: flex; align-items: center; gap: 1rem; }
.counter[hidden] { display: none; }
.odometer {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: #1B2F3C;
  border-radius: 6px;
  box-shadow: 0 1px 0 var(--paper), inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.od-cell {
  position: relative;
  display: block;
  width: 1.05em;
  height: 1.5em;
  overflow: hidden;
  background: var(--ink);
  border-radius: 2px;
  color: var(--fog);
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 75%;
  font-size: 1.4rem;
  line-height: 1.5em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.od-cell:last-child { background: var(--glacier); color: #FFFFFF; } /* the fast-turning wheel */
.od-cell::after {   /* shading that makes each wheel look round */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(15, 29, 38, 0.6), rgba(15, 29, 38, 0) 32%, rgba(15, 29, 38, 0) 68%, rgba(15, 29, 38, 0.6));
  pointer-events: none;
}
.od-strip {
  display: block;
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1);
}
.od-strip span { display: block; height: 1.5em; }
.counter-label { color: var(--slate); }
