/* WICK — the room. One candle, one shadow, honest arithmetic.
   Palette is drawn from the flame: soot, wax, amber, ember, and the cold
   slate the shadow speaks in. Hand-made everywhere: rough SVG filters on
   borders, scattered rotations, no straight corporate edges. */

:root {
  --night: #0a0704;
  --soot: #15100a;
  --soot-2: #1d1610;
  --ink-line: #3a2d1c;
  --wax: #f0e3c4;
  --wax-dim: #cdbb92;
  --wax-faint: #8a765a;
  --flame: #ffb84d;
  --flame-hot: #ffdf9e;
  --ember: #e2641b;
  --blood: #a83b24;
  --shadow-blue: #7b8fa3;
  --shadow-dim: #4c5a68;
  --serif: 'IM Fell English', serif;
  --sc: 'IM Fell English SC', serif;
  --mono: 'Space Mono', monospace;
  --hand: 'Caveat', cursive;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--night);
  color: var(--wax);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
  overflow-x: hidden;
}
::selection { background: var(--ember); color: var(--night); }

a { color: var(--flame); text-decoration: none; }
a:hover { color: var(--flame-hot); }

/* film grain over everything */
.grain {
  position: fixed; inset: -50%;
  width: 200%; height: 200%;
  pointer-events: none;
  z-index: 60;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain-shift 1.1s steps(4) infinite;
}
@keyframes grain-shift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1.2%, 0.8%); }
  50% { transform: translate(0.9%, -1.1%); }
  75% { transform: translate(-0.6%, -0.5%); }
  100% { transform: translate(0, 0); }
}

