/* ==========================================================================
   Black & White Games: base layout
   Structure shared by every theme. Themes (themes/*.css) set the variables
   below and add their own personality on top.
   ========================================================================== */

:root {
  /* palette: themes set --c-fg / --c-bg; everything else derives from them */
  --c-fg: #000;
  --c-bg: #fff;
  --fg: var(--c-fg);
  --bg: var(--c-bg);
  --muted-mix: 66%;
  --line-mix: 100%;

  --font-display: system-ui, sans-serif;
  --font-body: system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
  --body-size: 1.0625rem;
  --display-weight: 700;
  --display-transform: none;
  --display-tracking: 0;
  --display-leading: 1.05;

  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --section-pad: clamp(64px, 10vw, 128px);
  --radius: 0;
  --border-w: 2px;
  --grid-gap: 24px;
  --header-h: 76px;
}

/* inverted scope: swap ink and paper */
.invert { --fg: var(--c-bg); --bg: var(--c-fg); background: var(--bg); color: var(--fg); }

/* derived colours are recomputed wherever a scope may swap fg/bg */
:root, .invert, .site-footer, .site-header, .hero-art, .game-card, .game-card-emblem, .game-hero-art, .feature, .ticker, .pillar, .shot {
  --muted: color-mix(in srgb, var(--fg) var(--muted-mix), var(--bg));
  --line: color-mix(in srgb, var(--fg) var(--line-mix), var(--bg));
  --hatch: color-mix(in srgb, var(--fg) 18%, transparent);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: var(--body-size); line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, h4 {
  font-family: var(--font-display); font-weight: var(--display-weight);
  text-transform: var(--display-transform); letter-spacing: var(--display-tracking);
  line-height: var(--display-leading); margin: 0 0 .5em; text-wrap: balance;
}
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
::selection { background: var(--fg); color: var(--bg); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 12px; z-index: 200; padding: 10px 16px; background: var(--fg); color: var(--bg); }
.skip:focus { left: 12px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--bg); border-bottom: var(--border-w) solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: var(--header-h); position: relative; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark { width: 32px; height: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .02em; font-size: 1.02rem; white-space: nowrap; }
.brand-sub { font-size: .62rem; font-weight: 600; letter-spacing: .5em; text-transform: uppercase; margin-top: 5px; }
.site-nav ul { display: flex; gap: clamp(20px, 3vw, 40px); }
.site-nav a { text-decoration: none; font-size: .8rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; padding-block: 8px; background: linear-gradient(currentColor, currentColor) 0 100% / 0 2px no-repeat; transition: background-size .25s; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background-size: 100% 2px; }
.nav-toggle { display: none; align-items: center; gap: 10px; background: none; border: 0; padding: 8px 0; cursor: pointer; font-size: .8rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { display: block; width: 22px; height: 2px; background: currentColor; position: relative; transition: transform .2s; }
.nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bars::before { top: -7px; }
.nav-toggle-bars::after { top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; position: absolute; top: 100%; left: calc(var(--gutter) * -1); right: calc(var(--gutter) * -1); background: var(--bg); border-bottom: var(--border-w) solid var(--line); }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; padding: 8px var(--gutter) 20px; }
  .site-nav a { display: block; padding: 14px 0; font-size: 1rem; background: none; }
}

/* ---------- buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6em;
  padding: 1em 1.7em; border: var(--border-w) solid var(--fg); border-radius: var(--radius);
  font-family: var(--font-btn, var(--font-body)); font-weight: 700; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; line-height: 1.1; cursor: pointer;
  transition: background-color .2s, color .2s, transform .2s, box-shadow .2s;
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: transparent; color: var(--fg); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-ghost:hover { background: var(--fg); color: var(--bg); }

/* ---------- hero ---------- */
.hero { padding-block: var(--section-pad); position: relative; }
.hero-inner { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.eyebrow { display: inline-block; margin-bottom: 1.25rem; font-size: .75rem; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; }
.hero h1 { font-size: clamp(2.3rem, 7.2vw, 6rem); margin-bottom: .35em; }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); color: var(--muted); max-width: 34em; }
.hero-art { position: relative; display: grid; place-items: center; }
.hero-mark { width: 100%; max-width: 380px; height: auto; }
.hero-logo { display: none; width: 100%; max-width: 360px; height: auto; }
.hero-deco { display: none; }
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; justify-items: start; }
  .hero-mark { max-width: 140px; }
}

