/* cbdc.study Stylesheet */
/* Design: Light Academia + Botanical Illustration */

:root {
  /* Palette */
  --parchment-cream: #FBF7F0;
  --walnut-ink: #6B5744;
  --deep-umber: #3D2E1F;
  --brass: #8B7355;
  --aged-brass: #A09080;
  --linen-white: #F5EDE0;
  --tea-stain: #C8B898;
  --pressed-sage: #7A8B6F;
  --oxblood: #6E2C2C;

  /* Typography scale */
  --text-size-base: clamp(1.05rem, 1.8vw, 1.25rem);
  --text-size-margin: 0.8rem;
  --text-size-label: 0.85rem;
  --h1-size: clamp(2.8rem, 7vw, 5rem);
  --h2-size: clamp(1.6rem, 3.5vw, 2.4rem);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--parchment-cream);
  color: var(--deep-umber);
  font-family: "Cormorant Garamond", "Garamond", serif;
  font-weight: 400;
  font-size: var(--text-size-base);
  line-height: 1.72;
  letter-spacing: 0.01em;
  position: relative;
}

/* Paper texture overlay */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(200, 184, 152, 0.03) 2px,
      rgba(200, 184, 152, 0.03) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 2px,
      rgba(200, 184, 152, 0.03) 2px,
      rgba(200, 184, 152, 0.03) 4px
    );
  pointer-events: none;
  z-index: 1;
}

/* Heading Styles */
h1 {
  font-family: "Playfair Display", "Garamond", serif;
  font-weight: 700;
  font-size: var(--h1-size);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--deep-umber);
}

h2 {
  font-family: "Playfair Display", "Garamond", serif;
  font-weight: 400;
  font-style: italic;
  font-size: var(--h2-size);
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--walnut-ink);
  margin-bottom: 1.5rem;
}

/* Section Labels & Small Caps */
.section-label {
  font-family: "Cormorant Garamond", "Garamond", serif;
  font-weight: 500;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  font-size: var(--text-size-label);
  color: var(--brass);
  display: block;
  margin-bottom: 0.5rem;
}

/* Drop Capitals */
.drop-capital {
  font-family: "Playfair Display", "Garamond", serif;
  font-style: italic;
  font-size: 4.5em;
  color: var(--brass);
  float: left;
  line-height: 1;
  padding-right: 0.1em;
  padding-top: 0.1em;
}

/* Body Text */
.body-text {
  margin-bottom: 1.2rem;
}

/* Pull Quotes */
.pull-quote {
  font-family: "Lora", "Garamond", serif;
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.5;
  color: var(--walnut-ink);
  border-left: 2px solid var(--tea-stain);
  padding-left: 1.5rem;
  margin: 2rem 0;
  font-weight: 400;
}

.pull-quote p {
  margin: 0;
}

/* HERO SECTION */
#hero {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem 4vw;
  background-color: var(--parchment-cream);
}

#hero-monogram {
  position: absolute;
  top: 2rem;
  left: 4vw;
  font-family: "Playfair Display", serif;
  font-weight: 400;
  font-size: clamp(0.9rem, 2vw, 1.4rem);
  letter-spacing: 0.15em;
  color: var(--walnut-ink);
}

#hero-content {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
}

#hero-title-stack {
  flex: 0 0 40%;
  z-index: 10;
}

#hero-title {
  margin-bottom: 0.5rem;
}

#hero-subtitle {
  font-size: 0.95rem;
  font-weight: 400;
  font-style: normal;
}

#hero-illustration {
  flex: 0 0 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#root-system {
  width: 100%;
  max-width: 600px;
  height: auto;
}

.root-path {
  fill: none;
  stroke: var(--walnut-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.root-main {
  stroke-width: 2px;
}

.root-branch {
  stroke-width: 1.5px;
}

.root-fine {
  stroke-width: 1px;
}

.root-hair {
  stroke-width: 0.7px;
  opacity: 0.8;
}

.root-node {
  fill: var(--walnut-ink);
}

/* Scroll Indicator */
#hero-scroll-line {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0.5px;
  height: 2rem;
  background: linear-gradient(to bottom, var(--walnut-ink), transparent);
}

/* READING SECTIONS */
section.reading-section {
  width: 100%;
  padding: 6rem 4vw;
  position: relative;
}

section.reading-section.alt-bg {
  background-color: var(--linen-white);
}

.section-content {
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

/* Vine Border Divider */
.vine-border {
  margin-bottom: 3rem;
  width: 100%;
}

.vine-svg {
  width: 100%;
  height: 40px;
  display: block;
}

.vine-stem {
  fill: none;
  stroke: var(--walnut-ink);
  stroke-width: 1px;
  stroke-linecap: round;
}

.vine-leaf {
  fill: none;
  stroke: var(--walnut-ink);
  stroke-width: 0.75px;
  stroke-linecap: round;
}

.section-heading {
  position: relative;
  margin-bottom: 2rem;
}

.section-heading .section-label {
  display: block;
  margin-bottom: 0.5rem;
}

/* Text Block */
.text-block {
  margin-bottom: 2rem;
}

/* Margin Notes */
.margin-note {
  display: none;
  position: absolute;
  right: -200px;
  width: 160px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: var(--text-size-margin);
  line-height: 1.55;
  color: var(--aged-brass);
  opacity: 0;
}

.margin-note .margin-label {
  font-weight: 500;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  font-style: normal;
  font-size: 0.7rem;
  color: var(--brass);
  display: block;
  margin-bottom: 0.3rem;
}

@media (min-width: 1200px) {
  .margin-note {
    display: block;
  }

  .section-content {
    position: relative;
  }
}

/* Specimen Illustrations */
.specimen {
  display: none;
  position: absolute;
  right: -240px;
  width: 120px;
  margin-top: 2rem;
}

.specimen-svg {
  width: 100%;
  height: auto;
}

.specimen-label {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--aged-brass);
  text-align: center;
  margin-top: 0.5rem;
}

@media (min-width: 1200px) {
  .specimen {
    display: block;
  }
}

/* Fleuron Divider */
.fleuron {
  text-align: center;
  font-size: 2rem;
  color: var(--tea-stain);
  margin: 4rem 0;
  opacity: 0;
}

/* COLOPHON SECTION */
#colophon {
  width: 100%;
  padding: 6rem 4vw;
  background-color: var(--linen-white);
  display: flex;
  align-items: center;
  justify-content: center;
}

