/* leonschwahn.de — layout and game visuals. Values follow docs/handover-v1 (SCREENS.md, tokens.json). */

@font-face {
  font-family: 'Quicksand';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/quicksand-latin.woff2') format('woff2');
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--color-ink);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, p, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: var(--color-label); }
button { font: inherit; }
img { display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px;
  font: 700 var(--size-button-small)/1.2 var(--font-ui);
  white-space: nowrap; text-decoration: none; cursor: pointer;
  border: 2px solid currentColor; background: transparent; color: inherit;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}
.btn:focus-visible { outline: 3px solid var(--color-gold-deep); outline-offset: 2px; }
.btn-line { color: var(--ink, var(--color-ink)); }
.btn-ink { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); }
.btn-lime { background: var(--color-lime); border-color: var(--color-lime); color: var(--color-ink); }
.btn-paper { border-color: var(--color-paper); color: var(--color-paper); }
.done-actions .btn { flex: 1; justify-content: flex-start; padding: 12px 14px; font-size: var(--size-button); }

/* ---------------------------------------------------------------- shared pieces */

.brand { font-size: 16px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; }

.mini {
  display: inline-block; flex-shrink: 0; width: 12px; height: 12px; background: var(--c);
}
.reason-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 11px 14px;
  background: var(--color-paper); color: var(--color-ink);
  box-shadow: var(--shadow-card);
}
.reason-tag {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-label);
}
.reason-text { font-size: var(--size-reason); line-height: 1.35; }
.reason-card.is-new { animation: card-in 520ms var(--ease-spring) both; }

.done-kicker { font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--color-lime); }
.done-title { font-size: var(--size-done-title); font-weight: 600; line-height: 1.15; }
.done-actions { display: flex; gap: 10px; }

.site-foot {
  display: flex; gap: 20px; justify-content: center;
  padding: 28px 20px 40px; font-size: 14px;
}
.site-foot a { color: var(--color-ink-muted); }

@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .25; transform: scale(.6); } }

/* ---------------------------------------------------------------- static page (no JS) */

.js .static, .js.page-home .site-foot, .js .page-home .site-foot { display: none; }
.static {
  max-width: 680px; margin: 0 auto;
  padding: 48px 20px 8px;
  display: flex; flex-direction: column; gap: 40px;
}
.static-head { display: flex; flex-direction: column; gap: 12px; }
.static-photo { width: 88px; height: 88px; border-radius: 50%; border: 4px solid var(--color-paper-light); box-shadow: var(--shadow-card); object-fit: cover; }
.static-head .brand { color: var(--color-label); font-size: 14px; }
.static h1 { font-size: clamp(30px, 7vw, 44px); font-weight: 600; line-height: 1.05; letter-spacing: -.5px; text-wrap: balance; }
.static-sub { font-size: 18px; line-height: 1.45; color: var(--color-ink-muted); }
.static h2 { font-size: 22px; font-weight: 600; line-height: 1.2; }
.static-reasons { display: flex; flex-direction: column; gap: 14px; }
.static-reasons .reason-list { display: flex; flex-direction: column; gap: 10px; }
.static-worlds { display: flex; flex-direction: column; gap: 22px; }
.static-worlds p { margin-top: 6px; font-size: 16px; line-height: 1.45; color: var(--color-ink-muted); }
.static-done {
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px 22px; background: var(--color-ink); color: var(--color-paper);
  box-shadow: var(--shadow-done);
}

/* ---------------------------------------------------------------- legal pages */

.legal {
  max-width: 720px; margin: 0 auto; padding: 40px 20px 8px;
  font-size: 16px; line-height: 1.55;
}
.legal-back { margin-bottom: 28px; font-weight: 700; }
.legal-back a { text-decoration: none; }
.legal h1 { font-size: 36px; font-weight: 600; line-height: 1.1; margin-bottom: 24px; }
.legal h2 { font-size: 18px; font-weight: 700; margin: 28px 0 6px; }
.legal p + p { margin-top: 10px; }
.legal .lead { font-size: 18px; color: var(--color-ink-muted); }
.legal .stand { margin-top: 32px; color: var(--color-ink-muted); font-size: 14px; }

/* ---------------------------------------------------------------- game: common */

