/* =========================================================
   A Field Guide to the Baby Bean
   Palette: greenhouse at dusk
   ========================================================= */

:root {
  --pine:      #16291e;   /* deep ground */
  --moss:      #20382a;   /* raised panels */
  --moss-edge: #3a5a46;   /* hairlines */
  --sprout:    #a9cda8;   /* stems, secondary accent */
  --blossom:   #f2a6bc;   /* bean-flower pink, primary accent */
  --linen:     #f3efe4;   /* light text, letter paper */
  --faded:     #9db3a4;   /* captions */

  --display: "Fraunces", Georgia, serif;
  --body: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  --measure: 62ch;
}

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

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 700px at 50% -10%, #1d3527 0%, transparent 60%),
    var(--pine);
  color: var(--linen);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--blossom); color: var(--pine); }

a { color: var(--blossom); }

:focus-visible {
  outline: 2px solid var(--blossom);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- shared type ---------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--blossom);
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 550;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

h2 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); margin: 0.6rem 0 1rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; color: var(--sprout); }

.plate-intro {
  color: var(--faded);
  font-style: italic;
  max-width: var(--measure);
  margin-bottom: 2.2rem;
}

.fig-caption {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--faded);
  margin-top: 0.9rem;
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1.5rem 2rem;
  position: relative;
}

.hero-eyebrow { animation: rise 0.9s ease-out 0.1s both; }

.hero-title {
  font-size: clamp(3rem, 11vw, 6.5rem);
  margin: 0.8rem 0 0.6rem;
  animation: rise 0.9s ease-out 0.25s both;
}

.hero-sub {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: var(--faded);
  animation: rise 0.9s ease-out 0.4s both;
}
.hero-sub em { color: var(--sprout); }

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

/* ---------- the sprout ---------- */

.sprout {
  width: min(300px, 62vw);
  margin-top: 1.5rem;
  overflow: visible;
}

