:root {
  --paper: #f7f6f2; --ink: #14181d; --muted: #5b6470; --blue: #1c6fd1; --line: #dcd8cd;
  --font: "Inter", "Liberation Sans", "Helvetica Neue", Arial, sans-serif;
}
body[data-theme="paper"] { --bg: var(--paper); --fg: var(--ink); --fg2: var(--muted); --glass: rgba(247, 246, 242, .72); }
body[data-theme="dark"]  { --bg: #050a14; --fg: #eaf2ff; --fg2: #8fa3bf; --glass: rgba(5, 10, 20, .55); }

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }

/* ------------------------------------------------------------------ nav */
#nav { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: 60px; display: flex; align-items: center; gap: 28px;
  padding: 0 28px; color: var(--fg); transition: background .35s, box-shadow .35s, color .35s; }
#nav.solid { background: rgba(247, 246, 242, .92); color: var(--ink); backdrop-filter: blur(10px); box-shadow: 0 1px 0 var(--line); }
#nav .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .22em; font-size: 15px; }
#nav .logo svg { width: 34px; height: 24px; }
#nav .links { display: flex; gap: 22px; font-size: 14px; }
#nav .links a { text-decoration: none; opacity: .75; padding: 6px 0; border-bottom: 2px solid transparent; }
#nav .links a:hover { opacity: 1; }
#nav .home-link { opacity: 1 !important; border-bottom-color: var(--blue) !important; }
#nav .switch { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 13px; background: var(--glass);
  border: 1px solid rgba(127, 127, 127, .25); border-radius: 999px; padding: 3px; backdrop-filter: blur(8px); }
#nav.solid .switch { background: #fff; }
#nav .switch button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: transparent; color: inherit; font-size: 18px; line-height: 1; }
#nav .switch button:hover { background: rgba(127, 127, 127, .18); }
#style-name { min-width: 220px; text-align: center; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ intro stage */
#intro { position: relative; height: 640vh; }
.stage { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#gl[hidden] { display: none; }

#captions { position: absolute; left: 6.5vw; bottom: 13vh; pointer-events: none; }
.cap { position: absolute; left: 0; bottom: 0; width: min(560px, 80vw); opacity: 0; will-change: opacity, transform; }
.cap .k { font-size: 13px; font-weight: 700; letter-spacing: .24em; color: var(--blue); }
.cap .t { font-size: clamp(28px, 3.6vw, 54px); font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin-top: 10px; }
.cap .s { font-size: clamp(15px, 1.25vw, 19px); color: var(--fg2); margin-top: 12px; line-height: 1.45; }
body[data-theme="dark"] .cap .k { color: #4fb3ff; }
body[data-theme="dark"] .cap, body[data-theme="dark"] #brand { text-shadow: 0 2px 14px rgba(0, 0, 0, .65); }

#brand { position: absolute; left: 6.5vw; top: 19vh; opacity: 0; pointer-events: none; will-change: opacity, transform; }
#brand .mark { display: flex; align-items: center; gap: 2.2vh; }
#brand .mark svg { height: 6.2vh; width: auto; }
#brand .mark span { font-weight: 700; font-size: 9vh; letter-spacing: .26em; line-height: 1; }
#brand .tag { font-size: 4vh; color: var(--fg2); margin-top: 2.4vh; letter-spacing: .02em; }
#brand .sub { font-size: 2.2vh; color: var(--fg2); margin-top: 1.4vh; opacity: .9; }
body[data-brand="center"] #brand { left: 50%; top: 50%; text-align: center; }
body[data-brand="center"] #brand .mark { justify-content: center; }

#hint { position: absolute; left: 50%; bottom: 5vh; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center;
  gap: 10px; font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--fg2); pointer-events: none; }
#hint i { width: 22px; height: 36px; border: 2px solid currentColor; border-radius: 12px; position: relative; }
#hint i::after { content: ""; position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px;
  background: currentColor; animation: wheel 1.6s infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(-3px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }
#enter { position: absolute; left: 50%; bottom: 5vh; transform: translateX(-50%); font-size: 13px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--fg2); opacity: 0; pointer-events: none; }

#controls { position: absolute; right: 28px; bottom: 26px; display: flex; gap: 8px; }
#controls button { border: 1px solid rgba(127, 127, 127, .35); background: var(--glass); color: var(--fg); padding: 8px 14px; border-radius: 999px;
  font-size: 13px; backdrop-filter: blur(8px); }
#controls button:hover { border-color: var(--blue); }
#bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(127, 127, 127, .15); }
#bar i { display: block; height: 100%; width: 0; background: var(--blue); }

#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--bg); color: var(--fg2); font-size: 14px; letter-spacing: .08em; transition: opacity .6s; z-index: 5; }
#loading b { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(127, 127, 127, .25); border-top-color: var(--blue); animation: spin 1s linear infinite; }
#loading.done { opacity: 0; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
#error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 640px; padding: 18px 22px; background: #fff; color: #a1260d;
  border: 1px solid #e5b5a8; border-radius: 8px; font: 13px/1.5 ui-monospace, monospace; white-space: pre-wrap; z-index: 6; }

/* ------------------------------------------------------------------ home (stand-in for the Studio) */
#home { position: relative; z-index: 2; background: var(--paper); color: var(--ink); padding: 120px 6.5vw 60px; min-height: 100vh;
  box-shadow: 0 -30px 60px rgba(0, 0, 0, .06); }
.hero { max-width: 1100px; }
.eyebrow { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; color: var(--blue); font-weight: 700; }
.hero h1 { font-size: clamp(40px, 5.6vw, 84px); line-height: 1.02; letter-spacing: -.03em; margin: 18px 0 22px; }
.lead { font-size: clamp(17px, 1.4vw, 21px); line-height: 1.55; color: var(--muted); max-width: 760px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 34px; }
.btn { display: inline-block; padding: 13px 22px; border-radius: 999px; border: 1px solid #c9c4b7; text-decoration: none; font-size: 15px; background: #fff; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn:hover { border-color: var(--blue); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 80px; }
.cards figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cards img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; background: #eceae3; }
.cards figcaption { padding: 14px 16px 18px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.cards figcaption b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
footer { margin-top: 70px; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
@media (max-width: 820px) { .cards { grid-template-columns: 1fr; } #nav .links { display: none; } #style-name { min-width: 120px; } }

/* thumbnail mode: only the canvases */
body.thumb #nav, body.thumb #home, body.thumb #controls, body.thumb #hint, body.thumb #bar, body.thumb #enter, body.thumb #loading { display: none !important; }
