:root {
  color-scheme: dark;
  --ink: #f0f1eb;
  --muted: rgba(240, 241, 235, .56);
  --cyan: #8be7ef;
  --coral: #ee745d;
  --black: #08090c;
  --split: 58%;
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: var(--black); }

body {
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font: inherit; }

#experience {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 540px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 48%, rgba(119, 223, 234, .07), transparent 32%),
    #08090c;
}

.underpainting {
  position: absolute;
  z-index: -4;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .33;
  filter: contrast(1.15) saturate(.62);
  transform: scale(1.035);
  transition: transform 1.3s cubic-bezier(.2,.7,.1,1), filter 1s ease;
}

.grain {
  position: absolute;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  opacity: .055;
  mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
}

.mast {
  position: absolute;
  z-index: 5;
  top: var(--safe-top);
  left: clamp(16px, 2vw, 32px);
  right: clamp(16px, 2vw, 32px);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  pointer-events: none;
}

.date {
  grid-column: 1;
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--muted);
}

.mast h1 {
  grid-column: 1;
  margin: 5px 0 0;
  width: max-content;
  font-size: clamp(17px, 1.75vw, 27px);
  line-height: .88;
  letter-spacing: -.065em;
  text-transform: uppercase;
}

.about-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 52px;
  min-height: 44px;
  border: 1px solid rgba(240,241,235,.26);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(5,6,9,.42);
  backdrop-filter: blur(8px);
  cursor: pointer;
  pointer-events: auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.about-button:hover, .about-button:focus-visible { border-color: var(--cyan); outline: none; }

.storyworld {
  position: absolute;
  z-index: 1;
  inset: clamp(82px, 12vh, 126px) 0 clamp(134px, 18vh, 174px);
  display: grid;
  grid-template-columns: var(--split) calc(100% - var(--split));
  perspective: 1100px;
  transform-style: preserve-3d;
}

.voice {
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: opacity .45s ease, filter .45s ease, transform 1.4s cubic-bezier(.18,.72,.12,1);
  will-change: transform;
  container-type: inline-size;
}

.voice-left {
  padding: 34px clamp(32px, 4.2vw, 76px) 20px clamp(16px, 3vw, 48px);
  text-align: right;
  transform-origin: 100% 50%;
  background: transparent;
}

.voice-right {
  padding: 34px clamp(16px, 3vw, 48px) 20px clamp(32px, 4.2vw, 76px);
  text-align: left;
  transform-origin: 0 50%;
  background: transparent;
}

.voice-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(240,241,235,.24);
  opacity: .66;
}

.voice-left .voice-meta { flex-direction: row-reverse; }

.voice-meta h2, .voice-meta span {
  margin: 0;
  font-size: 9px;
  line-height: 1;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.voice-meta h2 { color: var(--cyan); }
.voice-right .voice-meta h2 { color: var(--coral); }

.voice p {
  margin: 14px 0 0;
  max-width: 100%;
  font-size: clamp(16px, 6.5cqw, 52px);
  line-height: .93;
  letter-spacing: -.058em;
  font-weight: 800;
  text-wrap: pretty;
  transition: color .35s ease, letter-spacing .35s ease, transform .35s ease;
}

.voice p span {
  display: inline;
  opacity: .78;
  transition: opacity .3s ease, color .3s ease, text-shadow .3s ease;
}

.voice p .charged { opacity: 1; color: #fff; }
.voice-left p .charged { text-shadow: 0 0 28px rgba(139,231,239,.34); }
.voice-right p .charged { text-shadow: 0 0 28px rgba(238,116,93,.34); }

.seam {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: 1px;
  pointer-events: none;
  transform: translateX(-.5px);
  background: rgba(255,255,255,.62);
  box-shadow: 0 0 16px rgba(255,255,255,.25), 0 0 54px rgba(139,231,239,.13);
}

.seam-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  height: 42%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255,255,255,.11), transparent 67%);
  opacity: 0;
  transition: opacity .35s ease;
}

