/* The landing page. Loaded after site.css, which supplies the colour tokens, the
   fonts and the base resets, and after Scaling's styles.css, which supplies the
   dot classes (.dot.read and friends) and the cells and wires (.node .box,
   .node .title, .gauge, .wire-line).

   Every rule here starts with .landing so that nothing leaks into a game page
   and nothing in those stylesheets outranks it.

   The look is Blueprint (site.css, "tokens: Blueprint"): light graph paper,
   navy ink, sections drawn as dashed sheets with corner marks, one blue for
   actions, mint and lime as highlighter. Colour otherwise means a kind of
   request, a level, or a state. */

/* ---- base ---- */

body.landing {
  /* styles.css makes body a full-height flex column for the game */
  display: block;
  height: auto;
  min-height: 100%;
  font: 16px/1.65 var(--font-sans);
  color: var(--ink-2);
  -webkit-text-size-adjust: 100%;
  /* graph paper: a fine 24px grid under a heavier one every 96px */
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid-fine) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-fine) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  background-position: -1px -1px;
}

/* styles.css lays <main> out as the game's three columns, and on narrow screens
   makes it scroll on its own. Here it is an ordinary block. */
.landing main {
  display: block;
  min-height: 0;
  overflow: visible;
}

.landing h1,
.landing h2,
.landing h3,
.landing h4,
.landing p,
.landing ul,
.landing ol,
.landing dl,
.landing dt,
.landing dd,
.landing figure {
  margin: 0;
}

.landing ul,
.landing ol {
  padding: 0;
  list-style: none;
}

/* site.css turns every h2 and h3 into a small grey capital label */
.landing h2,
.landing .sec-head h1 {
  font: 600 40px/1.1 var(--font-sans);
  font-size: clamp(30px, 3.6vw, 44px);
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--ink);
}

.landing h3 {
  font: 600 19px/1.3 var(--font-sans);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}

.landing a {
  color: inherit;
}

.landing a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.landing .wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* a highlighter stroke across the lower half of the words */
.landing .hl {
  background: linear-gradient(transparent 58%, var(--mint) 58%, var(--mint) 94%, transparent 94%);
}

.landing h2 .hl {
  background: linear-gradient(transparent 58%, var(--lime) 58%, var(--lime) 94%, transparent 94%);
}

/* the small monospace label above a heading, with its section's number */
.landing .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 12.5px/1.4 var(--font-mono);
  letter-spacing: 0.02em;
  color: var(--accent-text);
}

.landing .eyebrow b {
  padding: 1px 6px;
  font-weight: 500;
  color: var(--accent-ink);
  background: var(--accent);
}

/* a small word naming an area */
.landing .tag {
  font: 500 12px/1.4 var(--font-mono);
  color: var(--muted);
}

/* the icons on buttons and links: Lucide's, and the LinkedIn and X marks from
   Simple Icons, drawn in the words' colour */
.landing .btn-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

/* a link inside a sentence */
.landing .inline-link {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.landing .inline-link:hover {
  background: var(--lime);
}

.landing .start-link {
  text-decoration: none;
}

.landing .start-link:hover mark {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- a sheet: a dashed frame with a mark at each corner ---- */

.landing .frame {
  position: relative;
  border: 1px dashed var(--dash);
  background: color-mix(in srgb, var(--panel) 60%, transparent);
}

.landing .frame > .tk {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.landing .frame::before,
.landing .frame::after,
.landing .frame > .tk::before,
.landing .frame > .tk::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  border: 0 solid var(--ink);
}

.landing .frame::before {
  top: -5px;
  left: -5px;
  border-width: 1px 0 0 1px;
}

.landing .frame::after {
  top: -5px;
  right: -5px;
  border-width: 1px 1px 0 0;
}

.landing .frame > .tk::before {
  bottom: -5px;
  left: -5px;
  border-width: 0 0 1px 1px;
}

.landing .frame > .tk::after {
  bottom: -5px;
  right: -5px;
  border-width: 0 1px 1px 0;
}

/* ---- top bar ---- */

.landing .site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px dashed var(--dash);
}

.landing .site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 24px;
  min-height: 62px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.landing .wordmark {
  margin-right: auto;
  font: 600 17px/1.4 var(--font-mono);
  color: var(--ink);
  text-decoration: none;
}

.landing .site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font: 13.5px/1.4 var(--font-mono);
}

.landing .site-nav a {
  display: inline-block;
  padding: 6px 10px;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color 0.12s;
}

.landing .site-nav a:hover {
  color: var(--ink);
  background: var(--lime);
}