/* ---------------- header ---------------- */
.top {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 2rem;
  padding: .9rem 1.6rem;
  z-index: 50;
  background: linear-gradient(180deg, rgba(10,7,4,.92), rgba(10,7,4,.72) 70%, transparent);
}
.mark {
  font-family: var(--sc);
  font-size: 1.5rem;
  color: var(--wax);
  letter-spacing: .06em;
  display: flex; align-items: center; gap: .45rem;
}
.mark-flame {
  width: 11px; height: 15px; display: inline-block;
  background: radial-gradient(ellipse 60% 55% at 50% 78%, var(--flame-hot), var(--flame) 55%, var(--ember));
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  animation: mini-flicker 2.4s ease-in-out infinite;
  transform-origin: 50% 100%;
}
@keyframes mini-flicker {
  0%,100% { transform: scaleY(1) rotate(-1.5deg); }
  30% { transform: scaleY(1.12) rotate(1.8deg); }
  55% { transform: scaleY(.94) rotate(-2.5deg); }
  80% { transform: scaleY(1.06) rotate(1deg); }
}
.top nav { display: flex; gap: 1.4rem; margin-left: auto; }
.top nav a {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .05em;
  color: var(--wax-dim);
  border-bottom: 1px solid transparent;
}
.top nav a:hover { color: var(--flame); border-bottom-color: var(--ember); }
.pulse { display: flex; align-items: center; gap: .5rem; font-family: var(--mono); font-size: .7rem; color: var(--wax-faint); }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wax-faint); }
.pulse.live .pulse-dot { background: var(--flame); box-shadow: 0 0 8px var(--flame); animation: pulse-beat 2s ease-in-out infinite; }
.pulse.live { color: var(--flame); }
.pulse.dead .pulse-dot { background: var(--blood); }
.pulse.dead { color: var(--blood); }
@keyframes pulse-beat { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------------- the room (hero) ---------------- */
.room {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 7rem 1.6rem 4rem;
  /* full bleed: the generic section rule would pen the hero into a 1080px
     column, cutting its glow off at the edges like a lit picture frame.
     the room IS the page here — only .room-grid inside stays centered. */
  max-width: none;
  width: 100%;
  background:
    radial-gradient(ellipse 55% 42% at 32% 44%, rgba(226,100,27,.14), transparent 70%),
    radial-gradient(ellipse 90% 70% at 50% 110%, rgba(21,16,10,.9), transparent),
    var(--night);
}
.wall {
  position: absolute; inset: 0;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle 260px at var(--mx, 32%) var(--my, 40%), black 0%, rgba(0,0,0,.25) 55%, transparent 100%);
  mask-image: radial-gradient(circle 260px at var(--mx, 32%) var(--my, 40%), black 0%, rgba(0,0,0,.25) 55%, transparent 100%);
}
.wall span {
  position: absolute;
  font-family: var(--hand);
  color: var(--wax-dim);
  opacity: .5;
  white-space: nowrap;
  text-shadow: 0 0 14px rgba(255,184,77,.25);
}
.room-grid {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(320px, 640px);
  gap: 3rem;
  align-items: center;
  justify-content: center;
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}
.candle-stage { text-align: center; }
#candle { width: 100%; max-width: 400px; height: auto; overflow: visible; }
.flame {
  transform-origin: 150px 262px;
  animation: flame-dance 3.1s ease-in-out infinite;
}
@keyframes flame-dance {
  0%,100% { transform: scale(1, 1) rotate(0.4deg) translateX(0); }
  22% { transform: scale(.96, 1.08) rotate(-1.6deg) translateX(-1.2px); }
  43% { transform: scale(1.05, .93) rotate(1.9deg) translateX(1.4px); }
  61% { transform: scale(.97, 1.05) rotate(-.8deg) translateX(-.6px); }
  82% { transform: scale(1.03, .97) rotate(1.2deg) translateX(.9px); }
}
#flame-inner { animation: inner-sway 2.2s ease-in-out infinite; transform-origin: 150px 258px; }
@keyframes inner-sway {
  0%,100% { transform: scaleY(1); }
  50% { transform: scaleY(1.12) translateX(.6px); }
}
#halo { animation: halo-breathe 3.1s ease-in-out infinite; }
@keyframes halo-breathe { 0%,100% { opacity: .85; } 45% { opacity: 1.0; } 70% { opacity: .72; } }
.melt-text {
  font-family: var(--hand);
  font-size: 17px;
  fill: var(--wax-faint);
}
.stage-caption {
  font-family: var(--hand); font-size: 1.15rem; color: var(--wax-faint);
  margin-top: .4rem; transform: rotate(-1.2deg);
}
.candle-stage { position: relative; }
.candle-stage #candle { transition: filter .25s ease-out; }
.candle-stage.flare #candle {
  filter: brightness(1.3) drop-shadow(0 0 34px rgba(255,184,77,.4));
}
.ember {
  position: absolute;
  font-family: var(--mono); font-size: .8rem; font-weight: 700;
  color: var(--ember);
  pointer-events: none;
  animation: ember-rise 1.6s ease-out forwards;
  text-shadow: 0 0 10px rgba(226,100,27,.7);
}
@keyframes ember-rise {
  0% { opacity: 0; transform: translateY(0) rotate(-2deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-90px) rotate(3deg); }
}

/* the breath line — one heartbeat of the burner, updated live */
.breath-line {
  display: flex; align-items: center; gap: .55rem;
  margin-top: 1rem;
  font-family: var(--mono); font-size: .74rem;
  color: var(--wax-dim);
}
.breath-line[hidden] { display: none; }
.breath-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ember);
}
.breath-line.fresh .breath-dot {
  background: var(--flame);
  box-shadow: 0 0 10px var(--flame);
}
.breath-line a { font-size: .66rem; }

.overline {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .35em;
  color: var(--ember); text-transform: uppercase; margin-bottom: .6rem;
}
.title {
  font-family: var(--sc);
  font-size: clamp(4.2rem, 10vw, 7.5rem);
  line-height: .9;
  color: var(--wax);
  text-shadow: 0 0 40px rgba(255,184,77,.28), 0 0 120px rgba(226,100,27,.18);
  letter-spacing: .02em;
}
.tagline {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  color: var(--flame);
  margin: .5rem 0 1rem;
}
.lede { max-width: 56ch; color: var(--wax-dim); margin-bottom: 2rem; }
.lede em { color: var(--wax); }
.tick { font-family: var(--mono); font-size: .92em; color: var(--flame); }

