/* Gamely — shared styles. Editorial layout: hairline rules, a numbered index column, serif display, red accent. */

@font-face { font-family: 'DM Serif Display'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/dm-serif-display.woff2') format('woff2'); }
@font-face { font-family: 'DM Serif Display'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/fonts/dm-serif-display-italic.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/assets/fonts/inter-var.woff2') format('woff2'); }

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

:root {
  --bg: #f9f6f1;
  --ink: #0f0f0f;
  --muted: #6b6b6b;
  --rule: #0f0f0f;
  --hair: #d9d2c6;
  --accent: #c8392b;
  --serif: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img, svg { max-width: 100%; }

.wrap { width: min(1080px, calc(100% - 48px)); margin: 0 auto; }

.skip { position: absolute; left: -9999px; top: 12px; background: var(--ink); color: var(--bg); padding: 8px 14px; z-index: 10; text-decoration: none; }
.skip:focus { left: 16px; }

/* ── Header ── */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 0; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 28px; line-height: 1; letter-spacing: -0.01em; }
.logo img { display: block; height: 34px; width: auto; }
@media (max-width: 760px) { .logo img { height: 30px; } }
.nav { display: flex; gap: 28px; }
.nav a { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }

/* ── Shared type ── */
.kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 20px; }
.crumbs { font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 28px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs li + li::before { content: '/'; margin-right: 8px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }

/* ── Hero ── */
.hero { padding: 48px 0; border-bottom: 1.5px solid var(--rule); }
.hero-title { font-family: var(--serif); font-weight: 400; font-size: clamp(56px, 9.5vw, 112px); line-height: 0.94; letter-spacing: -0.02em; text-wrap: balance; }
.hero-title em { font-style: italic; color: var(--accent); }
.hero-sub { margin-top: 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.hero-tagline { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 580px; line-height: 1.55; }
.hero-meta { font-size: 12px; letter-spacing: 0.1em; color: var(--muted); text-align: right; white-space: nowrap; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Home: hero and grouped game index ── */
.hero-home { padding: 56px 0 52px; }
.hero-home .hero-title { font-size: clamp(42px, 6.4vw, 80px); line-height: 1.02; }
.group { border-bottom: 1.5px solid var(--rule); padding: 40px 0 8px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 40px; }
.group-head { grid-column: 1 / -1; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 40px; align-items: baseline; margin-bottom: 4px; }
.group-head .app-index { padding-top: 0; }
.group-title { font-family: var(--serif); font-weight: 400; font-style: italic; font-size: 28px; line-height: 1; color: var(--accent); }
.group-head p { color: var(--muted); font-size: 15px; }
.game-list { grid-column: 2; list-style: none; }
.game-list li + li { border-top: 1px solid var(--hair); }
.game-link { display: grid; grid-template-columns: 96px minmax(0, 1fr) 28px; gap: 8px 28px; align-items: center; padding: 22px 0; text-decoration: none; }
.game-icon { width: 96px; height: 96px; border-radius: 22px; display: block; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.game-text { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 32px; align-items: center; min-width: 0; }
.game-text .game-soon { grid-column: 2; }
.game-name { font-family: var(--serif); white-space: nowrap; font-size: clamp(34px, 4.4vw, 56px); line-height: 1; letter-spacing: -0.02em; transition: color 0.15s; }
.game-line { color: var(--muted); }
.game-meta, .game-soon { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; color: var(--muted); }
.game-soon { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.game-arrow { font-size: 22px; text-align: right; transition: transform 0.15s, color 0.15s; }
.game-link:hover .game-name, .game-link:hover .game-arrow { color: var(--accent); }
.game-link:hover .game-arrow { transform: translateX(4px); }

/* ── Game pages ── */
.app-hero { padding: 32px 0 0; }
.app-head { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 20px 32px; align-items: center; }
.app-icon { width: 112px; height: 112px; border-radius: 26px; display: block; box-shadow: 0 2px 6px rgba(0,0,0,.14); }
.app-title { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 6.5vw, 80px); line-height: 1; letter-spacing: -0.02em; }
.app-tagline { margin-top: 10px; font-size: clamp(16px, 1.8vw, 19px); color: var(--muted); max-width: 52ch; }
.app-head-text .game-soon { display: inline-block; margin-top: 12px; }
.app-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.app-shot { margin: 36px 0 0; }
.app-shot img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.highlights { border-bottom: 1.5px solid var(--rule); }
.highlights ul { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.highlights li { padding: 32px 28px 36px 0; border-top: 1.5px solid var(--rule); }
.highlights h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; margin-bottom: 10px; }
.highlights p { color: var(--muted); font-size: 15px; max-width: 34ch; }
.app-foot-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 40px; padding: 32px 0; border-bottom: 1.5px solid var(--rule); }
.app-foot-cta p { color: var(--muted); max-width: 60ch; }

.app-extra { margin-top: 10px; font-size: 13px; }
.app-extra a { color: var(--muted); text-underline-offset: 2px; }
.app-extra a:hover { color: var(--ink); }

/* ── Room invite ── */
.room { max-width: 560px; margin: 0 auto; padding: 56px 0 72px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.room .kicker { margin: 8px 0 0; }
.room-title { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 5vw, 44px); line-height: 1.1; text-wrap: balance; }
.room-title span { color: var(--accent); font-style: italic; }
.room-help { color: var(--muted); max-width: 44ch; }
.room-actions { justify-content: center; }
.room-get { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 12px; color: var(--muted); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink); padding: 12px 20px; border: 1.5px solid var(--ink); white-space: nowrap; min-width: 160px; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn-solid { background: var(--ink); color: var(--bg); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); }

/* ── Game list (home) ── */
.app-item { border-bottom: 1.5px solid var(--rule); padding: 48px 0; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 0 40px; align-items: start; }
.app-index { font-family: var(--serif); font-size: 13px; font-style: italic; color: var(--muted); padding-top: 8px; }
.app-name { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6vw, 72px); line-height: 1; letter-spacing: -0.02em; margin-bottom: 12px; }
.app-name a { text-decoration: none; }
.app-name a:hover { color: var(--accent); }
.app-sub { font-size: 14px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 20px; }
.app-desc { color: var(--muted); line-height: 1.7; max-width: 560px; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chips li { font-size: 12px; font-weight: 500; letter-spacing: 0.06em; padding: 5px 12px; border: 1px solid currentColor; color: var(--muted); }
.app-links { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.more-link { display: inline-block; margin-top: 20px; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; color: var(--ink); text-decoration: none; border-bottom: 1.5px solid var(--accent); padding-bottom: 2px; }
.more-link:hover { color: var(--accent); }

/* ── Sections ── */
.section { padding: 56px 0; border-bottom: 1.5px solid var(--rule); display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0 40px; }
.section > .app-index { grid-row: 1 / span 2; }
.section-title { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4.5vw, 48px); line-height: 1.05; letter-spacing: -0.01em; margin-bottom: 28px; text-wrap: balance; }
.section-title em { font-style: italic; color: var(--accent); }
.section-body { min-width: 0; }
.lede { font-size: 18px; color: var(--muted); max-width: 640px; line-height: 1.65; }
.lede + .lede { margin-top: 16px; }

/* Smaller list rows: "More from Gamely", features, FAQ */
.rows { list-style: none; border-top: 1px solid var(--hair); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) auto; gap: 8px 40px; padding: 24px 0; border-bottom: 1px solid var(--hair); align-items: baseline; }
.row-title { font-family: var(--serif); font-weight: 400; font-size: 26px; line-height: 1.15; }
.row-title small { display: block; margin-top: 6px; font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.row p { color: var(--muted); max-width: 60ch; }
.row p + p { margin-top: 10px; }
.row-link { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-decoration: none; white-space: nowrap; border-bottom: 1.5px solid var(--accent); padding-bottom: 2px; }
.row-link:hover { color: var(--accent); }
.rows.two .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }

/* Facts table */
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); border-top: 1px solid var(--hair); }
.facts dt, .facts dd { padding: 14px 0; border-bottom: 1px solid var(--hair); }
.facts dt { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 17px; }
.facts dd { padding-left: 40px; }

