/* Tessera site. Bone ground, chocolate ink, one moss accent on the action,
   brass only for the coin-coloured strip. Same tokens as the app. */

:root {
  --bg: #E5E1D8;
  --surface: #DAD5CA;
  --raised: #CFC8BB;
  --ink: #2A1D17;
  --muted: #6B5B51;
  --accent: #456F3A;
  --accent-ink: #FFFFFF;
  --brass: #B8862B;
  --brass-ink: #2A1D17;
  --deep: #2A1D17;
  --deep-ink: #E5E1D8;
  --table: #CFC8BA;
  --head: "Stack Sans Headline", "Segoe UI", system-ui, sans-serif;
  --text: "Stack Sans Text", "Segoe UI", system-ui, sans-serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(2.5rem, 1.2rem + 3.6vw, 4.5rem);
  --m: clamp(16px, 3vw, 32px);
  --r: 4px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1D1916; --surface: #27221E; --raised: #332C27; --ink: #ECE5DA; --muted: #A8998B;
    --accent: #8FB67F; --accent-ink: #14200F; --brass: #D4A64A; --brass-ink: #1D1916;
    --deep: #0F0C0A; --deep-ink: #ECE5DA; --table: #2B2420;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1D1916; --surface: #27221E; --raised: #332C27; --ink: #ECE5DA; --muted: #A8998B;
  --accent: #8FB67F; --accent-ink: #14200F; --brass: #D4A64A; --brass-ink: #1D1916;
  --deep: #0F0C0A; --deep-ink: #ECE5DA; --table: #2B2420;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-body)/1.5 var(--text);
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2 { font-family: var(--head); font-weight: 300; letter-spacing: -0.022em; line-height: 1.05; margin: 0; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---- Buttons: flat, square-ish, one fill ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 22px;
  background: var(--accent); color: var(--accent-ink);
  border-radius: var(--r); text-decoration: none;
  font-weight: 500; font-size: var(--step-body);
  transition: transform .15s var(--ease), background-color .2s;
}
.btn:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.btn:active { transform: scale(.97); }
.textlink { font-weight: 500; transition: color .2s; }
.textlink:hover { color: var(--accent); }

/* ---- Bar ---- */
.bar {
  display: flex; align-items: center; gap: 24px;
  padding: 18px var(--m);
}
.mark { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 300 var(--step-lead)/1 var(--head); letter-spacing: -0.02em; }
.mark svg { width: 36px; height: 36px; }
.bar nav { display: flex; gap: 22px; margin-left: auto; }
.bar nav a { text-decoration: none; transition: color .2s; }
.bar nav a:hover { color: var(--accent); text-decoration: underline; }

/* ---- Hero: the headline upper left, the puzzle at real size ---- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: clamp(24px, 4vw, 72px);
  align-items: start;
  padding: clamp(24px, 5vw, 64px) var(--m) clamp(96px, 12vw, 180px);
}
.hero h1 { font-size: var(--step-display); max-width: 17ch; }
.lead { font-size: var(--step-lead); line-height: 1.4; margin-top: 24px; max-width: 32ch; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 32px; }

.stage { background: var(--table); padding: clamp(14px, 2vw, 24px); border-radius: var(--r); }
.stage-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; font: 500 var(--step-small)/1.3 var(--text); font-variant-numeric: tabular-nums; }
.ui-btn {
  font: 500 var(--step-small)/1 var(--text); color: var(--ink);
  background: var(--bg); border: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); /* taste-skill-ignore: control inside the data-ui fragment */
  border-radius: var(--r); padding: 10px 14px; cursor: pointer; min-height: 40px;
  transition: background-color .2s, transform .15s var(--ease);
}
.ui-btn:hover { background: var(--surface); }
.ui-btn:active { transform: scale(.97); }
#puzzle { width: 100%; height: auto; display: block; touch-action: none; user-select: none; }
#puzzle .board { fill: color-mix(in srgb, var(--ink) 10%, var(--table)); }
#puzzle .ghost { opacity: .2; }
#puzzle .piece { cursor: grab; }
#puzzle .piece.lift { cursor: grabbing; filter: drop-shadow(0 6px 8px rgb(0 0 0 / .3)); } /* taste-skill-ignore: only the piece in the hand floats */
#puzzle .piece path { fill: none; stroke: rgb(0 0 0 / .35); stroke-width: 1; vector-effect: non-scaling-stroke; }
#puzzle .piece.home path { stroke: rgb(0 0 0 / .2); }
#puzzle.done .piece path { stroke: transparent; transition: stroke 1s; }
#puzzle.done .ghost { opacity: 0; }
.caption { font-size: var(--step-small); margin-top: 12px; color: var(--ink); }

