/* DreamWeaver — "one night" landing. Brand palette from src/theme/colors.js */
:root {
  --bg: #05060d;
  --ink: #e8e6f5;
  --ink-soft: rgba(232, 230, 245, 0.62);
  --ink-faint: rgba(232, 230, 245, 0.32);
  --line: rgba(232, 230, 245, 0.14);
  --violet: #c084fc;
  --cyan: #5eead4;
  --rose: #f0abfc;
  --ember: #fb7185;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --gutter: clamp(16px, 5vw, 72px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

::selection {
  background: rgba(192, 132, 252, 0.4);
}

:focus-visible {
  outline: 1px solid var(--violet);
  outline-offset: 5px;
}

/* ---------- Atmosphere ---------- */
#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Film grain keeps the dark gradients from looking digital. */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

.cursor {
  position: fixed;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--ink);
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 101;
  opacity: 0;
  transition: width 0.4s var(--ease), height 0.4s var(--ease), margin 0.4s var(--ease), opacity 0.4s;
}

.has-mouse .cursor {
  opacity: 1;
}

.cursor.big {
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
}

/* ---------- Top bar ---------- */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px var(--gutter);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  mix-blend-mode: difference;
  color: #fff;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.wordmark img {
  width: 26px;
  height: 26px;
}

.clock {
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 10px;
}

.clock::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.25; }
}

/* ---------- Shared type ---------- */
.big {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 12.5vw, 9.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0;
}

.big i {
  font-weight: 500;
}

.mid {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.2rem, 6vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: -0.015em;
  margin: 0;
}

.body {
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  color: var(--ink-soft);
  max-width: 34ch;
  margin: 0;
}

.tiny {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* Lines slide up from behind a mask. */
.mask {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.mask > span {
  display: block;
  transform: translateY(105%);
  transition: transform 1.4s var(--ease);
  transition-delay: calc(var(--n, 0) * 0.12s);
}

.in .mask > span,
.mask.in > span {
  transform: none;
}

.fade {
  opacity: 0;
  transition: opacity 1.6s ease;
  transition-delay: var(--d, 0.3s);
}

.in .fade,
.fade.in {
  opacity: 1;
}

section {
  position: relative;
  padding: 0 var(--gutter);
}

/* ---------- 1 · Opening ---------- */
.open {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding-top: 18svh;
  padding-bottom: 6svh;
}

.open h1 {
  align-self: start;
}

.open h1 .mask:nth-child(2) {
  padding-left: 12vw;
}

.open-foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}

.open-foot .body {
  max-width: 26ch;
  text-align: right;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  line-height: 1.3;
}

.scroll-hint {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scroll-hint::after {
  content: "";
  width: 48px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: hint 2.6s var(--ease) infinite;
}

@keyframes hint {
  0% { transform: scaleX(0); }
  50% { transform: scaleX(1); transform-origin: left; }
  51% { transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

/* ---------- 2 · Forgetting (pinned) ---------- */
.forget {
  height: 260svh;
  padding: 0;
}

.pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--gutter);
  overflow: hidden;
}

.dream-text {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 5vw, 4.8rem);
  line-height: 1.12;
  max-width: 25ch;
  margin: 0;
}

.dream-text .w {
  display: inline-block;
  will-change: transform, opacity, filter;
}

.forget .tiny {
  position: absolute;
  left: var(--gutter);
  bottom: 8svh;
}

.forget .counter {
  position: absolute;
  right: var(--gutter);
  bottom: 8svh;
  font-variant-numeric: tabular-nums;
}

/* ---------- 3 · Voice ---------- */
.voice {
  padding-top: 24svh;
  padding-bottom: 20svh;
}

.voice .row {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: end;
}

#wave {
  display: block;
  width: calc(100% + 2 * var(--gutter));
  height: 220px;
  margin: 8svh calc(-1 * var(--gutter)) 0;
}

.rec-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 0 0 rgba(251, 113, 133, 0.6);
  animation: rec 1.8s ease-out infinite;
}

@keyframes rec {
  to { box-shadow: 0 0 0 14px rgba(251, 113, 133, 0); }
}

/* ---------- 4 · Lenses ---------- */
.lenses {
  padding-top: 16svh;
  padding-bottom: 22svh;
}

.lenses .lead {
  margin-bottom: 6svh;
}

.lens-line {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 7.5vw, 7rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}

.lens-line .mask {
  display: inline-block;
  vertical-align: top;
}

.lens-word {
  font: inherit;
  font-style: italic;
  color: var(--lens, var(--violet));
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  display: inline-block;
  transition: color 0.8s ease;
}

.lens-word .ch {
  display: inline-block;
  transition: transform 0.7s var(--ease), opacity 0.5s ease, filter 0.7s ease;
  transition-delay: calc(var(--i) * 0.025s);
}

.lens-word.out .ch {
  transform: translateY(-0.35em) rotate(-4deg);
  opacity: 0;
  filter: blur(6px);
}

.lens-word.pre .ch {
  transform: translateY(0.35em) rotate(4deg);
  opacity: 0;
  filter: blur(6px);
  transition: none;
}

.lens-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 5svh 0 0;
  padding: 0;
  list-style: none;
}

.lens-pick button {
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink-faint);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.4s, border-color 0.4s;
}

.lens-pick button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--lens);
}

.reading {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  margin-top: 8svh;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.reading-text {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.65;
  margin: 0;
  max-width: 46ch;
  min-height: 7.5em;
  transition: opacity 0.5s ease, transform 0.8s var(--ease);
}

.reading-text.swap {
  opacity: 0;
  transform: translateY(10px);
}

/* ---------- 5 · Paint (pinned) ---------- */
.paint {
  height: 240svh;
  padding: 0;
}

.paint .pin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 48px;
}

