/* Just So Games. Values come from brand/tokens.json; the brand book is brand/README.md.
   Paper and ink, one marigold full stop per screen, Archivo Expanded for headlines only. */

@font-face {
  font-family: "Archivo Expanded";
  src: url("/assets/fonts/ArchivoExpanded-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/Archivo-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #FFFFFF;
  --surface: #F1F2F4;
  --ink: #15171C;
  --muted: #585D68;
  --line: #DCDFE4;
  --line-strong: #80868F;
  --marigold: #FFC21A;
  --on-marigold: #15171C;
  --focus: #15171C;
  --piece-blue: #2D54EE;
  --on-piece: #FFFFFF;
  --device: #15171C; /* the phone outline stays dark in both themes */
  /* A game card's colour window is a big fill: it keeps the game's light piece colour in both themes.
     The dark piece values are for marks and text on dark paper, not for large areas. */
  --box-blue: #2D54EE;  /* piece-blue, Exact Path */
  --box-coral: #C73A1A; /* piece-coral, Level */
  --box-teal: #0B7F77;  /* piece-teal, Roll */
  --shadow-lift: 0 1px 2px rgba(21, 23, 28, 0.08), 0 12px 32px rgba(21, 23, 28, 0.08);

  --font-display: "Archivo Expanded", "Archivo", system-ui, sans-serif;
  --font-text: "Archivo", system-ui, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  --radius-s: 6px;
  --radius-m: 14px;
  --radius-full: 999px;

  --gutter: var(--space-4);
  --section: var(--space-16);
  --max: 1080px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101114;
    --surface: #1B1D22;
    --ink: #F2F3F5;
    --muted: #A3A8B2;
    --line: #2C2F36;
    --line-strong: #6B717C;
    --focus: #FFC21A;
    --piece-blue: #7B92FF;
    --on-piece: #101114;
    --shadow-lift: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

@media (min-width: 760px) {
  .menu { gap: var(--space-6); }
}

@media (min-width: 760px) {
  :root {
    --gutter: var(--space-8);
    --section: var(--space-24);
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

h1, h2, h3, p, ul, ol { margin: 0; }

/* Links: ink text, a 2px marigold underline that thickens on hover. */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--marigold);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
a:hover { text-decoration-thickness: 4px; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: var(--space-2) var(--space-3);
  background: var(--paper);
  border: 2px solid var(--focus);
  border-radius: var(--radius-s);
  font-weight: 600;
  text-decoration: none;
  z-index: 10;
}
.skip:focus { top: var(--space-2); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Type, from the tokens' styles. */
.display-xl {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 10.6vw, 72px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.display-l {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(34px, 7vw, 48px);
  line-height: 1;
  letter-spacing: -0.03em;
}
.display-m {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.display-s {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.lead { font-size: 20px; line-height: 1.45; max-width: 34em; text-wrap: pretty; }
.small { font-size: 14px; line-height: 1.45; color: var(--muted); }
.label { font-size: 15px; line-height: 1.2; font-weight: 600; letter-spacing: 0.005em; }
strong, b { font-weight: 600; }

/* The marigold full stop, drawn as a tile sitting on the baseline. */
.stop {
  display: inline-block;
  width: 0.42em;
  height: 0.35em;
  margin-left: 0.06em;
  background: var(--marigold);
  vertical-align: baseline;
}

/* Header */
.top {
  padding-block: var(--space-6);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.brand {
  display: block;
  flex: none;
  text-decoration: none;
}
.brand img { width: 134px; height: auto; }
.menu {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
}
.menu a {
  font-size: 15px;
  white-space: nowrap;
  font-weight: 600;
  text-decoration-color: transparent;
}
.menu a:hover,
.menu a[aria-current="page"] { text-decoration-color: var(--marigold); }

/* Home: the headline and how-to on the left, the puzzle beside them from the top. */
.hero {
  padding-block: var(--space-12) var(--section);
}
.hero h1 { max-width: 15ch; }
.hero-body {
  display: grid;
  gap: var(--space-12);
  align-items: center;
}
@media (min-width: 900px) {
  .hero-body {
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: var(--space-16);
  }
  /* Two columns leave the headline about 560px; size it to fit three lines there. */
  .hero h1 { font-size: clamp(48px, 5.2vw, 64px); }
}
.hero-copy {
  display: grid;
  gap: var(--space-6);
  align-content: start;
  min-width: 0;
}
.hero-copy h1 { margin-bottom: var(--space-2); }
.hero-copy .lead { color: var(--ink); }

/* The three games in a row under the headline, linking down to their cards. */
.lineup {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3);
  border: 2px solid var(--line);
  border-radius: var(--radius-m);
  text-decoration: none;
}
.lineup:hover { border-color: var(--line-strong); }
.lineup-icons { display: flex; flex: none; }
.lineup-icons img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 0 0 3px var(--paper);
}
.lineup-icons img + img { margin-left: -10px; }
.lineup-text { display: grid; gap: 2px; min-width: 0; }

.how {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.4;
}
.how li {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: var(--space-3);
  align-items: baseline;
}
.how .glyph {
  width: 12px;
  height: 12px;
  align-self: center;
}
.glyph-bead { border-radius: var(--radius-full); background: var(--piece-blue); }
.glyph-ring { border-radius: var(--radius-full); border: 3px solid var(--piece-blue); }
.glyph-tile { border-radius: 3px; border: 2px solid var(--line-strong); }

/* The playable Exact Path board. The one raised object on the page. */
.demo {
  background: var(--surface);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-lift);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}
.demo-top {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.demo-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-4);
}
.demo-head .small { margin-bottom: var(--space-1); }
.demo-num {
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.demo-sum { text-align: right; }
.demo-sum .demo-num { color: var(--piece-blue); }
.demo[data-state="miss"] .demo-sum .demo-num { color: var(--ink); }

.meter {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--line);
  overflow: hidden;
}
.meter span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--piece-blue);
  transition: width 160ms ease-out;
}
.demo[data-state="miss"] .meter span { background: var(--ink); }

.demo-status {
  min-height: 1.55em;
  font-weight: 600;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border-radius: var(--radius-m);
}
.board:focus-visible { outline-offset: 4px; }
.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-m);
  background: var(--paper);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: clamp(20px, 5.4vw, 26px);
  font-variant-numeric: tabular-nums;
}
.face {
  position: relative;
  z-index: 1;
  width: 72%;
  aspect-ratio: 1;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  transition: transform 140ms cubic-bezier(.2, .9, .3, 1);
}
.cell.end .face { box-shadow: inset 0 0 0 3px var(--piece-blue); }
.cell.on .face,
.cell.start .face {
  background: var(--piece-blue);
  color: var(--on-piece);
  box-shadow: none;
}
.cell.pop .face { transform: scale(1.14); }
.lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.lines polyline {
  fill: none;
  stroke: var(--piece-blue);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.demo[data-state="won"] .cell.on { background: var(--paper); }
.demo[data-state="won"] .demo-status { color: var(--ink); }

.demo-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.demo-foot .small { min-width: 0; }

.btn {
  flex: none;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-m);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  transition: transform 100ms ease-out;
}
.btn:active { transform: scale(0.97); }
.btn:hover { border-color: var(--ink); }

