/* Tokens: the workshop world's palette — sky, painted blue, folder yellow, warm wood */
:root {
  --bg: #f4f8fd;
  --surface: #ffffff;
  --ink: #14213d;
  --muted: #55607a;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --accent-hover: #244bd0;
  --yellow: #f3c234;
  --wood: #c68a52;
  --sky: #dcebfb;
  --navy: #0f1a36;
  --line: #dfe6f1;

  --font: "Onest", system-ui, sans-serif;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-lead: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --step-head: clamp(2rem, 1.3rem + 2.6vw, 3.4rem);
  --step-display: clamp(3.4rem, 1.6rem + 6.2vw, 7.2rem);

  --gutter: clamp(16px, 3vw, 48px);
  --radius: 20px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --bar-h: 76px;
  --shadow: 0 18px 50px -20px rgba(20, 33, 61, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--yellow); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: fixed; left: var(--gutter); top: 8px; z-index: 50;
  padding: 10px 16px; background: var(--ink); color: #fff; border-radius: 10px; transform: translateY(-200%);
}
.skip:focus { transform: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 22px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: var(--step-small); text-decoration: none;
  border: 0; border-radius: 12px; cursor: pointer;
  transition: transform 140ms var(--ease-out), background-color 200ms var(--ease-out);
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.97); }
.btn--big { min-height: 58px; padding: 0 30px; font-size: 1.0625rem; border-radius: 14px; }
.btn--big::after { content: "›"; font-size: 1.5em; line-height: 0; margin-top: -2px; }

