/* Auntie Ruth's Mahjong web site. Colors come from the app (App/TileView.swift, HomeView.swift):
   table ink #122E2E, felt #0B2E2B, gold #E8BF6E, tile cream #F5E8C9, ivory #FAF0D6,
   jade #116E57, red #C43324, navy #142950, light table #C7D6BF. */

:root {
  --felt: #0b2e2b;
  --felt-deep: #072320;
  --felt-ink: #f5e8c9;
  --felt-soft: #bfd0c4;
  --gold: #e8bf6e;
  --gold-deep: #d9a94f;
  --table-ink: #122e2e;

  --bg: #faf3e3;
  --bg-alt: #f1e6cc;
  --surface: #fffaf0;
  --ink: #122e2e;
  --ink-soft: #3f5754;
  --line: #dccdab;
  --accent: #0f6a54;
  --accent-ink: #0b5443;
  --red: #b42f20;
  --focus: #116e57;
  --selection: #e8bf6e;

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.55rem, 1.3rem + 1.2vw, 2.25rem);
  --step-3: clamp(2.2rem, 1.6rem + 3vw, 4rem);
  --gutter: 16px;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b2e2b;
    --bg-alt: #0e3531;
    --surface: #123c37;
    --ink: #f5e8c9;
    --ink-soft: #bfd0c4;
    --line: #24504a;
    --accent: #8fd8bd;
    --accent-ink: #b5e8d4;
    --red: #ff9e8c;
    --focus: #e8bf6e;
  }
}
:root[data-theme="dark"] {
  --bg: #0b2e2b; --bg-alt: #0e3531; --surface: #123c37; --ink: #f5e8c9; --ink-soft: #bfd0c4;
  --line: #24504a; --accent: #8fd8bd; --accent-ink: #b5e8d4; --red: #ff9e8c; --focus: #e8bf6e;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  font-feature-settings: "kern", "liga";
  overflow-x: hidden;
}
::selection { background: var(--selection); color: var(--table-ink); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 0.07em; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 0.12em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
p { margin: 0 0 1em; text-wrap: pretty; }
.wrap { width: min(1160px, 100% - 2 * var(--gutter)); margin-inline: auto; }
@media (min-width: 720px) { :root { --gutter: 32px; } }

.skip { position: absolute; left: var(--gutter); top: -100px; z-index: 10; background: var(--gold); color: var(--table-ink); padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 12px; }

/* Header: always on felt, like the app's table header. */
.site-header { background: var(--felt); color: var(--felt-ink); border-bottom: 1px solid rgb(232 191 110 / 0.18); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--felt-ink); text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.wordmark:hover { color: var(--gold); }
.wind { width: 26px; height: 20px; fill: none; stroke: var(--gold); stroke-width: 1.7; stroke-linecap: round; }
.site-header nav { display: flex; gap: 4px; }
.site-header nav a { color: var(--felt-soft); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-size: var(--step--1); font-weight: 500; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--felt-ink); background: rgb(245 232 201 / 0.07); }
@media (max-width: 540px) {
  .header-row { flex-wrap: wrap; justify-content: center; gap: 2px; padding-block: 12px; }
  .site-header nav { justify-content: center; width: 100%; }
}
.site-header :focus-visible, .felt :focus-visible { outline-color: var(--gold); }

