/* ---------- Tokens ---------- */
/* Dark is the base; data-theme="light" (set by the inline script in <head>) swaps the palette. */
:root {
  color-scheme: dark;
  --bg: #0b1320;
  --bg-2: #0f1a2b;
  --surface: #13213a;
  --line: rgba(173, 196, 230, 0.12);
  --text: #e8edf5;
  --muted: #93a3bb;
  --ember: #ff7a2f;
  --ember-2: #ffb347;
  --ember-glow: rgba(255, 122, 47, 0.35);
  --accent-ink: #ffb347;     /* small accent text: eyebrows, links, dates */
  --sea: #3aa0c8;
  --nav-bg: rgba(11, 19, 32, 0.94);
  --ghost-bg: rgba(255, 255, 255, 0.02);
  --chip-bg: rgba(19, 33, 58, 0.55);
  --wave-back: rgba(15, 26, 43, 0.6);
  --glow-ember: rgba(255, 122, 47, 0.22);
  --glow-sea: rgba(58, 160, 200, 0.12);

  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f1e8;
  --bg-2: #efe7d9;
  --surface: #fffaf2;
  --line: rgba(40, 52, 75, 0.14);
  --text: #142033;
  --muted: #586376;
  --ember: #e4570f;
  --ember-2: #f29328;
  --ember-glow: rgba(228, 87, 15, 0.28);
  --accent-ink: #b5440a;
  --sea: #1f7fa6;
  --nav-bg: rgba(246, 241, 232, 0.94);
  --ghost-bg: rgba(255, 255, 255, 0.55);
  --chip-bg: rgba(255, 250, 242, 0.75);
  --wave-back: rgba(239, 231, 217, 0.7);
  --glow-ember: rgba(228, 87, 15, 0.16);
  --glow-sea: rgba(31, 127, 166, 0.10);
}

/* Applied briefly by script.js so a theme switch fades instead of snapping. */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after {
  transition: background-color 0.35s, color 0.35s, border-color 0.35s, fill 0.35s !important;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--serif); line-height: 1.1; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
.mono { font-family: var(--mono); }

::selection { background: var(--ember); color: var(--bg); }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--ember); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip:focus { left: 8px; }

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

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gutter);
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}
/* Solid-ish background instead of backdrop-filter: blur re-renders on every scroll frame. */
.nav.scrolled {
  background: var(--nav-bg);
  border-color: var(--line);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.2rem;
}
.brand em { font-style: normal; color: var(--ember); margin-left: 2px; }
.mark { width: 30px; height: 30px; color: var(--ember); flex: none; }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  text-decoration: none; color: var(--muted); font-size: 0.95rem; transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links .nav-cta {
  color: var(--text); border: 1px solid var(--line); padding: 8px 16px; border-radius: 999px;
}
.nav-links .nav-cta:hover { border-color: var(--ember); color: var(--accent-ink); }

.theme-toggle {
  display: grid; place-items: center;
  width: 38px; height: 38px; margin-left: 16px; flex: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--ghost-bg); color: var(--text); cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.theme-toggle:hover { border-color: var(--ember); color: var(--accent-ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
.nav-links { margin-left: auto; }

.nav-toggle {
  display: none; background: none; border: 0; padding: 10px; cursor: pointer;
  flex-direction: column; gap: 6px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); transition: transform 0.25s; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 13px 22px; border-radius: 999px; font-weight: 500; font-size: 0.98rem;
  text-decoration: none; transition: transform 0.2s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(135deg, var(--ember), var(--ember-2));
  color: #1a0e05;
  box-shadow: 0 8px 30px -8px var(--ember-glow);
}
.btn-primary:hover { box-shadow: 0 12px 40px -6px var(--ember-glow); }
.btn-ghost { border: 1px solid var(--line); color: var(--text); background: var(--ghost-bg); }
.btn-ghost:hover { border-color: var(--ember-glow); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 120px var(--gutter) 160px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 100%, var(--glow-ember), transparent 70%),
    radial-gradient(ellipse 80% 60% at 80% 0%, var(--glow-sea), transparent 60%),
    var(--bg);
  overflow: hidden;
  isolation: isolate;
}
#sparks { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }

.hero-inner { max-width: var(--max); margin: 0 auto; width: 100%; }

.eyebrow {
  color: var(--accent-ink); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  font-weight: 800;
  max-width: 14ch;
}
.ember {
  background: linear-gradient(100deg, var(--ember) 0%, var(--ember-2) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.lede { color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.25rem); max-width: 56ch; margin-top: 28px; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

.heat {
  display: inline-flex; align-items: center; gap: 12px;
  margin-top: 48px; padding: 10px 16px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--chip-bg); color: var(--muted); font-size: 0.85rem;
}
.heat strong { color: var(--accent-ink); font-weight: 500; }
.heat-dot {
  position: relative;
  width: 9px; height: 9px; border-radius: 50%; background: var(--ember);
}
.heat-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ember);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  from { transform: scale(1); opacity: 0.6; }
  to { transform: scale(3.6); opacity: 0; }
}