.landing .site-nav .nav-signin {
  margin-left: 6px;
  border: 1px solid var(--ink);
  color: var(--ink);
}

/* ---- hero: one sheet, the words on the left and Fig. 1 on the right ---- */

.landing .hero {
  padding: 64px 0 40px;
}

.landing .hero-sheet {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.landing .hero-copy {
  min-width: 0;
  padding: 48px 44px;
  border-right: 1px dashed var(--dash);
}

.landing .hero h1 {
  margin: 20px 0 22px;
  font: 600 64px/1.04 var(--font-sans);
  font-size: clamp(42px, 5.4vw, 72px);
  letter-spacing: -0.035em;
  color: var(--ink);
}

.landing .lede {
  max-width: 52ch;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
}

.landing .hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.landing .cta,
.landing .cta-quiet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  font: 500 14px/1.4 var(--font-mono);
  text-decoration: none;
  border: 1px solid var(--ink);
  transition: background-color 0.12s, border-color 0.12s;
}

.landing .cta {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.landing .cta:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.landing .cta-quiet {
  color: var(--ink);
  background: var(--panel);
}

.landing .cta-quiet:hover {
  background: var(--lime);
}

.landing .hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 24px;
}

.landing .hero-facts li {
  padding: 3px 9px;
  font: 12.5px/1.5 var(--font-mono);
  color: var(--ink-2);
  background: var(--panel);
  border: 1px solid var(--line);
}

.landing .start {
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--ink-2);
}

.landing .start mark {
  padding: 0 3px;
  color: var(--ink);
  background: var(--lime);
}

/* Fig. 1: the game's own picture of a solved stage, with notes under it */
.landing .fig {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  padding: 28px 28px 24px;
}

.landing .fig-head,
.landing .fig-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font: 12px/1.5 var(--font-mono);
  color: var(--muted);
}

.landing .demo {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--ink);
}

.landing .demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 9px 14px;
  font: 12.5px/1.5 var(--font-mono);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.landing .demo-crumb b {
  font-weight: 600;
  color: var(--ink);
}

/* the stage's state, as the game shows it when a stage clears */
.landing .demo-state {
  margin-left: 8px;
  padding: 0 7px;
  font-size: 11.5px;
  color: var(--mint-ink);
  background: var(--mint);
}

.landing .demo-legend {
  display: flex;
  gap: 12px;
}

.landing .demo-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.landing .demo-legend .dot {
  width: 8px;
  height: 8px;
}

/* the same dotted field the game is played on, in the beginner level's tint */
.landing .demo-art {
  display: block;
  width: 100%;
  height: auto;
  background-color: color-mix(in srgb, var(--level) var(--tint), var(--panel));
  background-image: radial-gradient(color-mix(in srgb, var(--level) 12%, var(--line-strong)) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: 12px 12px;
  border-top: 2px solid var(--level);
}

.landing .notes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.landing .notes li {
  padding-top: 8px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
  border-top: 1px solid var(--ink);
}

.landing .notes b {
  display: block;
  margin-bottom: 2px;
  font: 500 11.5px/1.5 var(--font-mono);
  color: var(--accent-text);
}

.landing .part-labels text {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--muted);
  text-anchor: middle;
}

.landing .part-labels text.is-bad {
  fill: var(--bad-text);
}

/* the standing picture replaces the moving one when motion is turned off */
.landing .still {
  display: none;
}

/* ---- sections: each a sheet, its heading beside its introduction ---- */

.landing .sec {
  padding: 40px 0;
  /* the top bar stays put, so a link to a section must stop short of it */
  scroll-margin-top: 64px;
}

.landing .sheet {
  padding: 48px 44px;
}

.landing .sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px;
  align-items: end;
  margin-bottom: 40px;
}

.landing .sec h2,
.landing .sec-head h1 {
  margin-top: 14px;
}

.landing .sec-intro {
  font-size: 16.5px;
  color: var(--ink-2);
}

/* ---- why taste: three columns joined into one ruled table ---- */

.landing .steps.taste {
  gap: 0;
  margin-top: 0;
  background: var(--panel);
  border: 1px solid var(--ink);
}

.landing .steps.taste li {
  display: flex;
  flex-direction: column;
  padding: 24px 26px;
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
}

.landing .steps.taste li:last-child {
  border-right: 0;
}

.landing .steps.taste h3 {
  margin-top: 0;
}

/* Lucide's split, scale and user-check, one above each heading */
.landing .taste-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 12px;
  color: var(--accent-text);
}

