/* Composition: the gallery wall the game is played on. Colours are the app's (Shared/Colours.swift, Painting.swift).
   Every size comes from two scales. Space: 4 8 12 16 24 32 48 64 96 128 192. Type: 12 14 16 18 20 24 30 36 48 60. */

@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/assets/fonts/newsreader-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --wall: #ECEAE5;
  --ink: #171615;
  --quiet: #5C5853;          /* secondary text: 5.9:1 on the wall */
  --hairline: rgba(23, 22, 21, 0.14);
  --linen: #D7D0C2;
  --blue: #1F3D8B;
  --hung: 0 1px 2px rgba(23, 22, 21, 0.14), 0 12px 32px -8px rgba(23, 22, 21, 0.24);
  --serif: "Newsreader", ui-serif, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --gutter: 24px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wall: #171615;
    --ink: #EDE9E1;
    --quiet: #A6A097;          /* 7.4:1 on the dark wall */
    --hairline: rgba(237, 233, 225, 0.16);
    --hung: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 40px -8px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
h1, h2 {
  margin: 0;
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }

/* The wordmark is the master SVG, painted in the current ink so it follows dark mode. */
.wordmark {
  display: block;
  width: 144px;
  aspect-ratio: 3048 / 512;
  background: currentColor;
  -webkit-mask: url("/assets/img/wordmark.svg") center / contain no-repeat;
  mask: url("/assets/img/wordmark.svg") center / contain no-repeat;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  margin-top: env(safe-area-inset-top);
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
}
/* Apple's badge, unaltered, never under 40 px tall. */
.badge { display: inline-block; line-height: 0; border-radius: 8px; }
.badge img { height: 48px; width: auto; }
.badge-small img { height: 40px; }

/* MARK: The first level */

.hero {
  display: grid;
  justify-items: center;
  gap: 24px;
  padding: 8px var(--gutter) 0;
  /* The canvas keeps the app's proportions (32 by 52 cells), and the first screen keeps room for its placard. */
  --board-w: clamp(256px, min(100vw - 2 * var(--gutter), (100svh - 288px) * 32 / 52), 420px);
}
.hero-words { display: grid; justify-items: center; gap: 8px; text-align: center; }
.hero h1 { max-width: 15em; font-size: 30px; line-height: 1.1; }
.hero-more { font-size: 16px; color: var(--quiet); }
.get-wide { display: none; }
.hero-play { display: grid; gap: 16px; width: var(--board-w); }