.game { display: none; }
.js .game { display: block; }
.game {
  --ink: var(--color-paper-light);
  --gc: 255, 247, 242;          /* ghost/guide colour as rgb triplet */
  --k: 1;                       /* desktop frame scale */
  --ks: 1;                      /* stage scale inside its box (mobile) */
  --sky: 1;                     /* size factor for sun, moon, dawn */
  position: relative;
  color: var(--ink);
  transition: color 700ms ease;
}
.game[data-world="3"] { --ink: var(--color-ink); --gc: 42, 27, 61; }

/* backdrop: world mood, full viewport */
.backdrop { position: fixed; inset: 0; overflow: hidden; pointer-events: none; background: var(--color-ink); }
.bg { position: absolute; inset: 0; opacity: 0; transition: opacity 900ms ease; }
.wedge {
  position: absolute; inset: 0; opacity: 0; transform: translateY(60px);
  transition: opacity 900ms ease var(--d), transform 1100ms cubic-bezier(.34,1.4,.64,1) var(--d);
}
.sun, .moon, .dawn { position: absolute; border-radius: 50%; background: var(--color-paper); opacity: 0; transform: translateY(60px); }
.sun {
  left: 82.03%; top: 7.5%; width: calc(150px * var(--sky)); height: calc(150px * var(--sky));
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(.34,1.4,.64,1);
}
.moon {
  left: 84.38%; top: 8.75%; width: calc(90px * var(--sky)); height: calc(90px * var(--sky));
  box-shadow: 0 0 60px 10px rgba(251,243,239,.35);
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(.34,1.4,.64,1);
}
.dawn {
  left: 26.56%; top: 80%; width: calc(520px * var(--sky)); height: calc(520px * var(--sky));
  background: var(--color-coral);
  transition: opacity 900ms ease, transform 1400ms cubic-bezier(.34,1.2,.64,1);
}
.star { position: absolute; width: 5px; height: 5px; opacity: 0; transition: opacity 900ms ease var(--d); }
.star i { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--color-paper); animation: twinkle 3s ease-in-out infinite; }

.game[data-world="0"] .bg-0, .game[data-world="1"] .bg-1,
.game[data-world="2"] .bg-2, .game[data-world="3"] .bg-3 { opacity: 1; }
.game[data-world="0"] .wedge-0, .game[data-world="1"] .wedge-1,
.game[data-world="2"] .wedge-2, .game[data-world="3"] .wedge-3 { opacity: var(--o); transform: none; }
.game[data-world="1"] .sun { opacity: .35; transform: none; }
.game[data-world="2"] .moon { opacity: .9; transform: none; }
.game[data-world="2"] .star { opacity: .9; }
.game[data-world="3"] .dawn { opacity: .4; transform: none; }

/* head */
.head { color: var(--ink); pointer-events: none; }
.head-top { display: flex; flex-direction: column; gap: 8px; }
.w-label { font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: .85; }
.w-title { font-size: var(--size-world-title); font-weight: 600; line-height: 1.05; letter-spacing: -.5px; text-wrap: balance; }
.w-sub { font-size: var(--size-body); line-height: 1.45; opacity: .9; }
.w-keys { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; opacity: .75; }
.w-keys:empty { display: none; }

/* progress */
.progress-label { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--color-ink); }
.dots { display: flex; gap: 12px; align-items: center; }
.dot {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid #CDB3AA; background: transparent;
  transition: background 400ms ease, border-color 400ms ease, transform 400ms var(--ease-spring);
}
.dot.is-current { border-color: var(--color-ink); transform: scale(1.25); }
.dot.is-on { background: var(--c); border-color: var(--c); }

/* stage */
.stage-box { outline: none; touch-action: none; -webkit-tap-highlight-color: transparent; cursor: pointer; user-select: none; -webkit-user-select: none; }
.game.kbd .stage-box:focus-visible { outline: 3px solid rgba(var(--gc), .7); outline-offset: -3px; }
.stage { position: absolute; left: 0; top: 0; width: 600px; height: 800px; transform-origin: 0 0; transform: scale(var(--ks)); }
.world {
  position: absolute; inset: 0; transform-origin: 300px 400px;
  opacity: 0; transform: rotate(90deg) scale(.6);
  transition: opacity 800ms ease, transform 1200ms cubic-bezier(.34,1.3,.64,1);
}
.world.is-past { transform: rotate(-90deg) scale(.35); }
.world.is-active { opacity: 1; transform: none; }
.ghost, .fill { position: absolute; }
.ghost {
  background: rgba(var(--gc), .12);
  border: 3px dashed rgba(var(--gc), .35);
  transition: background 200ms ease, border-color 200ms ease;
}
.game[data-world="3"] .ghost { background: rgba(var(--gc), .07); }
.ghost-tri { border: 0; }
.ghost.is-current { background: rgba(var(--gc), .28); border-color: rgba(var(--gc), .7); }
.game[data-world="3"] .ghost.is-current { background: rgba(var(--gc), .14); }
.ghost.is-hot { background: rgba(var(--gc), .55); border-color: rgba(var(--gc), .95); }
.game[data-world="3"] .ghost.is-hot { background: rgba(var(--gc), .28); }
.ghost-tri.is-current, .ghost-tri.is-hot { border: 0; }
.fill { opacity: 0; box-shadow: var(--shadow-shape); }
.fill.is-filled { opacity: 1; }

