/* ============================================================
   ScrollStory — Dark Cinematic Design System
   ============================================================ */

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

:root {
  --bg-deep: #07101a;
  --bg-mid: #0d1824;
  --text-primary: #e6eef5;
  --text-muted: #7a8a9c;
  --text-dim: #2e3d50;
  --accent: #c4956a;
  --secondary: #6aacca;
  --tertiary: #7ac48a;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--text-dim) transparent;
}

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--sans);
  font-weight: 300;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration-skip-ink: auto; }
a:hover { text-decoration: underline; }

::selection { background: rgba(196, 149, 106, 0.3); }


/* --- Canvas Background --- */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}


/* --- Progress Track (right side) --- */
#progress-track {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 200px;
  background: var(--text-dim);
  border-radius: 2px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.6s;
}

#progress-track.visible { opacity: 1; }

.progress-fill {
  width: 100%;
  background: var(--accent);
  border-radius: 2px;
  height: 0%;
  transition: height 0.1s;
}

.progress-label {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
  writing-mode: vertical-rl;
}


/* --- Metrics Panel (left side) --- */
#metrics-panel {
  position: fixed;
  left: 28px;
  bottom: 32px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transition: opacity 0.8s;
}

#metrics-panel.visible { opacity: 1; }

.metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.metric-label {
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.metric-value {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 300;
  transition: color 0.6s;
}

.metric-bar {
  width: 80px;
  height: 2px;
  background: var(--text-dim);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 2px;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 1px;
  width: 0%;
  transition: width 0.8s ease, background 0.8s ease;
}


/* --- Content Container --- */
#content { position: relative; z-index: 10; }


/* --- Hero --- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 40px 24px;
}

.hero-overline {
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 32px;
  animation: fadeUp 1.2s ease 0.3s both;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(48px, 10vw, 120px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  animation: fadeUp 1.2s ease 0.6s both;
}

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

.hero-sub {
  font-family: var(--serif);
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 300;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.6;
  margin-top: 28px;
  animation: fadeUp 1.2s ease 0.9s both;
}

.scroll-cue {
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: fadeUp 1.2s ease 1.2s both;
}

.scroll-cue span {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, var(--text-dim), transparent);
  animation: pulse 2s ease infinite;
}


/* --- Story Sections --- */
.story-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.story-section.in-view {
  opacity: 1;
  transform: translateY(0);
}

.section-inner {
  max-width: 600px;
  width: 100%;
}

.section-marker {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.marker-number {
  font-family: var(--serif);
  font-size: 56px;
  font-weight: 300;
  line-height: 1;
  color: var(--accent);
  opacity: 0.7;
}

.marker-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.5;
  white-space: pre-line;
}

.section-title {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 300;
  line-height: 1.3;
  margin-bottom: 20px;
}

.section-body {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.section-body p {
  margin-bottom: 1em;
}

.section-body p:last-child {
  margin-bottom: 0;
}

.section-body strong { font-weight: 500; color: var(--text-primary); }
.section-body em { font-style: italic; }
.section-body a { color: var(--accent); }

.section-insight {
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.6;
  color: var(--accent);
  padding-left: 20px;
  border-left: 1px solid var(--accent);
  opacity: 0.85;
}


/* --- Interludes --- */
.interlude {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.interlude.in-view { opacity: 1; }

.interlude-text {
  font-family: var(--serif);
  font-size: clamp(24px, 5vw, 48px);
  font-weight: 300;
  line-height: 1.4;
  max-width: 700px;
}

.interlude-text em {
  color: var(--tertiary);
  font-style: italic;
}


/* --- CTA Section --- */
.cta-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  opacity: 0;
  transition: opacity 1s ease;
}

.cta-section.in-view { opacity: 1; }

.cta-section h2 {
  font-family: var(--serif);
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: 16px;
}

.cta-sub {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 420px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.email-form {
  display: flex;
  gap: 0;
  max-width: 440px;
  width: 100%;
}

.email-form input {
  flex: 1;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--text-dim);
  border-right: none;
  border-radius: 6px 0 0 6px;
  color: var(--text-primary);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
}

.email-form input::placeholder { color: var(--text-dim); }
.email-form input:focus { border-color: var(--accent); }

.email-form button {
  padding: 14px 28px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0 6px 6px 0;
  color: var(--bg-deep);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.3s;
  white-space: nowrap;
}

.email-form button:hover { filter: brightness(1.15); }

.form-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-dim);
}

.form-success {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--tertiary);
  display: none;
}


/* --- Disclaimer --- */
.disclaimer {
  text-align: center;
  padding: 40px 24px 60px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
}


/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 0.8; }
}


/* --- Mobile --- */
@media (max-width: 768px) {
  #metrics-panel {
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
    flex-direction: row;
    gap: 0;
    background: rgba(7, 16, 26, 0.8);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    padding: 10px 6px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    max-width: calc(100vw - 24px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  #metrics-panel::-webkit-scrollbar { display: none; }
  .metric {
    align-items: center;
    text-align: center;
    flex: 0 0 auto;
    min-width: 56px;
    padding: 0 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
  }
  .metric:last-child { border-right: none; }
  .metric-value { font-size: 13px; }
  .metric-label { font-size: 7px; letter-spacing: 0.08em; }
  .metric-bar { width: 36px; }
  #progress-track { right: 14px; height: 140px; }
  .marker-number { font-size: 42px; }
  .email-form { flex-direction: column; }
  .email-form input { border-right: 1px solid var(--text-dim); border-radius: 6px; }
  .email-form button { border-radius: 6px; }
}
