/* Backgammon Pearl / Tavla Sedef, backgammonpearl.com.
   The app's world: oak café table by day, lamp-lit walnut by evening.
   Tokens are the app's (apps/mobile/src/theme/tokens.ts), value for value. */

:root {
  --page: #ebe7df;
  --page-rule: rgba(120, 100, 70, .035);
  --ink: #1f2430;
  --ink2: #5a6170;
  --ink3: #7d8592;
  --panel: rgba(255, 255, 255, .86);
  --panel-solid: #fbfaf7;
  --panel-line: rgba(31, 36, 48, .12);
  --panel-shadow: 0 2px 6px rgba(30, 30, 25, .08);
  --act: #34507c;
  --act-hi: #4a6a9c;
  --act-lo: #27406a;
  --act-ink: #ffffff;
  --act-soft: rgba(52, 80, 124, .12);
  --happened: #b24a33;
  --ok: #2f7d5a;
  --ok-soft: rgba(47, 125, 90, .12);
  --head-ink: #1f2430;
  --accent-ink: #34507c;
  --surface: #d9c3a0;
  --surface-tex: url("/img/oak.webp");
  --surface-op: .95;
  --surface-light: radial-gradient(110% 90% at 40% 40%, rgba(255,255,255,0), rgba(0,0,0,0) 50%, rgba(60,60,55,.12) 100%);
  --shadow-ink: rgba(40, 40, 35, .32);
  --frame: #1b1613;
  --frame-edge: #3a322b;
  --mono-bg: rgba(31, 36, 48, .05);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #120c08;
    --page-rule: rgba(255, 255, 255, .02);
    --ink: #f3e7d3;
    --ink2: #cbb99f;
    --ink3: #93826c;
    --panel: rgba(30, 18, 11, .86);
    --panel-solid: #1c120b;
    --panel-line: rgba(201, 162, 75, .30);
    --panel-shadow: none;
    --act: #c9a24b;
    --act-hi: #e8cf8a;
    --act-lo: #b08c3c;
    --act-ink: #1d130b;
    --act-soft: rgba(201, 162, 75, .14);
    --happened: #e0843c;
    --ok: #9cc58a;
    --ok-soft: rgba(156, 197, 138, .14);
    --head-ink: #e8cf8a;
    --accent-ink: #e8cf8a;
    --surface: #120c08;
    --surface-tex: url("/img/walnut.webp");
    --surface-op: .55;
    --surface-light: radial-gradient(70% 70% at 38% 36%, rgba(255,178,102,.20), rgba(0,0,0,0) 55%, rgba(0,0,0,.5) 100%);
    --shadow-ink: rgba(0, 0, 0, .55);
    --frame: #0c0907;
    --frame-edge: #2a221c;
    --mono-bg: rgba(255, 255, 255, .06);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #120c08;
  --page-rule: rgba(255, 255, 255, .02);
  --ink: #f3e7d3;
  --ink2: #cbb99f;
  --ink3: #93826c;
  --panel: rgba(30, 18, 11, .86);
  --panel-solid: #1c120b;
  --panel-line: rgba(201, 162, 75, .30);
  --panel-shadow: none;
  --act: #c9a24b;
  --act-hi: #e8cf8a;
  --act-lo: #b08c3c;
  --act-ink: #1d130b;
  --act-soft: rgba(201, 162, 75, .14);
  --happened: #e0843c;
  --ok: #9cc58a;
  --ok-soft: rgba(156, 197, 138, .14);
  --head-ink: #e8cf8a;
  --accent-ink: #e8cf8a;
  --surface: #120c08;
  --surface-tex: url("/img/walnut.webp");
  --surface-op: .55;
  --surface-light: radial-gradient(70% 70% at 38% 36%, rgba(255,178,102,.20), rgba(0,0,0,0) 55%, rgba(0,0,0,.5) 100%);
  --shadow-ink: rgba(0, 0, 0, .55);
  --frame: #0c0907;
  --frame-edge: #2a221c;
  --mono-bg: rgba(255, 255, 255, .06);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  background-image: repeating-linear-gradient(0deg, var(--page-rule) 0 1px, transparent 1px 7px);
  color: var(--ink);
  font: 400 17px/1.6 var(--font-body);
  overflow-x: hidden;
}
img, svg, picture { display: block; max-width: 100%; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--act); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.1; margin: 0; color: var(--head-ink); text-wrap: balance; letter-spacing: .005em; }
h1 { font-size: clamp(38px, 6.2vw, 64px); font-variation-settings: "opsz" 144; }
h2 { font-size: clamp(28px, 4vw, 40px); font-variation-settings: "opsz" 72; }
h3 { font-size: 22px; font-variation-settings: "opsz" 36; }
p { margin: 0; }
.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
@media (min-width: 720px) { .wrap { width: min(1120px, 100% - 48px); } }
.eyebrow { font: 600 13px/1.3 var(--font-body); letter-spacing: .09em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 12px; }
.lede { font-size: 19px; line-height: 1.55; color: var(--ink2); max-width: 54ch; text-wrap: pretty; }
.muted { color: var(--ink2); }
.small { font-size: 14px; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.site-head { display: flex; align-items: center; gap: 14px; padding: 18px 0 10px; }
.lockup { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.lockup .mark { width: 40px; height: 40px; flex: none; }
.lockup .words { display: grid; line-height: 1; }
.lockup .words b { font: 500 22px/1 var(--font-display); color: var(--ink); letter-spacing: .005em; }
.lockup .words small { font: 500 11px/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink3); margin-top: 5px; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { font: 600 15px/1 var(--font-body); color: var(--ink2); text-decoration: none; padding: 8px 0; }
.site-nav a:hover { color: var(--ink); }
.site-nav .hide-sm { display: none; }
@media (min-width: 720px) { .site-nav .hide-sm { display: inline; } }
.lang { display: inline-flex; align-items: center; border: 1px solid var(--panel-line); border-radius: 999px; background: var(--panel); box-shadow: var(--panel-shadow); overflow: hidden; }
.lang a, .lang span { font: 700 13px/1 var(--font-body); letter-spacing: .04em; padding: 9px 12px; text-decoration: none; color: var(--ink2); }
.lang [aria-current] { background: var(--act); color: var(--act-ink); }
.lang a:hover:not([aria-current]) { color: var(--ink); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 28px 0 24px; align-items: center; }
.hero > *, .row > *, .pair > *, .rooms > *, .band > *, .steps > *, .table-card, .phone, .row-fig { min-width: 0; }
@media (min-width: 900px) { .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px; padding: 40px 0 36px; } }
.hero-copy .kicker { display: inline-flex; align-items: center; gap: 8px; font: 600 13px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); margin-bottom: 18px; }
.hero-copy .kicker i { width: 8px; height: 8px; border-radius: 50%; background: var(--happened); display: inline-block; }
.hero-copy h1 { margin-bottom: 16px; }
.hero-copy .lede { margin-bottom: 26px; }
.micro { font-size: 13.5px; color: var(--ink3); margin-top: 16px; max-width: 48ch; }