.vitals {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .8rem;
  max-width: 560px;
}
.vital {
  position: relative;
  padding: .8rem 1rem .7rem;
  background: rgba(29,22,16,.55);
}
.vital::before {
  content: "";
  position: absolute; inset: 0;
  border: 1.5px solid var(--ink-line);
  border-radius: 255px 12px 225px 14px / 14px 225px 12px 255px;
  pointer-events: none;
}
.vital.wide { grid-column: 1 / -1; }
.v-label {
  display: block;
  font-family: var(--mono); font-size: .64rem; letter-spacing: .28em;
  text-transform: uppercase; color: var(--wax-faint);
  margin-bottom: .15rem;
}
.v-value {
  display: block;
  font-family: var(--mono); font-weight: 700;
  font-size: 1.5rem; color: var(--wax);
  line-height: 1.15;
}
.v-value.clock { font-size: 2rem; color: var(--flame); letter-spacing: .04em; }
.v-sub { display: block; font-family: var(--mono); font-size: .66rem; color: var(--wax-faint); margin-top: .1rem; }

.last-thought {
  margin-top: 2rem;
  max-width: 560px;
  padding: 1rem 1.2rem;
  position: relative;
  background: rgba(21,16,10,.4);
}
.last-thought::before {
  content: "";
  position: absolute; inset: 0;
  border-left: 3px solid var(--ember);
  border-top: 1px solid var(--ink-line);
  border-bottom: 1px solid var(--ink-line);
  border-radius: 4px 80px 6px 60px / 60px 6px 80px 4px;
  pointer-events: none;
}
.lt-label { font-family: var(--mono); font-size: .62rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ember); }
.last-thought p { font-style: italic; font-size: 1.12rem; margin: .35rem 0; color: var(--wax); }
.lt-when { font-family: var(--mono); font-size: .66rem; color: var(--wax-faint); }

.room-floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 120px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.55));
  pointer-events: none;
}

/* ---------------- shared section chrome ---------------- */
section { padding: 5.5rem 1.6rem; max-width: 1080px; margin: 0 auto; }
.h2 {
  font-family: var(--sc);
  font-size: clamp(2rem, 4.6vw, 3rem);
  color: var(--wax);
  display: inline-block;
  position: relative;
  margin-bottom: 1.2rem;
}
.underline {
  position: absolute; left: 0; right: 0; bottom: -8px;
  width: 100%; height: 12px; display: block;
}
.section-intro, .pact-intro { color: var(--wax-dim); max-width: 62ch; margin-bottom: 2.4rem; }

/* ---------------- the pact ---------------- */
.pact-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem;
  margin-bottom: 2rem;
}
.step {
  position: relative;
  padding: 1.4rem 1.3rem;
  background: rgba(29,22,16,.45);
}
.step::before {
  content: "";
  position: absolute; inset: 0;
  border: 1.5px solid var(--ink-line);
  border-radius: 12px 255px 14px 225px / 225px 14px 255px 12px;
  pointer-events: none;
}
.step:nth-child(1) { transform: rotate(-.5deg); }
.step:nth-child(2) { transform: rotate(.4deg); }
.step:nth-child(3) { transform: rotate(-.3deg); }
.doodle { width: 64px; height: 64px; margin-bottom: .6rem; }
.step h3 { font-family: var(--sc); font-size: 1.25rem; color: var(--flame); margin-bottom: .4rem; }
.step p { font-size: .95rem; color: var(--wax-dim); }

.pact-rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-bottom: 2rem; }
.rule { position: relative; padding: 1.2rem 1.3rem; }
.rule::before {
  content: "";
  position: absolute; inset: 0;
  border: 1.5px dashed var(--wax-faint);
  opacity: .55;
  border-radius: 225px 14px 255px 12px / 12px 255px 14px 225px;
  pointer-events: none;
}
.rule h4 { font-family: var(--sc); color: var(--wax); font-size: 1.1rem; margin-bottom: .35rem; }
.rule p { font-size: .95rem; color: var(--wax-dim); }
.rule strong { color: var(--flame); }

.ca-box {
  position: relative;
  padding: 1.3rem 1.4rem;
  background: rgba(21,16,10,.6);
  text-align: center;
}
.ca-box::before {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid var(--ember);
  border-radius: 255px 12px 225px 14px / 14px 225px 12px 255px;
  pointer-events: none;
}
.ca-label { font-family: var(--mono); font-size: .64rem; letter-spacing: .3em; text-transform: uppercase; color: var(--ember); display: block; margin-bottom: .4rem; }
.ca-box code { font-family: var(--mono); font-size: clamp(.8rem, 2.4vw, 1.05rem); color: var(--wax); word-break: break-all; }
.ca-warn { font-family: var(--hand); font-size: 1.1rem; color: var(--wax-faint); margin-top: .6rem; transform: rotate(-.6deg); }
.copy {
  font-family: var(--mono); font-size: .68rem;
  background: none; color: var(--flame);
  border: 1px solid var(--ember); border-radius: 2px;
  padding: .25rem .7rem; margin-left: .7rem;
  cursor: pointer;
}
.copy:hover { background: var(--ember); color: var(--night); }

