/* ===== Custom Properties ===== */
:root {
  --ink: #1C1C1C;
  --graphite: #3A3A3A;
  --pencil: #6B6B6B;
  --fog: #B8B8B8;
  --parchment: #F4F0E8;
  --linen: #FAF8F3;
  --paper: #FEFDFB;
  --shadow: rgba(28,28,28,0.06);
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Lora', Georgia, serif;
  background: var(--linen);
  color: var(--ink);
  overflow-x: hidden;
  line-height: 1.85;
  font-size: clamp(1rem, 1.1vw, 1.15rem);
}

/* ===== Folio Base ===== */
.folio {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  overflow: hidden;
}
.frontispiece { min-height: 100vh; }
.colophon { min-height: 80vh; }

/* ===== Parallax Backgrounds ===== */
.parallax-bg {
  position: absolute;
  inset: -20% 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  filter: grayscale(100%) sepia(15%) contrast(1.1) brightness(0.95);
  will-change: transform;
}
.frontispiece-bg {
  background: linear-gradient(180deg, var(--fog) 0%, var(--parchment) 60%, var(--linen) 100%);
  animation: kenBurns 20s ease-in-out infinite alternate;
}
@keyframes kenBurns {
  0% { transform: scale(1); }
  100% { transform: scale(1.03); }
}
.collection-bg {
  background: linear-gradient(135deg, var(--graphite) 0%, var(--pencil) 50%, var(--fog) 100%);
}
.evidence-bg {
  background: linear-gradient(180deg, var(--pencil) 0%, var(--graphite) 100%);
}

/* ===== Folio Content ===== */
.folio-content {
  position: relative;
  z-index: 10;
  max-width: 720px;
}
.folio-content.centered { text-align: center; }

/* ===== Page Container ===== */
.page-container {
  position: relative;
  z-index: 10;
  max-width: 780px;
  width: 100%;
  background: var(--parchment);
  padding: clamp(2rem, 4vw, 4rem);
  border-radius: 2px;
  box-shadow: 0 2px 8px var(--shadow);
  transition: box-shadow 0.4s ease;
}
.page-container:hover {
  box-shadow: 0 4px 16px rgba(28,28,28,0.08);
}

/* ===== Typography ===== */
.hero-title {
  font-family: 'Abril Fatface', serif;
  font-weight: 400;
  font-size: clamp(3rem, 10vw, 9rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
}
.hero-subtitle {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  color: var(--pencil);
  margin-top: 1rem;
}
.section-heading {
  font-family: 'Abril Fatface', serif;
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 4.5rem);
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}
p { margin-bottom: 1.25rem; }

/* Morph animation */
[data-morph] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1), transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
}
[data-morph].visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Ruled Lines ===== */
.ruled-lines {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20vh;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 23px, var(--fog) 23px, var(--fog) 24px);
  opacity: 0.4;
  z-index: 5;
}

/* ===== Marginalia Strip ===== */
.marginalia-strip {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3rem;
  gap: 2rem;
}
.margin-number {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--pencil);
  writing-mode: vertical-rl;
}
.margin-botanical { opacity: 0.5; }

/* ===== Parchment Strip (over photos) ===== */
.parchment-strip {
  position: relative;
  z-index: 10;
  background: rgba(244, 240, 232, 0.92);
  backdrop-filter: blur(2px);
  padding: clamp(2rem, 3vw, 3rem);
  max-width: 800px;
  width: 100%;
}
.parchment-strip.bottom-strip {
  margin-top: auto;
  align-self: flex-end;
}

/* ===== Paper List ===== */
.paper-list { display: flex; flex-direction: column; gap: 1.5rem; }
.paper-title {
  font-family: 'Abril Fatface', serif;
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}
.paper-desc {
  font-size: 0.95rem;
  color: var(--graphite);
  margin-bottom: 0;
}

/* ===== Pull Quote ===== */
.pull-quote {
  font-family: 'Abril Fatface', serif;
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-style: italic;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 0.75rem;
  border: none;
  padding: 0;
}
.quote-attr {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--pencil);
  font-style: normal;
}

/* ===== Two Column ===== */
.two-column {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
}
.col-margin {
  border-left: 1px dashed var(--fog);
  padding-left: 1.5rem;
}
.margin-commentary {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--pencil);
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ===== Dot Lattice ===== */
.dot-lattice {
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='9' cy='9' r='1.5' fill='%236B6B6B' opacity='0.15'/%3E%3C/svg%3E");
  background-color: var(--parchment);
}

/* ===== Chevron Divider ===== */
.chevron-divider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg width='24' height='12' viewBox='0 0 24 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='0,12 12,0 24,12' fill='none' stroke='%23B8B8B8' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  z-index: 15;
}

/* ===== Border Tape ===== */
.border-tape {
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 8px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='8' viewBox='0 0 16 8' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='8' height='8' fill='none' stroke='%233A3A3A' stroke-width='1'/%3E%3Crect x='8' y='2' width='4' height='4' fill='none' stroke='%233A3A3A' stroke-width='1'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  z-index: 15;
}

/* ===== Corner Ornaments ===== */
.corner-ornament {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 1px solid var(--fog);
}
.corner-ornament::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid var(--fog);
  transform: rotate(45deg);
}
.tl { top: 8px; left: 8px; }
.tr { top: 8px; right: 8px; }
.bl { bottom: 8px; left: 8px; }
.br { bottom: 8px; right: 8px; }

/* ===== Colophon ===== */
.colophon {
  background: var(--parchment);
}
.border-tape-frame {
  border: 1px solid var(--graphite);
  padding: 3rem;
  text-align: center;
  position: relative;
  z-index: 10;
  background: var(--parchment);
}
.colophon-content {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--pencil);
  line-height: 2;
}
.colophon-year {
  font-family: 'Abril Fatface', serif;
  font-size: 1.5rem;
  color: var(--ink);
  margin-top: 1rem;
}
.fern-drawing {
  margin-top: 1.5rem;
  opacity: 0.5;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--pencil);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .two-column { grid-template-columns: 1fr; }
  .col-margin { border-left: none; border-top: 1px dashed var(--fog); padding-left: 0; padding-top: 1.5rem; }
}
@media (max-width: 768px) {
  .folio { padding: 3rem 1.5rem; }
  .marginalia-strip { display: none; }
  .page-container { padding: 1.5rem; }
}
