/*
 * landing.css — the shared design system for every static landing page (SEO
 * pages, game guides, grade and topic hubs).
 *
 * One system: one type scale, one spacing scale, one radius scale, one button
 * style, one colour story. The page is a warm classroom-desk cream; headings
 * are set in Outfit, body copy in Instrument Sans, figures and labels in DM
 * Mono. Links draw their underline, cards lift 2px, buttons step on hover and
 * press on click, and the hero enters once on load. Everything honours
 * prefers-reduced-motion.
 *
 * The three faces are self-hosted (/styles/fonts.css) so the site renders the
 * same in every region — Google Fonts is unreachable from mainland China.
 *
 * Loaded with <link rel="stylesheet" href="/styles/landing.css?v=2"> before any
 * per-page <style> block, so pages that ship bespoke styles keep them.
 */

:root {
  /* palette: warm paper, ink navy, cobalt accent, brass detail, pine success */
  --ink: #171a21;
  --ink-2: #2b313c;
  --muted: #5c6472;
  --line: rgba(23, 26, 33, 0.13);
  --line-soft: rgba(23, 26, 33, 0.07);
  --paper: #f4efe2;
  --paper-deep: #ebe3d0;
  --surface: #fffdf7;
  --surface-2: #faf5e9;
  --surface-strong: #ffffff;
  --accent: #1a4b8f;
  --accent-deep: #123a72;
  --accent-soft: #e7edf9;
  --brass: #a96f12;
  --brass-ink: #6b4a10;
  --brass-bright: #e9ad3d;
  --brass-soft: #fbf1da;
  --pine: #1c6a52;
  --pine-deep: #14513f;
  --pine-soft: #e4f1eb;
  --stage: #161c28;
  --stage-ink: #f6f2e8;

  /* Legacy aliases. Pages that ship their own <style> block still speak the
     old token names; map them onto the current palette instead of letting
     them fall back to an invalid value. */
  --blue: var(--accent);
  --green: var(--pine);
  --gold: var(--brass-bright);

  /* one radius scale */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;

  /* one spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  --page: 1120px;
  --measure: 62ch;
  --shadow-1: 0 1px 2px rgba(23, 26, 33, 0.05), 0 8px 22px rgba(23, 26, 33, 0.06);
  --shadow-2: 0 2px 6px rgba(23, 26, 33, 0.07), 0 18px 44px rgba(23, 26, 33, 0.1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 180ms;

  --font-display: "Outfit", "Avenir Next", "Segoe UI", system-ui, -apple-system,
    "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-text: "Instrument Sans", "Segoe UI", system-ui, -apple-system,
    "PingFang SC", "Hiragino Sans", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0) 60%),
    var(--paper);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.75;
  letter-spacing: -0.003em;
  -webkit-text-size-adjust: 100%;
}

header,
main,
footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 24px;
}

header {
  padding-top: 44px;
}

main {
  padding-bottom: 56px;
}

/* ---------------------------------------------------------------- type */

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.32rem + 3.1vw, 3.4rem);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.026em;
  margin: 0.24em 0 0.42em;
  text-wrap: balance;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.42rem, 1.2rem + 0.9vw, 1.95rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.018em;
  margin: 0 0 10px;
  text-wrap: balance;
}

h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

p {
  margin: 0 0 18px;
  color: var(--ink-2);
}

strong {
  color: var(--ink);
  font-weight: 700;
}

a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  transition: color var(--dur) var(--ease), background-size 240ms var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--accent-deep);
  background-size: 100% 1px;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(26, 75, 143, 0.45);
  outline-offset: 3px;
  border-radius: 6px;
}

ul,
ol {
  margin: 0 0 18px;
  padding-left: 24px;
  color: var(--ink-2);
}

li {
  margin: 8px 0;
}

li::marker {
  color: var(--brass);
  font-weight: 700;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

/* Prose keeps a readable measure; tables, cards and grids stay full width. */
main > p,
main > ul,
main > ol {
  max-width: var(--measure);
}

main > p:first-of-type {
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--ink-2);
}

main > h2 {
  position: relative;
  margin: 52px 0 14px;
  padding-top: 26px;
  border-top: 1px solid var(--line-soft);
}

main > h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 56px;
  height: 2px;
  background: var(--brass-bright);
  border-radius: 2px;
}

main > h2:first-of-type {
  margin-top: 12px;
}

main > p:last-child,
main > ul:last-child,
main > ol:last-child {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------- blocks */

section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  margin: 22px 0;
  box-shadow: var(--shadow-1);
}

section > h2:first-child,
section > h3:first-child {
  margin-top: 0;
}

