/* murasaki.day — light-academia field journal
   Palette:
   #f7f1e8 Pressed Vellum   #ede4d3 Aged Linen
   #c8a8d8 Wisteria Bloom   #b89cd1 Crystalline Quartz
   #7a5e9b Iris Ink         #5a3f7a Plum Marginalia
   #3d2c4f Vesper Plum      #a8c8a0 Pressed Sage
   Fonts: Fraunces (display/drop-caps, variable), Cormorant Garamond (body),
          Cormorant SC (date/glyphs), Caveat (marginalia)
*/

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

:root {
  --vellum: #f7f1e8;
  --linen: #ede4d3;
  --wisteria: #c8a8d8;
  --quartz: #b89cd1;
  --iris: #7a5e9b;
  --plum-marg: #5a3f7a;
  --vesper: #3d2c4f;
  --sage: #a8c8a0;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html { scroll-behavior: smooth; }

body {
  background-color: var(--vellum);
  color: var(--vesper);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.0625rem, 1.1vw + 0.85rem, 1.2rem);
  line-height: 1.78;
  letter-spacing: 0.005em;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ---- Animated grain overlay ---- */
body::before {
  content: "";
  position: fixed;
  inset: -120px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.14;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3' seed='7'/></filter><rect width='600' height='600' filter='url(%23n)'/></svg>");
  background-size: 600px 600px;
  animation: grain 0.8s steps(8) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  12.5%{ transform: translate(-13px, 7px); }
  25%  { transform: translate(9px, -11px); }
  37.5%{ transform: translate(-7px, -15px); }
  50%  { transform: translate(14px, 4px); }
  62.5%{ transform: translate(-11px, 12px); }
  75%  { transform: translate(6px, -6px); }
  87.5%{ transform: translate(-4px, 9px); }
  100% { transform: translate(0, 0); }
}

/* ---- Pressed-flower edge garland ---- */
.garland {
  position: fixed;
  left: 0; right: 0;
  height: 24px;
  z-index: 50;
  pointer-events: none;
  background-repeat: repeat-x;
  background-size: 80px 24px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='24'><g fill='none' stroke='%23b89cd1' stroke-width='0.8'><path d='M0 12 L80 12' stroke-dasharray='1 5'/><polygon points='12,6 18,9 18,15 12,18 6,15 6,9' /><path d='M40 7 L42 11 L46 12 L43 14 L40 18 L37 14 L34 12 L38 11 Z' fill='%237a5e9b' stroke='none'/><polygon points='68,6 74,9 74,15 68,18 62,15 62,9'/></g></svg>");
  opacity: 0.7;
}
.garland-top { top: 0; }
.garland-bottom { bottom: 0; transform: scaleY(-1); }

/* ---- Chrome: hairline + date + glyph nav ---- */
.chrome {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  pointer-events: none;
}
.chrome-hairline {
  height: 1px;
  width: 100%;
  background: var(--iris);
}
.chrome-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.6rem;
}
.chrome-date {
  font-family: "Cormorant SC", "Cormorant Garamond", serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--iris);
  text-transform: uppercase;
}
.glyph-nav {
  display: flex;
  gap: 6rem;
  pointer-events: auto;
}
.glyph {
  font-family: "Cormorant SC", "Cormorant Garamond", serif;
  font-size: 10px;
  color: var(--iris);
  text-decoration: none;
  position: relative;
  line-height: 1;
  transition: color 0.4s ease;
}
.glyph:hover { color: var(--plum-marg); }
.glyph-tip {
  position: absolute;
  top: 1.4em;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  transform-origin: top center;
  opacity: 0;
  white-space: nowrap;
  font-family: "Cormorant SC", serif;
  font-style: italic;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--plum-marg);
  background: var(--linen);
  padding: 0.15rem 0.6rem;
  pointer-events: none;
  transition: opacity 1.5s ease, transform 0.28s var(--spring);
}
.glyph:hover .glyph-tip {
  opacity: 1;
  transform: translateX(-50%) scale(1);
  transition: opacity 0.4s ease, transform 0.28s var(--spring);
}

/* ---- Leaf: the single offset column ---- */
.leaf {
  width: 100%;
  padding: 0;
}

.scene {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 6vh 0;
}

.scene-body {
  width: clamp(420px, 56ch, 640px);
  max-width: 86vw;
  margin-left: calc(50% - 28ch - 7vw);
  position: relative;
}
@media (max-width: 720px) {
  .scene-body { margin-left: 7vw; margin-right: 7vw; width: auto; }
}

