:root {
  --bg: #17110d; --ink: #f3ebe2; --muted: #b9a998; --accent: #ffb469; --card: rgba(26, 19, 14, .72); --line: rgba(255, 196, 140, .22);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body { margin: 0; color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--accent); }

#bench { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; display: block; touch-action: pan-y; z-index: 0; -webkit-tap-highlight-color: transparent; outline: none; }
.shade { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: linear-gradient(90deg, rgba(23,17,13,.78) 0%, rgba(23,17,13,.35) 32%, rgba(23,17,13,0) 52%); }
html:not(.is-3d) #bench, html:not(.is-3d) .shade { visibility: hidden; }

.top { position: fixed; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.top a { pointer-events: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 99px; background: rgba(23,17,13,.78); border: 1px solid var(--line); color: var(--ink); text-decoration: none; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.top .brand { font-weight: 800; letter-spacing: -.03em; font-size: 1.05rem; }
.top .brand span { color: var(--accent); }
.top .all-link { font-weight: 600; font-size: .95rem; border-color: rgba(255,180,105,.55); }
.top a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#story { position: relative; z-index: 1; pointer-events: none; }
.sec { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 72px max(24px, env(safe-area-inset-right)) 48px max(clamp(24px, 6vw, 96px), env(safe-area-inset-left)); }
.card { pointer-events: auto; max-width: 30rem; padding: 22px 24px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.35); transition: border-color .3s; }
.sec.active .card { border-color: rgba(255, 180, 105, .55); }
.kicker { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
h1, h2 { margin: 0 0 10px; line-height: 1.02; letter-spacing: -.03em; font-weight: 800; }
h1 { font-size: clamp(2.6rem, 7vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 4.6vw, 3rem); }
.card p { margin: 0 0 14px; color: var(--muted); }
.open { display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #1a120b; font-weight: 700; text-decoration: none; }
.open:hover, .open:focus-visible { filter: brightness(1.08); outline: 2px solid #fff3; outline-offset: 2px; }
.all { list-style: none; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.all a { display: block; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.all a:hover, .all a:focus-visible { border-color: var(--accent); }

.tag { position: fixed; left: 0; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 12px; background: rgba(20,14,10,.88); border: 1px solid rgba(255,180,105,.6); box-shadow: 0 6px 24px rgba(0,0,0,.4); pointer-events: none; white-space: nowrap; transition: opacity .15s; will-change: transform; }
.tag[hidden] { display: none; }
.tag b { font-weight: 700; }
.tag .hint { color: var(--muted); font-size: .8rem; }
.tag .go { pointer-events: auto; padding: 6px 12px; border-radius: 8px; background: var(--accent); color: #1a120b; font-weight: 700; text-decoration: none; }

/* Unfolded / near-square screens: card at the bottom-left, model above it. */
@media (min-aspect-ratio: 39/50) and (max-aspect-ratio: 13/10) {
  .sec { align-items: flex-end; padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .card { max-width: 27rem; }
  .shade { background: linear-gradient(0deg, rgba(23,17,13,.85) 0%, rgba(23,17,13,.3) 35%, rgba(23,17,13,0) 55%); }
}
/* Narrow phones (folded): full-width card at the bottom, model in the top half. */
@media (max-aspect-ratio: 39/50) {
  .sec { align-items: flex-end; padding: 64px 12px max(14px, env(safe-area-inset-bottom)); }
  .card { max-width: none; width: 100%; padding: 16px 18px; border-radius: 14px; }
  .card p { font-size: .95rem; margin-bottom: 12px; }
  h2 { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .shade { background: linear-gradient(0deg, rgba(23,17,13,.88) 0%, rgba(23,17,13,.35) 34%, rgba(23,17,13,0) 50%); }
  .all { grid-template-columns: 1fr 1fr; }
}

/* No WebGL (or it failed): a plain list of the same cards. */
.flatnote { position: relative; z-index: 1; margin: 64px 20px 0; color: var(--muted); }
html.flat #story { pointer-events: auto; max-width: 720px; margin: 0 auto; }
html.flat .sec { min-height: 0; padding: 12px 16px; }
html.flat .sec.intro { padding-top: 64px; }
html.flat .card { width: 100%; max-width: none; }

/* Fallback reveal when GSAP is not available. */
html.css-reveal .sec .card > * { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
html.css-reveal .sec.in .card > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } html.css-reveal .sec .card > * { opacity: 1; transform: none; } }