.soil { fill: #122218; }

.seed {
  fill: var(--linen);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: seedSettle 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
}
@keyframes seedSettle {
  from { opacity: 0; transform: translateY(-26px) scale(0.7); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.seed-left  { animation: seedSettle 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.5s both,
                          crackL 0.5s ease-out 1.25s both; }
.seed-right { animation: seedSettle 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.5s both,
                          crackR 0.5s ease-out 1.25s both; }
@keyframes crackL { to { transform: translateX(-4px) rotate(-7deg); } }
@keyframes crackR { to { transform: translateX(4px) rotate(7deg); } }

.stem {
  stroke: var(--sprout);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: stemDraw 1.4s cubic-bezier(0.5, 0, 0.3, 1) 1.45s both;
}
@keyframes stemDraw { from { stroke-dashoffset: 1; } }

.leaf {
  fill: var(--sprout);
}
.leaf-left {
  transform: translate(158px, 252px) rotate(-80deg) scale(1.35);
  animation: leafL 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 2.55s both;
}
.leaf-right {
  transform: translate(160px, 234px) rotate(76deg) scale(1.15);
  animation: leafR 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 2.75s both;
}
@keyframes leafL { from { transform: translate(158px, 252px) rotate(-80deg) scale(0); } }
@keyframes leafR { from { transform: translate(160px, 234px) rotate(76deg) scale(0); } }

.bloom { transform: translate(158px, 197px) scale(1); animation: bloomPop 0.6s cubic-bezier(0.34, 1.7, 0.64, 1) 3.25s both; }
@keyframes bloomPop { from { transform: translate(158px, 197px) scale(0); } }
.petal { fill: var(--blossom); }
.bloom-heart { fill: var(--linen); }

.plant {
  transform-origin: 160px 306px;
  animation: sway 5.5s ease-in-out 4s infinite alternate;
}
@keyframes sway {
  from { transform: rotate(-1.6deg); }
  to   { transform: rotate(1.6deg); }
}

/* ---------- scroll cue ---------- */

.scroll-cue {
  margin-top: 2.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faded);
  text-decoration: none;
  animation: rise 0.9s ease-out 3.8s both;
}
.scroll-cue svg { width: 14px; height: 14px; animation: nudge 2.2s ease-in-out 4.5s infinite; }
.scroll-cue:hover { color: var(--blossom); }
@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

/* =========================================================
   PLATES
   ========================================================= */

.plate {
  max-width: 920px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem 1rem;
}

.plate + .plate { border-top: 0; }

/* scroll reveal (only when JS is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Plate I : identification ---------- */

.ident {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 3rem;
  align-items: center;
  background: var(--moss);
  border: 1px solid var(--moss-edge);
  border-radius: 12px;
  padding: 2.5rem;
}

.ident-figure { text-align: center; }
.ident-figure svg { width: 100%; max-width: 250px; }

.bean-body { fill: #2c4a37; stroke: var(--sprout); stroke-width: 2.5; }
.bean-eye { fill: var(--linen); }
.bean-smile { stroke: var(--linen); stroke-width: 3; stroke-linecap: round; }
.bean-blush { fill: var(--blossom); opacity: 0.45; }
.bean-heart { fill: var(--blossom); }

.tag circle { fill: var(--pine); stroke: var(--blossom); stroke-width: 1.5; }
.tag text {
  fill: var(--blossom);
  font-family: var(--mono);
  font-size: 11px;
  text-anchor: middle;
}

.leads path { stroke: var(--faded); stroke-width: 1.2; opacity: 0.8; }

.ident-list { list-style: none; display: grid; gap: 1.3rem; }
.ident-list li { display: flex; gap: 0.9rem; align-items: baseline; }
.ident-list strong { font-family: var(--display); font-weight: 600; color: var(--linen); }
.ident-list div { color: #cdd9cd; }

.tag-key {
  flex: none;
  width: 1.55rem; height: 1.55rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--blossom);
  border-radius: 50%;
  color: var(--blossom);
  font-family: var(--mono);
  font-size: 0.75rem;
  transform: translateY(0.2em);
}

/* ---------- Plate II : habitat ---------- */

.habitat {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
}

.habitat-card {
  background: var(--moss);
  border: 1px solid var(--moss-edge);
  border-radius: 12px;
  padding: 2rem;
}

.habitat-list { list-style: none; display: grid; gap: 0.9rem; color: #cdd9cd; }
.habitat-list li { padding-left: 1.4rem; position: relative; }
.habitat-list li::before {
  content: "";
  position: absolute; left: 0; top: 0.62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blossom);
}
.habitat-list .note { color: var(--faded); font-style: italic; }

.range-card { text-align: center; }
.range-map { width: 100%; max-width: 210px; margin: 0.5rem auto 0; display: block; }
.range-heart { fill: rgba(242, 166, 188, 0.12); stroke: var(--blossom); stroke-width: 2; }
.range-hatch path { stroke: var(--blossom); stroke-width: 1; opacity: 0.4; }
.range-label {
  fill: var(--linen);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--pine);
  stroke-width: 6;
  stroke-linejoin: round;
}

/* ---------- Plate III : field notes ---------- */

.notes {
  list-style: none;
  border-left: 1px solid var(--moss-edge);
  display: grid;
  gap: 2rem;
  padding: 0.4rem 0 0.4rem 0;
  max-width: var(--measure);
}

.note-entry {
  position: relative;
  padding-left: 2rem;
}
.note-entry::before {
  content: "";
  position: absolute;
  left: -5px; top: 0.5em;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--sprout);
}
.note-time {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--blossom);
  display: block;
  margin-bottom: 0.3rem;
}
.note-entry p { color: #cdd9cd; }

/* ---------- Plate IV : care ---------- */

.care-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.care-card {
  background: var(--moss);
  border: 1px solid var(--moss-edge);
  border-radius: 12px;
  padding: 1.8rem;
}
.care-card p { color: #cdd9cd; font-size: 1.02rem; }

.care-icon {
  width: 34px; height: 34px;
  margin-bottom: 0.9rem;
  stroke: var(--blossom);
  stroke-width: 2;
  fill: none;
}
.care-card:last-child .care-icon path:last-child { fill: var(--blossom); stroke: none; }

/* =========================================================
   THE LETTER
   ========================================================= */

.letter-section { max-width: 760px; }

.letter {
  position: relative;
  background: var(--linen);
  color: #2a3a2e;
  border-radius: 12px;
  padding: clamp(2rem, 5vw, 3.2rem);
  margin-top: 1.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.letter p { max-width: 56ch; }
.letter p + p { margin-top: 1.1rem; }

.letter-salutation {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.letter-signoff { margin-top: 1.6rem; }
.letter-signature {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.5rem;
  color: #7a3b51;
}

.letter-flower {
  position: absolute;
  top: 1.4rem; right: 1.4rem;
  width: 44px; height: 44px;
  opacity: 0.85;
}
.lf-petals ellipse { fill: var(--blossom); opacity: 0.7; }
.letter-flower circle { fill: #d98ca5; }

/* =========================================================
   THE GARDEN
   ========================================================= */

.garden-section { text-align: center; padding-bottom: 3rem; }
.garden-section .plate-intro { margin-left: auto; margin-right: auto; }

.garden {
  min-height: 96px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 0.4rem;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 0 0.6rem;
  border-bottom: 1px solid var(--moss-edge);
}

.garden-flower { width: 30px; overflow: visible; }
.garden-flower .g-stem { stroke: var(--sprout); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.garden-flower .g-petal { fill: var(--blossom); }
.garden-flower .g-mid { fill: var(--linen); }
.garden-flower.pop { animation: gardenPop 0.5s cubic-bezier(0.34, 1.6, 0.64, 1) both; transform-origin: 50% 100%; }
@keyframes gardenPop { from { transform: scale(0); } }

.garden-msg {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--faded);
  min-height: 1.6em;
  margin: 1.1rem 0 1.4rem;
}

.water-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pine);
  background: var(--blossom);
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.7rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.water-btn svg { width: 15px; height: 15px; }
.water-btn:hover { background: #f7bccd; transform: translateY(-2px); }
.water-btn:active { transform: translateY(0) scale(0.97); }

/* =========================================================
   FOOTER
   ========================================================= */

.site-footer {
  text-align: center;
  padding: 3rem 1.5rem 3.5rem;
  color: var(--faded);
  font-style: italic;
  font-size: 0.95rem;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 760px) {
  .ident { grid-template-columns: 1fr; padding: 1.8rem; gap: 2rem; }
  .habitat { grid-template-columns: 1fr; }
  .care-grid { grid-template-columns: 1fr; }
  .plate { padding-top: 4rem; }
}

/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