.portal {
  position: absolute; left: 240px; top: 430px; width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #FFFFFF 0%, var(--color-gold) 55%, var(--color-gold-deep) 100%);
  box-shadow: 0 0 70px 24px rgba(255,217,138,.6);
  opacity: 0; transform: scale(.3);
  transition: opacity 700ms ease, transform 900ms var(--ease-spring);
}
.game.is-done .portal { opacity: 1; transform: none; }
.guide {
  position: absolute; left: 0; top: 0; width: 0;
  border-left: 2px dashed rgba(var(--gc), .55);
  opacity: 0; transition: transform 140ms ease-out, opacity 200ms ease;
}
.game[data-world="3"] .guide { border-left-color: rgba(var(--gc), .4); }
.game[data-phase="hover"] .guide { opacity: 1; }
.piece-x, .piece-y { position: absolute; left: 0; top: 0; }
.piece { box-shadow: var(--shadow-shape); transition: opacity 300ms ease; }
.piece.is-hidden { opacity: 0; transition: none; }

.msg {
  position: absolute; left: 0; right: 0;
  top: calc(var(--msg-t, 230) * var(--ks) * 1px);
  display: flex; justify-content: center; pointer-events: none;
}
.msg span {
  padding: 10px 16px; border-radius: 999px;
  background: var(--color-paper-light); color: var(--color-ink);
  font-size: 16px; font-weight: 700; text-align: center;
  box-shadow: 0 10px 24px rgba(42,27,61,.2);
  opacity: 0; transform: translateY(-12px);
  transition: opacity 250ms ease, transform 400ms var(--ease-spring);
}
.msg.is-on span { opacity: 1; transform: none; }

.done-card {
  position: absolute; left: 40px; top: 36px; width: 520px;
  display: flex; flex-direction: column; gap: 10px;
  padding: 20px 22px; background: var(--color-ink); color: var(--color-paper);
  box-shadow: var(--shadow-done);
  animation: card-in 520ms var(--ease-spring) both;
}
.done-card[hidden] { display: none; }
.toast { display: none; }