/* the store badges: official artwork, unmodified, min 40px high, clear space of a quarter height */
.stores { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; }
.stores a, .stores .soon { display: inline-flex; align-items: center; }
.badge-play { height: 56px; width: auto; margin: -8px; }   /* the Play PNG carries its own clear space */
.badge-ios { height: 40px; width: auto; }
.soon { position: relative; gap: 10px; }
.soon .tag { font: 700 11.5px/1 var(--font-body); letter-spacing: .08em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; border: 1px solid var(--panel-line); background: var(--panel); color: var(--ink2); white-space: nowrap; }

/* the table card: the app's Home card, a café table seen from above, with the phone on it */
.table-card {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 10px 26px var(--shadow-ink), inset 0 1px 0 rgba(255,255,255,.08);
  border: 1px solid rgba(31, 36, 48, .10);
  padding: clamp(18px, 4vw, 44px) clamp(16px, 4vw, 40px) clamp(64px, 11vw, 120px);
  isolation: isolate;
}
.table-card::before { content: ""; position: absolute; inset: 0; background-image: var(--surface-tex); background-size: cover; background-position: 30% 40%; opacity: var(--surface-op); z-index: -2; }
.table-card::after { content: ""; position: absolute; inset: 0; background: var(--surface-light); z-index: -1; pointer-events: none; }
.table-card .piece { position: absolute; width: clamp(44px, 7vw, 76px); height: auto; filter: drop-shadow(3px 6px 8px var(--shadow-ink)); pointer-events: none; }
.table-card .tea { position: absolute; width: clamp(72px, 11vw, 120px); height: auto; right: 4%; top: 4%; filter: drop-shadow(3px 6px 8px var(--shadow-ink)); pointer-events: none; }
.table-card .checker-a { left: 7%; bottom: 3%; }
.table-card .checker-b { left: 15%; bottom: 7%; }
.table-card .die { right: 12%; bottom: 5%; width: clamp(34px, 5vw, 54px); transform: rotate(14deg); }
.table-card .phone { margin: 0 auto; width: min(100%, 560px); position: relative; }
.hero .table-card .phone { margin-top: clamp(28px, 6vw, 70px); }
@media (min-width: 900px) { .hero .table-card { margin-right: -8px; } }

