/* Landing-page-only styles (templates/pages/landing.html). Everything else on the page comes
   from base.html and the tokens in styles/styles.css; only the hero and the stage path,
   which no other page has, live here. Colours and fonts are the shared tokens
   (var(--color-*), var(--font-*)). */

/* The hero's sky is the exact colour of the hero image's top edge (--color-hero-sky), so the
   two join without a line. It is a little shorter than the screen, so the next section's
   ridgeline always shows below it, with a "See how it works" prompt over the picture. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: max(calc(100svh - 8rem), 34rem);
  color: var(--color-on-action);
  background: var(--color-hero-sky);
  overflow: hidden;
}

/* The image is a wide strip (3:1) along the bottom of the hero; the sky colour carries on
   above it, so the headline and buttons always sit on plain sky. */
.hero-art {
  position: absolute;
  inset: auto 0 0;
  height: 62%;
}
.hero-art img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center bottom;
}

.hero-copy {
  position: relative;
  flex: 1;
  padding-top: clamp(3rem, 11svh, 7.5rem);
  padding-bottom: clamp(9rem, 30svh, 28rem);
  text-align: center;
}
.hero h1 {
  font-size: var(--text-hero);
  font-weight: 500;
  line-height: var(--text-hero--line-height);
  letter-spacing: var(--text-hero--letter-spacing);
  text-wrap: balance;
}
.cursor {
  display: inline-block;
  width: 0.2em;
  height: 0.62em;
  margin-left: 0.1em;
  background: var(--color-gold);
  animation: blink 1.1s steps(1, end) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.hero :focus-visible {
  outline-color: var(--color-gold);
}

/* The arrow in "See how it works" hops down and back in steps, every couple of seconds. */
.scroll-cue-arrow {
  display: inline-flex;
  animation: hop 2.4s steps(1, end) infinite;
}
@keyframes hop {
  0%,
  70%,
  100% {
    translate: 0 0;
  }
  80% {
    translate: 0 3px;
  }
  90% {
    translate: 0 1px;
  }
}

/* ---- The extraction demo ----------------------------------------------------------------- */

/* Quoted sentences in the posting. Lit ones are gold, like everything that says "look here". */
.extract mark {
  background: transparent;
  color: inherit;
  transition:
    background-color 240ms steps(3, end),
    color 240ms steps(3, end);
}
.extract mark.lit,
.extract:not(.ready) mark {
  background: var(--color-gold-soft);
  color: var(--color-gold-ink);
  box-shadow: 0 0 0 2px var(--color-gold-soft);
}

/* The scan line steps down the posting to each sentence as it is read. */
.ex-scan {
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--color-gold);
  opacity: 0;
  pointer-events: none;
  transition: translate 360ms steps(6, end);
}
.extract.ready:not(.done) .ex-scan {
  opacity: 1;
}

/* Facts appear one by one, in steps. */
.extract.ready .ex-row,
.extract.ready .ex-chip {
  opacity: 0;
  translate: 0 4px;
  transition:
    opacity 180ms steps(3, end),
    translate 180ms steps(3, end);
}
.extract.ready .ex-row.shown,
.extract.ready .ex-chip.shown {
  opacity: 1;
  translate: 0 0;
}

/* ---- The stage path (Tracker demo) ------------------------------------------------------- */

.path {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
/* The dashed trail behind the stage blocks, through their middle. */
.path::before {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: calc(1.75rem - 2px);
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--color-edge) 0 8px, transparent 8px 16px);
}
.stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
  color: var(--color-ink-muted);
}
/* Each stage is a block holding its count, big enough to read on a wide screen. */
.stage-box {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  padding-bottom: 2px;
  background: var(--color-paper);
  color: var(--color-ink);
  /* The counts use the reading face, bold, because the pixel face's 1 and 2 are hard to read
     at this size. */
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  box-shadow:
    inset 0 0 0 4px var(--color-edge),
    0 0 0 4px var(--color-canvas);
  transition:
    background-color 120ms steps(3, end),
    box-shadow 120ms steps(3, end),
    translate 120ms steps(3, end);
}
.stage:hover .stage-box {
  box-shadow:
    inset 0 0 0 4px var(--color-gold),
    0 0 0 4px var(--color-canvas);
}
.stage[aria-pressed="true"] {
  color: var(--color-ink);
}
.stage[aria-pressed="true"] .stage-box {
  background: var(--color-gold);
  color: var(--color-on-gold);
  box-shadow:
    inset 0 -4px 0 var(--color-gold-lo),
    inset 0 4px 0 var(--color-gold-hi),
    0 0 0 4px var(--color-canvas);
  translate: 0 -4px;
}
/* Until a stage is picked, the blocks hop one after another, left to right, then rest: a
   clear "press one of these" wave rather than a jitter. Each hop is a quick lift and drop in
   steps, a third of a second apart. The picked block stays raised and doesn't hop. */
.path:not(.explored) .stage[aria-pressed="false"] .stage-box {
  /* The delay is set per block below through --hop-delay; the animation shorthand would
     otherwise reset it to zero and every block would hop at once. */
  animation: hop-wave 3.2s steps(1, end) var(--hop-delay, 0s) infinite;
}
.path .stage:nth-child(2) {
  --hop-delay: 0.35s;
}
.path .stage:nth-child(3) {
  --hop-delay: 0.7s;
}
.path .stage:nth-child(4) {
  --hop-delay: 1.05s;
}
.path .stage:nth-child(5) {
  --hop-delay: 1.4s;
}
@keyframes hop-wave {
  0% {
    translate: 0 -8px;
  }
  4% {
    translate: 0 -4px;
  }
  8% {
    translate: 0 0;
  }
  100% {
    translate: 0 0;
  }
}
/* Without JavaScript every stage is listed, so the hidden attribute is overruled. */
html:not(.js) .stage-group[hidden] {
  display: block;
}

@media (max-width: 34rem) {
  .stage-box {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.375rem;
  }
  .path::before {
    top: calc(1.375rem - 2px);
  }
}

/* "See how it works" and the nav's section links slide down instead of jumping. */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .cursor,
  .scroll-cue-arrow,
  .stage-box {
    animation: none !important;
  }
  .extract * {
    transition: none !important;
  }
}