.board {
  position: relative;
  width: var(--board-w);
  aspect-ratio: 32 / 52;
  background: var(--linen);
  box-shadow: var(--hung);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.board.finished { touch-action: auto; }
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* The placard under the canvas, as in the app: the painting's name on the left, how it's going on the right. */
.placard { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.placard-title { font: 600 20px/1.2 var(--serif); }
.placard-title i { display: block; margin-top: 4px; font-weight: 400; font-size: 18px; }
.placard-line { margin-top: 4px; font-size: 14px; line-height: 1.4; color: var(--quiet); text-wrap: balance; }
.placard-marks { display: flex; align-items: center; gap: 12px; flex: none; }

/* Spare lines, one stroke each: a lost one is broken. The game's mark for a line you can lose. */
.spare { display: flex; gap: 4px; height: 24px; }
.spare i { display: block; width: 4px; height: 100%; border-radius: 2px; background: var(--ink); }
.spare i.lost { background: linear-gradient(var(--ink) 0 36%, transparent 36% 64%, var(--ink) 64%); opacity: 0.4; }

.ring { width: 40px; height: 40px; }
.ring circle { fill: none; stroke-width: 3; }
.ring-track { stroke: var(--hairline); }
.ring-fill { stroke: var(--ink); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dasharray 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring-number { font: 600 12px var(--sans); fill: var(--ink); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }

/* After a round: what to do with this painting, then, set apart, what the app adds. */
.after { display: grid; gap: 32px; animation: arrive 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.after-actions { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: -8px; }
.next { display: grid; justify-items: start; gap: 16px; }
.next p { font-size: 16px; line-height: 1.5; text-wrap: pretty; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }

/* Quiet actions: words with a mark, the way the app's toolbar reads. The touch target is 44 px tall. */
.action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.action svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.action:active { opacity: 0.6; }

/* MARK: The daily board */

/* The clock, as in the app: grey until the first line starts it. */
.clock { font: 600 20px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.clock.idle { color: var(--quiet); }

/* After a round: the race's words, large like the app's finish, then the quiet detail. */
.result { display: grid; gap: 4px; margin-top: -8px; }
.result-big { font: 500 30px/1.1 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.result-small { font-size: 16px; color: var(--quiet); font-variant-numeric: tabular-nums; }

/* Today's tries as small blank canvases, in the canvas's own proportions: a fresh one is linen, a spent one its outline. */
.tries { display: inline-flex; gap: 4px; }
.tries i { display: block; width: 8px; height: 13px; border: 1.2px solid var(--ink); opacity: 0.35; }
.tries i.left { background: var(--linen); opacity: 1; }
a.action { text-decoration: none; }
.next-board { margin-top: -16px; font-size: 16px; color: var(--quiet); font-variant-numeric: tabular-nums; }

/* MARK: Features */

main > section + section { margin-top: 128px; }
.feature, .gallery, .plain, .last { padding: 0 var(--gutter); }
.feature { display: grid; justify-items: center; gap: 48px; }
.feature-words { width: 100%; max-width: 34em; }
.feature h2, .gallery h2 { font-size: 24px; line-height: 1.2; margin-bottom: 12px; }
.feature p, .gallery p { color: var(--quiet); }

.hung { margin: 0; display: grid; gap: 16px; width: min(256px, 72vw); }
.still { display: block; width: 100%; aspect-ratio: 32 / 52; background: var(--linen); box-shadow: var(--hung); }
.label { display: grid; gap: 4px; }
.label-title { font: 600 20px/1.2 var(--serif); }
.label-name { font: italic 400 18px/1.3 var(--serif); color: var(--ink); }
.label-facts { font-size: 14px; line-height: 1.4; color: var(--quiet); font-variant-numeric: tabular-nums; }

.device { width: min(256px, 72vw); filter: drop-shadow(0 16px 32px rgba(23, 22, 21, 0.18)); }

.gallery { display: grid; gap: 32px; }
/* The wall scrolls sideways on a phone, one painting at a time, edge to edge. */
.wall {
  list-style: none;
  margin: 0 calc(-1 * var(--gutter));
  padding: 8px var(--gutter) 24px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(224px, 64vw);
  gap: 32px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: none;
}
.wall::-webkit-scrollbar { display: none; }
.wall li { scroll-snap-align: start; display: grid; gap: 16px; align-content: start; }

.plain p { max-width: 20em; margin: 0 auto; text-align: center; font: 400 24px/1.35 var(--serif); text-wrap: balance; }

.last { display: grid; justify-items: center; text-align: center; }
.icon { width: 96px; height: 96px; margin-bottom: 24px; }
.last h2 { line-height: 0; }
.wordmark-large { width: 192px; }
.hidden-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.last p { color: var(--quiet); margin: 12px 0 24px; }

.foot {
  margin-top: 128px;
  padding: 32px var(--gutter) max(32px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  display: grid;
  gap: 12px;
  font-size: 14px;
  color: var(--quiet);
}
.foot nav { display: flex; gap: 24px; }
.foot nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.foot nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.foot .legal { font-size: 12px; }

/* MARK: Wider screens: words beside the work */

@media (min-width: 900px) {
  :root { --gutter: 48px; }
  .wordmark { width: 168px; }
  .top { height: 96px; max-width: 1200px; margin-left: auto; margin-right: auto; }
  .top .badge-small { visibility: hidden; }

  .hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 96px;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 0;
    --board-w: clamp(320px, (100svh - 256px) * 32 / 52, 440px);
  }
  .hero-words { justify-self: start; justify-items: start; gap: 24px; text-align: left; }
  .hero h1 { font-size: 60px; line-height: 1.05; max-width: 9em; }
  .hero-more { font-size: 18px; }
  .get-wide { display: flex; align-items: center; gap: 32px; margin-top: 24px; }
  .scan { display: flex; align-items: center; gap: 16px; margin: 0; color: var(--ink); }
  .scan .qr { width: 96px; height: 96px; }
  .scan figcaption { max-width: 8em; font-size: 14px; line-height: 1.4; color: var(--quiet); }
  /* On a computer the badge and the code already sit beside the canvas. */
  .next .badge { display: none; }

  main > section + section { margin-top: 192px; }
  .feature {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 96px;
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
  }
  .feature-flip .feature-words { order: 2; }
  .feature h2, .gallery h2 { font-size: 48px; line-height: 1.05; margin-bottom: 16px; }
  .feature p, .gallery p { font-size: 18px; }
  .hung, .device { width: 288px; }

  .gallery { max-width: 1200px; margin-left: auto; margin-right: auto; gap: 64px; }
  .gallery .feature-words { justify-self: center; text-align: center; max-width: 36em; }
  .wall {
    margin: 0;
    padding: 0;
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 64px 48px;
    overflow: visible;
  }
  .plain p { font-size: 36px; }
  .foot { max-width: 1200px; margin-left: auto; margin-right: auto; grid-template-columns: 1fr auto; align-items: center; }
  .foot nav { order: 2; }
  .foot .legal { grid-column: 1 / -1; }
}

@media (prefers-color-scheme: dark) {
  .device { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .after { animation: none; }
  .ring-fill { transition: none; }
}

/* MARK: Text pages */

.page { max-width: 40em; margin: 0 auto; padding: 32px var(--gutter) 0; }
.page h1 { font-size: 36px; line-height: 1.1; margin-bottom: 16px; }
.page .when { color: var(--quiet); font-size: 14px; margin: -8px 0 32px; }
.page .lead { font: 400 20px/1.45 var(--serif); margin-bottom: 32px; }
.page h2 { font-size: 24px; line-height: 1.2; margin: 48px 0 12px; }
.page p, .page li { margin: 0 0 16px; }
.page ul { padding-left: 20px; }
.page a { text-underline-offset: 3px; }
.page dl { margin: 0; }
.page dt { font-weight: 600; margin-top: 24px; }
.page dt:first-child { margin-top: 0; }
.page dd { margin: 4px 0 0; color: var(--quiet); }
.press-files { margin-bottom: 32px; }
.press-shots { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 16px; }
.press-shots img { border-radius: 8px; }
@media (min-width: 900px) {
  .page { padding-top: 64px; }
  .page h1 { font-size: 48px; }
  .page p, .page li, .page dd { font-size: 18px; }
}
.play-today { margin-top: 16px; }
/* The daily board's page. On a phone the canvas is framed by two rows exactly its width: its label above (the number
   and the date, on one baseline, like a work's label on a wall) and its placard below. On a computer the words column
   holds the same label at headline size. */
.daily { gap: 16px; --board-w: clamp(256px, min(100vw - 2 * var(--gutter), (100svh - 256px) * 32 / 52), 420px); }
.daily .hero-words { width: var(--board-w); justify-items: stretch; gap: 8px; text-align: left; }
.board-label { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.board-label h1 { font: 600 20px/1.2 var(--serif); letter-spacing: 0; }
.board-date { font-size: 14px; line-height: 1.4; color: var(--quiet); white-space: nowrap; }
.board-note { font-size: 14px; line-height: 1.4; color: var(--quiet); text-wrap: pretty; }

/* The clock with the time it races beneath it, quieter than the clock: the number carries the weight and the words
   fold in after it, as "12 left" does. */
.race { display: grid; justify-items: end; gap: 4px; }
.to-beat { font-size: 14px; line-height: 1; color: var(--quiet); font-variant-numeric: tabular-nums; white-space: nowrap; }
.to-beat b { font-weight: 600; }

@media (min-width: 900px) {
  .daily { gap: 96px; --board-w: clamp(320px, (100svh - 256px) * 32 / 52, 440px); }
  .daily .hero-words { width: auto; justify-items: start; gap: 24px; }
  .board-label { display: grid; justify-content: start; gap: 8px; }
  .board-label h1 { font: 500 60px/1.05 var(--serif); letter-spacing: -0.01em; }
  .board-date { font-size: 18px; }
  .board-note { font-size: 16px; max-width: 24em; }
}