/* a phone held sideways */
.phone { padding: 2.2%; border-radius: 7.5% / 13%; background: linear-gradient(158deg, var(--frame-edge), var(--frame) 70%); box-shadow: 0 14px 34px var(--shadow-ink), inset 0 0 0 1px rgba(255,255,255,.08); }
.phone .screen { border-radius: 5% / 9%; overflow: hidden; aspect-ratio: 16 / 9; background: #000; }
.phone .screen img { width: 100%; height: 100%; object-fit: cover; }
.phone.plain { box-shadow: 0 10px 28px var(--shadow-ink), inset 0 0 0 1px rgba(255,255,255,.08); }

/* ---------- feature rows ---------- */
.rows { display: grid; gap: 40px; padding: 36px 0 0; }
@media (min-width: 900px) { .rows { gap: 64px; padding-top: 56px; } }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: center; }
@media (min-width: 900px) {
  .row { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; }
  .row.flip .row-copy { order: 2; }
}
.row-copy h2 { margin-bottom: 14px; }
.row-copy p + p { margin-top: 12px; }
.row-copy .lede { font-size: 18px; }
.row-copy .more { display: inline-block; margin-top: 18px; font-weight: 600; }
.row-fig { margin: 0; }
.row-fig figcaption { font-size: 14px; color: var(--ink3); margin-top: 12px; text-align: center; }

/* the three steps of the seal */
.steps { counter-reset: step; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
.steps li { counter-increment: step; position: relative; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 16px; padding: 18px 18px 18px 18px; box-shadow: var(--panel-shadow); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--act-soft); color: var(--accent-ink); font: 500 18px/1 var(--font-display); margin-bottom: 12px; }
.steps li b { display: block; font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.steps li p { font-size: 15.5px; line-height: 1.5; color: var(--ink2); }
.steps li code { font-family: var(--font-mono); font-size: 13px; background: var(--mono-bg); padding: 2px 6px; border-radius: 6px; color: var(--ink); }

/* two screenshots side by side */
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 28px; }
@media (min-width: 720px) { .pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; } }
.pair figure { margin: 0; }
.pair figcaption { font-size: 14px; color: var(--ink3); margin-top: 10px; text-align: center; }

/* the rooms */
.rooms { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 24px; }
@media (min-width: 720px) { .rooms { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; } }
.room { background: var(--panel-solid); border: 1px solid var(--panel-line); border-radius: 18px; padding: 22px 22px 20px; box-shadow: var(--panel-shadow); }
.room h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.room h3 small { font: 600 13px/1 var(--font-body); color: var(--ink3); letter-spacing: .02em; white-space: nowrap; }
.room .sub { color: var(--ink2); font-size: 15.5px; margin-bottom: 14px; }
.room ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.room li { display: flex; gap: 10px; font-size: 15.5px; line-height: 1.45; }
.room li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--happened); flex: none; margin-top: 9px; }

/* a quiet statement band */
.band { margin-top: 56px; border-top: 1px solid var(--panel-line); border-bottom: 1px solid var(--panel-line); padding: 34px 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .band { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; } }
.band h3 { font-size: 21px; margin-bottom: 8px; }
.band p { color: var(--ink2); font-size: 15.5px; line-height: 1.5; }
.band .mk { display: block; width: 28px; height: 3px; border-radius: 2px; background: var(--happened); margin-bottom: 14px; }

/* ---------- closing ---------- */
.closing { text-align: center; padding: 64px 0 20px; }
.closing h2 { margin-bottom: 12px; }
.closing .lede { margin: 0 auto 26px; }
.closing .stores { justify-content: center; }
.closing .mail { display: inline-block; margin-top: 22px; font-weight: 600; }

