/* LWP Games — shared styles.
   Self-contained: no external fonts, no CDNs, no build step. */

/* ---------- tokens ---------- */
:root {
  --bg: #f5f2eb;
  --bg-alt: #efeade;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --text: #2e3140;
  --muted: #6b6e7d;
  --line: #e3ded2;
  --accent: #2d8a7d;
  --accent-hover: #24705f;
  --accent-soft: rgba(45, 138, 125, .1);
  --tile: #3db8a8;
  --coral: #ef6b5e;
  --magenta: #e05fc4;
  --amber: #f0b429;
  --shadow: 0 1px 2px rgba(46, 49, 64, .05), 0 8px 24px rgba(46, 49, 64, .07);
  --shadow-lg: 0 2px 4px rgba(46, 49, 64, .06), 0 20px 48px rgba(46, 49, 64, .14);
  --radius: 18px;
  --radius-sm: 12px;
  --ring: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent);
}

:root:not([data-theme="light"]) {
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17171b;
    --bg-alt: #1d1d23;
    --surface: #24242c;
    --surface-2: #2b2b34;
    --text: #eaeaf2;
    --muted: #a2a3b2;
    --line: #35353f;
    --accent: #46c3ae;
    --accent-hover: #63d6c2;
    --accent-soft: rgba(70, 195, 174, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 20px 48px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17171b;
  --bg-alt: #1d1d23;
  --surface: #24242c;
  --surface-2: #2b2b34;
  --text: #eaeaf2;
  --muted: #a2a3b2;
  --line: #35353f;
  --accent: #46c3ae;
  --accent-hover: #63d6c2;
  --accent-soft: rgba(70, 195, 174, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .35), 0 20px 48px rgba(0, 0, 0, .5);
}

:root[data-theme="light"] { color-scheme: light; }

/* ---------- base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5rem; }
h1 { font-size: clamp(2rem, 1.3rem + 3vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h3 { font-size: 1.1rem; letter-spacing: -0.01em; }
p { margin: 0 0 1rem; }

.wrap { width: min(1080px, 100% - 2.5rem); margin-inline: auto; }
/* Text pages keep a readable line length, but stay flush with the header and
   with every other page's content — never a centred column in a wide shell. */
.prose > * { max-width: 720px; }
.prose.center > * { margin-inline: auto; }
.section { padding: clamp(3rem, 8vw, 5.5rem) 0; }
.section-alt { background: var(--bg-alt); }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em; font-size: .75rem;
  font-weight: 700; color: var(--accent); margin: 0 0 .5rem;
}
.lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.muted { color: var(--muted); }

.skip {
  position: absolute; left: -9999px; top: 0; background: var(--surface);
  padding: .75rem 1rem; border-radius: 0 0 var(--radius-sm) 0; z-index: 100;
}
.skip:focus { left: 0; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 1px 12px rgba(0,0,0,.04); }
.site-header .wrap {
  display: flex; align-items: center; gap: 1rem;
  min-height: 62px; padding-block: .5rem;
}
.brand {
  font-weight: 700; text-decoration: none; color: var(--text);
  display: inline-flex; align-items: center; gap: .55rem; letter-spacing: -0.01em;
  margin-right: auto; white-space: nowrap;
}
.brand .mark {
  width: 28px; height: 28px; border-radius: 9px; background: var(--tile);
  display: grid; place-items: center; color: #fff; font-size: 15px; flex: none;
}
.nav { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500;
  padding: .4rem .6rem; border-radius: 999px; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 650; background: var(--accent-soft); }