.landing .taste-games {
  align-self: flex-start;
  margin-top: auto;
  padding: 1px 5px;
  font: 12px/1.5 var(--font-mono);
  color: var(--mint-ink);
  background: var(--mint);
}

.landing .steps.taste h3 + p {
  margin-bottom: 16px;
}

/* ---- the games: one spec sheet each ---- */

.landing .game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* the landing page's list scrolls; src/landing.js sets its height from data-rows,
   and this holds until then */
.landing .game-grid[data-rows] {
  max-height: 900px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-gutter: stable;
}

.landing .game-grid:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.landing .more-games {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--dash);
}

.landing .more-games p {
  margin: 0;
  color: var(--ink-2);
}

/* the card's words on the left, the ideas it teaches on the right, the levels
   and Play along the bottom */
.landing .game {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    'head head'
    'title ideas'
    'text ideas'
    'levels play';
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--ink);
  scroll-margin-top: 80px;
}

.landing .game-head {
  grid-area: head;
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  font: 12px/1.5 var(--font-mono);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.landing .game h3 {
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 0;
  font-size: 24px;
  letter-spacing: -0.02em;
  border-right: 1px dashed var(--dash);
}

/* Lucide icons, one a game, picked for what the game is about */
.landing .game-icon {
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--accent-text);
}

.landing .game > p {
  grid-area: text;
  padding: 6px 20px 18px;
  font-size: 14.5px;
  color: var(--ink-2);
  border-right: 1px dashed var(--dash);
}

.landing .ideas {
  grid-area: ideas;
  padding: 18px;
}

.landing .ideas p {
  margin-bottom: 6px;
  font: 500 11.5px/1.5 var(--font-mono);
  color: var(--accent-text);
}

.landing .ideas li {
  padding: 3px 0;
  font: 12.5px/1.5 var(--font-mono);
  color: var(--ink-2);
  border-bottom: 1px dotted var(--line-strong);
}

.landing .ideas:has(ul:empty) p {
  visibility: hidden;
}

/* each level is a cell in the bottom row, marked with its play area's colour */
.landing .game-levels {
  grid-area: levels;
  display: flex;
  border-top: 1px solid var(--ink);
}

.landing .game-levels li {
  flex: 1;
}

.landing .lv-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 4px;
  font: 500 12.5px/1.4 var(--font-mono);
  text-decoration: none;
  color: var(--ink-2);
  border-right: 1px solid var(--line);
  transition: background-color 0.12s;
}

.landing .lv-link::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--level);
}

.landing .lv-link:hover {
  color: var(--ink);
  background: var(--lime);
}

.landing .play {
  grid-area: play;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  font: 500 13px/1.4 var(--font-mono);
  white-space: nowrap;
  text-decoration: none;
  color: var(--accent-ink);
  background: var(--accent);
  border-top: 1px solid var(--ink);
  transition: background-color 0.12s;
}

.landing .play:hover {
  background: var(--accent-hover);
}

/* ---- one stage, in three figures ---- */

.landing .steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.landing .steps li {
  min-width: 0;
  padding: 16px 18px 20px;
  background: var(--panel);
  border: 1px solid var(--ink);
}

.landing .step-art {
  display: block;
  width: 100%;
  height: auto;
  margin: 10px 0 14px;
  padding: 8px;
  background: var(--sunken);
  border: 1px dashed var(--dash);
}

/* the cells are drawn at 0.6 of their size, so their lines are made heavier to
   come out as fine as the game's */
.landing .step-art .box,
.landing .step-art .wire-line {
  stroke-width: 1.25;
}

.landing .is-losing .box {
  stroke: var(--bad);
  stroke-width: 1.6;
}

.landing .is-losing .lamp {
  fill: var(--bad);
}

/* a picture, not the game: nothing to drag */
.landing .node {
  cursor: auto;
}

.landing .lost {
  fill: none;
  stroke: var(--bad);
  stroke-width: 2;
  stroke-linecap: round;
}

.landing .step-num {
  font: 12.5px/1.5 var(--font-mono);
  color: var(--accent-text);
}

.landing .steps h3 {
  margin-top: 4px;
}

.landing .steps h3 + p {
  margin-top: 6px;
  font-size: 15px;
  color: var(--ink-2);
}

.landing .lesson {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 20px;
  background: var(--panel);
  border: 1px solid var(--ink);
}

.landing .lesson .eyebrow {
  padding: 16px 18px;
  color: var(--ink);
  background: var(--lime);
  border-right: 1px solid var(--line);
}

.landing .lesson .eyebrow + p {
  padding: 16px 20px;
  font-size: 16px;
}

