:root {
  --stone: #e6ddcf;
  --stone-2: #d9ccb8;
  --ink: #6f6050;
  --ink-soft: rgba(111, 96, 80, .55);
  --display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
  background: var(--stone);
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
}
html::-webkit-scrollbar { display: none; }

body {
  background: var(--stone) 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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .39 0 0 0 0 .31 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--serif);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

html.js body { background: #0c0b0a; }
html.nogl body { background-color: var(--stone); }
html.js:not(.ready) main, html.js:not(.ready) .mute { visibility: hidden; }

.gated body { overflow: hidden; height: 100vh; }

body { position: relative; }

/* the canvas scrolls with the page (JS sizes and places it); a clipping
   wrapper the height of the page keeps its overhang from adding scroll */
#stone-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
#stone {
  position: absolute;
  left: 0; top: 0;
  display: none;
  will-change: transform;
}
#stone.fixed { position: fixed; }
html.gl #stone { display: block; }

main { position: relative; z-index: 1; }

/* ── carving ─────────────────────────────────────────────── */

[data-carve] {
  font-variant-ligatures: none;
  font-kerning: normal;
  color: rgba(96, 80, 62, .62);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .55), 0 -1px 0 rgba(60, 45, 30, .12);
}
html.gl [data-carve] { color: transparent; text-shadow: none; }
html.gl [data-carve]::selection { color: #4a3d2f; background: rgba(255, 236, 196, .55); }
html.gl [data-carve] *::selection { color: #4a3d2f; background: rgba(255, 236, 196, .55); }

/* inked lettering: real type, sitting in the stone */
html.gl [data-carve].ink {
  color: rgba(84, 66, 48, .86);
  text-shadow: 0 1px 0 rgba(255, 251, 242, .42), 0 -1px 0 rgba(60, 44, 30, .1);
  transition: none;
}
html.gl.gated [data-carve].ink:not([style*="opacity"]) { opacity: 0; }
html.gl [data-carve].ink::selection { color: #3a2e22; background: rgba(255, 236, 196, .6); }

[data-glyph] { display: block; }
html:not(.gl) [data-glyph] {
  border-radius: 50%;
  box-shadow: inset 0 2px 3px rgba(255,255,255,.6), inset 0 -3px 5px rgba(80,60,40,.18), 0 3px 6px rgba(80,60,40,.12);
}

[data-rule] { display: block; height: 1px; }
html:not(.gl) [data-rule] { background: rgba(96, 80, 62, .3); }

/* ── cursor ─────────────────────────────────────────────── */

#cursor { display: none; }
html.fine.gl, html.fine.gl * { cursor: none !important; }
html.fine.gl #cursor {
  display: block;
  position: fixed;
  left: 0; top: 0;
  width: 8px; height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 244, 228, .9);
  box-shadow: 0 0 0 1px rgba(60, 45, 30, .25);
  pointer-events: none;
  z-index: 50;
  transition: width .35s cubic-bezier(.2,.8,.2,1), height .35s cubic-bezier(.2,.8,.2,1), margin .35s cubic-bezier(.2,.8,.2,1), opacity .4s;
  will-change: transform;
}
html.fine.gl #cursor.over { width: 34px; height: 34px; margin: -17px 0 0 -17px; }
html.fine.gl #cursor.hide { opacity: 0; }

/* ── the threshold ──────────────────────────────────────── */

#gate { display: none; }
html.js.gl.gated #gate {
  display: grid;
  place-items: center;
  position: fixed;
  inset: 0;
  z-index: 20;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-touch-callout: none;
}
#gate.leaving { pointer-events: none; }
.gate-sigil {
  position: absolute;
  left: 50%; top: 50%;
  width: 120px; height: 120px;
  transform: translate(-50%, -50%);
}
.gate-hint {
  position: absolute;
  left: 0; right: 0;
  top: calc(50% + 118px);
  margin: 0;
  text-align: center;
  font-style: italic;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: .14em;
}
.gate-skip {
  position: absolute;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: none; border: 0;
  font: 12px/1 var(--mono);
  letter-spacing: .3em;
  color: rgba(255, 240, 220, .0);
  padding: 10px 16px;
}
.gate-skip:focus-visible { color: rgba(255, 240, 220, .7); outline: 1px solid rgba(255,240,220,.3); }

/* ── I. surface ─────────────────────────────────────────── */

.surface {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 620px;
}
.mast {
  position: absolute;
  left: var(--gutter);
  top: clamp(28px, 6vh, 64px);
}
.name {
  margin: 0;
  font-weight: 600;
  font-size: clamp(14px, 1.5vw, 19px);
  letter-spacing: .6em;
  line-height: 1;
}
.mast .rule { width: 26px; margin-top: 18px; margin-left: calc(50% - 26px); }