/* reasons */
.reasons-head { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.photo { width: 52px; height: 52px; flex-shrink: 0; border-radius: 50%; border: 4px solid var(--color-paper); object-fit: cover; }
.reasons-title { font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.reasons-count { font-size: 14px; font-weight: 600; opacity: .85; }
.reason-list { display: flex; flex-direction: column; gap: var(--space-gap-reasons); }

.legal-links { display: flex; gap: 14px; font-size: 12px; font-weight: 600; }
.legal-links a { color: var(--ink); opacity: .8; }
.cta { display: flex; align-items: center; gap: 10px; }
.cta-label { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink); }

/* ---------------------------------------------------------------- game: desktop (≥ 1024 px) */

@media (min-width: 1024px) {
  html.js, html.js body { height: 100%; overflow: hidden; }
  .game { height: 100vh; height: 100dvh; overflow: hidden; }
  .frame {
    position: absolute; left: 50%; top: 50%; width: 1280px; height: 800px;
    transform: translate(-50%, -50%) scale(var(--k));
  }
  .head { position: absolute; left: var(--space-page-x); top: 44px; width: var(--space-column-left-w); display: flex; flex-direction: column; gap: 22px; }
  .progress {
    position: absolute; left: var(--space-page-x); top: 560px; width: var(--space-column-left-w);
    display: flex; flex-direction: column; gap: 10px; padding: 16px;
    background: var(--color-paper); box-shadow: 0 18px 40px rgba(42,27,61,.2);
  }
  .stage-box { position: absolute; left: var(--space-stage-x); top: 0; width: var(--space-stage-w); height: 800px; }
  .reasons {
    position: absolute; left: var(--space-reasons-x); top: 40px; bottom: 96px; width: var(--space-reasons-w);
    display: flex; flex-direction: column; gap: 8px; overflow: hidden;
  }
  .reason-list .reason-card { flex-shrink: 0; }
  .controls { position: absolute; left: var(--space-page-x); bottom: 40px; display: flex; flex-direction: row-reverse; gap: 10px; }
  .legal-links { position: absolute; left: var(--space-page-x); bottom: 12px; }
  .cta { position: absolute; right: 56px; bottom: 36px; }
}

/* ---------------------------------------------------------------- game: phone and tablet portrait (< 1024 px) */

@media (max-width: 1023.98px) {
  .game { --sky: .5; min-height: 100vh; min-height: 100dvh; }
  .frame {
    position: relative; display: flex; flex-direction: column;
    min-height: 100vh; min-height: 100dvh;
    padding-top: calc(18px + env(safe-area-inset-top));
  }
  .head { order: 1; display: flex; flex-direction: column; gap: 6px; padding: 0 20px; }
  .head-top { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .brand { font-size: 12px; letter-spacing: 2px; }
  .w-label { font-size: 12px; letter-spacing: 1.5px; }
  .w-title { font-size: 26px; line-height: 1.08; margin-top: 4px; }
  .w-sub { font-size: 15px; line-height: 1.4; }
  .w-keys { font-size: 11px; letter-spacing: 1px; }

  .progress { order: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 0; }
  .progress-label { color: var(--ink); font-size: 12px; }
  .dots { gap: 8px; }
  .dot { width: 14px; height: 14px; border-width: 2px; border-color: rgba(var(--gc), .45); }
  .dot.is-current { border-color: var(--ink); }

  .stage-box {
    order: 3; position: relative; flex-shrink: 0;
    width: calc(600px * var(--ks)); height: calc(800px * var(--ks));
    margin: 10px auto 0;
  }
  .stage-fit { position: absolute; inset: 0; }
  .msg span { font-size: 14px; padding: 8px 14px; }
  .done-card { left: -8px; right: -8px; top: 8px; width: auto; padding: 16px 18px; }
  .done-title { font-size: 21px; }
  .done-actions .btn { padding: 11px 12px; font-size: 15px; }
  .toast {
    display: block; position: absolute; left: -8px; right: -8px; bottom: 6px;
    opacity: 0; transform: translateY(12px); pointer-events: none;
    transition: opacity 250ms ease, transform 400ms var(--ease-spring);
  }
  .toast.is-on { opacity: 1; transform: none; }
  .toast .reason-card { box-shadow: 0 12px 28px rgba(42,27,61,.28); }
  .toast .reason-text { font-size: 14px; }

  .controls { order: 4; display: flex; flex-direction: row-reverse; justify-content: center; gap: 8px; padding: 14px 20px 0; }
  .controls .btn { padding: 8px 12px; font-size: 13px; }

  .reasons { order: 5; display: flex; flex-direction: column; gap: 10px; padding: 24px 20px 0; }
  .photo { width: 44px; height: 44px; border-width: 3px; }

  .legal-links { order: 6; justify-content: center; padding: 24px 20px 20px; }

  .cta {
    order: 7; position: sticky; bottom: 0; z-index: 2; margin-top: auto;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(42,27,61,.82);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  }
  .cta-label { display: none; }
  .cta .btn { flex: 1; padding: 12px 14px; font-size: 15px; }
  .cta .btn-ink { background: var(--color-lime); border-color: var(--color-lime); color: var(--color-ink); }
  .cta .btn-line { color: var(--color-paper); border-color: var(--color-paper); }
}

/* reference states (?state=…) are frozen so screenshots are reproducible */
.game.frozen *, .game.frozen { transition: none !important; animation: none !important; }

/* ---------------------------------------------------------------- reduced motion (media query or ?motion=reduce) */

.game.rm .world { transform: none; transition: opacity 200ms ease; }
.game.rm .wedge, .game.rm .sun, .game.rm .moon, .game.rm .dawn, .game.rm .bg { transform: none; transition: opacity 200ms ease; }
.game.rm .star { transition: opacity 200ms ease; }
.game.rm .star i { animation: none; }
.game.rm .portal { transform: none; transition: opacity 200ms ease; }
.game.rm .reason-card.is-new, .game.rm .done-card { animation: none; }
.game.rm .msg span, .game.rm .toast { transform: none; transition: opacity 200ms ease; }
