:root {
  --bg: #111110;
  --surface: #181715;
  --surface-hover: #1f1d1a;
  --text: #f2ece1;
  --text-muted: #9e9589;
  --accent: #d97745;
  --brass: #c89d54;
  --accent-soft: rgba(217, 119, 69, 0.14);
  --border: #2d2a25;
  --border-strong: #443e36;
  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.72;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body.is-locked {
  overflow: hidden;
}

body.is-locked .page-layout,
body.is-locked .music-player,
body.is-locked .mobile-toc-btn,
body.is-locked .top-progress {
  display: none;
}

/* Editorial Password Gate */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  transition: opacity 0.45s var(--ease-spring), visibility 0.45s ease;
}

.lock-screen.is-unlocked {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.lock-card.shake {
  animation: lockShake 0.36s ease;
}

@keyframes lockShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.lock-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.lock-title {
  font-family: var(--font-serif);
  font-size: 2.15rem;
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 10px;
}

.lock-title em {
  font-style: italic;
  color: var(--accent);
}

.lock-subtitle {
  font-size: 0.94rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lock-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.lock-input {
  width: 100%;
  padding: 12px 44px 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.96rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.lock-input:focus {
  border-color: var(--accent);
}

.lock-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
}

.lock-eye:hover {
  color: var(--text);
}

.lock-eye svg {
  width: 18px;
  height: 18px;
}

.lock-submit {
  width: 100%;
  justify-content: center;
}

.lock-error {
  min-height: 20px;
  font-size: 0.84rem;
  color: #e06c53;
}

/* Canvases */
#bg-canvas,
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#bg-canvas {
  z-index: 0;
}

#confetti-canvas {
  z-index: 60;
}

/* Top Progress Rule */
.top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.04);
  z-index: 80;
}

.top-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.12s linear;
}

/* Minimalist Floating Music Player */
.music-player {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s var(--ease-spring), border-color 0.25s ease;
}

.music-player:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.player-btn,
.player-mute {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.player-btn {
  background: var(--accent);
  color: #111110;
}

.player-btn:hover {
  background: #e38656;
}

.player-btn svg,
.player-mute svg {
  width: 17px;
  height: 17px;
}

.player-btn .icon-pause {
  display: none;
}

.music-player.is-playing .player-btn .icon-play {
  display: none;
}

.music-player.is-playing .player-btn .icon-pause {
  display: block;
}

.player-info {
  display: flex;
  flex-direction: column;
  min-width: 175px;
  max-width: 240px;
}

.player-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.player-lyric {
  font-size: 0.72rem;
  color: var(--brass);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 11px;
}

.equalizer span {
  width: 2px;
  height: 3px;
  background: var(--accent);
  border-radius: 1px;
  transition: height 0.2s ease;
}

.music-player.is-playing .equalizer span {
  animation: eqPulse 0.8s ease-in-out infinite alternate;
}

.music-player.is-playing .equalizer span:nth-child(2) { animation-delay: 0.15s; }
.music-player.is-playing .equalizer span:nth-child(3) { animation-delay: 0.3s; }
.music-player.is-playing .equalizer span:nth-child(4) { animation-delay: 0.45s; }

@keyframes eqPulse {
  0% { height: 3px; }
  100% { height: 11px; }
}

.player-mute {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.player-mute:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.player-mute .icon-muted {
  display: none;
}

.music-player.is-muted .player-mute .icon-vol {
  display: none;
}

.music-player.is-muted .player-mute .icon-muted {
  display: block;
  color: var(--accent);
}

/* Page Layout with Right-Side TOC */
.page-layout {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 64px;
  align-items: start;
}

.content-column {
  min-width: 0;
  padding-bottom: 120px;
}

/* =========================================================
   ARTCRAFT-STYLE MOVING RIGHT-SIDE TABLE OF CONTENTS
   ========================================================= */
.toc-rail {
  position: sticky;
  top: 110px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.25s ease;
}

.toc-rail:hover {
  border-color: var(--border-strong);
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.toc-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.toc-percent {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
}

.toc-nav {
  position: relative;
  display: flex;
}

.toc-track {
  position: relative;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
  margin-right: 14px;
  flex-shrink: 0;
}

.toc-indicator {
  position: absolute;
  left: -1px;
  top: 0;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: var(--accent);
  transition:
    transform 0.42s var(--ease-spring),
    height 0.42s var(--ease-spring);
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.toc-link {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 400;
  transition:
    color 0.2s ease,
    transform 0.28s var(--ease-spring),
    background 0.2s ease;
}

.toc-link:hover {
  color: var(--text);
  transform: translateX(4px);
}

.toc-link.active {
  color: var(--text);
  font-weight: 600;
  transform: translateX(5px);
  background: var(--accent-soft);
}

.toc-footer-note {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Mobile TOC Button */
.mobile-toc-btn {
  display: none;
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 75;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.mobile-toc-pct {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Sections */
.section {
  padding: 88px 0;
}

.hero-section {
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 72px;
}

.editorial-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.kicker-sep {
  color: var(--accent);
}

/* Hand-drawn Ink Flourish */
.quill-wrap {
  width: 170px;
  margin-bottom: 14px;
}

.quill-path {
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: drawQuill 2s var(--ease-spring) 0.25s forwards;
}

.quill-dot {
  opacity: 0;
  animation: fadeInDot 0.5s ease 1.6s forwards;
}

@keyframes drawQuill {
  to { stroke-dashoffset: 0; }
}

@keyframes fadeInDot {
  to { opacity: 1; }
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6.5vw, 5.2rem);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--text);
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-subtitle {
  max-width: 560px;
  font-size: 1.12rem;
  color: var(--text-muted);
  margin-bottom: 36px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 56px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.22s var(--ease-spring), background 0.2s ease, border-color 0.2s ease;
}

.btn-icon {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent);
  color: #111110;
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #e38656;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.scroll-cue {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.scroll-line {
  width: 48px;
  height: 1px;
  background: var(--accent);
  transform-origin: left;
  animation: slideLine 2.4s ease-in-out infinite;
}

@keyframes slideLine {
  0%, 100% { transform: scaleX(0.5); opacity: 0.5; }
  50% { transform: scaleX(1); opacity: 1; }
}

/* Chapter Headers */
.chapter-header {
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.chapter-num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 8px;
}

.chapter-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 500;
  line-height: 1.15;
}

.chapter-desc {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.96rem;
}

/* Matte Editorial Cards */
.editorial-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  transition: border-color 0.25s ease;
}

.editorial-card:hover {
  border-color: var(--border-strong);
}

.editorial-card p {
  font-size: 1.06rem;
  color: #dcd5c9;
  margin-bottom: 20px;
}

.dropcap::first-letter {
  float: left;
  font-family: var(--font-serif);
  font-size: 3.7rem;
  line-height: 0.82;
  padding-right: 12px;
  padding-top: 5px;
  color: var(--accent);
}

.literary-quote {
  margin-top: 28px;
  padding: 20px 24px;
  border-left: 2px solid var(--accent);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.18rem;
  color: var(--text);
}

.literary-quote footer {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.84rem;
  color: var(--brass);
}

/* Two Placeholder Photo Frames ("very cool pics of you") */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
}

.photo-card:hover {
  border-color: var(--accent);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.45);
}

.photo-frame {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #141311;
}

.photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s var(--ease-spring);
}