.waves { position: absolute; left: 0; right: 0; bottom: -1px; height: 120px; pointer-events: none; }
.waves svg { position: absolute; bottom: 0; width: 200%; height: 100%; will-change: transform; }
.waves svg:first-child { fill: var(--wave-back); animation: drift 18s linear infinite; }
.waves svg:last-child { fill: var(--bg-2); animation: drift 12s linear infinite reverse; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vw, 140px) var(--gutter); }
.section > * { max-width: var(--max); margin-left: auto; margin-right: auto; }
.section-head { margin-bottom: 56px; }
.section-head h2 { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 600; }
.section-sub { color: var(--muted); margin-top: 16px; max-width: 58ch; }

.promise { background: var(--bg-2); }
.anvil { background: var(--bg); }
.log { background: var(--bg-2); }
.contact { background: var(--bg); }

/* Vows */
.vows {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.vow { background: var(--bg-2); padding: 36px 30px; position: relative; transition: background 0.3s; }
.vow:hover { background: var(--surface); }
.vow::after {
  content: ""; position: absolute; left: 30px; right: 30px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--ember), transparent);
  transform: scaleX(0); transform-origin: left; transition: transform 0.4s;
}
.vow:hover::after { transform: scaleX(1); }
.vow-num { color: var(--ember); font-size: 0.85rem; display: block; margin-bottom: 18px; }
.vow h3 { font-size: 1.45rem; font-weight: 600; margin-bottom: 10px; }
.vow p { color: var(--muted); font-size: 0.98rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card {
  --status: var(--ember);
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; gap: 12px;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.card:hover { transform: translateY(-4px); border-color: var(--ember-glow); box-shadow: 0 20px 50px -24px var(--ember-glow); }
.card[data-status="cooling"] { --status: var(--ember-2); }
.card[data-status="tempered"] { --status: var(--sea); }
.card[data-status="cold"] { --status: var(--muted); }

.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--status);
}
.status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--status);
  box-shadow: 0 0 10px var(--status);
}
.card[data-status="cold"] .status::before { box-shadow: none; }
.tag { font-size: 0.75rem; color: var(--muted); }
.card h3 { font-size: 1.5rem; font-weight: 600; }
.card p { color: var(--muted); font-size: 0.97rem; flex: 1; }
.card-link { color: var(--accent-ink); text-decoration: none; font-size: 0.92rem; font-weight: 500; margin-top: 6px; }
.card-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.card-empty { background: transparent; border-style: dashed; }

/* Timeline */
.timeline { list-style: none; padding: 0; position: relative; }
.entry > div { max-width: 640px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(180deg, var(--ember), transparent);
}
.entry { position: relative; padding-left: 44px; padding-bottom: 44px; display: grid; gap: 8px; }
.entry::before {
  content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ember); box-shadow: 0 0 0 5px var(--bg-2), 0 0 18px var(--ember-glow);
}
.entry time { color: var(--accent-ink); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.entry h3 { font-size: 1.4rem; font-weight: 600; margin-bottom: 6px; }
.entry p { color: var(--muted); }
.entry-future { opacity: 0.55; }
.entry-future::before { background: var(--bg-2); border: 2px dashed var(--muted); box-shadow: 0 0 0 5px var(--bg-2); }

/* Contact */
.contact-card {
  text-align: center; padding: clamp(48px, 8vw, 80px) clamp(20px, 5vw, 60px);
  border: 1px solid var(--line); border-radius: 24px;
  background:
    radial-gradient(ellipse 70% 80% at 50% 120%, var(--glow-ember), transparent 70%),
    var(--surface);
}
.contact-card h2 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 600; margin-bottom: 16px; }
.contact-card > p:not(.eyebrow) { color: var(--muted); max-width: 46ch; margin: 0 auto; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 36px; }

/* Footer */
.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 32px var(--gutter); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.82rem;
  max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto;
}
.footer .mark { width: 26px; height: 26px; }
.footer p { flex: 1; }
.back-top { text-decoration: none; }
.back-top:hover { color: var(--accent-ink); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s;
  }
  .nav-links.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-links a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
  .nav-links .nav-cta { border: 0; padding: 14px 0; border-radius: 0; color: var(--accent-ink); }
  .nav.menu-open { background: var(--bg); }
  .theme-toggle { order: 2; margin-left: auto; margin-right: 4px; }
  .nav-toggle { order: 3; }

  .hero { padding-bottom: 130px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .footer { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