.shared-phrase {
  position: absolute;
  left: 50%;
  top: 50%;
  writing-mode: vertical-rl;
  transform: translate(-50%, -50%) scaleY(.55);
  color: #fff;
  font-size: clamp(15px, 1.4vw, 22px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: .28em;
  text-transform: uppercase;
  text-shadow: 0 0 18px #fff, 0 0 58px rgba(139,231,239,.8);
  opacity: 0;
  filter: blur(5px);
  white-space: nowrap;
  transition: opacity .4s ease, filter .4s ease, transform .6s cubic-bezier(.2,.7,.1,1);
}

.runner {
  position: absolute;
  left: 50%;
  top: 2%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 22px;
  opacity: 0;
}

.gutter-handle {
  position: absolute;
  z-index: 8;
  top: 50%;
  left: var(--split);
  width: 58px;
  height: 78px;
  margin: -39px 0 0 -29px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: ew-resize;
  touch-action: none;
}

.gutter-handle span {
  position: absolute;
  inset: 9px 24px;
  border-radius: 99px;
  background: #f8f8f2;
  box-shadow: 0 0 0 1px rgba(255,255,255,.4), 0 0 26px rgba(255,255,255,.7), 0 0 70px rgba(139,231,239,.24);
  transition: inset .2s ease, background .2s ease, box-shadow .2s ease;
}

.gutter-handle:hover span, .gutter-handle:focus-visible span {
  inset: 4px 22px;
  background: var(--cyan);
  box-shadow: 0 0 0 1px #fff, 0 0 32px rgba(139,231,239,.9), 0 0 82px rgba(139,231,239,.38);
}

.gutter-handle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }

#experience.is-near .voice p { letter-spacing: -.066em; color: #fff; }
#experience.is-near .seam-glow { opacity: 1; }
#experience.is-near .shared-phrase { opacity: .32; filter: blur(2px); transform: translate(-50%, -50%) scaleY(.82); }
#experience.is-aligning .gutter-handle span { background: #fff; box-shadow: 0 0 38px #fff, 0 0 100px rgba(139,231,239,.72); }

#experience.is-found .shared-phrase {
  opacity: 1;
  filter: blur(0);
  transform: translate(-50%, -50%) scaleY(1);
}

#experience.is-found .voice { opacity: .22; filter: blur(1.2px); }
#experience.is-found .gutter-handle { opacity: 0; pointer-events: none; }
#experience.is-found .gutter-handle span { opacity: 0; transform: scale(.15); }
#experience.is-found .runner { animation: run-seam 1.2s cubic-bezier(.2,.7,.1,1) both; }

@keyframes run-seam {
  0% { top: 2%; opacity: 0; }
  15% { opacity: 1; }
  88% { opacity: 1; }
  100% { top: 96%; opacity: 0; }
}

.guide {
  position: absolute;
  z-index: 6;
  left: clamp(16px, 3vw, 48px);
  right: clamp(16px, 3vw, 48px);
  bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: minmax(92px, .35fr) minmax(260px, 1fr) auto;
  align-items: end;
  gap: clamp(18px, 3vw, 60px);
  min-height: 82px;
}

.chapter { display: grid; gap: 5px; }
.chapter span { font-size: 9px; font-weight: 800; letter-spacing: .16em; color: var(--muted); }
.chapter span:last-child { color: var(--ink); }

.instruction {
  max-width: 520px;
  margin: 0;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(15px, 1.35vw, 20px);
  font-style: italic;
  line-height: 1.25;
  color: rgba(240,241,235,.77);
}

.progress { display: flex; gap: 7px; padding-bottom: 4px; }
.progress i { width: 26px; height: 2px; background: rgba(240,241,235,.23); transition: background .4s ease, width .4s ease; }
.progress i.active { width: 44px; background: var(--ink); }
.progress i.done { background: var(--cyan); }

