/* ============ TOKENS ============ */
:root {
  --bg: #f3f7fa;
  --ink: #000000;
  --accent: #0e2cec;
  --accent-deep: #061bb0;
  --font-script: 'Mrs Saint Delafield', cursive;
  --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --stage-content-w: clamp(280px, 34vw, 440px);
  --stage-gap: clamp(1.5rem, 4vw, 4rem);
  --stage-pendant-w: clamp(200px, 20vw, 340px);
}

/* ============ RESET ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow-x: hidden;
  cursor: default;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; background: none; border: none; cursor: pointer; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.75rem 1.25rem;
  z-index: 999;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.script {
  font-family: var(--font-script);
  font-weight: 400;
  line-height: 1;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ============ GRAIN ============ */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ============ CURSOR DOT ============ */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
  z-index: 999;
  transform: translate(-50%, -50%);
  transition: width 0.25s var(--ease), height 0.25s var(--ease), opacity 0.25s var(--ease);
  opacity: 0;
  will-change: transform;
}
.cursor-dot.is-active { opacity: 0.55; }
.cursor-dot.is-hovering {
  width: 26px;
  height: 26px;
  opacity: 0.35;
}
@media (hover: none), (pointer: coarse) {
  .cursor-dot { display: none; }
}

/* ============ SOCIAL LINKS ============ */
.social-links {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 60;
  display: flex;
  gap: 0.9rem;
}
.social-link {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(14, 44, 236, 0.07);
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}
.social-link svg { width: 18px; height: 18px; }
.social-link:hover {
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .social-links { bottom: 1.25rem; left: 1.25rem; }
  .social-link { width: 34px; height: 34px; }
}

/* ============ HERO ============ */
.hero {
  position: relative;
  height: 100vh;
  min-height: 640px;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: 0 clamp(1.5rem, 6vw, 6rem);
}

.hero-illustration-wrap {
  position: relative;
  z-index: 2;
  width: clamp(220px, 28vw, 420px);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  order: 2;
}

.hero-illustration-float { width: 100%; }
.hero-illustration {
  width: 100%;
  height: auto;
  will-change: transform;
  transform-style: preserve-3d;
}

.hero-text {
  position: relative;
  z-index: 3;
  padding-left: 0;
  margin-left: 0;
  order: 1;
}
.hero-heading {
  font-size: clamp(2.6rem, 6vw, 3rem);
  color: var(--ink);
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 3rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  opacity: 0.65;
  transition: opacity 0.3s var(--ease);
  transform: translateX(-50%);
}
.scroll-cue:hover { opacity: 1; }
.scroll-cue-line {
  display: block;
  width: 1px;
  height: 34px;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}
.scroll-cue-line::after {
  content: '';
  position: absolute;
  left: 0; top: -100%;
  width: 100%; height: 100%;
  background: var(--accent);
  animation: cueDrop 2.2s ease-in-out infinite;
}
@keyframes cueDrop {
  0% { transform: translateY(-100%); }
  60% { transform: translateY(100%); }
  100% { transform: translateY(100%); }
}
.scroll-cue-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
  }
  .hero-illustration-wrap {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: 62vw;
    margin: 0 auto 0.75rem;
    order: 1;
  }
  .hero-text {
    padding-top: 0;
    margin-top: 0;
    order: 2;
  }
}


/* ============ SPACE SECTION (horizontal chapters) ============ */
.space-section {
  position: relative;
  background: var(--bg);
}

.space-pin {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.pendant-wrap {
  position: absolute;
  left: calc(50% + (var(--stage-content-w) + var(--stage-gap)) / 2 - var(--stage-pendant-w) / 2);
  top: 0;
  height: 100%;
  width: var(--stage-pendant-w);
  z-index: 1;
  opacity: 0.9;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pendant-float {
  width: 100%;
}
.pendant-illustration {
  width: 100%;
  height: auto;
}

.chapters-track {
  position: relative;
  z-index: 2;
  display: flex;
  height: 100%;
  width: 400%;
  will-change: transform;
}

.chapter {
  width: 100vw;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: var(--stage-gap);
  padding: 0 clamp(1.5rem, 6vw, 6rem);
}

.chapter-inner {
  width: var(--stage-content-w);
  flex: 0 0 auto;
}

.chapter-spacer {
  width: var(--stage-pendant-w);
  flex: 0 0 auto;
  visibility: hidden;
}

.chapter-label {
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  color: var(--ink);
  margin-bottom: 1.4rem;
}

.chapter-content {
  max-height: 42vh;
  overflow-y: auto;
  padding-right: 0.75rem;
}
.chapter-content p {
  font-size: 0.94rem;
  line-height: 1.65;
  font-weight: 300;
  margin-bottom: 1rem;
  max-width: 42ch;
}
.chapter-list {
  margin-top: 0.5rem;
}
.chapter-list li {
  padding: 0.6rem 0;
  border-top: 1px solid rgba(0,0,0,0.1);
  font-weight: 400;
}
.chapter-list li:last-child { border-bottom: 1px solid rgba(0,0,0,0.1); }

.chapter-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), color 0.3s var(--ease);
}
.chapter-cta:hover {
  color: var(--accent-deep);
  border-color: currentColor;
}

.article-list { display: flex; flex-direction: column; gap: 0.9rem; margin-bottom: 1.3rem; }
.article-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  transition: background 0.3s var(--ease);
}
.article-link:hover { background: rgba(14, 44, 236, 0.06); }
.article-title { font-weight: 600; font-size: 0.92rem; }
.article-meta {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.article-snippet {
  font-size: 0.82rem;
  font-weight: 300;
  opacity: 0.75;
  max-width: 46ch;
}

/* custom scrollbar for chapter content, subtle */
.chapter-content::-webkit-scrollbar { width: 4px; }
.chapter-content::-webkit-scrollbar-thumb {
  background: rgba(14, 44, 236, 0.25);
  border-radius: 4px;
}

.chapter-progress {
  position: absolute;
  bottom: 2.5rem;
  right: clamp(2rem, 8vw, 7rem);
  z-index: 3;
  display: flex;
  gap: 0.6rem;
}
.progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}
.progress-dot.is-active {
  background: var(--accent);
  transform: scale(1.35);
}

@media (max-width: 900px) {
  .space-pin { height: auto; }
  .chapters-track {
    flex-direction: column;
    width: 100%;
    height: auto;
  }
  .chapter {
    width: 100%;
    height: auto;
    padding: 5rem clamp(1.5rem, 6vw, 3rem);
  }
  .chapter-content { max-height: none; overflow: visible; }
  .chapter-spacer { display: none; }
  .pendant-wrap { display: none; }
  .chapter-progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue-line::after { animation: none; }
}
