/* THE MOUTH OF THE WORLD — a rare edition.
   The ground is the dust before it stood: a warm near-black. Ink is linen. Light comes from above,
   always, because the poem is about a thing that points up. Nothing glows except the line being spoken
   and the one word at the end. */

:root {
  --night: #0a0806;
  --night-2: #100c08;
  --linen: #f0e6d4;
  --linen-2: #cbbda6;
  --linen-3: #8d8272;
  --gold: #d9a95f;
  --gold-2: #f3cf94;
  --leaf: #7d5a24;
  --rule: rgba(240, 230, 212, 0.13);
  --hair: rgba(217, 169, 95, 0.32);
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Palatino, Georgia, serif;
  --label: 'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
  --read: 31rem;
  --gutter: clamp(20px, 6vw, 64px);
  --ease: cubic-bezier(0.22, 0.61, 0.2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--night);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--linen);
  font: 400 clamp(19px, 2.1vw, 25px) / 1.72 var(--serif);
  letter-spacing: 0.004em;
  background-color: var(--night);
  background-image:
    radial-gradient(1100px 620px at 50% -240px, rgba(217, 169, 95, 0.16), transparent 72%),
    radial-gradient(900px 1200px at 50% 118%, rgba(140, 47, 42, 0.1), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85 .05' numOctaves='2' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 .85 0 0 0 0 .78 0 0 0 0 .66 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(217, 169, 95, 0.28); color: #fff; }
a { color: var(--gold-2); text-underline-offset: 0.24em; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible { outline: 1px solid var(--gold); outline-offset: 4px; }

/* the rising dust: canvas under everything, never in the way */
#dust {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* ---------- the title ---------- */
.front {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  padding: clamp(80px, 16vh, 200px) var(--gutter) clamp(60px, 12vh, 140px);
}
.front::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: clamp(36px, 9vh, 120px);
  background: linear-gradient(var(--hair), transparent);
}
.mark {
  font: 400 clamp(11px, 1.1vw, 13px) / 1 var(--label);
  font-variant: small-caps;
  letter-spacing: 0.62em;
  margin-right: -0.62em;
  color: var(--gold);
  text-decoration: none;
}
h1 {
  margin: clamp(26px, 4vh, 44px) 0 0;
  font: 300 clamp(42px, 8.6vw, 118px) / 0.96 var(--serif);
  letter-spacing: -0.014em;
  font-feature-settings: 'liga', 'dlig';
  max-width: 14ch;
  color: #fbf4e7;
  text-wrap: balance;
}
h1 .l2 {
  display: block;
  color: var(--gold-2);
  font-style: italic;
  letter-spacing: -0.005em;
}
.sub {
  margin: clamp(22px, 3.4vh, 34px) 0 0;
  font: italic 400 clamp(16px, 1.5vw, 20px) / 1.55 var(--serif);
  color: var(--linen-3);
  max-width: 26ch;
}
.rule {
  width: min(200px, 46vw);
  height: 9px;
  margin: clamp(28px, 4vh, 46px) auto 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--rule);
}
.front-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 26px;
  justify-content: center;
  align-items: baseline;
  margin-top: clamp(26px, 4vh, 40px);
}
.hear {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hair);
  padding: 8px 2px 9px;
  color: var(--gold-2);
  font: 400 clamp(11px, 1.1vw, 13px) / 1 var(--label);
  font-variant: small-caps;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: color 0.5s var(--ease), border-color 0.5s var(--ease);
}
.hear:hover { color: #fff; border-color: var(--gold); }
.hear .glyph { display: flex; gap: 2.5px; align-items: center; height: 13px; }
.hear .glyph i {
  width: 1.5px;
  height: 4px;
  background: currentColor;
  transition: height 0.5s var(--ease);
}
.hear.on .glyph i { animation: breath 2.9s ease-in-out infinite; }
.hear.on .glyph i:nth-child(2) { animation-delay: -0.7s; }
.hear.on .glyph i:nth-child(3) { animation-delay: -1.4s; }
.hear.on .glyph i:nth-child(4) { animation-delay: -2.1s; }
@keyframes breath { 50% { height: 13px; } }
.toc {
  margin-top: clamp(30px, 5vh, 52px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  font: 400 12px / 1.6 var(--label);
  font-variant: small-caps;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  opacity: 0.66;
}
.toc a { color: var(--linen-2); text-decoration: none; }
.toc a:hover { color: var(--gold-2); opacity: 1; }
.toc .n { color: var(--gold); margin-right: 6px; }

/* ---------- the poem ---------- */
main { position: relative; z-index: 1; }
.section {
  width: min(var(--read), 100%);
  margin: 0 auto;
  padding: clamp(60px, 11vh, 132px) var(--gutter) clamp(20px, 4vh, 44px);
  scroll-margin-top: 8vh;
}
.section + .section { border-top: 1px solid var(--rule); }
.head {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  margin-bottom: clamp(34px, 6vh, 62px);
}
.numeral {
  font: 300 clamp(30px, 3.4vw, 40px) / 1 var(--serif);
  color: var(--gold);
  font-variant-numeric: lining-nums;
  letter-spacing: 0.1em;
}
.numeral::after {
  content: '';
  display: block;
  width: 1px;
  height: 26px;
  margin: 14px auto 0;
  background: linear-gradient(var(--hair), transparent);
}
h2 {
  margin: 0;
  font: 400 clamp(12px, 1.15vw, 14px) / 1.5 var(--label);
  font-variant: small-caps;
  letter-spacing: 0.46em;
  margin-right: -0.46em;
  color: var(--linen-2);
  font-weight: 400;
}
.stanzas { display: grid; gap: clamp(22px, 3.6vh, 36px); }
.stanza { margin: 0; }
.line {
  display: block;
  color: var(--linen);
  transition: color 0.7s var(--ease), opacity 0.9s var(--ease), text-shadow 0.7s var(--ease);
}
.line.one { text-indent: 0; }
.stanza + .stanza .line:first-child { }
/* the line being spoken */
.line.said {
  color: #fff8ea;
  text-shadow: 0 0 26px rgba(243, 207, 148, 0.42), 0 0 3px rgba(243, 207, 148, 0.3);
}
.listening .line:not(.said) { opacity: 0.42; }
/* the section he stands in */
.section.here .line { opacity: 1; }
.section.here .line:not(.said) { opacity: 0.6; }
.listening .section:not(.here) { opacity: 0.3; }

.one-word { font-style: italic; color: var(--gold-2); }

/* the closing blessing */
.closing {
  margin: clamp(30px, 5vh, 48px) 0 0;
  padding-top: clamp(22px, 3.4vh, 32px);
  border-top: 1px solid var(--hair);
  font: italic 300 clamp(19px, 1.85vw, 23px) / 1.66 var(--serif);
  color: var(--gold-2);
  text-align: center;
  text-wrap: balance;
}

/* ---------- the end-plate ---------- */
.colophon {
  position: relative;
  z-index: 1;
  width: min(var(--read), 100%);
  margin: clamp(40px, 8vh, 90px) auto 0;
  padding: clamp(40px, 7vh, 80px) var(--gutter) clamp(60px, 10vh, 110px);
  border-top: 1px solid var(--rule);
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
  font: 400 14px / 1.7 var(--serif);
  color: var(--linen-3);
}
.colophon .sign { font: italic 400 17px / 1.5 var(--serif); color: var(--linen-2); margin: 0; }
.colophon .links { display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: center; font-variant: small-caps; letter-spacing: 0.14em; font-size: 12px; }
.colophon a { color: var(--linen-3); text-decoration: none; }
.colophon a:hover { color: var(--gold-2); }
.stamp { font: 400 10.5px / 1.6 ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: 0.06em; color: rgba(200, 190, 175, 0.42); }

/* ---------- the listening dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: clamp(14px, 3vh, 26px);
  transform: translate(-50%, 12px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 18px;
  background: rgba(12, 9, 6, 0.82);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--hair);
  border-radius: 2px;
  box-shadow: 0 24px 60px -30px #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease), visibility 0s 0.6s;
  font: 400 11px / 1 var(--label);
  font-variant: small-caps;
  letter-spacing: 0.24em;
  color: var(--gold-2);
  white-space: nowrap;
}
.dock.up { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.dock button {
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  color: var(--linen-2);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border-radius: 1px;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.dock button:hover { color: #fff; border-color: var(--hair); }
.dock svg { width: 13px; height: 13px; fill: currentColor; }
.dock .where { min-width: 6.5em; color: var(--linen-3); }
.dock .where b { color: var(--gold-2); font-weight: 400; }

/* ---------- states ---------- */
.flat .section, .flat .front { animation: none; }
.section.arrive { animation: rise 1.5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition-duration: 0.01s !important; }
}
