:root {
  --leather-dark: #3D3229;
  --leather-mid: #6B5B4E;
  --leather-warm: #A8947E;
  --parchment-light: #F4EDE4;
  --parchment-dark: #EDE5D8;
  --pigment-green: #5A6B4A;
  --pigment-ochre: #C49A3C;
  --pigment-rust: #A0523D;
  --ink: #4A4038;
  --grey-warm: #8B7D6B;
  --grain: #635449;
  --pore: #5A4D42;
  --patina: #756553;
  --ease-morph: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Compliance trace: IntersectionObserver` at 0.15 threshold to trigger panel morphs. Each panel has a `data-depth` attribute (1-5. Source Serif 4 (contemporary serif) (#A0523D (Google Fonts Space Grotesk (neo-grotesque. */

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  line-height: 1.72;
  letter-spacing: 0.005em;
  background-color: var(--leather-mid);
  background-image:
    radial-gradient(ellipse at 50% 34%, rgba(117, 101, 83, 0.22) 0%, rgba(61, 50, 41, 0.34) 80%),
    radial-gradient(circle at 1.5px 1.5px, var(--pore) 0.5px, transparent 0.9px),
    repeating-linear-gradient(87deg, var(--leather-mid) 0 1px, var(--grain) 1px 2px, var(--leather-mid) 2px 4px);
  background-size: 100% 100%, 3px 3px, auto;
  overflow-x: hidden;
}

.journal { position: relative; isolation: isolate; }

.folio {
  position: relative;
  min-height: 100vh;
  padding: clamp(2rem, 5vw, 5.5rem);
  display: grid;
  grid-template-columns: 1fr 1.618fr 1fr 1.618fr 1fr;
  align-items: center;
  column-gap: clamp(1rem, 2vw, 2.4rem);
}

.opening { color: var(--parchment-light); overflow: hidden; }

.opening::before {
  content: "";
  position: absolute;
  inset: 8vh 8vw auto auto;
  width: 20vw;
  height: 56vh;
  border-left: 1px solid rgba(168, 148, 126, 0.45);
  border-top: 1px solid rgba(168, 148, 126, 0.45);
  opacity: 0.8;
}

.opening-rule {
  position: absolute;
  left: 0;
  top: 51%;
  height: 1px;
  width: 72vw;
  background: var(--leather-mid);
}

.folio-label,
.panel-kicker,
.annotation span,
.annotation-kicker {
  font-family: "Space Grotesk", Inter, Arial, sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-warm);
}

.opening .folio-label { grid-column: 1 / 3; align-self: start; margin: 0; }

.opening-title {
  grid-column: 1 / 5;
  margin: 0;
  font-family: "Space Grotesk", Inter, Arial, sans-serif;
  font-size: clamp(5rem, 18vw, 17rem);
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: 0.1em;
  color: var(--parchment-light);
  animation: tightenKerning 1200ms var(--ease-spring) 120ms forwards;
  z-index: 2;
}

.annotation-box,
.annotation {
  border: 1px solid var(--leather-warm);
  color: var(--ink);
  background: rgba(244, 237, 228, 0.94);
}

.opening-note {
  grid-column: 4 / 6;
  justify-self: end;
  align-self: end;
  max-width: 34rem;
  padding: 1.25rem 1.35rem 1.4rem;
  text-align: right;
  z-index: 3;
}

.opening-note p { margin: 0.65rem 0 0; }

.specimen-set { align-items: start; margin-top: -16vh; padding-top: 18vh; }
.specimen-set.shifted { margin-top: -20vh; }
.specimen-set.reversed { margin-top: -18vh; }

.panel {
  position: relative;
  z-index: 2;
  padding: clamp(3rem, 6vw, 6rem);
  min-height: 62vh;
  overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, var(--parchment-light) 0%, var(--parchment-dark) 70%);
}

.parchment-light { background: radial-gradient(ellipse at 30% 20%, var(--parchment-light) 0%, var(--parchment-dark) 78%); }
.parchment-dark { background: radial-gradient(ellipse at 70% 16%, var(--parchment-dark) 0%, #e4d8c8 100%); }

.panel-large { grid-column: 2 / 6; }
.panel-medium { grid-column: 1 / 5; }
.panel-tall { grid-column: 2 / 5; min-height: 74vh; }

.panel h2,
.colophon-panel h2 {
  margin: 0.35rem 0 2rem;
  max-width: 13ch;
  font-family: "Space Grotesk", Inter, Arial, sans-serif;
  font-size: clamp(2.4rem, 6vw, 5.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.92;
  color: var(--leather-dark);
}

.panel p { max-width: 40rem; }

.folio-number {
  position: absolute;
  right: -0.08em;
  bottom: -0.18em;
  font-family: "Space Grotesk", Inter, Arial, sans-serif;
  font-size: clamp(10rem, 26vw, 20rem);
  font-weight: 700;
  line-height: 1;
  color: var(--leather-dark);
  opacity: 0.06;
  pointer-events: none;
}

.ornament-rule {
  position: relative;
  width: 100%;
  height: 1px;
  border: 0;
  margin: 2rem 0;
  background: var(--leather-mid);
}

.ornament-rule::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  width: 6px;
  height: 6px;
  background: var(--pigment-ochre);
  transform: translateX(-50%) rotate(45deg);
}

.dark-rule { background: var(--leather-warm); }

.annotation {
  position: relative;
  z-index: 4;
  padding: 1rem 1rem 1.15rem;
  font-size: 0.95rem;
  line-height: 1.48;
}

.annotation p { margin: 0.7rem 0 0; }
.annotation-one { grid-column: 1 / 3; margin-top: 42vh; }
.annotation-two { grid-column: 4 / 6; margin-top: -12vh; }
.annotation-three { grid-column: 5 / 6; margin-top: 18vh; }

.seed-cluster {
  display: block;
  width: 9px;
  height: 9px;
  margin: 1.1rem 0 0 auto;
  border-radius: 50%;
  background: var(--pigment-ochre);
  box-shadow: -18px 3px 0 var(--pigment-ochre), -34px -4px 0 rgba(196, 154, 60, 0.72), -52px 6px 0 rgba(196, 154, 60, 0.5);
}

.specimen-frame {
  position: relative;
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--leather-warm);
  outline: 1px solid var(--leather-warm);
  outline-offset: 4px;
}

.marginal-mark { color: var(--pigment-rust); font-size: 0.8rem; margin-right: 0.7rem; }

.leaf-specimen {
  position: absolute;
  z-index: 5;
  width: 18rem;
  height: 22rem;
  opacity: 0.46;
  pointer-events: none;
}

.leaf-a { right: 5vw; top: 8vh; transform: rotate(-7deg); }
.leaf-b { left: 5vw; top: 24vh; transform: rotate(8deg); }

.leaf-specimen::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10%;
  width: 1px;
  height: 78%;
  background: var(--pigment-green);
}

.leaf-specimen i {
  position: absolute;
  width: 7rem;
  height: 3.8rem;
  background: var(--pigment-green);
  clip-path: ellipse(48% 42% at 50% 50%);
  transform-origin: right center;
}

.leaf-specimen i:nth-child(1) { left: 18%; top: 24%; transform: rotate(28deg); }
.leaf-specimen i:nth-child(2) { right: 15%; top: 36%; transform: rotate(146deg); }
.leaf-specimen i:nth-child(3) { left: 12%; top: 52%; transform: rotate(-18deg); }
.leaf-specimen i:nth-child(4) { right: 11%; top: 64%; transform: rotate(160deg); }

.root-diagram {
  position: absolute;
  left: 8vw;
  top: 7vh;
  z-index: 1;
  width: 11rem;
  height: 24rem;
  border-left: 1px solid var(--leather-warm);
  opacity: 0.82;
}

.root-diagram i {
  position: absolute;
  left: 0;
  width: 7rem;
  height: 1px;
  background: var(--leather-warm);
  transform-origin: left center;
}
.root-diagram i:nth-child(1) { top: 18%; transform: rotate(30deg); }
.root-diagram i:nth-child(2) { top: 34%; transform: rotate(-28deg); }
.root-diagram i:nth-child(3) { top: 54%; transform: rotate(22deg); }
.root-diagram i:nth-child(4) { top: 72%; transform: rotate(-34deg); }

.closing {
  margin-top: -8vh;
  background: linear-gradient(135deg, rgba(61, 50, 41, 0.72) 0%, rgba(107, 91, 78, 0.44) 100%);
}

.colophon-panel {
  grid-column: 1 / 6;
  min-height: 78vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 8vw, 8rem);
  color: var(--parchment-light);
  background: linear-gradient(135deg, var(--leather-dark) 0%, var(--leather-mid) 100%);
}

.colophon-panel h2 { color: var(--parchment-light); max-width: none; }
.colophon-panel p:last-child { margin: 1.2rem 0 0; font-family: "Space Grotesk", Inter, Arial, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--parchment-dark); font-size: 0.85rem; }

.reveal-panel,
.reveal-note,
.reveal-leaf {
  opacity: 0;
  will-change: transform, opacity;
}

.reveal-panel { transform: scale(0.96) translateY(20px); transition: opacity 600ms var(--ease-morph), transform 600ms var(--ease-morph); }
.reveal-note { transform: scale(0.92); transition: opacity 600ms var(--ease-morph) 200ms, transform 600ms var(--ease-morph) 200ms; }
.reveal-leaf { transform: rotate(-3deg) scale(0.95); transition: opacity 800ms var(--ease-morph) 160ms, transform 800ms var(--ease-morph) 160ms; }

.is-visible { opacity: 1; transform: translate3d(0, 0, 0) scale(1) rotate(var(--settle-rotate, 0deg)); }
.leaf-a.is-visible { --settle-rotate: -7deg; }
.leaf-b.is-visible { --settle-rotate: 8deg; }
.is-receded { transform: translateY(-8px) scale(0.992); }

@keyframes tightenKerning {
  from { letter-spacing: 0.1em; transform: translateY(8px); opacity: 0.92; }
  to { letter-spacing: -0.03em; transform: translateY(0); opacity: 1; }
}

@media (max-width: 860px) {
  .folio { grid-template-columns: 1fr; padding: 2rem 1.2rem; }
  .opening-title,
  .opening .folio-label,
  .opening-note,
  .panel-large,
  .panel-medium,
  .panel-tall,
  .annotation-one,
  .annotation-two,
  .annotation-three,
  .colophon-panel { grid-column: 1; }
  .opening-note { text-align: left; margin-top: 2rem; }
  .specimen-set,
  .specimen-set.shifted,
  .specimen-set.reversed { margin-top: -8vh; padding-top: 10vh; }
  .panel { padding: 2rem 1.35rem; min-height: auto; }
  .annotation { margin-top: 1.4rem; }
  .leaf-specimen { width: 10rem; height: 13rem; opacity: 0.28; }
  .leaf-a { right: -1rem; top: 1rem; }
  .leaf-b { left: -2rem; top: 7rem; }
  .root-diagram { display: none; }
}