.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 36px; height: 36px; border-radius: 999px; cursor: pointer; flex: none;
  display: grid; place-items: center; font-size: 15px; line-height: 1;
  transition: border-color .15s, transform .15s;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(-12deg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; text-decoration: none;
  font-weight: 650; font-size: 1rem; padding: .8rem 1.5rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-ghost { border-color: var(--line); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin: 1.5rem 0 .5rem; }

.pill {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 650;
  padding: .3rem .7rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  letter-spacing: .01em;
}
.pill-soon { background: color-mix(in srgb, var(--amber) 18%, transparent); color: #9a6f04; }
:root[data-theme="dark"] .pill-soon { color: var(--amber); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-soon { color: var(--amber); }
}

/* ---------- hero ---------- */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero-grid {
  display: grid; gap: clamp(2rem, 5vw, 3.5rem); align-items: center;
  grid-template-columns: 1.15fr .85fr;
}
.hero h1 { margin-bottom: 1rem; }
.hero .lede { font-size: 1.2rem; }

/* decorative animated board */
.board {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem;
  aspect-ratio: 1; width: min(340px, 100%); margin-inline: auto;
  padding: .65rem; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.cell { border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; }
.cell.arrow { color: #fff; font-size: clamp(20px, 5vw, 30px); font-weight: 700; }
.cell.a1 { background: var(--tile); }
.cell.a2 { background: var(--coral); }
.cell.a3 { background: var(--magenta); border-radius: 50%; }
.cell.glyph {
  background: var(--tile); color: #fff; font-weight: 700;
  font-size: clamp(22px, 5vw, 34px);
}
@media (prefers-reduced-motion: no-preference) {
  .cell.glyph { animation: breathe 3.6s ease-in-out infinite; }
}
@media (prefers-reduced-motion: no-preference) {
  .cell.a1 { animation: slideUp 5.5s ease-in-out infinite; }
  .cell.a2 { animation: slideRight 5.5s ease-in-out .7s infinite; }
  .cell.a3 { animation: spin 5.5s ease-in-out 1.4s infinite; }
}
@keyframes slideUp {
  0%, 12% { transform: translateY(0); opacity: 1; }
  26% { transform: translateY(-190%); opacity: 0; }
  27%, 100% { transform: translateY(0); opacity: 1; }
}
@keyframes slideRight {
  0%, 14% { transform: translateX(0); opacity: 1; }
  30% { transform: translateX(210%); opacity: 0; }
  31%, 100% { transform: translateX(0); opacity: 1; }
}
@keyframes spin {
  0%, 16% { transform: rotate(0deg); }
  32% { transform: rotate(90deg); }
  33%, 100% { transform: rotate(0deg); }
}

/* ---------- hero carousel (home) ----------
   Cross-fades animated panels, one per game. The first panel carries .active
   in the markup, so with JS off you get a single static illustration. */
.carousel { width: min(360px, 100%); margin-inline: auto; }
.carousel .frame {
  position: relative; aspect-ratio: 1; border-radius: 28px; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  padding: 1.15rem;
}
.carousel .slide {
  position: absolute; inset: 1.15rem; display: grid; place-items: center;
  opacity: 0; transition: opacity .7s ease; pointer-events: none;
}
.carousel .slide.active { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .carousel .slide { transition: none; }
}
/* boards sit flat inside the frame — the frame already provides the card */
.carousel .slide .board,
.carousel .slide .blocks {
  box-shadow: none; background: none; padding: 0; width: 100%; border-radius: 0;
}

/* generic "mobile games" panel: a grid of app tiles that breathe */
.apps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem;
  width: 100%; aspect-ratio: 1;
}
.apps span { border-radius: 18px; background: var(--surface-2); }
.apps .t1 { background: var(--tile); }
.apps .t2 { background: var(--coral); }
.apps .t3 { background: var(--magenta); }
.apps .t4 { background: var(--amber); }
@media (prefers-reduced-motion: no-preference) {
  .apps span { animation: breathe 3.6s ease-in-out infinite; }
  .apps span:nth-child(2) { animation-delay: .18s; }
  .apps span:nth-child(3) { animation-delay: .36s; }
  .apps span:nth-child(4) { animation-delay: .12s; }
  .apps span:nth-child(5) { animation-delay: .3s; }
  .apps span:nth-child(6) { animation-delay: .48s; }
  .apps span:nth-child(7) { animation-delay: .24s; }
  .apps span:nth-child(8) { animation-delay: .42s; }
  .apps span:nth-child(9) { animation-delay: .6s; }
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(.9); }
}

/* ---------- App Store badge (Apple's official artwork, served locally) ---------- */
.appstore { display: inline-block; line-height: 0; border-radius: 8px; }
.appstore img { width: 150px; height: auto; }
.appstore:hover { opacity: .85; }
:root[data-theme="dark"] .appstore img { filter: invert(1); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .appstore img { filter: invert(1); }
}
.carousel .dots { display: flex; gap: .4rem; justify-content: center; margin-top: .9rem; }
.carousel .dot {
  width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px;
  background: var(--line); cursor: pointer; transition: background .2s ease, width .2s ease;
}
.carousel .dot:hover { background: var(--muted); }
.carousel .dot[aria-current="true"] { background: var(--accent); width: 22px; }
.carousel .cap {
  text-align: center; font-size: .85rem; color: var(--muted); margin: .6rem 0 0; min-height: 1.2em;
}

/* single screenshot hero (product pages) */
.hero-shot {
  width: min(280px, 100%); margin-inline: auto; border-radius: 28px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
}

/* ---------- block-puzzle motif (Rush Out) ---------- */
.blocks {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem;
  aspect-ratio: 1; width: min(340px, 100%); margin-inline: auto;
  padding: .6rem; background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg);
}
.blocks .b { border-radius: 9px; background: var(--surface-2); }
.blocks .b.f { background: var(--tile); }
.blocks .b.f2 { background: var(--coral); }
.blocks .b.f3 { background: var(--magenta); }
.blocks .b.f4 { background: var(--amber); }
@media (prefers-reduced-motion: no-preference) {
  .blocks .row-clear { animation: rowClear 4.5s ease-in-out infinite; }
  .blocks .drop { animation: drop 4.5s ease-in-out infinite; }
}
@keyframes rowClear {
  0%, 45% { opacity: 1; transform: scale(1); }
  60% { opacity: 0; transform: scale(.6); }
  61%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes drop {
  0% { transform: translateY(-140%); opacity: 0; }
  18%, 100% { transform: translateY(0); opacity: 1; }
}

/* ---------- cards ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .35rem; }
.card p:last-child { margin-bottom: 0; }
.card .icon {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  font-size: 20px; color: #fff; margin-bottom: .9rem; background: var(--tile);
}
.icon-coral { background: var(--coral) !important; }
.icon-magenta { background: var(--magenta) !important; }
.icon-amber { background: var(--amber) !important; }

/* game card */
.game-card {
  display: grid; grid-template-columns: 96px 1fr; gap: 1.25rem; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); text-decoration: none; color: inherit;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.game-card:hover, .game-card:focus-visible {
  transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent); color: inherit;
}
.game-card .art {
  width: 96px; height: 96px; border-radius: 22px; background: var(--tile);
  display: grid; place-items: center; color: #fff; font-size: 44px; flex: none;
}
.game-card h3 { font-size: 1.25rem; }
.game-card .meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .85rem; }
.game-card .go { color: var(--accent); font-weight: 650; font-size: .93rem; margin-top: .85rem; display: inline-block; }
.game-card:hover .go { text-decoration: underline; }
@media (max-width: 520px) {
  .game-card { grid-template-columns: 1fr; }
  .game-card .art { width: 72px; height: 72px; font-size: 34px; }
}