/* Felt: the table's surface, in both themes. */
.felt {
  background:
    radial-gradient(120% 90% at 70% 10%, #14403b 0%, transparent 60%),
    radial-gradient(90% 80% at 10% 100%, var(--felt-deep) 0%, transparent 70%),
    var(--felt);
  color: var(--felt-ink);
  --ink: var(--felt-ink); --ink-soft: var(--felt-soft); --accent: var(--gold); --accent-ink: #f3d79c; --line: #24504a;
}
.felt ::selection { background: var(--gold); color: var(--table-ink); }

/* Hero */
.hero { padding: 40px 0 56px; overflow: hidden; }
.hero-grid { display: grid; gap: 40px; }
.hero-icon { width: 72px; height: 72px; border-radius: 17px; box-shadow: 0 10px 24px -8px rgb(0 0 0 / 0.55), 0 2px 4px rgb(0 0 0 / 0.3); margin-bottom: 24px; }
.hero h1 { font-size: var(--step-3); max-width: 13ch; }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--felt-soft); max-width: 36ch; margin-top: 20px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 16px; }
.meta { font-size: var(--step--1); color: var(--felt-soft); margin: 0; }
.hero-shot { margin: 0; }
.hero-shot img {
  border-radius: 18px;
  box-shadow: 0 30px 60px -24px rgb(0 0 0 / 0.7), 0 8px 18px -8px rgb(0 0 0 / 0.5);
  outline: 1px solid rgb(232 191 110 / 0.22); outline-offset: -1px;
}
.hero-shot figcaption { font-size: var(--step--1); color: var(--felt-soft); margin-top: 14px; }
@media (min-width: 960px) {
  .hero { padding: 72px 0 88px; }
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: 56px; }
  .hero-shot { margin-right: calc(-1 * max(var(--gutter), (100vw - 1160px) / 2) + 24px); }
}
@media (prefers-reduced-motion: no-preference) {
  .hero-shot img { animation: deal 900ms cubic-bezier(0.16, 1, 0.3, 1) both 120ms; }
  @keyframes deal { from { opacity: 0; transform: translateY(18px) rotate(0.6deg); filter: blur(6px); } }
}