/* ---------- footer ---------- */
.site-foot { margin-top: 36px; padding: 24px 0 44px; border-top: 1px solid var(--panel-line); color: var(--ink3); font-size: 14px; display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.site-foot a { color: var(--ink2); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
.site-foot .sep { opacity: .6; }
.site-foot .langs { margin-left: auto; display: inline-flex; gap: 10px; }

/* ---------- document pages (legal, check, 404) ---------- */
.doc { width: min(72ch, 100% - 32px); margin-inline: auto; padding-bottom: 60px; }
@media (min-width: 720px) { .doc { width: min(72ch, 100% - 48px); } }
.doc h1 { font-size: clamp(32px, 5vw, 44px); margin: 28px 0 6px; }
.doc h2 { font-size: 24px; margin: 36px 0 10px; }
.doc h3 { font-size: 19px; margin: 24px 0 8px; }
.doc p, .doc li { font-size: 16.5px; line-height: 1.65; }
.doc p + p { margin-top: 12px; }
.doc ul, .doc ol { padding-left: 22px; margin: 10px 0; }
.doc li { margin: 6px 0; }
.doc .updated { color: var(--ink3); font-size: 14px; margin-bottom: 22px; }
.doc .lede { font-size: 18px; margin-bottom: 8px; max-width: none; }
.callout { border: 1px solid var(--panel-line); background: var(--panel-solid); border-radius: 14px; padding: 16px 18px; margin: 22px 0; box-shadow: var(--panel-shadow); }
.callout.good { border-color: rgba(47, 125, 90, .45); }
.callout.good strong { color: var(--ok); }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 12px 0; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--panel-line); }
.doc th { color: var(--ink3); font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.doc code { font-family: var(--font-mono); font-size: .9em; background: var(--mono-bg); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.doc pre { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.5; background: var(--mono-bg); border: 1px solid var(--panel-line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; }

/* ---------- the dice checker ---------- */
.check-form { display: grid; gap: 16px; margin: 26px 0 8px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13.5px; color: var(--ink3); }
.field input, .field textarea { font: 400 15px/1.45 var(--font-mono); color: var(--ink); background: var(--panel-solid); border: 1px solid var(--panel-line); border-radius: 12px; padding: 11px 13px; width: 100%; box-shadow: var(--panel-shadow); }
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--act); box-shadow: 0 0 0 3px var(--act-soft); }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--happened); }
.field-row { display: grid; gap: 16px; }
@media (min-width: 600px) { .field-row { grid-template-columns: 1fr 1fr; } }
.btn { font: 700 16px/1 var(--font-body); border: 0; border-radius: 14px; padding: 15px 22px; background: linear-gradient(180deg, var(--act-hi), var(--act) 55%, var(--act-lo)); color: var(--act-ink); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 2px 8px var(--shadow-ink); }
.btn:hover { filter: brightness(1.04); }
.btn.quiet { background: var(--panel-solid); color: var(--ink); border: 1px solid var(--panel-line); box-shadow: var(--panel-shadow); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.result { margin-top: 28px; }
.result .seal-line { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--panel-line); background: var(--panel-solid); box-shadow: var(--panel-shadow); }
.result .seal-line .ic { width: 28px; height: 28px; flex: none; margin-top: 2px; }
.result .seal-line b { display: block; font-size: 16px; }
.result .seal-line code { display: block; margin-top: 4px; }
.result .seal-line.ok b { color: var(--ok); }
.result .seal-line.bad b { color: var(--happened); }
.rolls { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; margin-top: 18px; list-style: none; padding: 0; }
.rolls li { display: flex; align-items: baseline; gap: 8px; padding: 9px 10px; border-radius: 10px; background: var(--panel-solid); border: 1px solid var(--panel-line); font-family: var(--font-mono); font-size: 15px; white-space: nowrap; }
.rolls li .n { color: var(--ink3); font-size: 12.5px; min-width: 2ch; text-align: right; }
.rolls li .d { font-weight: 700; letter-spacing: .04em; }
.rolls li.bad { border-color: var(--happened); background: rgba(178, 74, 51, .08); }
.rolls li.bad .d { color: var(--happened); text-decoration: line-through; }
.rolls li.bad .rec { color: var(--happened); font-weight: 700; margin-left: auto; }
.rolls li.ok { border-color: rgba(47, 125, 90, .35); }
.summary { margin-top: 16px; font-weight: 600; }
.summary.ok { color: var(--ok); }
.summary.bad { color: var(--happened); }
.err { color: var(--happened); font-weight: 600; margin-top: 8px; }

/* ---------- 404 ---------- */
.lost { text-align: center; padding: 60px 0 40px; }
.lost .die { width: 96px; margin: 0 auto 20px; filter: drop-shadow(3px 6px 8px var(--shadow-ink)); transform: rotate(-12deg); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
