/* midori.day — wet-pigment field journal corrupted by a dying CRT */

:root {
  --mizu-moss: #7a8c6f;
  --bone-wash: #e8e2d5;
  --sumi-drift: #2b2e2a;
  --aged-vellum: #d6c9a8;
  --bruise-plum: #5a4a5e;
  --glitch-cyan: #6fa8a6;
  --glitch-magenta: #b07a8a;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--mizu-moss);
  color: var(--sumi-drift);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  letter-spacing: 0.005em;
  overflow-x: hidden;
  cursor: none;
}

.svg-defs { position: absolute; }

/* ---------- custom cursor ---------- */
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 14px; height: 14px;
  border: 1.5px solid var(--sumi-drift);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
  transition: width 0.2s cubic-bezier(0.4,0,0.2,1),
              height 0.2s cubic-bezier(0.4,0,0.2,1),
              border-color 0.2s ease;
  mix-blend-mode: multiply;
}
.cursor-ring.is-hover {
  width: 22px; height: 22px;
  border-color: var(--bruise-plum);
}

/* ---------- F-spine ---------- */
.f-spine {
  position: fixed;
  left: 4vw; top: 0;
  height: 100vh;
  width: 9vw;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  pointer-events: none;
}
.spine-num {
  position: relative;
  font-family: "Fraunces", Georgia, serif;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 400;
  color: var(--sumi-drift);
  opacity: 0.55;
  text-decoration: none;
  line-height: 0.95;
  pointer-events: auto;
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1), opacity 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spine-num .bubble-ring {
  position: absolute;
  width: 18px; height: 18px;
  bottom: -10px; left: 50%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, transparent 60%, currentColor 65%, transparent 70%);
  color: var(--sumi-drift);
  opacity: 0;
  transition: width 0.24s cubic-bezier(0.4,0,0.2,1),
              height 0.24s cubic-bezier(0.4,0,0.2,1),
              opacity 0.4s ease, color 0.24s ease;
  pointer-events: none;
}
.spine-num.is-active {
  opacity: 1;
  transform: scale(1.15);
}
.spine-num.is-active .bubble-ring {
  opacity: 1;
  color: var(--bruise-plum);
}
.spine-num.is-near .bubble-ring {
  width: 28px; height: 28px;
  color: var(--bruise-plum);
}

/* click ripple */
.bubble-ripple {
  position: fixed;
  border-radius: 50%;
  border: 1.5px solid;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0.9;
  animation: ripple-out 0.6s ease-out forwards;
}
@keyframes ripple-out {
  to { transform: translate(-50%, -50%) scale(3); opacity: 0; }
}

/* ---------- scroll narrative ---------- */
.scroll-narrative {
  scroll-snap-type: y proximity;
}
.entry {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  scroll-snap-align: start;
  padding: 25vh 14vw 8vh calc(4vw + 11vw);
  display: flex;
  flex-direction: column;
}
.entry--moss   { background: var(--mizu-moss); }
.entry--bone   { background: var(--bone-wash); }
.entry--bruise { background: var(--bruise-plum); color: var(--bone-wash); }
.entry--night  { background: #1a1c19; color: var(--bone-wash); }
.entry--bruise .specimen path,
.entry--night .specimen path { stroke: var(--bone-wash); }

/* wash bleed between sections */
.entry::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 18vh;
  background: linear-gradient(to bottom, transparent, rgba(90,74,94,0.18));
  pointer-events: none;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 100%, #000 40%, transparent 75%);
  mask-image: radial-gradient(120% 100% at 50% 100%, #000 40%, transparent 75%);
  z-index: 0;
}
.entry--last::after { display: none; }

.wash {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
}

/* ---------- glitch strip ---------- */
.glitch-strip {
  position: absolute;
  top: 33vh; left: 0; right: 0;
  height: 6vh;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
  will-change: transform;
}
.glitch-strip .strip-ink {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(111,168,166,0.0) 0px,
      rgba(111,168,166,0.0) 3px,
      rgba(111,168,166,0.12) 3px,
      rgba(111,168,166,0.12) 4px
    ),
    linear-gradient(90deg, rgba(111,168,166,0.10), rgba(176,122,138,0.10));
  mix-blend-mode: screen;
  animation: scanline-tear 7s steps(1) infinite;
}
.entry--bone .glitch-strip .strip-ink,
.entry--bruise .glitch-strip .strip-ink,
.entry--night .glitch-strip .strip-ink {
  mix-blend-mode: difference;
}
.glitch-strip::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(111,168,166,0.18) 0%,
    transparent 30%,
    transparent 70%,
    rgba(176,122,138,0.18) 100%);
  clip-path: polygon(0 20%, 30% 20%, 30% 55%, 0 55%);
  animation: pixel-sort 7s ease-in-out infinite;
}
@keyframes scanline-tear {
  0%, 92%   { transform: translateX(0); }
  93%       { transform: translateX(8px); }
  95%       { transform: translateX(-6px); }
  97%       { transform: translateX(4px); }
  100%      { transform: translateX(0); }
}
@keyframes pixel-sort {
  0%, 60%   { transform: translateX(0); clip-path: polygon(0 20%, 30% 20%, 30% 55%, 0 55%); }
  65%       { transform: translateX(40px); }
  70%, 100% { transform: translateX(20px); clip-path: polygon(0 30%, 45% 30%, 45% 70%, 0 70%); }
}