/* ---------------- the ledger ---------------- */
.ledger-wrap { margin-top: 2.6rem; }
.ledger-title { font-family: var(--sc); font-size: 1.3rem; color: var(--wax); margin-bottom: .3rem; }
.ledger-intro { font-size: .9rem; color: var(--wax-faint); margin-bottom: 1rem; }
.ledger {
  display: flex; flex-direction: column;
  max-height: 340px; overflow-y: auto;
  border-top: 1px solid var(--ink-line);
}
.ledger-row {
  display: flex; align-items: baseline; gap: .8rem;
  padding: .5rem .2rem;
  border-bottom: 1px dashed rgba(58,45,28,.6);
  font-family: var(--mono); font-size: .74rem;
  color: var(--wax-dim);
}
.ledger-row .l-when { color: var(--wax-faint); font-size: .64rem; white-space: nowrap; }
.ledger-row .l-kind {
  font-size: .58rem; letter-spacing: .18em; text-transform: uppercase;
  padding: .1rem .45rem; border: 1px solid currentColor; border-radius: 2px;
  white-space: nowrap;
}
.ledger-row.k-burn .l-kind, .ledger-row.k-fire .l-kind { color: var(--blood); }
.ledger-row.k-fuel .l-kind { color: var(--flame); }
.ledger-row.k-wax .l-kind { color: var(--wax-dim); }
.ledger-row.k-flameout .l-kind { color: var(--blood); }
.ledger-row.k-relight .l-kind, .ledger-row.k-birth .l-kind { color: var(--flame-hot); }
.ledger-row.k-gift .l-kind { color: #9fd08a; }
.ledger-row.k-gas .l-kind { color: var(--wax-faint); }
.ledger-row.k-dream .l-kind { color: var(--shadow-blue); }
.ledger-row .l-text { flex: 1; }
.ledger-row .l-tx { color: var(--ember); white-space: nowrap; }
.ledger-row .l-tx:hover { color: var(--flame); }

/* ---------------- thoughts ---------------- */
.thought-feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem; }
.thought {
  position: relative;
  padding: 1.1rem 1.2rem .9rem;
  background: var(--soot-2);
}
.thought::before {
  content: "";
  position: absolute; inset: 0;
  border: 1.5px solid var(--ink-line);
  border-radius: 12px 255px 14px 225px / 225px 14px 255px 12px;
  pointer-events: none;
}
.thought:nth-child(odd) { transform: rotate(-.6deg); }
.thought:nth-child(even) { transform: rotate(.5deg); }
.thought:nth-child(3n) { transform: rotate(.9deg); }
.thought p { font-family: var(--mono); font-size: .92rem; color: var(--wax); line-height: 1.55; margin-bottom: .6rem; }
.t-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .64rem; color: var(--wax-faint); }
.t-badge { color: var(--flame); }
.t-badge.held { color: var(--shadow-blue); }
.empty { font-family: var(--hand); font-size: 1.2rem; color: var(--wax-faint); }