.photo-card:hover .photo-img {
  transform: scale(1.03);
}

.photo-caption {
  padding: 14px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.caption-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.caption-text {
  font-size: 0.92rem;
  color: var(--text);
}

/* Literary Gems Grid */
.gems-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.gem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  transition: transform 0.3s var(--ease-spring), border-color 0.25s ease, background 0.25s ease;
}

.gem-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.gem-index {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 10px;
}

.gem-card h3 {
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.gem-card p {
  font-size: 0.94rem;
  color: var(--text-muted);
}

/* Interactive Birthday Cake & Candle */
.wish-card {
  text-align: center;
  padding: 48px 32px;
}

.candle-stage {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}

.cake-glow {
  position: absolute;
  top: -18px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217, 119, 69, 0.28), transparent 70%);
  transition: opacity 0.6s ease;
}

.candle-stage.is-blown .cake-glow {
  opacity: 0;
}

.candle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

.flame {
  width: 20px;
  height: 34px;
  background: radial-gradient(circle at 50% 70%, #fff4cc, #e8963e 65%, #d95d39 100%);
  border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%;
  box-shadow: 0 0 18px rgba(232, 150, 62, 0.75);
  animation: flicker 0.95s ease-in-out infinite alternate;
  transform-origin: bottom center;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.flame-inner {
  width: 8px;
  height: 14px;
  margin: 14px auto 0;
  background: #fffdf7;
  border-radius: 50%;
  opacity: 0.85;
}

.candle-stage.is-blown .flame {
  opacity: 0;
  transform: scale(0.2) translateY(-10px);
}

@keyframes flicker {
  0% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.05, 0.96) rotate(2deg); }
  100% { transform: scale(0.97, 1.04) rotate(-1deg); }
}

.wick {
  width: 2.5px;
  height: 8px;
  background: #555;
}

.wax {
  width: 16px;
  height: 50px;
  background: linear-gradient(90deg, #ede6d6, #d8cfc0);
  border-radius: 3px 3px 0 0;
}

.cake-top {
  width: 188px;
  height: 16px;
  background: #ede6d6;
  border-radius: 8px 8px 3px 3px;
  z-index: 2;
}

.cake-body {
  width: 176px;
  height: 60px;
  background: #24211d;
  border: 1px solid var(--border-strong);
  border-radius: 3px 3px 10px 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--brass);
}

.wish-status {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 1rem;
}

.site-footer {
  padding: 40px 0 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.86rem;
  border-top: 1px solid var(--border);
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease-spring), transform 0.7s var(--ease-spring);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 20px;
  }

  .mobile-toc-btn {
    display: inline-flex;
  }

  .toc-rail {
    position: fixed;
    top: 66px;
    right: 18px;
    width: 240px;
    z-index: 74;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px) scale(0.96);
  }

  .toc-rail.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 680px) {
  .photo-grid,
  .gems-grid {
    grid-template-columns: 1fr;
  }

  .music-player {
    left: 14px;
    right: 14px;
    bottom: 14px;
    justify-content: space-between;
  }

  .player-info {
    min-width: 0;
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .flame { animation: none; }
}