/* ---- Split: size in, cut out ---- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 90svh; }
.split-in, .split-out { position: relative; padding: 18svh var(--m) 140px; }
.split-in { background: var(--deep); color: var(--deep-ink); }
.split-out { background: var(--surface); display: flex; justify-content: center; }
.split-intro { font-size: var(--step-lead); line-height: 1.4; max-width: 24ch; }
.sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 32px; max-width: 460px; }
.sizes button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  text-align: left; cursor: pointer;
  background: color-mix(in srgb, var(--deep-ink) 10%, var(--deep)); color: var(--deep-ink);
  border: 0; border-radius: var(--r); padding: 12px 14px; min-height: 76px;
  font: 400 var(--step-small)/1.2 var(--text);
  transition: background-color .2s, color .2s, transform .15s var(--ease);
}
.sizes button b { font: 300 var(--step-lead)/1 var(--head); letter-spacing: -0.02em; }
.sizes button:hover { background: color-mix(in srgb, var(--deep-ink) 18%, var(--deep)); }
.sizes button:active { transform: scale(.97); }
.sizes button[aria-checked="true"] { background: var(--deep-ink); color: var(--deep); }
.split-h { font: 300 var(--step-head)/1 var(--head); letter-spacing: -0.03em; position: absolute; bottom: 32px; margin: 0; }
.split-h-a { left: var(--m); }
.split-h-b { right: var(--m); }
.cutframe { margin: 0; width: min(520px, 100%); align-self: flex-start; }
.cutframe .fade { position: relative; aspect-ratio: 4 / 3; }
.cutframe .fade img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.6s ease; }
.cutframe .fade img.on { opacity: 1; }
.cutframe { position: relative; }
.cutframe svg { position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 4 / 3; }
.cutframe svg path { fill: none; stroke: rgb(0 0 0 / .55); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.cutframe figcaption { margin-top: 12px; font: 500 var(--step-small)/1.3 var(--text); font-variant-numeric: tabular-nums; }

/* ---- Statement with picture words ---- */
.statement { padding: clamp(120px, 14vw, 220px) var(--m); }
.big { font: 400 clamp(22px, 1rem + 1.6vw, 36px)/1.3 var(--text); max-width: 34ch; }
.slot {
  display: inline-block; height: 1em; width: 1.9em; object-fit: cover;
  border-radius: .18em; vertical-align: -0.12em;
}
.slot-tray { object-position: 50% 92%; }
.statement-foot { margin: 72px 0 0 auto; max-width: 520px; display: grid; gap: 24px; justify-items: start; }
.statement-foot p { font-size: var(--step-body); }

/* ---- Gallery: prints with label strips ---- */
.gallery { padding: 0 var(--m) clamp(120px, 14vw, 200px); }
.gallery h2 { font-size: var(--step-head); }
.gallery-lead { margin: 14px 0 40px; max-width: 52ch; }
.prints { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 12px; }
.print img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .6s var(--ease); }
.print { overflow: hidden; }
.print:hover img { transform: scale(1.03); }
.tag { position: relative; min-height: 92px; padding: 12px; display: grid; gap: 4px; font-size: var(--step-small); line-height: 1.3; font-variant-numeric: tabular-nums; }
.tag b { font-weight: 500; }
.tag span { display: flex; justify-content: space-between; gap: 6px; }
.tag i { font-style: normal; }
.tag em { font-style: normal; }
.s0 .tag { background: var(--accent); color: var(--accent-ink); }
.s1 .tag { background: var(--deep); color: var(--deep-ink); }
.s2 .tag { background: var(--brass); color: var(--brass-ink); }
.s3 .tag { background: var(--raised); color: var(--ink); }
.credit { margin-top: 28px; font-size: var(--step-small); }

/* ---- FAQ: filled tiles ---- */
.faq { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 32px; padding: 0 var(--m) clamp(120px, 14vw, 200px); align-items: start; }
.faq h2 { font-size: var(--step-head); position: sticky; top: 96px; }
.tiles { display: grid; gap: 8px; }
details { background: var(--surface); border-radius: var(--r); transition: background-color .25s; }
details[open] { background: var(--accent); color: var(--accent-ink); }
summary {
  list-style: none; cursor: pointer; min-height: 72px; padding: 22px 64px 22px 24px; position: relative;
  font: 500 var(--step-body)/1.3 var(--text);
}
summary::-webkit-details-marker { display: none; }
summary i { position: absolute; right: 24px; top: 50%; width: 16px; height: 16px; margin-top: -8px; }
summary i::before, summary i::after { content: ""; position: absolute; left: 0; top: 6.5px; width: 16px; height: 3px; background: currentColor; transition: transform .25s var(--ease); }
summary i::after { transform: rotate(90deg); }
details[open] summary i::after { transform: rotate(0); }
details p { padding: 0 24px 24px; max-width: 52ch; }