/* ---- Crystalline lattice scene-break band ---- */
.lattice-band {
  position: absolute;
  top: 4vh;
  left: 0; right: 0;
  height: 60px;
  overflow: hidden;
  pointer-events: none;
}
.lattice-svg {
  width: 200%;
  height: 60px;
  opacity: 0.22;
  animation: latticeDrift 12s ease-in-out infinite alternate;
}
@keyframes latticeDrift {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---- Drop-cap: sole sectional marker ---- */
.dropcap {
  position: absolute;
  right: 4vw;
  top: 14vh;
  font-family: "Fraunces", "Cormorant Garamond", serif;
  font-optical-sizing: none;
  font-variation-settings: "opsz" 144, "SOFT" 100, "WONK" 1, "wght" 200;
  font-weight: 200;
  font-size: clamp(8rem, 18vw, 14rem);
  line-height: 0.8;
  color: var(--wisteria);
  user-select: none;
  cursor: default;
  z-index: 5;
  transition: color 0.6s ease, text-shadow 0.6s ease;
}
.dropcap:hover {
  color: var(--quartz);
  text-shadow: 0 0 30px rgba(184, 156, 209, 0.4);
}
@media (max-width: 720px) {
  .dropcap { right: 2vw; top: 8vh; font-size: clamp(6rem, 24vw, 9rem); opacity: 0.6; }
}

/* ---- Section titles: variable-fluid breathing ---- */
.scene-title {
  font-family: "Fraunces", "Cormorant Garamond", serif;
  font-optical-sizing: none;
  font-weight: 200;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1.1;
  color: var(--iris);
  margin-bottom: 1.4rem;
  letter-spacing: 0.01em;
}
.breathe {
  animation: breathe 8s ease-in-out infinite alternate;
}
.breathe-slow {
  animation-duration: 8s;
}
@keyframes breathe {
  from { font-variation-settings: "wght" 200, "SOFT" 100, "WONK" 1, "opsz" 144; }
  to   { font-variation-settings: "wght" 680, "SOFT" 0,   "WONK" 1, "opsz" 144; }
}

/* ---- Body prose ---- */
.scene-body p {
  margin-bottom: 1.5rem;
}
.scene-body em {
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ---- Scene 1 specifics ---- */
.roman-numeral {
  font-family: "Cormorant SC", "Cormorant Garamond", serif;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  letter-spacing: 0.18em;
  color: var(--plum-marg);
  margin-bottom: 2rem !important;
}
.dedication {
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--vesper);
  margin-bottom: 0.6rem !important;
}

/* ---- Marginalia: Caveat handwritten notes ---- */
.marginalia {
  position: absolute;
  right: -14vw;
  top: 40%;
  width: 12vw;
  min-width: 130px;
  font-family: "Caveat", cursive;
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--plum-marg);
  transform: rotate(var(--rot, 4deg));
  background: var(--linen);
  padding: 0.3rem 0.5rem;
}
@media (max-width: 980px) {
  .marginalia {
    position: static;
    display: block;
    width: auto;
    min-width: 0;
    margin-top: 1.4rem;
    max-width: 28ch;
    transform: rotate(var(--rot, 2deg));
  }
}

/* ---- Heretical sage strikethrough ---- */
mark.heretic {
  background: transparent;
  color: inherit;
  position: relative;
  white-space: nowrap;
}
mark.heretic::after {
  content: "";
  position: absolute;
  left: -2px; right: -2px;
  top: 52%;
  height: 8px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='8' preserveAspectRatio='none'><path d='M2 6 Q40 1 70 4 T140 3 T198 5' fill='none' stroke='%23a8c8a0' stroke-width='2' stroke-linecap='round'/></svg>");
  /* draw-on-scroll: width animates from 0 */
  width: 0;
  transition: width 1.2s ease;
}
mark.heretic.struck::after {
  width: calc(100% + 4px);
}

/* ---- Pressed-violet footnote markers ---- */
.violet-mark {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.1em;
  vertical-align: super;
  line-height: 0;
}
.violet-mark svg {
  width: 14px;
  height: 14px;
  transition: transform 0.6s var(--spring);
}
.violet-mark:hover svg { transform: scale(1.5) rotate(20deg); }
.violet-mark.pulse svg {
  animation: violetPulse 0.6s var(--spring);
}
@keyframes violetPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.7) rotate(-15deg); }
  100% { transform: scale(1); }
}

/* ---- Botanical annotation panel ---- */
.violet-annotation {
  position: fixed;
  z-index: 90;
  width: clamp(180px, 18vw, 240px);
  font-family: "Caveat", cursive;
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--plum-marg);
  background: var(--linen);
  padding: 0.8rem 1rem;
  transform: rotate(-3deg) scale(0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.28s var(--spring);
}
.violet-annotation.show {
  opacity: 1;
  transform: rotate(-3deg) scale(1);
}

/* ---- Big lattice (scene 3) ---- */
.big-lattice {
  display: block;
  width: clamp(220px, 40vw, 360px);
  height: auto;
  margin: 2.5rem auto;
  opacity: 0.5;
  transition: transform 4s var(--spring);
}

/* ---- Wax seal watermark ---- */
.wax-seal {
  position: absolute;
  right: -10vw;
  bottom: 6%;
  width: 120px;
  height: 120px;
  opacity: 0.18;
  pointer-events: none;
}
.scene-vesper .scene-body .wax-seal { display: none; }
@media (max-width: 980px) {
  .wax-seal { right: 2vw; bottom: 2%; opacity: 0.12; }
}

/* ---- Scene 8 vesper ---- */
.scene-vesper {
  background: linear-gradient(180deg, var(--vellum) 0%, #e6dcc8 70%, #ddd0bd 100%);
}
.scene-body-vesper p { font-size: 0.92rem; line-height: 1.7; color: var(--vesper); }
.vesper-line { font-style: italic; letter-spacing: 0.015em; }
.caveat-close {
  display: block;
  margin-top: 2rem;
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--plum-marg);
  transform: rotate(-2deg);
}

/* ---- Selection ---- */
::selection { background: var(--wisteria); color: var(--vesper); }
