:root {
  --bg: #161615;
  --fg: #e9e5da;
  --muted: #9b978d;
  --dim: #5d5a54;
  --line: rgba(233, 229, 218, 0.16);
  --accent: #8fc79a;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.gated { overflow: hidden; }
body.gated main { visibility: hidden; }
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* =================== GATE =================== */
#gate {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(#8d8d8f, #c6c6c6 60%, #9a9a9a);
  color: #262625;
}
#gate.gone { display: none; }
#ocean { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gate-center {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  text-align: center; width: 90%;
  transition: opacity .9s ease, transform 1.6s cubic-bezier(.6, 0, .9, .4), filter .9s ease;
}
.gate-title { font-weight: 500; font-size: clamp(56px, 7vw, 96px); letter-spacing: -0.01em; line-height: 1; }
.gate-sub { font-style: italic; font-size: clamp(18px, 1.6vw, 24px); margin-top: 18px; color: #3a3a38; }
#engage {
  margin-top: 40px;
  padding: 9px 22px 8px;
  border: 1px solid rgba(38, 38, 37, .45);
  background: rgba(255, 255, 255, .18);
  border-radius: 3px;
  font-variant: small-caps; text-transform: lowercase;
  font-size: 19px; letter-spacing: .14em; color: #262625;
  transition: background .3s, color .3s, border-color .3s;
}
#engage:hover, #engage:focus-visible { background: #262625; color: #e9e5da; border-color: #262625; outline: none; }
.gate-foot {
  position: absolute; bottom: 22px; font-variant: small-caps; text-transform: lowercase;
  letter-spacing: .14em; font-size: 15px; color: rgba(38, 38, 37, .55);
  transition: opacity .6s;
}
.gate-foot-l { left: 28px; }
.gate-foot-r { right: 28px; }
.gate-fade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; transition: opacity 1s ease; }

#gate.engaging .gate-center { opacity: 0; transform: translate(-50%, -50%) scale(1.25); filter: blur(4px); }
#gate.engaging .gate-foot { opacity: 0; }
#gate.leaving .gate-fade { opacity: 1; }

/* =================== ESSAY =================== */
main { padding: 13vh 0 0; }
.col { width: min(880px, calc(100% - 48px)); margin: 0 auto; }
.title { font-weight: 600; font-size: clamp(54px, 6.5vw, 84px); line-height: 1.05; letter-spacing: -0.01em; }
.byline { color: var(--muted); font-size: 22px; margin: 14px 0 34px; font-style: italic; }
.col p { margin-bottom: 1.05em; }
h2 { font-weight: 600; font-size: 27px; margin: 2.3em 0 .7em; letter-spacing: -0.003em; }
sup { font-size: .62em; line-height: 0; }
em { font-style: italic; }

/* assembly */
[data-asm] { opacity: 0; transform: translateY(10px); filter: blur(3px); transition: opacity 1.1s ease, transform 1.1s cubic-bezier(.2, .8, .2, 1), filter 1.1s ease; }
[data-asm].in { opacity: 1; transform: none; filter: none; }
.w { opacity: 0; filter: blur(2px); transition: opacity .7s ease, filter .7s ease; }
.w.in { opacity: 1; filter: none; }
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 1s ease, transform 1s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* figures */
.fig { width: min(1180px, calc(100% - 48px)); margin: 70px auto 80px; }

/* --- search grid --- */
.grid-wrap { position: relative; display: flex; justify-content: center; }
.grid-label { position: absolute; left: 0; top: 0; }
.grid-count { font-size: 26px; line-height: 1.1; font-variant-numeric: lining-nums; }
.grid-unit { font-style: italic; font-size: 16px; color: var(--muted); }
#grid { width: min(520px, 100%); aspect-ratio: 1; display: block; cursor: pointer; }
.stepper { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; margin-top: 34px; min-height: 64px; }
.step-text { max-width: 760px; transition: opacity .35s ease; }
.step-text b { font-weight: 600; }
.step-text i { color: var(--muted); }
.step-nav { display: flex; align-items: baseline; gap: 18px; white-space: nowrap; color: var(--muted); font-size: 18px; }
.step-nav button { font-style: italic; color: var(--fg); border-bottom: 1px solid var(--line); padding-bottom: 1px; transition: color .2s, border-color .2s; }
.step-nav button:hover { color: var(--accent); border-color: var(--accent); }
.step-nav button:disabled { opacity: .25; cursor: default; }
#step-num { font-variant-numeric: lining-nums tabular-nums; font-size: 17px; }

/* --- layers --- */
#layers { width: 100%; height: auto; display: block; overflow: visible; }
#layers .plane { fill: none; stroke: rgba(233, 229, 218, .75); stroke-width: 1.2; }
#layers .gridline { stroke: rgba(233, 229, 218, .09); stroke-width: 1; }
#layers .plabel { fill: var(--accent); font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; font-size: 19px; }
#layers .node { fill: var(--fg); }
#layers .node-s { fill: rgba(233, 229, 218, .55); }
#layers .nlabel { fill: var(--fg); font-size: 19px; }
#layers .local { stroke: rgba(233, 229, 218, .32); stroke-width: .8; fill: none; }
#layers .link { stroke: rgba(143, 199, 154, .38); stroke-width: .9; fill: none; }
#layers .layer { opacity: 0; transition: opacity .9s ease; }
#layers .layer.on { opacity: 1; }
#layers .link, #layers .local { stroke-dasharray: 1; stroke-dashoffset: 1; }
#layers .drawn { transition: stroke-dashoffset 1.4s cubic-bezier(.4, 0, .2, 1); stroke-dashoffset: 0; }
.layers-cap { display: flex; justify-content: space-between; align-items: baseline; margin-top: 24px; color: var(--muted); font-size: 21px; }
.layers-cap b { color: var(--accent); font-weight: 400; }
.layers-cap button { font-style: italic; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 19px; }
.layers-cap button:hover { color: var(--fg); }

/* --- loop --- */
.fig-loop { display: flex; justify-content: center; margin-top: 40px; }
.loop { width: min(560px, 100%); height: auto; overflow: visible; }
.loop-ring { fill: none; stroke: var(--line); stroke-width: 1.2; }
.loop-dot { fill: var(--accent); filter: drop-shadow(0 0 6px rgba(143, 199, 154, .8)); }
.loop-pts circle { fill: var(--fg); }
.loop-labels text { fill: var(--fg); font-family: var(--serif); font-variant: small-caps; text-transform: lowercase; letter-spacing: .1em; font-size: 21px; }

/* --- cloud --- */
.fig-cloud { margin-top: 30px; }
#cloud { width: 100%; height: min(78vh, 820px); display: block; }
.cloud-cap { color: var(--muted); font-size: 19px; }

/* --- outro --- */
.outro { padding: 40px 0 110px; }
.rule { width: 48px; height: 1px; background: var(--fg); opacity: .4; margin-bottom: 28px; }
.outro-name { font-weight: 600; margin-bottom: 4px !important; }
.li { font-style: italic; color: var(--fg); transition: color .2s; }
.li:hover { color: var(--accent); }
.li span { font-style: normal; display: inline-block; transition: transform .2s; }
.li:hover span { transform: translate(2px, -2px); }

/* =================== RESPONSIVE =================== */
@media (max-width: 760px) {
  body { font-size: 19px; }
  .grid-wrap { flex-direction: column; gap: 14px; }
  .grid-label { position: static; }
  .stepper { flex-direction: column; gap: 14px; }
  #cloud { height: 60vh; }
  .gate-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001s !important; animation-duration: .001s !important; }
}