.continue, .restart {
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 999px;
  color: #090a0c;
  background: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.continue { position: absolute; right: 0; bottom: 38px; animation: arrive .5s both; }
.continue span { padding-left: 12px; }
.continue:hover, .continue:focus-visible, .restart:hover, .restart:focus-visible { background: var(--cyan); outline: none; }

@keyframes arrive { from { opacity: 0; transform: translateY(10px); } }

.finale {
  position: absolute;
  z-index: 4;
  inset: clamp(90px, 12vh, 130px) 8vw clamp(104px, 14vh, 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .8s .55s ease, transform 1.35s .35s cubic-bezier(.18,.72,.12,1);
}

.finale-kicker { margin: 0 0 18px; color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .28em; }
.finale-line { margin: 0; font-size: clamp(38px, 7.4vw, 128px); line-height: .78; font-weight: 900; letter-spacing: -.075em; text-transform: uppercase; }
.finale-line em { color: var(--coral); font-family: Georgia, 'Times New Roman', serif; font-weight: 400; text-transform: none; }
.finale-note { margin: 26px 0 22px; max-width: 420px; font-family: Georgia, 'Times New Roman', serif; font-style: italic; font-size: 15px; color: rgba(240,241,235,.68); }
.finale .restart { pointer-events: auto; }

#experience.is-finale .voice-left { transform: translateX(-28vw) rotateY(72deg); opacity: .07; filter: blur(3px); }
#experience.is-finale .voice-right { transform: translateX(28vw) rotateY(-72deg); opacity: .07; filter: blur(3px); }
#experience.is-finale .seam { box-shadow: 0 0 28px #fff, 0 0 22vw rgba(139,231,239,.34); }
#experience.is-finale .shared-phrase { opacity: .14; filter: blur(1px); }
#experience.is-finale .underpainting { transform: scale(1.14); filter: contrast(1.45) brightness(.63) saturate(.7); }
#experience.is-finale .finale { opacity: 1; transform: scale(1); }
#experience.is-finale .guide, #experience.is-finale .gutter-handle { opacity: 0; pointer-events: none; }
#experience.is-finale .mast h1, #experience.is-finale .date { opacity: 0; }

dialog {
  width: min(92vw, 520px);
  padding: 0;
  border: 1px solid rgba(240,241,235,.27);
  border-radius: 2px;
  color: var(--ink);
  background: rgba(8,9,12,.94);
  box-shadow: 0 28px 100px #000;
  backdrop-filter: blur(22px);
}

dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
dialog form { position: relative; padding: 42px clamp(24px, 6vw, 50px); }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; color: var(--ink); background: transparent; cursor: pointer; font-size: 30px; }
.dialog-kicker { color: var(--cyan); font-size: 9px; font-weight: 900; letter-spacing: .2em; }
dialog h2 { margin: 16px 0 20px; font-size: clamp(38px, 8vw, 64px); line-height: .88; letter-spacing: -.06em; text-transform: uppercase; }
dialog p { font-family: Georgia, 'Times New Roman', serif; line-height: 1.45; color: rgba(240,241,235,.72); }
dialog .credits { margin-top: 28px; font-family: Arial, Helvetica, sans-serif; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }

@media (max-width: 680px) {
  #experience { min-height: 500px; }
  .mast { top: var(--safe-top); }
  .date { display: none; }
  .mast h1 { margin-top: 0; font-size: 15px; }
  .storyworld { inset: 62px 0 152px; }
  .voice { justify-content: center; }
  .voice-left { padding: 24px 23px 16px 12px; }
  .voice-right { padding: 24px 12px 16px 23px; }
  .voice-meta { display: grid; gap: 5px; padding-bottom: 7px; }
  .voice-left .voice-meta { direction: rtl; }
  .voice-meta h2, .voice-meta span { font-size: 7px; }
  .voice p { margin-top: 9px; font-size: clamp(15px, 8.4cqw, 24px); line-height: .94; }
  .gutter-handle { width: 56px; height: 72px; margin: -36px 0 0 -28px; }
  .gutter-handle span { inset: 9px 23px; }
  .gutter-handle:hover span, .gutter-handle:focus-visible span { inset: 5px 22px; }
  .shared-phrase { font-size: 12px; letter-spacing: .2em; }
  .guide { left: 14px; right: 14px; bottom: var(--safe-bottom); grid-template-columns: 1fr auto; grid-template-rows: auto auto; gap: 8px 12px; min-height: 112px; }
  .chapter { grid-column: 1; grid-row: 1; }
  .instruction { grid-column: 1 / -1; grid-row: 2; padding-right: 56px; font-size: 14px; }
  .progress { grid-column: 2; grid-row: 1; }
  .progress i { width: 17px; }
  .progress i.active { width: 28px; }
  .continue { right: 0; bottom: 0; width: 52px; min-height: 52px; padding: 0; font-size: 0; }
  .continue span { padding: 0; font-size: 19px; }
  .finale { inset: 66px 16px 78px; }
  .finale-line { font-size: clamp(39px, 14vw, 68px); line-height: .8; }
  .finale-note { margin: 20px 18px; font-size: 13px; }
}

@media (max-height: 660px) and (min-width: 681px) {
  .storyworld { inset: 72px 0 112px; }
  .voice p { font-size: clamp(20px, 2.65vw, 38px); }
  .guide { min-height: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
}