/* ---------------------------------------------------------------- tables */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 20px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.97rem;
  line-height: 1.62;
  box-shadow: var(--shadow-1);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  overflow-wrap: anywhere;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:nth-child(even) {
  background: rgba(250, 245, 233, 0.7);
}

/* Quick-facts tables: keep the row label readable instead of splitting it
   mid-word ("Spiel|typ") on narrow screens. The label column is sized to its
   text so the value starts right after it instead of 400px down the page. */
th[scope="row"] {
  width: 190px;
  min-width: 150px;
  overflow-wrap: break-word;
  color: var(--ink);
  font-weight: 600;
}

/* A facts table has no reason to stretch the full page width. */
table:has(th[scope="row"]) {
  max-width: 880px;
}

thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- buttons */

/* The one button style: a filled pill that steps on hover and presses down. */
.cta,
.seo-cta,
main > p:has(> a[href^="/play/"]:only-child) a,
.hero-copy > p:has(> a[href^="/play/"]:only-child) a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--pine);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  background-image: none;
  box-shadow: 0 10px 24px rgba(28, 106, 82, 0.24);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.cta:hover,
.seo-cta:hover,
main > p:has(> a[href^="/play/"]:only-child) a:hover,
.hero-copy > p:has(> a[href^="/play/"]:only-child) a:hover {
  background: var(--pine-deep);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(28, 106, 82, 0.3);
}

.cta:active,
.seo-cta:active,
main > p:has(> a[href^="/play/"]:only-child) a:active,
.hero-copy > p:has(> a[href^="/play/"]:only-child) a:active {
  transform: translateY(1px);
  box-shadow: 0 6px 14px rgba(28, 106, 82, 0.24);
}

main > p:has(> a[href^="/play/"]:only-child),
.hero-copy > p:has(> a[href^="/play/"]:only-child) {
  margin: 24px 0 28px;
}

.hero-copy > p:has(> a[href^="/play/"]:only-child) {
  margin: 22px 0 4px;
}

/* ---------------------------------------------------------------- chips */

p.related {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

p.related a,
p.classroom-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  background-image: none;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

p.related a:hover,
p.classroom-actions a:hover {
  background: var(--surface-strong);
  border-color: rgba(26, 75, 143, 0.45);
  color: var(--accent-deep);
  transform: translateY(-2px);
}

/* Classroom / teacher action row */
p.classroom-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.94rem;
  color: var(--muted);
}

/* ---------------------------------------------------------------- grids */

.grid,
.cards,
.facts,
.stats,
.game-grid,
.activity-grid,
.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.card,
.fact,
.game,
.activity,
.share-card,
.note,
.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 18px;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

