:root {
  /* Space Mono issue codes should appear along the edges. Space Mono* Space Mono** only for tiny coordinates */
  --espresso: #130B12;
  --pearl: #D8D4E6;
  --violet: #7B5CFF;
  --caramel: #F0A84B;
  --foam: #FFF3DD;
  --berry: #5B1638;
  --marble-blue: #9DB7C8;
  --plum: #2A163F;
  --serif: "Cormorant Garamond", Cormorant, "Times New Roman", serif;
  --soft-serif: Fraunces, "Noto Serif", Georgia, serif;
  --jp: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --mono: "Space Mono", "Mono**", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--pearl);
  background: var(--espresso);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  overflow-x: hidden;
}

button { font: inherit; color: inherit; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(123, 92, 255, .28), transparent 22rem),
    radial-gradient(circle at 78% 18%, rgba(240, 168, 75, .16), transparent 18rem),
    radial-gradient(circle at 15% 80%, rgba(91, 22, 56, .5), transparent 28rem),
    linear-gradient(115deg, #130B12 0%, #2A163F 47%, #130B12 100%);
  z-index: -4;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  z-index: 10;
  background-image:
    radial-gradient(circle, rgba(255, 243, 221, .55) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(157, 183, 200, .35) 0 1px, transparent 1.6px);
  background-size: 41px 47px, 89px 73px;
  mix-blend-mode: screen;
}

.registration {
  position: fixed;
  width: 42px;
  height: 42px;
  z-index: 8;
  pointer-events: none;
  border-color: rgba(216, 212, 230, .55);
}
.top-left { top: 22px; left: 22px; border-top: 1px solid; border-left: 1px solid; }
.top-right { top: 22px; right: 22px; border-top: 1px solid; border-right: 1px solid; }
.bottom-left { bottom: 22px; left: 22px; border-bottom: 1px solid; border-left: 1px solid; }
.bottom-right { bottom: 22px; right: 22px; border-bottom: 1px solid; border-right: 1px solid; }

.chapter {
  min-height: 100vh;
  position: relative;
  padding: clamp(28px, 5vw, 72px);
  display: grid;
  place-items: center;
  isolation: isolate;
}

.chapter::before {
  content: attr(data-chapter);
  position: absolute;
  right: -2vw;
  top: 5vh;
  font-family: var(--mono);
  font-size: clamp(70px, 17vw, 245px);
  line-height: 1;
  color: rgba(216, 212, 230, .055);
  letter-spacing: -.08em;
  z-index: -1;
}

.spread {
  width: min(1500px, 100%);
  min-height: min(790px, 86vh);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(12px, 2vw, 34px);
  align-items: center;
  position: relative;
  transform: rotate(var(--tilt, -.7deg));
  transition: transform 900ms ease, filter 900ms ease;
}

.chapter.in-view .spread { --tilt: .15deg; }

.folio {
  position: absolute;
  left: -1vw;
  top: -2vh;
  font-family: var(--mono);
  font-size: clamp(44px, 9vw, 132px);
  color: rgba(240, 168, 75, .26);
  letter-spacing: -.08em;
}

.kicker {
  font-family: var(--mono);
  color: var(--caramel);
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: 12px;
}

h1, h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--foam);
}

h2 { font-size: clamp(48px, 8vw, 118px); line-height: .88; letter-spacing: -.055em; }
p { line-height: 1.7; }

.title-panel { grid-column: 1 / 8; z-index: 2; }

.domain-title {
  font-size: clamp(58px, 11.8vw, 176px);
  line-height: .76;
  letter-spacing: -.075em;
  text-shadow: 0 0 48px rgba(123, 92, 255, .22);
}

.domain-title span:first-child { color: var(--pearl); }
.domain-title span:last-child { color: var(--foam); display: block; padding-left: clamp(38px, 6vw, 90px); }
.hyphen {
  display: inline-grid;
  place-items: center;
  width: .45em;
  margin: 0 .04em;
  font-style: normal;
  color: var(--caramel);
  filter: blur(2px);
  text-shadow: 0 0 12px #F0A84B, 0 0 42px #F0A84B, 0 0 78px #7B5CFF;
  animation: hyphenWake 4.8s ease forwards, candleFlicker 2.6s infinite 5s;
}

.lead {
  width: min(570px, 90%);
  color: rgba(216, 212, 230, .78);
  font-family: var(--soft-serif);
  font-size: clamp(18px, 2.1vw, 28px);
}

.edge-code, .footer-code {
  position: absolute;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  color: rgba(216, 212, 230, .54);
}
.edge-code-left { left: 18px; top: 50%; writing-mode: vertical-rl; }
.edge-code-right { right: 18px; top: 20%; writing-mode: vertical-rl; }

