/* Jon's Side Quests: US highway signage.
   An overhead gantry carries the green guide sign with the channels. Below it a road runs past mile markers (days
   since upload) to brown attraction signs (videos), then blue service signs (optional extra links).
   Sign colours are the same day and night, like on a real road; only the road surface changes with the theme. */

@font-face {
  font-family: "Overpass";
  src: url("/fonts/overpass-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Road surface: daytime concrete */
  --road: #E2E4E2;
  --road-strip: #CACDCB;
  --fog-line: #FFFFFF;
  --center-line: #D49A00;
  --ink: #1F2427;
  --ink-soft: #4C5459;
  --steel: #8C9398;
  --steel-dark: #6A7176;
  --shadow: rgba(31, 36, 39, .22);

  /* Sign colours */
  --guide: #006B3F;
  --attraction: #5C3A21;
  --service: #0B4F9C;
  --warn: #FFC20E;
  --legend: #F7F7F2;
  --warn-ink: #1A1A1A;
  --glint: rgba(255, 255, 255, .38);

  --font: "Overpass", "Highway Gothic", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Road surface: night asphalt */
    --road: #2F3336;
    --road-strip: #232729;
    --fog-line: #D9DCD8;
    --center-line: #FFC20E;
    --ink: #E9EBE7;
    --ink-soft: #A9B0B3;
    --steel: #6C7378;
    --steel-dark: #50565A;
    --shadow: rgba(0, 0, 0, .5);

    color-scheme: dark;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  font: 400 1.0625rem/1.5 var(--font);
  color: var(--ink);
  background-color: var(--road);
  /* Fine aggregate texture, like a road surface. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 4px solid var(--warn); outline-offset: 4px; border-radius: 12px; }
img { max-width: 100%; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  max-width: 1040px;
  margin-inline: auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
}

/* ---------- Signs: one shape, colour by role ---------- */
.sign {
  position: relative;
  display: block;
  color: var(--legend);
  background: var(--sign-bg);
  border-radius: 14px;
  box-shadow:
    inset 0 0 0 6px var(--sign-bg),
    inset 0 0 0 9px var(--legend),
    0 10px 24px -8px var(--shadow);
}
.sign--guide { --sign-bg: var(--guide); }
.sign--attraction { --sign-bg: var(--attraction); }
.sign--service { --sign-bg: var(--service); }

/* ---------- Gantry ---------- */
.gantry { padding-top: env(safe-area-inset-top, 0px); }

.beam {
  height: 18px;
  margin-top: 14px;
  background:
    linear-gradient(var(--steel-dark), var(--steel-dark)) top / 100% 3px no-repeat,
    linear-gradient(var(--steel-dark), var(--steel-dark)) bottom / 100% 3px no-repeat,
    repeating-linear-gradient(60deg, transparent 0 9px, var(--steel) 9px 12px, transparent 12px 21px),
    repeating-linear-gradient(-60deg, transparent 0 9px, var(--steel) 9px 12px, transparent 12px 21px);
}

.hangers { position: relative; height: 22px; }
.hangers span {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  background: var(--steel);
  border-inline: 2px solid var(--steel-dark);
}
.hangers span:first-child { left: 14%; }
.hangers span:last-child { right: 14%; }

.hero {
  overflow: hidden;
  padding: 28px 26px 14px;
}

/* One headlight glint across the sign when the page loads. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 38%, var(--glint) 50%, transparent 62%);
  transform: translateX(-110%);
  animation: glint 1.5s .35s cubic-bezier(.3, .1, .3, 1) 1 forwards;
  pointer-events: none;
}
@keyframes glint { to { transform: translateX(110%); } }

.hero h1 {
  margin: 0;
  font-weight: 800;
  font-size: clamp(2.25rem, 9.5vw, 4rem);
  line-height: .98;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.hero .sub {
  margin: 10px 0 18px;
  max-width: 34ch;
  font-weight: 600;
  font-size: clamp(1rem, 3.6vw, 1.2rem);
  line-height: 1.3;
}

.channels {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.channel {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-top: 3px solid var(--legend);
}
.channel--plain { grid-template-columns: 1fr auto; }
.channel .glyph { display: block; width: 32px; height: 32px; }
.channel .name { display: block; font-weight: 800; font-size: 1.4rem; line-height: 1.1; }
.channel .handle { display: block; font-weight: 600; font-size: .95rem; opacity: .86; }
.channel .arrow { display: block; width: 30px; height: 30px; }
.arrow--exit { transform: rotate(45deg); }
.channel:hover .name {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

/* ---------- Sections ---------- */
main {
  display: grid;
  gap: 44px;
  padding-block: 36px 24px;
}

section {
  display: grid;
  gap: 22px;
}

/* A small sign that names the section. Its colour matches the signs below it. */
.plaque {
  justify-self: start;
  margin: 0;
  padding: 10px 20px 8px;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--legend);
  background: var(--sign-bg);
  border-radius: 10px;
  box-shadow:
    inset 0 0 0 4px var(--sign-bg),
    inset 0 0 0 6px var(--legend),
    0 6px 14px -6px var(--shadow);
}

/* ---------- The road: videos as stops, newest first ---------- */
.route {
  position: relative;
  display: grid;
  gap: 30px;
  margin: 0;
  padding: 0 0 0 64px;
  list-style: none;
}

/* On phones the road runs down the left edge. */
.route::before {
  content: "";
  position: absolute;
  left: 0;
  top: -12px;
  bottom: -12px;
  width: 46px;
  background:
    repeating-linear-gradient(to bottom, var(--center-line) 0 18px, transparent 18px 36px) center / 4px 100% no-repeat,
    var(--road-strip);
  border-inline: 3px solid var(--fog-line);
}

.stop { position: relative; min-width: 0; }

.marker {
  position: absolute;
  left: -57px;
  top: 14px;
  display: grid;
  justify-items: center;
  width: 32px;
}
.marker .post {
  width: 32px;
  padding: 6px 0 5px;
  text-align: center;
  line-height: 1;
  color: var(--legend);
  background: var(--guide);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px var(--guide), inset 0 0 0 4px var(--legend);
}
.marker .unit { display: block; font-size: .6rem; font-weight: 800; letter-spacing: .04em; }
.marker .num {
  display: block;
  margin-top: 3px;
  font-size: 1.15rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.marker .stem { width: 6px; height: 14px; background: var(--steel); }

.video {
  display: grid;
  gap: 12px;
  padding: 18px 18px 16px;
}

/* hqdefault thumbnails are 4:3 with letterbox bars; cropping to 16:9 removes the bars. */
.thumb {
  display: block;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 5px;
  background: var(--road-strip);
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vtitle {
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.2;
  text-wrap: balance;
}
.vdate { margin-top: -6px; font-weight: 600; font-size: .9rem; opacity: .85; }
.video:hover .vtitle {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* Yellow warning diamond on the newest video, for its first week. */
.new {
  position: absolute;
  top: -14px;
  right: -10px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  pointer-events: none;
}
.new::before {
  content: "";
  position: absolute;
  inset: 8px;
  transform: rotate(45deg);
  background: var(--warn);
  border-radius: 5px;
  box-shadow: inset 0 0 0 2px var(--warn), inset 0 0 0 4px var(--warn-ink), 0 6px 12px -4px var(--shadow);
}
.new span {
  position: relative;
  color: var(--warn-ink);
  font-weight: 900;
  font-size: .85rem;
  letter-spacing: .02em;
}

/* ---------- Extra links ---------- */
.services {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.service {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
}
.service .glyph { display: block; width: 28px; height: 28px; }
.service .label { display: block; font-weight: 800; font-size: 1.15rem; line-height: 1.15; }
.service .detail { display: block; font-weight: 600; font-size: .9rem; opacity: .86; }
.service .arrow { display: block; width: 24px; height: 24px; }
.service:hover .label {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

footer {
  display: grid;
  gap: 4px;
  padding-block: 8px 40px;
  font-size: .9rem;
  color: var(--ink-soft);
}
footer p { margin: 0; }

/* ---------- Wider screens ---------- */
@media (min-width: 720px) {
  .hero { padding: 34px 36px 18px; }

  .channels { grid-template-columns: 1fr 1fr; }
  .channel { padding: 16px 22px 16px 4px; }
  .channels li:nth-child(even) .channel { padding-left: 22px; border-left: 3px solid var(--legend); }
  /* A single row (e.g., on the 404 page) spans the sign. */
  .channels li:only-child { grid-column: 1 / -1; }

  .services { grid-template-columns: 1fr 1fr; }
}

/* On wide screens the road runs across, above the videos: one column per video, up to three. */
@media (min-width: 880px) {
  .route {
    grid-template-columns: repeat(var(--count, 3), minmax(0, 1fr));
    gap: 26px;
    padding: 70px 0 0;
  }

  /* A single video shouldn't stretch across the whole page. */
  .route[data-count="1"] { max-width: 520px; }

  .route::before {
    left: -12px;
    right: -12px;
    top: 0;
    bottom: auto;
    width: auto;
    height: 46px;
    background:
      repeating-linear-gradient(to right, var(--center-line) 0 18px, transparent 18px 36px) center / 100% 4px no-repeat,
      var(--road-strip);
    border-inline: 0;
    border-block: 3px solid var(--fog-line);
  }

  .marker { left: 18px; top: -62px; }
  .marker .stem { height: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero::after { display: none; animation: none; }
}
