/* ============================================================
   WICK & WAX — styles.css  (full-screen chapter scroll)
   ============================================================ */

/* ---------- Brand constants ---------- */
:root {
  --forest: #11160F;
  --font-serif: "Spectral", Georgia, serif;
  --font-sans: "Outfit", "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Light theme ---------- */
:root,
[data-theme="light"] {
  --bg: #F3F0E7;
  --surface: #FFFFFF;
  --surface-2: #EAE5D9;
  --text: #1C2118;
  --text-muted: rgba(28, 33, 24, 0.6);
  --accent: #B4702F;
  --accent-soft: #D08B48;
  --line: rgba(28, 33, 24, 0.14);
  --line-strong: rgba(28, 33, 24, 0.26);
  --glow: rgba(180, 112, 47, 0.12);
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg: var(--forest);
  --surface: #181E16;
  --surface-2: #1E261C;
  --text: #EFEDE2;
  --text-muted: rgba(239, 237, 226, 0.6);
  --accent: #E39B4E;
  --accent-soft: #F0BD82;
  --line: rgba(239, 237, 226, 0.14);
  --line-strong: rgba(239, 237, 226, 0.26);
  --glow: rgba(227, 155, 78, 0.18);
}

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

html {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.35s var(--ease), color 0.35s var(--ease);
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul { margin: 0; }

/* ---------- Accessibility ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--accent);
  color: #11160F;
  padding: 10px 18px;
  border-radius: 0 0 10px 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: #11160F; }
.btn-accent:hover { box-shadow: 0 16px 34px -16px var(--accent); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn .icon {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.icon-flame-off { display: none; }
[data-embers="off"] .icon-flame { display: none; }
[data-embers="off"] .icon-flame-off { display: block; }

/* ---------- Fixed header ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 26px;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.brand em { font-style: italic; color: var(--accent); }
.header-actions { display: flex; gap: 10px; }

/* ---------- Dot nav ---------- */
.dotnav {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 90;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line-strong);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), height 0.3s var(--ease);
}
.dot:hover { border-color: var(--accent); }
.dot.active { background: var(--accent); border-color: var(--accent); height: 24px; }

/* ============================================================
   CHAPTERS
   ============================================================ */
.chapter {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 24px;
}

.chapter-inner {
  width: 100%;
  max-width: 1000px;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.chapter.is-active .chapter-inner { opacity: 1; transform: none; }

.chapter-center { max-width: 760px; text-align: center; }
.chapter-statement { max-width: 640px; text-align: center; }

.eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 6.5vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
}
.display em { font-style: italic; color: var(--accent); }

.lede {
  font-size: 1.08rem;
  font-weight: 300;
  color: var(--text-muted);
  max-width: 46ch;
  margin: 0 auto;
}
.chapter-statement .lede { max-width: 40ch; }

/* ---------- Cover flame ---------- */
.flame {
  width: 84px;
  margin: 30px auto 0;
  animation: flameFlicker 1.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.flame svg { width: 100%; height: auto; }
.flame-outer { fill: var(--accent); stroke: none; }
.flame-inner { fill: var(--accent-soft); stroke: none; }

.scroll-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.scroll-hint svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  animation: hintBob 2s ease-in-out infinite;
}

/* ---------- Collection ---------- */
.chapter-head { text-align: center; margin-bottom: 40px; }
.chapter-head .display { margin-bottom: 0; }

.candles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.candle { text-align: center; }

.jar-art { width: 118px; margin: 0 auto 16px; color: var(--text-muted); }
.jar-art svg { width: 100%; height: auto; }
.jar-art .flame {
  fill: var(--accent);
  stroke: var(--accent);
  animation: jarFlame 2.6s ease-in-out infinite;
  transform-origin: 50% 100%;
}

.candle h3 { font-family: var(--font-serif); font-weight: 500; font-size: 1.15rem; margin-bottom: 4px; }
.candle p { color: var(--text-muted); font-size: 0.88rem; max-width: 22ch; margin: 0 auto 8px; }
.candle .price { font-size: 0.88rem; color: var(--accent); font-weight: 500; }

/* ---------- Ritual ---------- */
.ritual-list {
  list-style: none;
  margin: 34px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 34px;
}
.ritual-list li { display: flex; flex-direction: column; gap: 2px; }
.ritual-list strong { font-family: var(--font-serif); font-weight: 500; font-size: 1.18rem; }
.ritual-list span { color: var(--text-muted); font-size: 0.9rem; }

/* ---------- Contact ---------- */
.contact-form {
  max-width: 480px;
  margin: 28px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.82rem; font-weight: 500; color: var(--text-muted); }
.field input,
.field textarea {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  resize: vertical;
  transition: border-color 0.2s var(--ease);
}
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--accent); }

.form-note { font-size: 0.9rem; min-height: 1.2em; text-align: center; }
.form-note.success { color: var(--accent); }
.form-note.error { color: #d4695c; }

/* ============================================================
   MOTION — embers + glow + flame
   ============================================================ */
.glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(60% 52% at 50% 112%, var(--glow), transparent 72%);
  animation: glowFlicker 7s ease-in-out infinite;
}
[data-embers="off"] .glow { display: none; }

.embers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}
[data-embers="off"] .embers { display: none; }

.ember {
  position: absolute;
  bottom: -4%;
  width: var(--w, 5px);
  height: var(--h, 5px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), rgba(0, 0, 0, 0) 70%);
  opacity: 0;
  animation: emberRise var(--dur, 8s) linear infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes emberRise {
  0%   { transform: translate(0, 0) scale(0.4); opacity: 0; }
  8%   { opacity: 0.95; }
  55%  { opacity: 0.5; }
  100% { transform: translate(var(--sway, 20px), -108vh) scale(0.25); opacity: 0; }
}

@keyframes glowFlicker {
  0%, 100% { opacity: 0.5; }
  12% { opacity: 0.74; }
  24% { opacity: 0.44; }
  38% { opacity: 0.7; }
  52% { opacity: 0.4; }
  68% { opacity: 0.66; }
  82% { opacity: 0.5; }
}

@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  25% { transform: scale(1.05, 0.97) rotate(1.5deg); }
  50% { transform: scale(0.98, 1.05) rotate(-1.5deg); }
  75% { transform: scale(1.04, 0.98) rotate(1deg); }
}

@keyframes jarFlame {
  0%, 100% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.06, 0.96) rotate(1.5deg); }
  60% { transform: scale(0.97, 1.05) rotate(-1.5deg); }
}

@keyframes hintBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
  .glow, .embers { display: none; }
  .chapter-inner { opacity: 1; transform: none; }
  .flame { animation: none; }
  .jar-art .flame { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .candles { grid-template-columns: repeat(2, 1fr); gap: 26px; }
  .ritual-list { gap: 22px; }
}

@media (max-width: 560px) {
  .site-header { padding: 16px 18px; }
  .dotnav { right: 12px; gap: 12px; }
  .dot { width: 8px; height: 8px; }
  .dot.active { height: 18px; }
  .field-row { grid-template-columns: 1fr; }
  .candles { gap: 20px; }
  .jar-art { width: 92px; }
}
