/* matsurika.moe — monastic herbalist's almanac of moonlit jasmine */

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

:root {
  --vault: #1c2026;
  --pewter: #262b32;
  --granite: #3a414b;
  --silver: #5a6470;
  --silver-soft: #7a8590;
  --mist: #9aa3ad;
  --bone: #c8cdd3;
  --flame: #ffb86b;
}

html { scroll-behavior: smooth; }

body {
  background: var(--vault);
  color: var(--mist);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: 0.94rem;
  line-height: 1.7;
  letter-spacing: 0.005em;
  overflow-x: hidden;
}

/* ---------- Vellum noise overlay ---------- */
.vellum-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.vellum-fine {
  position: absolute;
  inset: 0;
  filter: url(#vellum-fine);
  opacity: 0.04;
  mix-blend-mode: overlay;
}
.vellum-stone {
  position: absolute;
  inset: 0;
  filter: url(#vellum-stone);
  opacity: 0.025;
  mix-blend-mode: overlay;
}

/* ---------- The Persistent Candle ---------- */
.candle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10;
  pointer-events: none;
}
.candle svg, .cover svg { display: block; overflow: visible; }
.flame {
  fill: var(--flame);
  filter: drop-shadow(0 0 14px rgba(255,184,107,0.35));
  transform-origin: 50% 100%;
  animation: flicker 1.7s infinite;
}
.flame-core {
  fill: #fff2dc;
  opacity: 0.55;
  transform-origin: 50% 100%;
  animation: flicker 1.7s infinite;
}
.stand-thread {
  stroke: var(--granite);
  stroke-width: 1;
}
@keyframes flicker {
  0%, 100% { opacity: 0.92; transform: scaleY(1) translateX(0); }
  33% { opacity: 0.78; transform: scaleY(0.94) translateX(0.4px); }
  66% { opacity: 1; transform: scaleY(1.03) translateX(-0.3px); }
}

/* ---------- Page-open cover ---------- */
.cover {
  position: fixed;
  inset: 0;
  background: var(--vault);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 800ms ease;
}
.cover.lifted {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Codex column ---------- */
.codex {
  max-width: 720px;
  margin: 0 auto;
  padding: 18vh 0 24vh;
  position: relative;
}

/* gauge hairline */
.gauge {
  position: absolute;
  left: 88px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--granite);
}

/* ---------- Title block ---------- */
.title-block {
  margin-left: 152px;
  margin-bottom: clamp(180px, 24vh, 320px);
}
.title-block h1 {
  font-family: 'Cormorant Infant', serif;
  font-weight: 500;
  font-variant: small-caps;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: clamp(1.4rem, 2.4vw, 1.95rem);
  color: var(--bone);
  line-height: 1.2;
}
.title-sub {
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--silver);
  letter-spacing: 0.03em;
}

/* ---------- Entry ---------- */
.entry {
  position: relative;
  margin-left: 152px;
  margin-bottom: clamp(180px, 24vh, 320px);
}

/* vertical marginalia in the 88px gutter lane */
.margin-note {
  position: absolute;
  left: -152px;
  font-size: 0.7rem;
  color: var(--silver);
  letter-spacing: 0.06em;
  transform: rotate(-90deg);
  transform-origin: left top;
  white-space: nowrap;
}

/* phase-mark: lunar tick + timestamp overlapping the gauge */
.phase-mark {
  position: absolute;
  left: -72px;
  top: -8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.phase-mark::before {
  /* the 12px horizontal nub on the gauge */
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 12px;
  height: 1px;
  background: var(--silver);
  transform: translateY(-50%);
}
.phase-mark .glyph {
  font-size: 0.85rem;
  color: var(--silver);
  transition: color 600ms ease, text-shadow 600ms ease;
}
.phase-mark.lit .glyph {
  color: var(--flame);
  text-shadow: 0 0 12px rgba(255,184,107,0.45);
}
.phase-mark .stamp {
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--silver-soft);
}

/* heading */
.entry h2 {
  font-family: 'Cormorant Infant', serif;
  font-weight: 500;
  font-variant: small-caps;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  color: var(--bone);
  margin-bottom: 16px;
}

/* observation paragraph */
.entry p {
  max-width: 540px;
  color: var(--mist);
  margin-bottom: 32px;
}

/* ---------- Specimen card (tilt-3d) ---------- */
.specimen {
  width: 360px;
  min-height: 220px;
  background: var(--pewter);
  border: 1px solid var(--granite);
  box-shadow:
    inset 0 1px 0 rgba(200,205,211,0.06),
    0 18px 32px -16px rgba(0,0,0,0.55);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: perspective(1200px) rotateX(6deg) rotateY(-4deg);
  transform-style: preserve-3d;
  transition: transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform;
}
.sprig {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  line-height: 1.25;
  color: var(--mist);
  white-space: pre;
  text-align: center;
  letter-spacing: 0;
}
.spec-meta {
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--silver);
  text-align: center;
}
.spec-meta div:first-child { color: var(--silver-soft); }

/* ---------- Stone rule ---------- */
.stone-rule {
  border: 0;
  height: 1px;
  background: var(--granite);
  margin: clamp(120px, 16vh, 200px) 0 clamp(120px, 16vh, 200px) 152px;
  width: 540px;
}

/* ---------- End of Watch ---------- */
.end-of-watch {
  margin-left: 152px;
  margin-top: clamp(160px, 22vh, 280px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
}
.sextant {
  stroke: var(--granite);
  stroke-width: 1;
}
.watch-end-label {
  font-family: 'Cormorant Infant', serif;
  font-weight: 500;
  font-variant: small-caps;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  font-size: 0.92rem;
  color: var(--silver);
}

/* ---------- Narrow viewport: keep the column intact, just shrink gutters ---------- */
@media (max-width: 760px) {
  .codex { padding-left: 12px; padding-right: 12px; }
  .gauge { left: 56px; }
  .title-block, .entry, .stone-rule, .end-of-watch { margin-left: 96px; }
  .stone-rule, .entry p { width: auto; max-width: 100%; }
  .phase-mark { left: -56px; }
  .margin-note { left: -96px; }
  .specimen { width: 100%; max-width: 360px; }
}
