/* Mock landing (EP-001.T-05). Palette and fonts follow the game (client/styles/tokens.css). */
:root {
  --sky-top: #0f1633;
  --sky-mid: #1f2a55;
  --sky-low: #3a3f6e;
  --parchment: #FBF6EC;
  --gold: #AB8248;
  --gold-light: #E0BD7B;
  --glow: #F7B44F;
  --glass: rgba(15, 22, 51, .55);
  --glass-line: rgba(224, 189, 123, .22);
  --font-display: 'Philosopher', Georgia, serif;
  --font-ui: 'Nunito', system-ui, sans-serif;
  /* Game panel width (EP-023, decision C2). Settings, not numbers in landing.js: the script reads the limits
     and the keyboard steps from these tokens. --panel-user-w is the viewer's choice (landing.js, localStorage);
     the clamp keeps it inside the limits whatever the viewport. */
  --panel-min: 320px;
  --panel-default: 420px;
  --panel-max: min(960px, calc(100vw - 360px));   /* the page keeps at least 360 px */
  --panel-step: 16px;                              /* ← / → on the handle */
  --panel-step-big: 64px;                          /* Shift + ← / →, Page Up / Page Down */
  --panel-handle: 12px;                            /* hit area of the resize edge */
  --panel-w: clamp(var(--panel-min), var(--panel-user-w, var(--panel-default)), var(--panel-max));
  --t-panel: .35s;
  /* hero kins: the glow and clouds fade in with the first kin, then each kin rises in after the previous one */
  --t-kin-scene: .9s;
  --t-kin-in: .6s;
  --kin-stagger: 220ms;                            /* read by landing.js */
  --kin-wait-max: 4000ms;                          /* read by landing.js: a kin shows after this even if a layer is late */
  --kin-rise: 8%;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%) fixed;
  color: var(--parchment);
  font: 500 17px/1.55 var(--font-ui);
}
a { color: var(--gold-light); }

/* the page is a size container: with the game panel open it gets narrower, and its blocks reflow by its own width */
.page { max-width: 1120px; margin: 0 auto; padding: 0 20px; container-type: inline-size; }

.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand img { border-radius: 10px; }
.brand-name { font: 700 24px var(--font-display); letter-spacing: .02em; }
.top-nav { display: flex; gap: 18px; font-size: 15px; }
.top-nav a { text-decoration: none; opacity: .85; }
.top-nav a:hover { opacity: 1; text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--glow);
  border-radius: 999px;
  color: var(--glow);
  font: 700 12px/1.6 var(--font-ui);
  text-transform: uppercase;
  letter-spacing: .08em;
  vertical-align: middle;
}
.badge.small { font-size: 10px; padding: 0 6px; }

.hero { display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; align-items: center; padding: 48px 0 32px; }
.hero h1 { font: 700 clamp(34px, 5vw, 56px)/1.1 var(--font-display); margin: 0 0 16px; }
.lead { font-size: 19px; opacity: .9; max-width: 34em; }
.note { font-size: 14px; opacity: .65; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 12px; }

/* hero art: kins of the game by the lantern light, standing in a cloud (landing.js, HERO_KINS). Layers, back to front:
   glow, back cloud, back row, mid cloud (hides the back row's feet: they stand in it), front row. The cloud band of
   the game is opaque at the bottom, so both clouds fade out to every side through a soft elliptical mask. */
.hero-art { position: relative; aspect-ratio: 1; max-height: 70vh; width: 100%; margin-inline: auto; }
.kin-glow, .kin-cloud { opacity: 0; transition: opacity var(--t-kin-scene) ease-out; }
.hero-art.ready .kin-glow, .hero-art.ready .kin-cloud { opacity: 1; }
.hero-art.ready .kin-cloud.mid { opacity: .92; }
.kin-glow {
  position: absolute; inset: -16% -20% -4%; border-radius: 50%; mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(247, 180, 79, .30), rgba(247, 180, 79, .14) 35%, rgba(247, 180, 79, .05) 65%, transparent);
}
.kin-cloud {
  position: absolute; left: -12%; width: 124%; object-fit: cover; pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, rgba(0, 0, 0, .7) 60%, rgba(0, 0, 0, .25) 82%, transparent);
  mask-image: radial-gradient(closest-side, #000 35%, rgba(0, 0, 0, .7) 60%, rgba(0, 0, 0, .25) 82%, transparent);
}
.kin-cloud.back { bottom: 2%; height: 56%; object-position: 50% 20%; filter: blur(1px) brightness(.85); }
.kin-cloud.mid { bottom: -8%; height: 46%; object-position: 30% 35%; }
.kin-row { position: absolute; inset: 0; }
/* --x is the kin's centre, --y the bottom of its square, % of the art square. margin, not translate: the game's
   .kinfig uses translate for its feet line (--feet-shift) */