/* ---------- feature list ---------- */
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.features li { display: grid; grid-template-columns: 26px 1fr; gap: .75rem; align-items: start; }
.features .tick {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: .25rem;
}

/* ---------- screenshots ---------- */
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.shot {
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  background: none; padding: 0; cursor: zoom-in; display: block; width: 100%;
  transition: transform .18s ease, box-shadow .18s ease;
}
.shot:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.shot img { width: 100%; }

.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  background: rgba(10, 10, 14, .88); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 1.5rem;
}
.lightbox[open], .lightbox.open { display: flex; }
.lightbox img { max-height: 86vh; width: auto; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.lightbox .lb-close, .lightbox .lb-nav {
  position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 20px;
  display: grid; place-items: center; transition: background .15s;
}
.lightbox .lb-close:hover, .lightbox .lb-nav:hover { background: rgba(255, 255, 255, .26); }
.lightbox .lb-close { top: 1.25rem; right: 1.25rem; }
.lightbox .lb-prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-caption {
  position: absolute; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.85); font-size: .9rem; text-align: center; max-width: 80%;
}

/* ---------- FAQ ---------- */
.faq { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  cursor: pointer; padding: 1.1rem 1.35rem; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  transition: background .15s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { background: var(--surface-2); }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; font-weight: 400; flex: none; }
.faq details[open] summary::after { content: "\2212"; }
.faq .answer { padding: 0 1.35rem 1.25rem; color: var(--muted); }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- text pages ---------- */
.page-head { padding: clamp(2.5rem, 6vw, 4rem) 0 1rem; }
.doc h2 { margin-top: 2.5rem; }
.doc ul { padding-left: 1.2rem; }
.doc li { margin: .4rem 0; }
.callout {
  border-left: 3px solid var(--accent); background: var(--surface); padding: 1.1rem 1.35rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.5rem 0; box-shadow: var(--shadow);
}
.callout p:last-child { margin-bottom: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 3rem 0 2.5rem; margin-top: 4rem; color: var(--muted); font-size: .92rem; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; justify-content: space-between; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .links { display: flex; flex-wrap: wrap; gap: 1.25rem; }

/* ---------- reveal ----------
   Scoped to .js so the content is never hidden when JavaScript is blocked,
   fails to load, or hasn't run yet. No .js class => plain visible content. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
  .js .reveal.in { opacity: 1; transform: none; }
}

@media (max-width: 820px) {
  /* headline leads on narrow screens; the decorative board follows it */
  .hero-grid { grid-template-columns: 1fr; }
  .board { width: min(280px, 100%); }
}
@media (max-width: 600px) {
  .site-header .wrap { flex-wrap: wrap; min-height: 0; }
  .brand { margin-right: auto; }
  .nav { width: 100%; order: 3; gap: .15rem; }
  .nav a { padding: .35rem .5rem; font-size: .88rem; }
}