a.card:hover,
a.fact:hover,
a.game:hover,
a.activity:hover,
a.share-card:hover {
  background: var(--surface-strong);
  border-color: rgba(26, 75, 143, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.stat {
  text-align: center;
  background: var(--surface-strong);
}

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------------------------------------------------------------- links */

.seo-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-left: 0;
}

.seo-nav-links li {
  margin: 0;
}

.seo-nav-links a {
  display: inline-block;
  padding: 2px 0;
}

.seo-nav-group h3 {
  margin: 22px 0 8px;
  font-family: var(--font-display);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.checklist {
  max-width: 780px;
}

.checklist li {
  margin-bottom: 10px;
}

.note {
  background: var(--brass-soft);
  border-color: rgba(169, 111, 18, 0.28);
  border-left: 3px solid var(--brass-bright);
}

pre {
  background: var(--stage);
  color: var(--stage-ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.7;
}

blockquote {
  margin: 20px 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--brass-bright);
  color: var(--muted);
}

/* ---------------------------------------------------------------- hero */

.eyebrow {
  color: var(--brass);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding: clamp(20px, 3vw, 40px) 0 clamp(8px, 1.5vw, 20px);
}

/* The hero enters once on load. */
.hero > * {
  animation: nd-rise 520ms var(--ease) both;
}

.hero > *:nth-child(2) {
  animation-delay: 80ms;
}

.hero > *:nth-child(3) {
  animation-delay: 160ms;
}

@keyframes nd-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.visual {
  min-height: 240px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(130% 110% at 18% 0%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 58%),
    linear-gradient(150deg, #f8f0dc 0%, #e7dcc2 100%);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4.6vw, 2.9rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--accent-deep);
}

/* The hero copy column holds the eyebrow, headline, lead paragraph and the
   play button. Everything else on the page stays in <main>. */
.hero-copy {
  max-width: 42rem;
}

/* The brand lock: one mark, one position, on every landing page. */
.brand-lock {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-lock:hover {
  color: var(--accent);
}

.brand-lock .brand-mark {
  display: block;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 4px rgba(26, 75, 143, 0.24));
}

.hero-copy > p {
  max-width: 46ch;
  font-size: 1.12rem;
  line-height: 1.68;
  color: var(--ink-2);
}

.hero-copy > p.eyebrow {
  margin: 0 0 10px;
}

.hero-copy > h1 {
  margin-top: 0.12em;
}

.hero-copy > a.cta {
  margin-top: 4px;
}

/* Hero art is decoration: a text-free SVG that scales with the card. */
.visual svg.hero-art {
  display: block;
  width: min(100%, 300px);
  height: auto;
}

.cta {
  margin-top: 14px;
}

/* ---------------------------------------------------------------- breadcrumb */

main > p.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-bottom: 10px;
  max-width: none;
}

main > p.breadcrumb a {
  color: var(--muted);
  font-weight: 500;
  background-image: linear-gradient(currentColor, currentColor);
}

main > p.breadcrumb a:hover {
  color: var(--accent);
}

/* The breadcrumb lives in the hero, above the headline. */
.hero-copy > p.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: var(--muted);
  max-width: none;
  margin: 0 0 14px;
}

.hero-copy > p.breadcrumb a {
  color: var(--muted);
  font-weight: 500;
  background-image: linear-gradient(currentColor, currentColor);
}

.hero-copy > p.breadcrumb a:hover {
  color: var(--accent);
}

/* ---------------------------------------------------------------- footer */

footer {
  color: var(--muted);
  font-size: 0.94rem;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

footer a {
  color: var(--muted);
}

footer a:hover {
  color: var(--accent);
}

/* -------------------------------------------------- locale landing pages */

.seo-content {
  max-width: var(--page);
}

.seo-content > section {
  margin: 26px 0;
}

.seo-content > section:first-child {
  margin-top: 8px;
}

.seo-content h1 {
  margin-top: 0.1em;
}

.seo-content > section > p:first-of-type:not(.eyebrow) {
  font-size: 1.1rem;
  color: var(--muted);
}

.seo-content .seo-cta {
  margin: 18px 0 8px;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .visual {
    min-height: 190px;
  }
}

@media (max-width: 760px) {
  header,
  main,
  footer {
    padding: 18px;
  }

  header {
    padding-top: 26px;
  }

  main {
    padding-bottom: 40px;
  }

  section {
    padding: 20px;
  }

  /* Narrow columns used to chop words mid-syllable ("Produc|t-Duel-Regeln").
     Hyphenation at the language's own syllable breaks keeps German and
     Spanish compounds readable without forcing the table wider than the
     viewport. */
  main table th,
  main table td {
    overflow-wrap: normal;
    hyphens: auto;
  }

  thead th {
    position: static;
  }

}

/* Wide tables (three or more columns) sit inside a scroll wrapper so they
   keep readable column widths on a phone instead of squeezing into three
   120px columns that break every word mid-syllable. */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 760px) {
  .table-wrap > table {
    min-width: 34rem;
  }
}

/* Wide reference tables become card grids on a desktop screen: one card per
   row, every field named by its column header. The table markup stays put,
   so the header row still reaches search engines and screen readers. */
@media (min-width: 900px) {
  .table-cards {
    overflow: visible;
  }

  .table-cards > table,
  .table-cards > table > tbody,
  .table-cards > table > tbody > tr,
  .table-cards > table > tbody > tr > td {
    display: block;
    width: auto;
  }

  .table-cards > table {
    margin: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .table-cards > table > thead {
    display: none;
  }

  .table-cards > table > tbody {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
    gap: 16px;
  }

  .table-cards > table > tbody > tr {
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    padding: 18px 20px;
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  }

  .table-cards > table > tbody > tr:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
  }

  .table-cards > table > tbody > tr > td {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 7px 0;
    border-bottom: 0;
  }

  .table-cards > table > tbody > tr > td + td {
    border-top: 1px solid var(--line-soft);
  }

  .table-cards > table > tbody > tr > td::before {
    content: attr(data-label);
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brass);
    line-height: 1.6;
  }

  /* The first column is the card title. */
  .table-cards > table > tbody > tr > td:first-child {
    display: block;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    line-height: 1.32;
    color: var(--ink);
    padding-bottom: 12px;
  }

  .table-cards > table > tbody > tr > td:first-child::before {
    content: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .hero > * {
    opacity: 1;
    transform: none;
  }
}

.first-puzzle { min-width: 0; margin: 1rem 0; padding: 1rem; border: 1px solid var(--pine); border-radius: var(--radius); }
.first-puzzle legend { padding: 0 .4em; font-weight: 700; }
.puzzle-choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.puzzle-choices button { min-width: 44px; min-height: 44px; font: inherit; background: var(--surface); color: var(--ink); border: 1px solid currentColor; border-radius: .5rem; cursor: pointer; }
.first-puzzle output { display: block; margin-block: .5rem; }