/* Worked example (Math 24) */
.example { font-family: var(--serif); font-size: clamp(24px, 3.4vw, 34px); line-height: 1.3; font-variant-numeric: tabular-nums; }
.example span { color: var(--accent); }

/* Contact */
.contact-email { display: inline-block; margin-top: 24px; font-family: var(--serif); font-size: clamp(26px, 4vw, 40px); line-height: 1.1; text-decoration: none; border-bottom: 2px solid var(--accent); word-break: break-word; }
.contact-email:hover { color: var(--accent); }

/* ── Legal pages ── */
.prose { max-width: 720px; padding: 48px 0 72px; }
.prose h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 7vw, 80px); line-height: 1; letter-spacing: -0.02em; margin-bottom: 16px; }
.prose h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 48px 0 16px; padding-top: 24px; border-top: 1px solid var(--hair); }
.prose h3 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin-bottom: 16px; color: #2b2b2b; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose li ul { margin: 6px 0 0; }
.prose a { text-decoration-color: var(--accent); text-underline-offset: 2px; word-break: break-word; }
.prose strong { color: var(--ink); }
.prose .updated { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.toc { margin: 32px 0 8px; padding: 20px 0; border-top: 1.5px solid var(--rule); border-bottom: 1.5px solid var(--rule); }
.toc p { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.toc ol { columns: 2; column-gap: 32px; padding-left: 20px; margin: 0; }
.toc li { font-size: 14px; }

/* ── Footer ── */
.site-foot { padding: 28px 0 40px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.site-foot p, .site-foot a { font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.site-foot .foot-games { flex-basis: 100%; padding-bottom: 20px; border-bottom: 1px solid var(--hair); }
.site-foot .foot-games a { font-family: var(--serif); font-size: 20px; letter-spacing: 0; color: var(--ink); border-bottom: 0; }
.site-foot .foot-games a:hover { color: var(--accent); }
.site-foot a { text-decoration: none; border-bottom: 1px solid var(--muted); transition: color 0.15s, border-color 0.15s; }
.site-foot a:hover { color: var(--ink); border-color: var(--ink); }

/* ── Responsive ── */
@media (max-width: 760px) {
  .wrap { width: calc(100% - 32px); }
  .nav { gap: 18px; }
  .hero { padding: 32px 0 36px; }
  .hero-sub { flex-direction: column; align-items: flex-start; gap: 20px; }
  .hero-meta { text-align: left; white-space: normal; }
  .app-item { grid-template-columns: 32px minmax(0, 1fr); padding: 36px 0; gap: 0 16px; }
  .app-links { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; margin-top: 24px; padding-top: 0; }
  .app-links .btn { min-width: 0; flex: 1; }
  .section { grid-template-columns: 32px minmax(0, 1fr); gap: 0 16px; padding: 44px 0; }
  .group { grid-template-columns: 32px minmax(0, 1fr); gap: 0 16px; padding-top: 32px; }
  .group-head { grid-template-columns: 32px minmax(0, 1fr); gap: 6px 16px; }
  .group-head p { grid-column: 2; }
  .game-link { grid-template-columns: 72px minmax(0, 1fr) 20px; gap: 4px 16px; padding: 18px 0; }
  .game-icon { width: 72px; height: 72px; border-radius: 17px; }
  .game-text { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .game-text .game-soon { grid-column: 1; }
  .game-name { font-size: 32px; }
  .app-head { grid-template-columns: 80px minmax(0, 1fr); gap: 16px 18px; }
  .app-icon { width: 80px; height: 80px; border-radius: 19px; }
  .app-head .app-actions { grid-column: 1 / -1; }
  .app-actions .btn { flex: 1; min-width: 0; }
  .highlights li { padding: 24px 0 26px; }
  .row, .rows.two .row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts dt { border-bottom: 0; padding-bottom: 0; }
  .facts dd { padding-left: 0; padding-top: 4px; }
  .toc ol { columns: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── Language switch ── */
.lang-switch { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted); text-decoration: none; padding: 6px 12px; border: 1px solid var(--hair); }
.lang-switch:hover { color: var(--ink); border-color: var(--ink); }

/* ── Simplified Chinese ── */
:lang(zh) { --serif: 'DM Serif Display', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
            --sans: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif; }
:lang(zh) body { line-height: 1.75; }
:lang(zh) em, :lang(zh) .group-title, :lang(zh) .room-title span { font-style: normal; }
:lang(zh) .hero-title, :lang(zh) .app-title, :lang(zh) .game-name, :lang(zh) .highlights h3, :lang(zh) .section-title, :lang(zh) .prose h1, :lang(zh) .prose h2 { font-weight: 700; letter-spacing: 0; }
:lang(zh) .hero-home .hero-title { line-height: 1.15; }
:lang(zh) .kicker, :lang(zh) .game-soon { letter-spacing: 0.08em; }
.nobr { display: inline-block; }
:lang(zh) .game-name { white-space: normal; }