.ritual-link {
  position: absolute;
  bottom: 38px;
  right: clamp(28px, 7vw, 110px);
  background: linear-gradient(90deg, rgba(216, 212, 230, .08), rgba(123, 92, 255, .12));
  border: 1px solid rgba(216, 212, 230, .3);
  border-radius: 999px;
  padding: 13px 22px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .12em;
  cursor: pointer;
  box-shadow: inset 0 0 18px rgba(255, 243, 221, .08), 0 0 36px rgba(123, 92, 255, .15);
}

.plate {
  grid-column: 8 / 13;
  min-height: clamp(430px, 64vh, 720px);
  border: 1px solid rgba(216, 212, 230, .22);
  border-radius: 44% 56% 49% 51% / 37% 39% 61% 63%;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(125deg, transparent 0 22%, rgba(216, 212, 230, .2) 22.4%, transparent 24%),
    linear-gradient(53deg, transparent 0 43%, rgba(157, 183, 200, .26) 43.4%, transparent 45%),
    radial-gradient(circle at 62% 35%, rgba(240, 168, 75, .2), transparent 14%),
    radial-gradient(circle at 30% 70%, rgba(123, 92, 255, .42), transparent 28%),
    linear-gradient(145deg, #2A163F, #130B12 58%, #5B1638);
  box-shadow: inset 0 0 100px rgba(216, 212, 230, .07), 0 30px 120px rgba(0, 0, 0, .5);
  animation: driftIn 3.8s ease both;
}

.cloche {
  position: absolute;
  width: 64%;
  height: 42%;
  left: 19%;
  top: 25%;
  border-radius: 50% 50% 10% 10%;
  border: 1px solid rgba(255, 243, 221, .34);
  background: linear-gradient(120deg, rgba(216,212,230,.22), rgba(255,255,255,.04) 45%, rgba(123,92,255,.12));
  backdrop-filter: blur(6px);
}

.steam-thread {
  position: absolute;
  width: 2px;
  height: 180px;
  top: 12%;
  background: linear-gradient(#FFF3DD, transparent);
  border-radius: 100%;
  filter: blur(2px);
  animation: steamRise 5.2s ease-in-out infinite;
}
.s1 { left: 42%; } .s2 { left: 52%; animation-delay: .8s; } .s3 { left: 62%; animation-delay: 1.6s; }

.spoon-orbit, .chrome-spoon {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(ellipse at 35% 30%, #FFF3DD, #9DB7C8 34%, #2A163F 72%);
  box-shadow: 0 0 34px rgba(216, 212, 230, .24);
}
.spoon-orbit { width: 52%; height: 16%; left: 25%; bottom: 14%; transform: rotate(-12deg); }

.cake-slice {
  position: absolute;
  width: 150px;
  height: 150px;
  right: 19%;
  bottom: 25%;
  clip-path: polygon(50% 0, 100% 86%, 0 86%);
  background: linear-gradient(135deg, #F0A84B, #FFF3DD 38%, #7B5CFF 39% 46%, #5B1638 47%);
  opacity: .84;
  animation: rotateCake 12s linear infinite;
}

.essay { grid-column: 2 / 7; }
.essay p:not(.kicker), .closing-copy p, .note { color: rgba(216, 212, 230, .72); max-width: 560px; }
.ingredient-column { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 10px; margin-top: 34px; }
.ingredient-column span { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; color: var(--marble-blue); border-top: 1px solid rgba(216, 212, 230, .24); padding-top: 11px; }

.orbit-stage { grid-column: 7 / 13; min-height: 680px; position: relative; border-left: 1px solid rgba(216, 212, 230, .16); }
.orbit-ring { position: absolute; inset: 13%; border: 1px solid rgba(157, 183, 200, .32); border-radius: 50%; transform: rotate(-18deg); }
.ring-b { inset: 24% 6%; transform: rotate(23deg); border-color: rgba(123, 92, 255, .35); }
.artifact { position: absolute; transition: transform 900ms ease, filter 900ms ease, opacity 900ms ease; }
.jelly { width: 130px; height: 130px; left: 22%; top: 18%; border-radius: 28px; background: linear-gradient(135deg, rgba(157,183,200,.82), rgba(123,92,255,.55)); transform: rotate(12deg); }
.cup { width: 178px; height: 122px; right: 14%; top: 42%; border-radius: 20px 20px 70px 70px; background: radial-gradient(ellipse at 50% 18%, #F0A84B 0 18%, #130B12 19% 32%, #D8D4E6 33%); }
.crescent { width: 188px; height: 188px; left: 22%; bottom: 10%; border-radius: 50%; background: #FFF3DD; box-shadow: inset 38px -16px 0 #2A163F; }
.artifact b { position: absolute; inset: 15%; border: 1px solid rgba(255, 243, 221, .38); border-radius: inherit; }
.vertical-caption { position: absolute; right: 2%; bottom: 8%; writing-mode: vertical-rl; font-family: var(--jp); color: rgba(255, 243, 221, .64); letter-spacing: .24em; }

.marble-wall { grid-column: 1 / 8; height: min(760px, 78vh); position: relative; border-radius: 42px; overflow: hidden; border: 1px solid rgba(216, 212, 230, .19); background: radial-gradient(circle at 26% 22%, rgba(123,92,255,.38), transparent 24%), linear-gradient(135deg, #130B12, #2A163F 45%, #5B1638); }
.vein { position: absolute; height: 2px; width: 75%; background: linear-gradient(90deg, transparent, #D8D4E6, transparent); filter: blur(.4px); transform-origin: left; animation: drawVein 5s ease-in-out infinite; }
.v1 { left: 3%; top: 23%; transform: rotate(18deg); } .v2 { left: 15%; top: 55%; transform: rotate(-11deg); animation-delay: 1s; } .v3 { left: -6%; top: 76%; transform: rotate(28deg); animation-delay: 2s; }
.sugar-stars { position: absolute; inset: 0; background-image: radial-gradient(circle, #FFF3DD 0 1px, transparent 1.5px); background-size: 37px 51px; opacity: .33; }
.poem-panel { grid-column: 8 / 13; }
.menu-poem { font-family: var(--serif); font-size: clamp(25px, 3.4vw, 48px); color: var(--foam); line-height: 1.2; }

.candle-field { grid-column: 1 / 7; height: 640px; position: relative; }
.wick-line { position: absolute; left: 50%; top: 20%; width: 12px; height: 330px; border-radius: 999px; background: linear-gradient(transparent, #F0A84B 20% 78%, transparent); filter: blur(1px); box-shadow: 0 0 40px #F0A84B; animation: candleFlicker 2.4s infinite; }
.flame { position: absolute; left: calc(50% - 38px); top: 11%; width: 76px; height: 112px; border-radius: 70% 30% 60% 40%; background: radial-gradient(circle at 50% 72%, #FFF3DD, #F0A84B 36%, rgba(123,92,255,.55) 68%, transparent 70%); filter: blur(.6px); animation: flameSway 3.1s ease-in-out infinite; }
.chrome-spoon { width: 58%; height: 19%; left: 21%; bottom: 14%; transform: rotate(8deg); }
.closing-copy { grid-column: 7 / 13; }
.footer-code { bottom: 20px; left: 50%; transform: translateX(-50%); white-space: nowrap; }

.focus-artifact { will-change: transform, filter; transition: transform 850ms cubic-bezier(.2,.8,.2,1), filter 850ms ease, opacity 850ms ease; }
.focus-artifact.is-focused { transform: scale(1.075) rotate(var(--focus-rotate, 0deg)); filter: brightness(1.18) saturate(1.16) drop-shadow(0 0 38px rgba(240, 168, 75, .22)); }
.focus-zone.soft .artifact:not(.is-focused), .chapter.soft-text p:not(.kicker) { opacity: .45; filter: blur(1.5px); }

@keyframes hyphenWake { 0% { opacity: .35; filter: blur(12px); transform: scaleX(.18); } 100% { opacity: 1; filter: blur(1.2px); transform: scaleX(1); } }
@keyframes candleFlicker { 0%, 100% { opacity: .78; } 38% { opacity: 1; transform: scaleY(1.04); } 61% { opacity: .68; } }
@keyframes driftIn { from { opacity: 0; transform: translateX(9vw) rotate(4deg); filter: blur(16px); } to { opacity: 1; transform: translateX(0) rotate(0); filter: blur(0); } }
@keyframes steamRise { 0% { transform: translateY(35px) scaleY(.5); opacity: 0; } 35% { opacity: .8; } 100% { transform: translateY(-80px) scaleY(1.25); opacity: 0; } }
@keyframes rotateCake { to { transform: rotate(360deg); } }
@keyframes drawVein { 0%, 100% { clip-path: inset(0 100% 0 0); opacity: .2; } 50% { clip-path: inset(0 0 0 0); opacity: .75; } }
@keyframes flameSway { 0%, 100% { transform: rotate(-2deg) scale(.96); } 50% { transform: rotate(3deg) scale(1.04); } }

@media (max-width: 820px) {
  .chapter { padding: 58px 22px; }
  .spread { display: block; min-height: auto; transform: none; }
  .title-panel, .essay, .poem-panel, .closing-copy { margin: 80px 0 30px; }
  .plate, .orbit-stage, .marble-wall, .candle-field { min-height: 460px; height: 460px; margin: 30px 0; }
  .domain-title span:last-child { padding-left: 0; }
  .edge-code { display: none; }
  .ritual-link { position: static; margin-top: 25px; }
}