.landing .lesson b {
  color: var(--ink);
}

/* ---- foot: the brand, three columns of links, and a base line ---- */

.landing .foot {
  margin-top: 56px;
  background: var(--panel);
  border-top: 1px solid var(--ink);
}

.landing .foot .wrap {
  padding-top: 48px;
  padding-bottom: 28px;
}

.landing .foot-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
  padding-bottom: 40px;
}

.landing .foot-brand p {
  max-width: 34ch;
  margin: 0;
  color: var(--ink-2);
}

.landing .foot-mark {
  font: 600 19px/1.4 var(--font-mono);
  color: var(--ink);
  text-decoration: none;
}

.landing .foot-brand .foot-line {
  margin: 6px 0 14px;
  font: 600 15px/1.4 var(--font-sans);
  color: var(--ink);
}

.landing .foot-line::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  margin-top: 10px;
  background: var(--accent);
}

.landing .foot-col h2 {
  margin: 0 0 14px;
  font: 600 12px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.landing .foot-col ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.landing .foot-col a {
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}

.landing .foot-col a:hover,
.landing .foot-base a:hover {
  background: var(--lime);
}

.landing .foot-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  border-top: 1px dashed var(--dash);
  font: 12.5px/1.5 var(--font-mono);
  color: var(--muted);
}

.landing .foot-base p {
  margin: 0;
}

.landing .foot-base a {
  color: var(--ink-2);
  text-underline-offset: 3px;
}

@media (max-width: 760px) {
  .landing .foot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }

  .landing .foot-brand {
    grid-column: 1 / -1;
  }
}

/* ---- the privacy and terms pages: one sheet of plain reading ---- */

.landing .legal .sheet {
  max-width: 820px;
}

.landing .legal h1 {
  margin: 14px 0 16px;
  font: 600 48px/1.08 var(--font-sans);
  font-size: clamp(36px, 5vw, 56px);
  letter-spacing: -0.035em;
  color: var(--ink);
}

.landing .legal h2 {
  margin: 36px 0 10px;
  font-size: 22px;
  letter-spacing: -0.015em;
}

.landing .legal p + p,
.landing .legal ul + p {
  margin-top: 12px;
}

.landing .legal ul {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  list-style: square;
}

.landing .legal li::marker {
  color: var(--accent-text);
}

.landing .legal b {
  color: var(--ink);
}

/* the switch that stops or restarts recording in this browser */
.landing .consent {
  display: grid;
  gap: 8px;
  justify-items: start;
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--ink);
}

.landing .consent p {
  margin: 0;
}

.landing .consent-id {
  font: 12.5px/1.5 var(--font-mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.landing .consent button {
  border-color: var(--ink);
}

/* ---- narrower screens ---- */

/* the hero becomes one column, with Fig. 1 under the words, and one game a row */
@media (max-width: 1000px) {
  .landing .hero-sheet {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing .hero-copy {
    border-right: 0;
    border-bottom: 1px dashed var(--dash);
  }

  .landing .game-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .landing .wrap {
    padding: 0 14px;
  }

  /* too tall to keep on screen once it wraps */
  .landing .site-head {
    position: static;
  }

  .landing .hero {
    padding: 28px 0 20px;
  }

  .landing .hero-copy,
  .landing .sheet {
    padding: 28px 18px;
  }

  .landing .fig {
    padding: 20px 14px;
  }

  .landing .notes,
  .landing .sec-head,
  .landing .steps,
  .landing .steps.taste {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing .sec-head {
    gap: 12px;
  }

  .landing .steps.taste li {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .landing .steps.taste li:last-child {
    border-bottom: 0;
  }

  .landing .sec,
  .landing .game {
    scroll-margin-top: 12px;
  }

  .landing .lede,
  .landing .sec-intro {
    font-size: 16px;
  }

  /* one column: the words, the ideas, the levels, then Play */
  .landing .game {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: 'head' 'title' 'text' 'ideas' 'levels' 'play';
  }

  .landing .game h3,
  .landing .game > p {
    border-right: 0;
  }

  .landing .ideas {
    padding-top: 0;
  }

  .landing .lesson {
    grid-template-columns: minmax(0, 1fr);
  }

  .landing .lesson .eyebrow {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* ---- motion ---- */

@media (prefers-reduced-motion: reduce) {
  .landing .flow {
    display: none;
  }

  .landing .still {
    display: inline;
  }

  .landing .cta,
  .landing .cta-quiet,
  .landing .play,
  .landing .lv-link,
  .landing .site-nav a {
    transition: none;
  }
}