/* Sections */
.section { padding-block: 0 var(--section); }
.section-head {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.section-head p { max-width: 34em; color: var(--muted); }

/* Each game as a card: a window of its own colour with a real 9:41 screen rising out of the
   bottom edge, then its name, rule and facts on surface. Three across on wide screens. */
.shelf {
  display: grid;
  gap: var(--space-6);
}
@media (min-width: 900px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.game {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
  border-radius: var(--radius-m);
  overflow: hidden;
  min-width: 0;
}
.game-art {
  --box-fill: var(--box-blue);
  background: var(--box-fill);
  height: 300px;
  padding-top: var(--space-8);
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.game-art .device {
  --dw: 220px;
  padding-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  align-self: flex-start;
}
.game-art .screen { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.game-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.game-id {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.game-id .display-m { font-size: clamp(26px, 2.7vw, 32px); }
.game-id img {
  width: 56px;
  height: 56px;
  border-radius: 13px;
  flex: none;
}
.game-rule {
  font-weight: 600;
  text-wrap: pretty;
}
.game-facts {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}
.game-facts li {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: var(--space-2);
  align-items: baseline;
}
.game-facts li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--line-strong);
  transform: translateY(-2px);
}
.chip {
  align-self: flex-start;
  display: inline-block;
  margin-top: auto;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 2px solid var(--line-strong);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

/* The phone: Claimable's store frame (claimable marketing/app-store/claimable/frame.mjs), scaled
   from its 1150px body by --dw. A thin bezel, the Dynamic Island floating over the screen, and a
   9:41 status bar with signal, wifi and an outlined battery. */
.device {
  --dw: 260px;
  justify-self: center;
  width: 100%;
  max-width: var(--dw);
  padding: calc(var(--dw) * 0.0243);
  border-radius: calc(var(--dw) * 0.15);
  background: var(--device);
  box-shadow: 0 calc(var(--dw) * 0.052) calc(var(--dw) * 0.14) rgba(6, 8, 12, 0.32),
              inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.screen {
  position: relative;
  border-radius: calc(var(--dw) * 0.129);
  overflow: hidden;
  background: var(--paper);
}
.screen::after {
  content: "";
  position: absolute;
  top: calc(var(--dw) * 0.026);
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--dw) * 0.261);
  height: calc(var(--dw) * 0.078);
  border-radius: var(--radius-full);
  background: #000;
  z-index: 2;
}
.statusbar {
  position: absolute;
  inset: 0 0 auto 0;
  height: calc(var(--dw) * 0.13);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--dw) * 0.016) calc(var(--dw) * 0.083) 0;
  font-size: calc(var(--dw) * 0.045);
  font-weight: 600;
  color: var(--ink);
  z-index: 1;
}
.status-icons { display: flex; align-items: center; gap: 0.35em; }
.status-icons svg { height: 0.72em; width: auto; }
.batt {
  width: 1.82em;
  height: 0.88em;
  padding: 0.088em;
  border: 0.088em solid currentColor;
  border-radius: 0.26em;
  opacity: 0.9;
}
.batt span { display: block; height: 100%; background: currentColor; border-radius: 0.12em; }
.screen img { padding-top: calc(var(--dw) * 0.13); width: 100%; height: auto; }
/* Each game's box in its own studio piece, and its screen in its own app background, so the
   9:41 strip runs into the render. The fills keep their light values in both themes, like blue. */
.game-level .game-art { --box-fill: var(--box-coral); }
.game-roll .game-art { --box-fill: var(--box-teal); }
.screen-ep { background: #ECEFF4; }
.screen-level { background: #F5F4F1; }
.screen-roll { background: #EEF0F3; }
@media (prefers-color-scheme: dark) {
  .screen-ep { background: #0D1119; }
  .screen-level { background: #121214; }
  .screen-roll { background: #0F1013; }
}

.next {
  margin-top: var(--space-6);
  color: var(--muted);
  max-width: 48em;
}
.next .label { color: var(--ink); }

/* House rules: six tiles, a number and a sentence each. */
.rules {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 600px) {
  .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .rules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.rules li {
  display: grid;
  gap: var(--space-3);
  align-content: start;
  padding: var(--space-6);
  border: 2px solid var(--line);
  border-radius: var(--radius-m);
}
.rules li span:last-child { color: var(--muted); text-wrap: pretty; }

/* Footer */
.foot {
  border-top: 1px solid var(--line);
  padding-block: var(--space-12);
}
.foot .wrap {
  display: grid;
  gap: var(--space-6);
}
@media (min-width: 760px) {
  .foot .wrap {
    grid-template-columns: auto 1fr;
    align-items: end;
  }
}
.foot-brand img { width: 172px; height: auto; }
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  list-style: none;
  padding: 0;
  font-weight: 600;
  font-size: 15px;
}
@media (min-width: 760px) {
  .foot-links { justify-content: flex-end; }
}
.foot .small { grid-column: 1 / -1; }

/* Legal pages */
.doc {
  padding-block: var(--space-8) var(--section);
}
.doc-col {
  max-width: 40em;
  display: grid;
  gap: var(--space-4);
}
.doc-col h1 { margin-bottom: var(--space-1); }
.doc-col h2 { margin-top: var(--space-8); }
.doc-col ul { padding-left: 1.2em; display: grid; gap: var(--space-2); }
.summary {
  background: var(--surface);
  border-radius: var(--radius-m);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-3);
  margin-block: var(--space-4);
}
.summary .lead { font-weight: 600; }

/* 404 */
.lost {
  padding-block: var(--space-16) var(--section);
}
.lost .wrap {
  display: grid;
  gap: var(--space-6);
  justify-items: start;
}
.lost h1 { max-width: 14ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .btn:active { transform: none; }
  .cell.pop .face { transform: none; }
}