/* ---------- ticker ---------- */
.ticker { overflow: hidden; border-block: var(--border-w) solid var(--line); white-space: nowrap; user-select: none; }
.ticker-track { display: inline-flex; align-items: center; gap: 2.5rem; padding-block: 1.1rem; animation: ticker 50s linear infinite; }
.ticker-track > span:not(.tick-sep) { font-family: var(--font-display); font-weight: var(--display-weight); text-transform: uppercase; font-size: clamp(1.1rem, 2vw, 1.5rem); letter-spacing: .08em; }
.tick-mark { width: 16px; height: auto; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- sections ---------- */
.section { padding-block: var(--section-pad); }
.section-head { display: grid; gap: .6rem; margin-bottom: clamp(32px, 5vw, 64px); max-width: 760px; }
.section-num { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .2em; }
.section-head h2 { font-size: clamp(2rem, 4.6vw, 3.5rem); margin: 0; }
.section-head p { color: var(--muted); font-size: 1.125rem; margin: .4rem 0 0; }
.studio-section .actions { margin-top: clamp(32px, 5vw, 56px); }

/* ---------- game cards ---------- */
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); }
.game-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .game-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .game-grid:not(.game-grid-3) { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px) { .game-grid, .game-grid-3 { grid-template-columns: 1fr; } }
.game-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  text-decoration: none; color: var(--fg); background: var(--surface, transparent);
  border: var(--border-w) solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: background-color .25s, color .25s, transform .25s, box-shadow .25s, border-color .25s;
}
.game-card-emblem { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--emblem-bg, var(--fg)); color: var(--emblem-fg, var(--bg)); transition: inherit; }
.game-card-emblem .emblem { width: 30%; height: auto; transition: transform .4s; }
.game-card:hover .game-card-emblem .emblem { transform: scale(1.06); }
/* app icons (iOS-style rounded square) */
.game-icon { display: block; aspect-ratio: 1; object-fit: cover; border-radius: 22.5%; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.game-card-emblem .game-icon { height: 62%; width: auto; transition: transform .4s; }
.game-card:hover .game-card-emblem .game-icon { transform: scale(1.05); }
.game-card-body { display: flex; flex-direction: column; gap: .5rem; flex: 1; padding: clamp(20px, 3vw, 32px); }
.game-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; font-size: .7rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.game-card h3 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); margin: .25rem 0 0; }
.game-card-tagline { font-weight: 600; margin: 0; }
.game-card p { margin: 0; }
.game-card p:not(.game-card-tagline) { color: var(--muted); font-size: .98rem; }
.game-card-cta { margin-top: auto; padding-top: 1.1rem; font-size: .78rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.game-grid-3 .game-card p:not(.game-card-tagline) { display: none; }

/* ---------- pillars ---------- */
.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--grid-gap); }
.pillar-num { display: block; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .2em; margin-bottom: 1rem; }
.pillar h3 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
.pillar p { color: var(--muted); margin: 0; }
@media (max-width: 760px) { .pillars { grid-template-columns: 1fr; } }

/* ---------- newsletter / CTA ---------- */
.cta-inner { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 6vw, 96px); align-items: center; }
.cta-copy h2 { font-size: clamp(2rem, 4.6vw, 3.5rem); }
.cta-copy p { color: var(--muted); font-size: 1.1rem; max-width: 30em; }
.cta-email { font-size: .95rem !important; }
.signup { display: flex; flex-wrap: wrap; gap: 12px; }
.signup input {
  flex: 1 1 240px; min-width: 0; padding: 1em 1.1em; border: var(--border-w) solid var(--fg); border-radius: var(--radius);
  background: transparent; color: var(--fg); font-size: 1rem;
}
.signup input::placeholder { color: var(--muted); opacity: 1; }
.signup .btn { flex: 0 0 auto; }
.form-note { flex-basis: 100%; margin: 0; font-size: .85rem; color: var(--muted); }
@media (max-width: 860px) { .cta-inner { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.site-footer { padding-block: clamp(48px, 7vw, 80px) 32px; border-top: var(--border-w) solid var(--line); background: var(--bg); color: var(--fg); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-brand p { margin-top: 1.25rem; color: var(--muted); }
.footer-col h2 { font-family: var(--font-body); font-size: .72rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 1.1rem; }
.footer-col li { margin-bottom: .55rem; }
.footer-col a { text-decoration: none; color: var(--muted); transition: color .2s; }
.footer-col a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: clamp(40px, 6vw, 64px); padding-top: 24px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.footer-bottom p { margin: 0; }
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

/* ---------- game page ---------- */
.game-hero { padding-block: clamp(48px, 8vw, 104px) clamp(48px, 7vw, 88px); position: relative; }
.game-hero-inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.breadcrumb { margin-bottom: 1.5rem; font-size: .72rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.game-hero h1 { font-size: clamp(2.1rem, 9.6vw, 7rem); overflow-wrap: break-word; margin-bottom: .2em; }
.game-tagline { font-family: var(--font-display); font-size: clamp(1.3rem, 2.4vw, 1.9rem); line-height: 1.2; margin-bottom: 1rem; }
.game-hero-art { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: var(--emblem-bg, var(--fg)); color: var(--emblem-fg, var(--bg)); border-radius: var(--radius); }
.game-hero-art .emblem { width: 52%; height: auto; }
.game-hero-art .game-icon { width: 58%; height: auto; }
@media (max-width: 860px) {
  .game-hero-inner { grid-template-columns: 1fr; }
  .game-hero-art { order: -1; aspect-ratio: 16 / 9; }
  .game-hero-art .emblem, .game-hero-art .game-icon { width: auto; height: 64%; }
}

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-block: var(--border-w) solid var(--line); }
.facts > div { padding: 22px 20px 22px 0; }
.facts dt { font-size: .7rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: .35rem 0 0; font-weight: 600; font-size: 1.05rem; overflow-wrap: anywhere; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr 1fr; } }

.about-grid { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(24px, 6vw, 96px); align-items: start; }
.about-grid .section-head { margin-bottom: 0; }
.prose { font-size: clamp(1.08rem, 1.4vw, 1.22rem); max-width: 40em; }
.prose p:last-child { margin-bottom: 0; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; } }

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--grid-gap); }
.feature { padding: clamp(24px, 3.4vw, 40px); border: var(--border-w) solid var(--line); border-radius: var(--radius); background: var(--surface, transparent); }
.feature-num { display: block; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .2em; margin-bottom: 1.25rem; }
.feature h3 { font-size: clamp(1.35rem, 2vw, 1.65rem); }
.feature p { color: var(--muted); margin: 0; }
@media (max-width: 680px) { .feature-grid { grid-template-columns: 1fr; } }