/* Buttons: the app's gold and outline styles. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px; font: 600 var(--step-0)/1 var(--sans); text-decoration: none; transition: transform 120ms ease-out, background-color 120ms ease-out, box-shadow 120ms ease-out; }
.button-gold { background: var(--gold); color: var(--table-ink); box-shadow: 0 6px 16px -8px rgb(0 0 0 / 0.6); }
.button-gold:hover { background: #efcb82; color: var(--table-ink); }
.button-gold:active { transform: scale(0.98); }
.button-gold.is-soon { background: rgb(232 191 110 / 0.16); color: var(--ink); box-shadow: inset 0 0 0 1px rgb(232 191 110 / 0.5); cursor: default; }
.felt .button-gold.is-soon { color: var(--gold); }
.button-quiet { color: var(--ink); box-shadow: inset 0 0 0 1.5px currentColor; background: transparent; }
.felt .button-quiet { color: var(--felt-ink); box-shadow: inset 0 0 0 1.5px rgb(245 232 201 / 0.45); }
.button-quiet:hover { background: rgb(127 127 127 / 0.08); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .button { transition: none; } }

/* Sections */
.band { padding: 64px 0; }
.band-alt { background: var(--bg-alt); }
.band h2 { font-size: var(--step-2); }
.section-head { max-width: 62ch; margin-bottom: 36px; }
.section-head h2 { margin-bottom: 14px; }
.section-head p { color: var(--ink-soft); }
.split { display: grid; gap: 20px; }
.prose { max-width: 66ch; }
.prose > :last-child { margin-bottom: 0; }
@media (min-width: 860px) {
  .band { padding: 96px 0; }
  .split { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: 56px; }
  .split h2 { position: sticky; top: 24px; align-self: start; }
}
.ticks { list-style: none; padding: 0; margin: 1.4em 0 0; display: grid; gap: 12px; }
.ticks li { position: relative; padding-left: 30px; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 0.42em; width: 14px; height: 18px; border-radius: 3px; background: linear-gradient(#fffaf0, #f0e3c2); box-shadow: 0 2px 0 #7a9f8f, 0 3px 5px -1px rgb(0 0 0 / 0.35); }
.aside { color: var(--ink-soft); margin-top: 28px; }
.more { font-weight: 600; }

/* The ladder: a real sequence, so the numbers carry meaning. */
.ladder { list-style: none; counter-reset: rung; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.ladder li { counter-increment: rung; display: grid; grid-template-columns: 52px 1fr; column-gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); align-items: start; }
.ladder li::before {
  content: counter(rung); grid-row: span 2; align-self: start;
  width: 40px; height: 52px; display: grid; place-items: center;
  font: 600 1.35rem/1 var(--serif); color: var(--table-ink);
  background: linear-gradient(#fffaf0, #f3e6c6); border-radius: 7px;
  box-shadow: 0 3px 0 #116e57, 0 5px 8px -2px rgb(0 0 0 / 0.35), inset 0 0 0 1px #e6d7b2;
}
.ladder li:nth-child(n+5)::before { color: #c43324; }
.ladder li:last-child::before { color: #142950; }
.rung-name { font: 600 var(--step-1)/1.25 var(--serif); }
.rung-adds { color: var(--ink-soft); }
@media (min-width: 860px) {
  .ladder { grid-template-columns: 1fr 1fr; column-gap: 48px; }
  .ladder li { grid-template-columns: 56px 1fr; }
  .ladder { grid-auto-flow: column; grid-template-rows: repeat(4, auto); }
}

/* Cast */
.cast { margin: 0; display: grid; gap: 0; border-top: 1px solid var(--line); }
.cast > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.cast dt { font: 600 var(--step-1)/1.25 var(--serif); margin-bottom: 4px; }
.cast dd { margin: 0; color: var(--ink-soft); }
@media (min-width: 720px) { .cast { grid-template-columns: repeat(2, 1fr); column-gap: 40px; } }
@media (min-width: 1040px) { .cast { grid-template-columns: repeat(3, 1fr); } }

/* Achievements: the app's own Game Center art. */
.achievements { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.achievements li { display: grid; gap: 10px; justify-items: center; text-align: center; font-weight: 600; font-size: var(--step--1); }
.achievements img { width: 100%; max-width: 168px; border-radius: 50%; box-shadow: 0 12px 22px -12px rgb(0 0 0 / 0.55); }
@media (min-width: 560px) { .achievements { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .achievements { grid-template-columns: repeat(6, 1fr); } }

/* Footer */
.site-footer { background: var(--felt-deep); color: var(--felt-soft); padding: 40px 0 48px; font-size: var(--step--1); }
.footer-row { display: grid; gap: 16px; }
.footer-mark { display: flex; align-items: center; gap: 12px; color: var(--felt-ink); margin: 0; }
.footer-mark img { border-radius: 9px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--felt-ink); overflow-wrap: anywhere; }
.site-footer a:hover { color: var(--gold); }
.site-footer :focus-visible { outline-color: var(--gold); }
.fine { margin: 0; max-width: 80ch; }

/* Reading pages and the home-page FAQ share the same comfortable measure. */
.document { max-width: 72ch; padding-block: 56px 80px; overflow-wrap: anywhere; }
.band .document { padding-block: 0; }
.document h1 { font-size: var(--step-3); margin-bottom: 24px; }
.document h2 { font-size: var(--step-2); margin: 48px 0 18px; scroll-margin-top: 24px; }
.document h3 { font-size: var(--step-1); margin: 28px 0 12px; }
.document .intro { font-size: var(--step-1); color: var(--ink-soft); }
.document li { margin-bottom: 0.55em; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.1em; font-size: var(--step--1); color: var(--accent); }
.contents, .example, .notice { background: var(--bg-alt); border: 1px solid var(--line); padding: 20px 24px; border-radius: var(--radius); margin-block: 24px; }
.definitions dt { font-weight: 650; margin-top: 20px; }
.definitions dd { margin: 8px 0 20px; }
.table-scroll { overflow-x: auto; margin-bottom: 24px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 650; padding: 12px 14px; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { font-weight: 650; background: var(--bg-alt); }
.lesson-shot { margin: 28px 0 0; }
.lesson-shot img { border-radius: var(--radius); }
.lesson-shot figcaption { margin-top: 12px; font-size: var(--step--1); color: var(--ink-soft); }
.share-link { overflow-wrap: anywhere; font-weight: 650; }
[hidden] { display: none !important; }