/* Header */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 36px;
  padding: 0 var(--gutter);
  color: var(--ink);
  background: rgba(244, 248, 253, 0.82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: color 300ms var(--ease-out), background-color 300ms var(--ease-out);
}
.bar[data-ink="light"] { color: #fff; background: rgba(15, 26, 54, 0.6); }
.wordmark {
  font-weight: 800; font-size: 26px; letter-spacing: -0.02em; line-height: 1;
  text-decoration: none; margin-right: auto;
  display: inline-flex; align-items: center; gap: 12px;
}
.globe {
  flex: none; width: 40px; height: 40px; padding: 0; margin-right: -24px;
  border: 0; border-radius: 50%; background: none; cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.globe svg { width: 100%; height: 100%; }
.globe-land { fill: #4ec36a; stroke: #2f8a45; stroke-width: 0.6; stroke-linejoin: round; }
.globe:hover { transform: rotate(-8deg) scale(1.06); }
.globe:active { transform: scale(0.94); }
.bar-links { display: flex; gap: 32px; font-size: 1rem; font-weight: 500; }
.bar-links a { text-decoration: none; padding: 12px 0; }
.bar-links a:hover { color: var(--accent); }
.bar[data-ink="light"] .bar-links a:hover { color: var(--yellow); }

#world {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
main, .foot { position: relative; z-index: 1; }

.rail {
  position: fixed; left: 50%; bottom: 22px; z-index: 15;
  transform: translate(-50%, 12px);
  padding: 12px 22px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow);
  font-size: var(--step-small); font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--ink); opacity: 0;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
}
.rail.is-on { opacity: 1; transform: translate(-50%, 0); }
.rail-n { color: var(--accent); }

/* Hero: the whole archipelago seen from above, the title on the open sky at the left */
.hero { position: relative; min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: calc(var(--bar-h) + 24px) var(--gutter) 64px; }
.no-webgl .hero { background: var(--sky); }
.hero-copy {
  width: min(600px, 46vw); display: grid; gap: 24px;
  padding: 36px 40px 40px; border-radius: 28px;
  background: rgba(244, 248, 253, 0.86); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hero-title {
  font-weight: 800; font-size: var(--step-display);
  line-height: 0.92; letter-spacing: -0.045em;
}
.hero-lead { font-size: var(--step-lead); line-height: 1.4; color: var(--muted); max-width: 30ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 8px; }
.link-folder {
  display: inline-flex; align-items: center; gap: 12px;
  font-weight: 600; text-decoration: none; padding: 10px 0;
}
.link-folder::before {
  content: ""; width: 34px; height: 26px; border-radius: 4px 4px 6px 6px;
  background: linear-gradient(var(--yellow), var(--yellow)) 0 0 / 45% 30% no-repeat, linear-gradient(#f7cf4f, #f7cf4f) 0 100% / 100% 82% no-repeat;
}
.link-folder:hover { color: var(--accent); }

/* Flight: each project holds the camera for a few screens */
.station {
  position: relative;
  min-height: 240vh; min-height: 240svh;
  padding: 0 var(--gutter);
  display: flex; flex-direction: column;
}
.copy {
  position: sticky; top: calc(var(--bar-h) + 9vh);
  width: min(480px, 40vw);
  padding: 32px 32px 28px;
  background: rgba(255, 255, 255, 0.94); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: grid; gap: 16px;
}
.station[data-side="right"] .copy { align-self: flex-end; }
.copy h2 {
  font-weight: 800; font-size: var(--step-head);
  line-height: 0.98; letter-spacing: -0.035em; text-wrap: balance;
}
.copy p { max-width: 46ch; color: #2b3754; }
.copy .hint { font-size: var(--step-small); color: var(--muted); margin-top: -6px; }
.copy .meta { font-size: var(--step-small); color: var(--muted); }
.btn--panel { justify-self: start; }

.live { display: flex; flex-wrap: wrap; gap: 8px; }
.live button {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: #edf1f8; color: var(--ink); font-weight: 600; font-size: var(--step-small);
  transition: transform 140ms var(--ease-out), background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.live button:hover { background: #e1e8f5; }
.live button:active { transform: scale(0.97); }
.live button[aria-pressed="true"] { background: var(--accent); color: #fff; }

/* Chapters after the flight */
.about, .work { position: relative; }
.section-title { font-weight: 800; font-size: var(--step-head); line-height: 1; letter-spacing: -0.035em; }

.about { background: var(--surface); padding: 150px var(--gutter); display: grid; gap: 48px; }
.about-text {
  columns: 2; column-gap: 48px;
  font-size: clamp(20px, 1.7vw, 26px); line-height: 1.38;
  text-wrap: pretty;
}
.about-text strong { font-weight: 700; }
.hl { color: var(--ink); padding: 0 0.15em; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.hl--mint { background: #d6f0d6; }
.hl--grey { background: #e3e9f3; }
.hl--orange { background: #ffe3a3; }
.hl-link { text-decoration: none; background: var(--accent); color: #fff; transition: background-color 200ms var(--ease-out); }
.hl-link:hover { background: var(--ink); }

.work { background: var(--bg); padding: 150px var(--gutter); }
.ledger { position: relative; width: min(620px, 100%); margin-left: 18vw; }
.ledger-title { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 28px; }
.ledger-rows li > * {
  display: grid; grid-template-columns: 52% 1fr auto; align-items: center;
  min-height: 52px; padding: 0 14px; border-radius: 12px; text-decoration: none;
  transition: background-color 200ms var(--ease-out);
}
.l-name { font-size: 16px; font-weight: 600; }
.l-kind { font-size: 14px; color: var(--muted); }
.l-ver { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
.ledger-rows li > a:hover, .ledger-rows li > a:focus-visible { background: #fff; }
.ledger-preview {
  position: absolute; left: calc(100% + 48px); top: 0;
  width: 320px; height: 240px; object-fit: cover; border-radius: 16px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity 150ms var(--ease-out);
  pointer-events: none;
}
.ledger-preview.is-on { opacity: 1; }

  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  font-weight: 800; letter-spacing: -0.05em;
  font-size: clamp(56px, 8.5vw, 136px); line-height: 0.95;
}

.foot {
  display: grid; gap: 20px;
  background: var(--navy); color: #fff;
  padding: 120px var(--gutter) 24px;
}
.foot-mark { width: 100%; height: auto; fill: #fff; font-family: var(--font); font-weight: 800; font-size: 120px; letter-spacing: -6px; }
.legal { font-size: 13px; color: #a9b4cc; }

/* Day / night switch: a 3D sun and moon in a round sky window with a metal bezel */
.theme-toggle {
  position: relative; flex: none; width: 46px; height: 46px; padding: 0; margin-left: -12px;
  border: 0; border-radius: 50%; cursor: pointer; background: none;
  transition: transform 160ms var(--ease-out);
}
.theme-toggle:active { transform: scale(0.94); }
.theme-dial {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  filter: drop-shadow(0 3px 5px rgba(10, 16, 34, 0.35));
}
/* until the 3D one is ready (or without WebGL): the same picture, flat */
.theme-toggle .flat {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 50%; box-shadow: 0 3px 8px -3px rgba(10, 16, 34, 0.45);
}
.flat-moon { display: none; }
[data-theme="dark"] .flat-sun { display: none; }
[data-theme="dark"] .flat-moon { display: block; }
.theme-toggle.is-3d .flat { display: none; }

/* Night: deep navy surfaces, warm light, the same layout */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1326;
  --surface: #0f172d;
  --ink: #e9eefa;
  --muted: #9ba8c4;
  --accent: #5b7dff;
  --accent-hover: #7590ff;
  --sky: #070c1b;
  --navy: #050913;
  --line: #22304d;
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.7);
}
[data-theme="dark"] .bar { background: rgba(9, 14, 30, 0.74); }
[data-theme="dark"] .bar[data-ink="light"] { background: rgba(5, 9, 19, 0.7); }
[data-theme="dark"] .bar-links a:hover { color: #ffc47c; }
[data-theme="dark"] .rail { background: rgba(14, 21, 40, 0.92); }
[data-theme="dark"] .rail-n { color: #ffb866; }
[data-theme="dark"] .hero-copy { background: rgba(11, 17, 36, 0.8); }
[data-theme="dark"] .copy { background: rgba(12, 19, 38, 0.9); }
[data-theme="dark"] .copy p { color: #c4cee4; }
[data-theme="dark"] .live button { background: #1b2643; }
[data-theme="dark"] .live button:hover { background: #24325a; }
[data-theme="dark"] .live button[aria-pressed="true"] { background: var(--accent); }
[data-theme="dark"] .hl--mint { background: #1d4532; }
[data-theme="dark"] .hl--grey { background: #26324c; }
[data-theme="dark"] .hl--orange { background: #5b4318; }
[data-theme="dark"] .hl-link { color: #fff; }
[data-theme="dark"] .hl-link:hover { background: #ffb866; color: #0b1224; }
[data-theme="dark"] .ledger-rows li > a:hover, [data-theme="dark"] .ledger-rows li > a:focus-visible { background: #17213b; }
[data-theme="dark"] .link-folder:hover { color: #ffc47c; }
[data-theme="dark"] .skip { background: var(--accent); }
/* surfaces fade with the dusk instead of flipping */
body, .bar, .rail, .hero-copy, .about, .work, .foot, .live button, .hl, .ledger-rows li > * {
  transition-property: background-color, color, opacity, transform;
  transition-duration: 600ms; transition-timing-function: var(--ease-out);
}
.copy { transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out), background-color 600ms var(--ease-out); }
.copy p, .copy .meta, .hero-lead { transition: color 600ms var(--ease-out); }

/* Entrances: parts of each section rise once; content is visible without script */
.js [data-rise] { opacity: 0; transform: translateY(24px); }
.js [data-rise].is-in {
  opacity: 1; transform: none;
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}
.js .copy { opacity: 0; transform: translateY(24px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.js .copy.is-in { opacity: 1; transform: none; }

.no-webgl .station { min-height: auto; padding-top: 100px; padding-bottom: 100px; }
.no-webgl .copy { position: static; }

@media (max-width: 860px) {
  :root { --bar-h: 62px; }
  .bar { gap: 16px; }
  .wordmark { font-size: 20px; }
  .globe { width: 32px; height: 32px; margin-right: -8px; }
  .theme-toggle { width: 40px; height: 40px; margin-left: 0; }
  .bar-links { display: none; }
  .rail { bottom: auto; top: calc(var(--bar-h) + 10px); padding: 8px 16px; }

  .hero { align-items: flex-start; padding-top: calc(var(--bar-h) + 28px); }
  .hero-copy { width: 100%; gap: 16px; padding: 24px 22px 26px; border-radius: 22px; }
  .hero-title { font-size: 15vw; }
  .hero-lead { font-size: 16px; }
  .btn--big { min-height: 52px; }

  .station { justify-content: flex-end; }
  .copy, .station[data-side="right"] .copy {
    position: sticky; top: auto; bottom: 16px; align-self: stretch;
    width: 100%; padding: 22px 20px 20px; gap: 12px; margin-bottom: 16px;
  }
  .copy h2 { font-size: 30px; }
  .copy p { font-size: 15px; }
  .copy .meta { font-size: 13px; }

  .about { padding: 96px 18px; gap: 28px; }
  .about-text { columns: 1; font-size: 19px; line-height: 1.4; }
  .hl-link { display: block; margin-top: 20px; padding: 12px 0.4em; }

  .work { padding: 96px 16px; }
  .ledger { margin-left: 0; width: 100%; }
  .ledger-rows li > * {
    grid-template-columns: 1fr auto; grid-template-areas: "n v" "k k";
    min-height: 56px; padding: 8px 10px;
  }
  .l-name { grid-area: n; }
  .l-ver { grid-area: v; }
  .l-kind { grid-area: k; font-size: 13px; }
  .ledger-preview { display: none; }
}