.clock {
  position: absolute;
  right: var(--gutter);
  top: clamp(28px, 6vh, 64px);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .22em;
  line-height: 1;
  padding: 6px 0 10px 12px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
html.fine .clock:hover { cursor: ew-resize; }

.constellation {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.persona, .node {
  position: absolute;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  will-change: transform;
}
.persona { pointer-events: none; }
.node {
  pointer-events: auto;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.node:focus-visible { outline: 1px dashed rgba(96,80,62,.5); outline-offset: 6px; border-radius: 6px; }
.node .g { width: var(--gs, 58px); height: var(--gs, 58px); }
.persona .g { width: var(--ms, 150px); height: var(--ms, 150px); }
.node .lbl, .persona .lbl {
  margin-top: 10px;
  font-size: clamp(17px, 1.4vw, 20px);
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.1;
}
.persona .lbl { font-size: clamp(20px, 1.8vw, 25px); margin-top: 14px; letter-spacing: .02em; }
.node .cap {
  position: absolute;
  top: 100%;
  margin-top: 6px;
  font-style: italic;
  font-weight: 500;
  font-size: 16.5px;
  white-space: nowrap;
  line-height: 1.2;
}
html:not(.gl) .node .cap { opacity: 0; transition: opacity .4s; }
html:not(.gl) .node:hover .cap { opacity: 1; }

.aphorism {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(28px, 6vh, 64px);
  margin: 0;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(17px, 1.5vw, 21px);
  line-height: 1.38;
}
.motto {
  position: absolute;
  right: var(--gutter);
  bottom: clamp(30px, 6vh, 66px);
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .46em;
  line-height: 1;
}
.descend {
  position: absolute;
  left: 50%; bottom: 0;
  width: 1px; height: 7vh;
}
.descend-line { width: 1px; height: 100%; }

/* ── II. strata ─────────────────────────────────────────── */

.strata {
  position: relative;
  padding: 22vh 0 18vh;
}
.strata-col { position: relative; }
.st-label {
  position: absolute;
  left: 0; right: 0;
  height: 0;
}
.st-gloss, .st-time {
  position: absolute;
  bottom: 4px;
  line-height: 1;
  white-space: nowrap;
}
.st-gloss {
  left: var(--gutter);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(17px, 1.6vw, 22px);
}
.st-time {
  right: var(--gutter);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: .16em;
}
.st-label.now .st-gloss { font-size: clamp(26px, 2.6vw, 36px); font-style: italic; font-weight: 500; }
.st-label.now .st-time { font-size: 13px; letter-spacing: .3em; }
.zero {
  margin: 30px var(--gutter) 0 0;
  text-align: right;
  font-style: italic;
  font-weight: 500;
  font-size: 16.5px;
}

/* ── III. erosion ───────────────────────────────────────── */

.erosion { position: relative; height: 260vh; }
.erosion-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.word {
  font-family: var(--display);
  margin: 0;
  font-weight: 600;
  font-size: clamp(54px, 14.5vw, 230px);
  letter-spacing: .03em;
  line-height: 1;
  white-space: nowrap;
}
.word .pre {
  position: relative;
  display: inline-block;
  width: var(--pw, auto);
  height: 1em;
  vertical-align: baseline;
}
.word .pre > span { position: absolute; right: 0; bottom: 0; }
html:not(.gl) .word .no { visibility: hidden; }
.after {
  margin: 4vh 0 0;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(18px, 1.8vw, 24px);
}

/* ── IV. relics ─────────────────────────────────────────── */

.relics {
  position: relative;
  padding: 16vh var(--gutter) 22vh;
}
.relics-head { text-align: center; margin-bottom: 9vh; }
.relics-head h2 {
  margin: 0;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .7em;
  padding-left: .7em;
}
.relics-head .rule { width: 26px; margin: 18px auto 0; }
.niches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 48px);
  max-width: 1240px;
  margin: 0 auto;
}
.relic {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.relic:focus-visible { outline: 1px dashed rgba(96,80,62,.5); outline-offset: 10px; border-radius: 8px; }
.niche {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 50% 50% 10px 10px / 40% 40% 10px 10px;
}
html:not(.gl) .niche { box-shadow: inset 0 6px 14px rgba(70,50,30,.28), inset 0 -2px 3px rgba(255,255,255,.4); }
.relic-screen {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  border-radius: 50% 50% 4px 4px / 37% 37% 4px 4px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
  background: #0b1020;
}
.seal { position: absolute; left: 50%; top: 52%; width: 44%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.relic-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-top: 26px;
  text-align: center;
}
.relic-num { font-family: var(--mono); font-weight: 500; font-size: 12px; letter-spacing: .3em; }
.relic-title { font-size: 19px; font-weight: 600; letter-spacing: .45em; padding-left: .45em; }
.relic-years { font-size: 13px; font-weight: 500; letter-spacing: .28em; }
.relic-line { font-style: italic; font-weight: 500; font-size: 17px; }

.portal {
  position: fixed !important;
  z-index: 40;
  inset: auto !important;
  margin: 0 !important;
  transition: transform 1.1s cubic-bezier(.7,0,.2,1), border-radius 1.1s cubic-bezier(.7,0,.2,1);
  transform-origin: 0 0;
}

/* ── V. descent ─────────────────────────────────────────── */

.descent { position: relative; height: 240vh; }
.dw {
  font-family: var(--display);
  position: absolute;
  margin: 0;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(42px, 7vw, 104px);
  line-height: 1;
  white-space: nowrap;
}
.dw1 { top: 14%; left: 14%; }
.dw2 { top: 36%; right: 16%; }
.dw3 { top: 58%; left: 22%; }
.dw4 { top: 80%; right: 22%; }

/* ── VI. mirror ─────────────────────────────────────────── */

.mirror {
  position: relative;
  min-height: 150vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30vh 0 12vh;
}
.nowhere {
  font-family: var(--display);
  margin: 0;
  font-weight: 500;
  font-size: clamp(40px, 9.5vw, 156px);
  letter-spacing: .16em;
  padding-left: .16em;
  line-height: 1;
  white-space: nowrap;
  display: flex;
}
.nowhere .gap { display: inline-block; width: var(--gap, 0px); }
.ouro {
  margin-top: 16vh;
  width: 92px; height: 92px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.ouro:focus-visible { outline: 1px dashed rgba(255,255,255,.4); outline-offset: 8px; }
.ouro-g { width: 100%; height: 100%; }
.again { margin: 18px 0 0; font-style: italic; font-weight: 500; font-size: 17px; letter-spacing: .06em; }
.contact { margin: 22px 0 0; font-family: var(--mono); font-size: 13px; letter-spacing: .18em; min-height: 1em; }
.contact a { color: inherit; text-decoration: none; }
.year { margin: 12vh 0 0; font-size: 12px; font-weight: 600; letter-spacing: .5em; padding-left: .5em; }

/* ── controls ───────────────────────────────────────────── */

.mute {
  position: fixed;
  right: var(--gutter);
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 30;
  background: none;
  border: 0;
  padding: 10px 0 10px 14px;
  font: italic 500 16px/1 var(--serif);
  letter-spacing: .1em;
  -webkit-tap-highlight-color: transparent;
  opacity: 1;
  transition: opacity .6s;
}
.gated .mute { opacity: 0; pointer-events: none; }
html.gl .mute [data-carve].ink { transition: color .8s; }
html.gl .mute.dark [data-carve].ink { color: rgba(236, 222, 200, .5); text-shadow: none; }

.con-cap { display: none; }
html:not(.js) .mute { display: none; }

/* ── small screens ──────────────────────────────────────── */

@media (max-width: 760px) {
  .surface { min-height: 540px; }
  .mast, .clock { top: calc(clamp(24px, 4.5vh, 40px) + env(safe-area-inset-top)); }
  .name { letter-spacing: .44em; font-size: 14px; }
  .clock { font-size: 12px; letter-spacing: .16em; padding: 0; }
  .aphorism { bottom: calc(66px + env(safe-area-inset-bottom)); font-size: 17px; }
  .motto { right: auto; left: var(--gutter); bottom: calc(30px + env(safe-area-inset-bottom)); letter-spacing: .34em; font-size: 11px; }
  .descend { display: none; }
  .mute { bottom: calc(18px + env(safe-area-inset-bottom)); font-size: 15px; }
  .node .lbl { font-size: 15px; margin-top: 6px; }
  .persona .lbl { font-size: 18px; margin-top: 9px; }
  /* one caption, under the circle, instead of one per symbol */
  .node .cap { display: none; }
  .con-cap {
    display: block;
    position: absolute;
    left: var(--gutter); right: var(--gutter);
    margin: 0;
    text-align: center;
    font-style: italic;
    font-weight: 500;
    font-size: 17px;
    line-height: 1.3;
    min-height: 2.6em;
    pointer-events: none;
  }
  .niches { grid-template-columns: minmax(0, 1fr); max-width: 340px; gap: 64px; }
  .relic.sealed { display: none; }
  .relic.sealed:nth-of-type(2) { display: flex; }
  .dw1 { left: 8%; } .dw2 { right: 8%; } .dw3 { left: 10%; } .dw4 { right: 10%; }
  .st-time { font-size: 10px; letter-spacing: .1em; }
}

@media (max-width: 359px) {
  .name { letter-spacing: .3em; font-size: 13px; }
  .motto { letter-spacing: .24em; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