.hero-kin {
  position: absolute; width: var(--size); left: var(--x); bottom: var(--y); margin-inline-start: calc(var(--size) / -2);
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .35));
  opacity: 0; transform: translateY(var(--kin-rise)) scale(.96);
  transition: opacity var(--t-kin-in) ease-out, transform var(--t-kin-in) cubic-bezier(.2, .8, .3, 1.2);
}
.hero-kin.in { opacity: 1; transform: none; }
.kin-row.back .hero-kin { filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .3)) brightness(.9); }
.kin-row.back .hero-kin:nth-child(1) { --size: 30%; --x: 23%; --y: 30%; }
.kin-row.back .hero-kin:nth-child(2) { --size: 30%; --x: 50%; --y: 33%; }
.kin-row.back .hero-kin:nth-child(3) { --size: 30%; --x: 77%; --y: 30%; }
.kin-row.front .hero-kin:nth-child(1) { --size: 38%; --x: 22%; --y: 6%; }
.kin-row.front .hero-kin:nth-child(2) { --size: 44%; --x: 50%; --y: 2%; }
.kin-row.front .hero-kin:nth-child(3) { --size: 38%; --x: 78%; --y: 6%; }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 20px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: var(--glass);
  color: var(--parchment);
  font: 700 16px var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.btn:hover { border-color: var(--gold-light); background: rgba(31, 42, 85, .8); }
.btn.primary { background: linear-gradient(180deg, #f7c46a, var(--gold)); color: #2b1f12; border-color: var(--gold-light); }
.btn.primary:hover { background: linear-gradient(180deg, #fbd488, #b88c50); }
.btn:focus-visible, .panel-close:focus-visible, .panel-link:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn { white-space: nowrap; }
.btn .meta { font-weight: 500; font-size: 13px; opacity: .75; }
#ext-download { flex-wrap: wrap; row-gap: 2px; }

.surfaces { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 24px 0 56px; }
.card { padding: 22px; border: 1px solid var(--glass-line); border-radius: 18px; background: var(--glass); backdrop-filter: blur(6px); }
.card h2 { font: 700 22px var(--font-display); margin: 0 0 8px; color: var(--gold-light); }
.card p { margin: 0 0 16px; opacity: .88; }
.card .hint { font-size: 13px; opacity: .65; margin: 12px 0 0; }

.foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 0 28px; font-size: 13px; opacity: .6; border-top: 1px solid var(--glass-line); }
#api-status.ok::before { content: "● "; color: #7bd88f; }
#api-status.down::before { content: "● "; color: #e07b7b; }

/* ── game side panel (like Chrome's side panel): beside the page, resizable by its left edge ── */
.panel {
  position: fixed; top: 0; right: 0; z-index: 20;
  width: var(--panel-w); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--sky-top);
  border-inline-start: 1px solid var(--glass-line);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform var(--t-panel) cubic-bezier(.6, 0, .25, 1), visibility 0s linear var(--t-panel);
}
.panel.open { transform: none; visibility: visible; transition: transform var(--t-panel) cubic-bezier(.6, 0, .25, 1); }
.panel-bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-bottom: 1px solid var(--glass-line); }
.panel-title { font: 700 17px var(--font-display); flex: 1; }
.panel-link { font-size: 13px; }
.panel-close {
  width: 34px; height: 34px; border-radius: 10px;
  border: 1px solid var(--glass-line); background: transparent; color: var(--parchment);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.panel-close:hover { border-color: var(--gold); }
.panel-frame { flex: 1; width: 100%; border: 0; background: var(--sky-top); }
.panel-resize {
  position: absolute; inset-block: 0; inset-inline-start: calc(var(--panel-handle) / -2); z-index: 1;
  width: var(--panel-handle);
  cursor: col-resize; touch-action: none;
}
.panel-resize::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: calc(50% - 1px);
  width: 2px; background: transparent; transition: background .2s;
}
.panel-resize:hover::after, .panel-resizing .panel-resize::after { background: var(--gold); }
.panel-resize:focus-visible { outline: none; }
.panel-resize:focus-visible::after { inset-inline-start: calc(50% - 2px); width: 4px; background: var(--glow); }
/* while dragging: the game iframe would swallow the pointer, and no transition may lag behind it */
.panel-resizing, .panel-resizing * { cursor: col-resize; user-select: none; }
.panel-resizing .panel-frame { pointer-events: none; }
.panel-resizing .panel, .panel-resizing body { transition: none; }

/* like Chrome's side panel: the page makes room instead of being covered */
@media (min-width: 641px) {
  body { transition: padding-inline-end var(--t-panel) cubic-bezier(.6, 0, .25, 1); }
  body.panel-open { padding-inline-end: var(--panel-w); }
}

@container (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 24px; gap: 8px; }
  .hero-art { max-width: 340px; }
}
@container (max-width: 600px) {
  .top-nav a[href="#surfaces"] { display: none; }
}
@media (max-width: 640px) {
  :root { --panel-w: 100vw; }
  body.panel-open { overflow: hidden; }
  .panel-resize { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .panel, .panel.open, body { transition: none; }
  .hero-kin, .kin-glow, .kin-cloud { transition: none; transform: none; }
}