.canvas-wrap {
  position: relative;
  aspect-ratio: 4 / 5;
  max-height: 78svh;
  justify-self: center;
  width: 100%;
  max-width: 520px;
  border-radius: 2px;
  overflow: hidden;
  clip-path: inset(var(--clip, 50%) 0 var(--clip, 50%) 0);
}

.canvas-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-wrap figcaption {
  position: absolute;
  left: 16px;
  bottom: 14px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------- 6 · Journal ---------- */
.journal {
  padding-top: 20svh;
  padding-bottom: 18svh;
}

.entries {
  list-style: none;
  margin: 10svh 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.entry {
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  gap: 24px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.6s var(--ease);
}

.entry:hover {
  padding-left: 14px;
}

.entry time {
  font-size: 0.8rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.entry p {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  line-height: 1.15;
  margin: 0;
}

.entry .tag {
  font-size: 0.75rem;
  color: var(--ink-faint);
}

.entry mark {
  background: none;
  color: inherit;
  position: relative;
  white-space: nowrap;
  transition: color 0.8s ease;
}

.entry mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.06em;
  height: 0.09em;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.2s var(--ease);
}

.entries.lit mark {
  color: var(--cyan);
}

.entries.lit mark::after {
  transform: scaleX(1);
}

.entries.lit .entry:nth-child(2) mark::after { transition-delay: 0.35s; }
.entries.lit .entry:nth-child(3) mark::after { transition-delay: 0.7s; }
.entries.lit .entry:nth-child(4) mark::after { transition-delay: 1.05s; }

.insight {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 24px;
  margin-top: 7svh;
}

.insight p {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  line-height: 1.3;
  margin: 0;
  max-width: 30ch;
}

/* ---------- 7 · Lantern ---------- */
.lantern {
  min-height: 130svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 10svh;
  padding-bottom: 10svh;
}

.lantern .mid {
  margin-bottom: 9svh;
}

.dark-text {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.dark-text p {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 4.4vw, 4rem);
  line-height: 1.15;
  max-width: 26ch;
  margin: 0 0 0.6em;
}

.dark-text .dim {
  color: var(--ink);
  opacity: 0.1;
}

.dark-text .lit {
  position: absolute;
  inset: 0;
  -webkit-mask-image: radial-gradient(circle var(--r, 180px) at var(--lx, 50%) var(--ly, 50%), #000 30%, transparent 100%);
  mask-image: radial-gradient(circle var(--r, 180px) at var(--lx, 50%) var(--ly, 50%), #000 30%, transparent 100%);
}

.lantern .tiny {
  margin-top: 4svh;
}

/* ---------- 8 · Dawn ---------- */
.dawn {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 16svh;
  padding-bottom: 6svh;
}

.dawn .big .mask:nth-child(2) {
  padding-left: 10vw;
}

.dawn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 12svh;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.soon {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  line-height: 1.25;
  margin: 0 0 18px;
}

.prices {
  list-style: none;
  margin: 0;
  padding: 0;
}

.prices li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.prices li span:last-child {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px 32px;
  margin-top: 14svh;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
}

.foot a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.foot a:hover {
  border-color: currentColor;
}

/* ---------- Mobile ---------- */
@media (max-width: 820px) {
  .open h1 .mask:nth-child(2),
  .dawn .big .mask:nth-child(2) {
    padding-left: 0;
  }

  .open-foot {
    flex-direction: column-reverse;
    align-items: start;
  }

  .open-foot .body {
    text-align: left;
  }

  .voice .row,
  .reading,
  .dawn-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  #wave {
    height: 150px;
  }

  .paint .pin {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 28px;
  }

  .canvas-wrap {
    max-height: 52svh;
    width: auto;
    aspect-ratio: 4 / 5;
  }

  .entry {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .insight {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ---------- Legal pages ---------- */
.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: 140px 16px 80px;
}

.legal h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}

.legal .updated {
  color: var(--ink-faint);
  font-size: 0.85rem;
  margin: 0 0 48px;
}

.legal h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.8rem;
  margin: 52px 0 12px;
}

.legal h3 {
  font-weight: 500;
  font-size: 1.05rem;
  margin: 32px 0 6px;
}

.legal p,
.legal li,
.legal td {
  color: rgba(232, 230, 245, 0.78);
}

.legal ul,
.legal ol {
  padding-left: 1.2em;
}

.legal li {
  margin-bottom: 8px;
}

.legal a {
  color: var(--ink);
  text-decoration-color: var(--violet);
  text-underline-offset: 3px;
}

.legal .note {
  margin: 32px 0;
  padding: 4px 0 4px 22px;
  border-left: 1px solid var(--violet);
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}

.legal th,
.legal td {
  text-align: left;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.legal th {
  font-weight: 500;
}

.legal .mail {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 4vw, 2rem);
  text-decoration: none;
  border-bottom: 1px solid var(--violet);
}

.legal-foot {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 60px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.legal-foot a {
  text-decoration: none;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.001ms !important;
  }

  .mask > span {
    transform: none;
  }

  .fade {
    opacity: 1;
  }

  .forget,
  .paint {
    height: auto;
  }

  .pin {
    position: relative;
    height: auto;
    padding-top: 15svh;
    padding-bottom: 15svh;
  }

  .canvas-wrap {
    clip-path: none;
  }

  .dark-text .lit {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .dark-text .dim {
    visibility: hidden;
  }
}