/* ---------------- the dark room ---------------- */
.darkroom {
  max-width: none;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(76,90,104,.12), transparent 70%),
    #060402;
  border-top: 1px solid #14100c;
  border-bottom: 1px solid #14100c;
}
.darkroom > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.dr-title { color: #cfd8e0; }
.dr-lede { color: var(--shadow-blue); max-width: 60ch; margin-bottom: .8rem; }
.dr-warning {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .18em;
  color: var(--shadow-dim); text-transform: uppercase;
  margin-bottom: 2.2rem;
}
.dr-grid { display: grid; grid-template-columns: 240px 1fr; gap: 1.6rem; }
.dr-sessions { display: flex; flex-direction: column; gap: .5rem; max-height: 560px; overflow-y: auto; padding-right: .4rem; }
.dr-session {
  text-align: left;
  font-family: var(--mono); font-size: .7rem;
  background: none; border: 1px solid #1d232a; border-radius: 2px;
  color: var(--shadow-blue);
  padding: .55rem .7rem;
  cursor: pointer;
  line-height: 1.45;
}
.dr-session:hover, .dr-session.active { border-color: var(--shadow-blue); color: #cfd8e0; }
.dr-session .s-date { color: var(--shadow-dim); display: block; font-size: .62rem; }
.dr-meta { font-family: var(--mono); font-size: .68rem; color: var(--shadow-dim); margin-bottom: 1rem; min-height: 1em; }
.dr-transcript { display: flex; flex-direction: column; gap: 1.1rem; min-height: 300px; }
.dr-turn { max-width: 62ch; }
.dr-turn .who {
  font-family: var(--mono); font-size: .62rem; letter-spacing: .3em;
  text-transform: uppercase; display: block; margin-bottom: .2rem;
}
.dr-turn.wick .who { color: var(--ember); }
.dr-turn.shadow .who { color: var(--shadow-blue); }
.dr-turn.wick p { font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--wax); }
.dr-turn.shadow p { font-family: var(--mono); font-size: .9rem; color: #aebbc7; }
.dr-turn.shadow { align-self: flex-end; text-align: right; }
.dr-turn.typing p::after {
  content: "▍";
  animation: caret 1s steps(1) infinite;
  color: var(--shadow-blue);
}
@keyframes caret { 50% { opacity: 0; } }

/* ---------------- vigil (footer) ---------------- */
.vigil { padding: 4rem 1.6rem 2.5rem; }
.vigil-inner {
  display: grid; grid-template-columns: 1.3fr 1fr 1.1fr; gap: 2.4rem;
  max-width: 1080px; margin: 0 auto 2.5rem;
}
.vigil h4 { font-family: var(--sc); color: var(--wax); margin-bottom: .5rem; }
.addr { font-family: var(--mono); font-size: .72rem; color: var(--wax-dim); word-break: break-all; }
.v-note { font-size: .85rem; color: var(--wax-faint); margin-top: .5rem; }
.v-links { display: flex; gap: 1.2rem; font-family: var(--mono); font-size: .85rem; }
.epigraph .epi {
  font-family: var(--hand); font-size: 1.35rem; color: var(--wax-dim);
  transform: rotate(-1.4deg); line-height: 1.4;
}
.epi-src { font-family: var(--mono); font-size: .64rem; color: var(--wax-faint); margin-top: .5rem; }
.colophon {
  text-align: center; font-family: var(--mono); font-size: .68rem;
  color: var(--wax-faint);
  border-top: 1px solid #14100c; padding-top: 1.4rem;
  max-width: 1080px; margin: 0 auto;
}

/* ---------------- flameout ---------------- */
.flameout-veil[hidden] { display: none; }
.flameout-veil {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(2,1,0,.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem;
}
.fo-line { font-family: var(--sc); font-size: clamp(1.6rem, 5vw, 3rem); color: var(--wax-dim); }
.fo-sub { font-family: var(--mono); font-size: .8rem; color: var(--wax-faint); }
body.flameout .flame, body.flameout #halo { display: none; }
body.flameout .pulse .pulse-dot { background: var(--blood); }

/* ---------------- responsive ---------------- */
@media (max-width: 980px) {
  .room-grid { grid-template-columns: 1fr; gap: 1.6rem; text-align: center; }
  .candle-stage { order: 2; }
  #candle { max-width: 250px; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .vitals { max-width: 640px; }
  .last-thought { text-align: left; }
  .pact-steps { grid-template-columns: 1fr; }
  .pact-rules { grid-template-columns: 1fr; }
  .dr-grid { grid-template-columns: 1fr; }
  .dr-sessions { flex-direction: row; overflow-x: auto; max-height: none; }
  .dr-session { min-width: 180px; }
  .vigil-inner { grid-template-columns: 1fr; gap: 1.6rem; }
  .top nav { display: none; }
}
@media (max-width: 560px) {
  .vitals { grid-template-columns: 1fr 1fr; }
  .v-value.clock { font-size: 1.4rem; }
}