#colophon-border {
  max-width: 640px;
  border-top: 1px solid var(--walnut-ink);
  border-bottom: 1px solid var(--walnut-ink);
  padding: 3rem 0;
  position: relative;
}

#colophon-border::before,
#colophon-border::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--walnut-ink);
}

#colophon-border::before {
  top: -3px;
}

#colophon-border::after {
  bottom: -3px;
}

#colophon-content {
  text-align: center;
  opacity: 0;
}

.colophon-monogram {
  font-size: 2rem;
  color: var(--oxblood);
  margin-bottom: 1rem;
}

.colophon-text {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--aged-brass);
  margin-bottom: 1rem;
}

.colophon-text em {
  font-style: normal;
  font-weight: 500;
}

.colophon-date {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  margin-top: 1.5rem;
}

/* ANIMATION CLASSES */

/* Fade-Reveal Animation */
@keyframes fadeReveal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rootDraw {
  from {
    stroke-dashoffset: var(--dash-length);
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-reveal {
  animation: fadeReveal 0.7s ease-out forwards;
  animation-delay: 0s;
  opacity: 0;
}

.fade-reveal.visible {
  animation: fadeReveal 0.7s ease-out forwards;
  opacity: 1;
}

#hero-title-stack .fade-reveal {
  animation: titleFadeIn 1s ease-out forwards;
  animation-delay: 0.8s;
}

.margin-note.visible {
  animation: slideInLeft 0.5s ease-out forwards;
}

/* SVG Path Animation for Vines */
.vine-svg .vine-stem {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawVine 1.2s ease-in-out forwards;
}

@keyframes drawVine {
  to {
    stroke-dashoffset: 0;
  }
}

.vine-svg .vine-leaf {
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
  animation-delay: 1.2s;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* Root system drawing animation */
#root-system .root-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

#root-system .root-main {
  animation: drawRoot 2.5s ease-in-out forwards;
}

#root-system .root-branch {
  animation: drawRoot 2.5s ease-in-out forwards 0.3s;
}

#root-system .root-fine {
  animation: drawRoot 2.5s ease-in-out forwards 0.6s;
}

#root-system .root-hair {
  animation: drawRoot 2.5s ease-in-out forwards 0.9s;
}

@keyframes drawRoot {
  to {
    stroke-dashoffset: 0;
  }
}

#root-system .root-node {
  opacity: 0;
  animation: fadeIn 0.3s ease-out forwards 2.2s;
}

/* Responsive Design */

@media (max-width: 1024px) {
  #hero-content {
    flex-direction: column;
    gap: 2rem;
  }

  #hero-title-stack {
    flex: 1;
    order: 2;
  }

  #hero-illustration {
    flex: 1;
    order: 1;
  }

  .margin-note,
  .specimen {
    display: none !important;
  }

  .section-content {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  #hero {
    height: auto;
    min-height: 100vh;
    padding: 2rem 1.5rem;
  }

  #hero-monogram {
    left: 1.5rem;
  }

  #hero-content {
    flex-direction: column;
    gap: 1.5rem;
  }

  section.reading-section {
    padding: 3rem 1.5rem;
  }

  .section-heading {
    font-size: 1.4rem;
  }

  #colophon {
    padding: 3rem 1.5rem;
  }

  #colophon-border {
    padding: 2rem 0;
  }
}

@media (max-width: 480px) {
  #hero {
    padding: 1.5rem;
  }

  #hero-monogram {
    left: 1.5rem;
    font-size: 0.9rem;
  }

  #hero-title {
    font-size: 2rem;
  }

  #hero-subtitle {
    font-size: 0.85rem;
  }

  section.reading-section {
    padding: 2rem 1.5rem;
  }

  .body-text {
    font-size: 1rem;
  }

  .pull-quote {
    font-size: 1.1rem;
    padding-left: 1rem;
  }
}

/* Ensure relative positioning for layout */
section {
  position: relative;
}

/* Stagger animations within sections */
.fade-reveal:nth-child(1) { animation-delay: 0s; }
.fade-reveal:nth-child(2) { animation-delay: 0.08s; }
.fade-reveal:nth-child(3) { animation-delay: 0.16s; }
.fade-reveal:nth-child(4) { animation-delay: 0.24s; }
.fade-reveal:nth-child(5) { animation-delay: 0.32s; }
.fade-reveal:nth-child(6) { animation-delay: 0.40s; }

/* Print Styles */
@media print {
  body::after {
    display: none;
  }

  section.reading-section,
  section.reading-section.alt-bg {
    page-break-inside: avoid;
    page-break-after: avoid;
  }
}