.shot-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--grid-gap); }
.shot {
  display: grid; place-items: center; aspect-ratio: 16 / 9; border: var(--border-w) solid var(--line); border-radius: var(--radius);
  background: repeating-linear-gradient(-45deg, transparent 0 12px, var(--hatch) 12px 13px);
  font-size: .72rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
}
.shot span { padding: .5em 1em; background: var(--bg); }
.shot-trailer { grid-row: span 2; aspect-ratio: auto; }
@media (max-width: 680px) { .shot-grid { grid-template-columns: 1fr; } .shot-trailer { aspect-ratio: 16 / 9; grid-row: auto; } }

/* document pages: privacy, support */
.doc-hero { padding-block: clamp(48px, 8vw, 104px) clamp(24px, 4vw, 48px); border-bottom: var(--border-w) solid var(--line); }
.doc-hero h1 { font-size: clamp(2.1rem, 8.6vw, 5.6rem); overflow-wrap: break-word; margin-bottom: .3em; }
.doc-hero .lede { max-width: 42em; }
.doc > * { max-width: 52rem; }
.doc-block { padding-block: 1.6rem; border-bottom: 1px solid var(--line); }
.doc-block:first-child { padding-top: 0; }
.doc-block h2 { font-size: clamp(1.2rem, 2vw, 1.5rem); margin-bottom: .5em; }
.doc-block p { margin: 0; max-width: 42em; }
.doc-list { margin: .8rem 0 0; padding-left: 1.2em; }
.doc-list li { margin: .5rem 0; }
.doc-games { list-style: none; padding: 0; }
.doc-games li { padding: .8rem 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header-h) + 16px); }
.doc-meta { color: var(--muted); font-size: .85rem; margin-left: .4em; }
.doc-more { margin-top: 1.6rem; }

/* gameplay: video, then screenshots (one large + two stacked, or a 3-column grid of six) */
.gameplay-video { margin: 0 0 var(--grid-gap); border: var(--border-w) solid var(--line); border-radius: var(--radius); overflow: hidden; background: #000; }
.gameplay-video video { display: block; width: 100%; height: auto; max-height: 80vh; background: #000; }
.gameplay-video figcaption { padding: .7em 1em; font-size: .85rem; color: var(--muted); background: var(--bg); border-top: var(--border-w) solid var(--line); }
/* 6-column grid: the first shot is large (4 cols x 2 rows), the next two stack beside it,
   then the rest fill rows (three across for 6 shots, two across for 5) */
.shots { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--grid-gap); }
.shots figure { grid-column: span 2; }
.shots-5 figure:nth-child(n+4) { grid-column: span 3; }
.shots figure { position: relative; margin: 0; min-width: 0; overflow: hidden; border: var(--border-w) solid var(--line); border-radius: var(--radius); background: #000; }
.shots figure:first-child { grid-column: span 4; grid-row: span 2; }
.shots a { display: block; height: 100%; }
.shots img { display: block; width: 100%; height: 100%; min-height: 100%; object-fit: cover; aspect-ratio: 16 / 9; transition: transform .4s; }
.shots figure:first-child img { aspect-ratio: auto; }
.shots a:hover img { transform: scale(1.02); }
.shots figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 2.2em 1em .7em; pointer-events: none;
  font-size: .8rem; line-height: 1.3; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .75));
}
@media (max-width: 680px) {
  .shots { grid-template-columns: 1fr; }
  .shots figure, .shots figure:first-child, .shots-5 figure:nth-child(n+4) { grid-row: auto; grid-column: auto; }
  .shots figure:first-child img { aspect-ratio: 16 / 9; }
  .shots a { height: auto; }
  .shots figcaption { position: static; padding: .6em .9em; color: var(--muted); background: var(--bg); }
}
.signup-mail { display: grid; gap: .6rem; justify-items: start; align-content: center; }

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