/* ---------- entry content ---------- */
.entry-inner {
  position: relative;
  z-index: 4;
  max-width: 52ch;
}
.eyebrow {
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  opacity: 0.85;
}
.specimen {
  width: 32px; height: 32px;
  flex-shrink: 0;
}
.headline {
  font-family: "Fraunces", Georgia, serif;
  font-variation-settings: 'SOFT' 100, 'WONK' 1, 'opsz' 144;
  font-weight: 600;
  font-size: clamp(3rem, 7.5vw, 8rem);
  line-height: 0.95;
  margin-bottom: 2.2rem;
  letter-spacing: -0.01em;
}
.headline.glitch-active {
  text-shadow: -2px 0 var(--glitch-cyan), 2px 0 var(--glitch-magenta);
  animation: chroma-jitter 0.3s steps(2) infinite;
}
@keyframes chroma-jitter {
  0%   { text-shadow: -2px 0 var(--glitch-cyan), 2px 0 var(--glitch-magenta); }
  50%  { text-shadow: -3px 0 var(--glitch-cyan), 3px 1px var(--glitch-magenta); }
  100% { text-shadow: -2px 1px var(--glitch-cyan), 2px 0 var(--glitch-magenta); }
}
.lede {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 1.6rem;
  font-weight: 600;
}
.body-copy {
  margin-bottom: 1.2rem;
}
.signoff {
  margin-top: 2.5rem;
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

/* hovered text gets momentary chroma-shift */
.text-glitch {
  text-shadow: -2px 0 var(--glitch-cyan), 2px 0 var(--glitch-magenta);
  transition: text-shadow 0.2s ease;
}

/* ---------- marginalia ---------- */
.marginalia {
  position: absolute;
  right: 0; top: 25vh;
  width: 12vw;
  min-height: 50vh;
  background: var(--aged-vellum);
  color: var(--sumi-drift);
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  padding: 1.4rem 1rem 1.4rem 1.2rem;
  z-index: 6;
  word-spacing: 0.2rem;
  box-shadow: -2px 0 12px rgba(43,46,42,0.12);
}
.marginalia .ml-line {
  display: block;
  margin-bottom: 1.1rem;
  position: relative;
}
.marginalia .ml-line.is-active::before {
  content: "";
  position: absolute;
  left: -0.2rem; right: -0.2rem;
  bottom: -0.3rem;
  height: 1px;
  background: var(--bruise-plum);
  opacity: 0.5;
}
.marginalia .ml-char {
  display: inline-block;
  white-space: pre;
}
.marginalia .ml-bloom {
  text-shadow: 0 0 0.4px currentColor, 0 0 1px rgba(90,74,94,0.4);
  color: var(--bruise-plum);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body { cursor: auto; }
  .cursor-ring { display: none; }
  .f-spine { left: 1vw; width: 12vw; }
  .spine-num { font-size: 1.6rem; }
  .entry {
    padding: 18vh 5vw 6vh 16vw;
  }
  .marginalia {
    position: static;
    width: auto;
    min-height: 0;
    margin-top: 3rem;
    box-shadow: none;
  }
  .glitch-strip { top: 28vh; }
}
@media (max-width: 560px) {
  .headline { font-size: clamp(2.2rem, 11vw, 3.4rem); }
  .lede { font-size: 1.05rem; }
  .entry { padding: 16vh 5vw 5vh 14vw; }
}