/* ---- Footer: the last two rows of the board ---- */
.foot { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; padding: 10px; }
.ft { border-radius: var(--r); padding: 24px; background: var(--surface); min-height: 220px; }
.ft-statement { grid-column: 1 / 5; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; }
.ft-statement p { font-size: var(--step-lead); line-height: 1.3; }
.ft-statement small { font-size: var(--step-small); }
.ft-nav { grid-column: 5 / 8; display: flex; flex-direction: column; gap: 10px; }
.ft-nav a { text-decoration: none; }
.ft-nav a:hover { text-decoration: underline; }
.ft-facts { grid-column: 8 / 10; font-variant-numeric: tabular-nums; }
.ft-mail { grid-column: 10 / 13; display: flex; flex-direction: column; justify-content: space-between; }
.ft-mail a { overflow-wrap: anywhere; }
.ft-word { grid-column: 1 / 9; min-height: 320px; background: var(--deep); color: var(--deep-ink); display: grid; place-items: center; font: 300 9vw/1 var(--head); letter-spacing: -0.03em; overflow: hidden; }
.ft-go { grid-column: 9 / 13; min-height: 320px; background: var(--accent); color: var(--accent-ink); text-decoration: none; position: relative; font: 300 var(--step-lead)/1.15 var(--head); transition: background-color .2s; }
.ft-go:hover { background: color-mix(in srgb, var(--accent) 86%, var(--ink)); }
.ft-go svg { position: absolute; right: 24px; bottom: 24px; width: 48px; height: 48px; transition: transform .25s var(--ease); }
.ft-go:hover svg { transform: translate(4px, -4px); }

/* ---- Documents (privacy, 404) ---- */
.doc { max-width: 760px; padding: clamp(32px, 6vw, 80px) var(--m) 120px; }
.doc h1 { font-size: var(--step-head); }
.doc h2 { font-size: var(--step-lead); margin: 48px 0 12px; }
.doc p, .doc li { margin: 0 0 14px; }
.doc .meta { margin-top: 16px; color: var(--muted); }
.doc ul { padding-left: 1.2em; }

/* ---- Motion: parts rise in as their section arrives ---- */
/* The hero animates by itself, so it can never stay hidden. */
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
.rise { animation: rise .7s var(--ease) both; }
.hero .stage.rise { animation-delay: 120ms; }
.js .reveal > * { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.in > * { opacity: 1; transform: none; }
.js .reveal.in > *:nth-child(2) { transition-delay: 80ms; }
.js .reveal.in > *:nth-child(3) { transition-delay: 160ms; }
.js .reveal.in > *:nth-child(4) { transition-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation: none !important; }
  .js .reveal > * { opacity: 1; transform: none; }
}

/* ---- Phone ---- */
@media (max-width: 860px) {
  .bar nav { display: none; }
  .bar .btn-small { margin-left: auto; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2.25rem, 9vw, 3.5rem); max-width: none; }
  .split { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .split-in, .split-out { min-height: 62svh; padding: 48px 20px 96px; }
  .split-h-a { bottom: 20px; }
  .split-h-b { top: 20px; bottom: auto; left: 20px; right: auto; }
  .split-out { padding-top: 96px; }
  .big { font-size: 22px; line-height: 1.35; }
  .slot { width: 1.5em; }
  .statement-foot { margin-left: 0; }
  .prints { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 8px; }
  .tag span i:nth-child(n+3) { display: none; }
  .faq { grid-template-columns: minmax(0, 1fr); }
  .faq h2 { position: static; }
  summary { min-height: 64px; padding: 20px 56px 20px 20px; }
  details p { padding: 0 20px 20px; }
  .foot { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .ft { grid-column: auto; min-height: 0; padding: 20px; }
  .ft-word { grid-column: 1 / -1; min-height: 160px; font-size: 18vw; }
  .ft-go { grid-column: 1 / -1; min-height: 160px; }
  .ft-statement { grid-column: 1 / -1; }
}
