/* ============================================================
   Israel's Butterflies — forest field-guide theme
   Motion tokens (--dur-*, --ease-*) come from assets/motion.css
   ============================================================ */

:root {
  --forest-0: #16261c;
  --forest-1: #1b2f21;
  --forest-2: #243c2a;
  --forest-3: #2f4a32;
  --moss:     #6b9e58;
  --leaf:     #8fb96b;
  --sun:      #f0e2ad;
  --sun-warm: #e8c879;

  --parchment: #f5efdf;
  --parchment-edge: #e7ddc3;
  --ink:       #2c3326;
  --ink-soft:  #5c6450;
  --cream:     #eef3e0;
  --cream-soft: #c5d2b2;

  --anemone:  #cf3b2f;
  --violet:   #8f6fc0;

  --maxw: 1120px;
  --ease-soft: var(--ease-out-cubic, cubic-bezier(0.215,0.61,0.355,1));
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--cream);
  background: var(--forest-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, .hero-title, .sp-name { font-family: "Fraunces", Georgia, serif; font-weight: 500; }

img { max-width: 100%; display: block; }

a { color: inherit; }

/* ---------- Forest backdrop (fixed) ---------- */
.forest-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(240,226,173,.22), transparent 60%),
    radial-gradient(900px 500px at 12% 4%, rgba(143,185,107,.16), transparent 60%),
    linear-gradient(180deg, #34512f 0%, #284224 34%, #1d3322 66%, #152619 100%);
}
.canopy-light {
  position: absolute; inset: 0;
  background:
    radial-gradient(420px 320px at 22% 12%, rgba(245,236,190,.20), transparent 70%),
    radial-gradient(520px 380px at 86% 20%, rgba(245,236,190,.14), transparent 70%),
    radial-gradient(360px 300px at 60% 0%, rgba(245,236,190,.12), transparent 70%);
  mix-blend-mode: screen;
  animation: drift 26s var(--ease-in-out-cubic, ease-in-out) infinite alternate;
}
@keyframes drift { from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); } to { transform: translate3d(2%, 1.5%, 0) scale(1.06); } }

.foliage { position: absolute; inset: 0; }
.foliage--far {
  background:
    radial-gradient(260px 200px at -4% -6%, rgba(18,38,24,.9), transparent 70%),
    radial-gradient(300px 240px at 104% -8%, rgba(18,38,24,.85), transparent 70%),
    radial-gradient(420px 300px at 50% 116%, rgba(13,28,18,.9), transparent 70%);
  filter: blur(2px);
}
.foliage--near {
  background:
    radial-gradient(170px 150px at 6% -3%, rgba(31,58,36,.95), transparent 72%),
    radial-gradient(190px 160px at 96% -2%, rgba(31,58,36,.92), transparent 72%);
  filter: blur(6px);
}

/* ---------- Pollen motes ---------- */
.motes { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.mote {
  position: absolute; bottom: -12px; width: 6px; height: 6px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255,250,220,.95), rgba(240,226,150,.35) 70%, transparent);
  opacity: 0; will-change: transform, opacity;
  animation: rise var(--mote-dur, 16s) linear infinite;
  animation-delay: var(--mote-delay, 0s);
}
@keyframes rise {
  0%   { transform: translate3d(0, 0, 0) scale(.6); opacity: 0; }
  12%  { opacity: var(--mote-op, .7); }
  88%  { opacity: var(--mote-op, .7); }
  100% { transform: translate3d(var(--mote-x, 40px), -104vh, 0) scale(1); opacity: 0; }
}

/* ---------- Flying butterflies ---------- */
.sky { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.flit { position: absolute; top: 0; left: 0; will-change: transform; }
.flit-wing {
  width: 100%; height: auto;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.28));
  animation: flap .4s var(--ease-in-out-cubic, ease-in-out) infinite;
  transform-origin: 50% 50%;
}
@keyframes flap { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(.74) scaleY(1.02); } }

/* ---------- Meadow (foreground grass + flowers) ---------- */
.meadow {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1;
  width: 100%; height: clamp(140px, 22vh, 260px);
  pointer-events: none;
}
.blade, .flower {
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: sway var(--sway-dur, 4.5s) var(--ease-in-out-cubic, ease-in-out) infinite alternate;
  animation-delay: var(--sway-delay, 0s);
}
@keyframes sway {
  from { transform: rotate(calc(var(--sway-amp, 2deg) * -1)); }
  to   { transform: rotate(var(--sway-amp, 2deg)); }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 14px clamp(18px, 4vw, 40px);
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(18,32,22,.72), rgba(18,32,22,.18) 80%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--cream); }
.brand-mark { color: var(--sun-warm); display: inline-flex; }
.brand-text { font-family: "Fraunces", serif; font-weight: 500; font-size: 18px; letter-spacing: .2px; }
.nav-links { display: flex; gap: 22px; }
.nav-links a { text-decoration: none; color: var(--cream-soft); font-size: 14px; font-weight: 500; padding: 6px 2px; border-bottom: 1.5px solid transparent; }
.nav-links a:hover { color: var(--cream); border-bottom-color: var(--sun-warm); }

/* ---------- Layout shell ---------- */
main { position: relative; z-index: 2; }
section { padding-inline: clamp(18px, 4vw, 40px); }
.section-head, .hero-inner, .stats, .species, .about-card, .names { max-width: var(--maxw); margin-inline: auto; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding-block: 8vh 12vh;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .32em; font-size: 12.5px; font-weight: 600;
  color: var(--sun-warm); margin: 0 0 18px;
}
.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: 1.02; margin: 0;
  color: #fbf7ea; letter-spacing: -.5px; text-shadow: 0 2px 30px rgba(0,0,0,.35);
}
.hero-title em { font-style: italic; font-weight: 400; color: var(--sun-warm); }
.hero-lead {
  max-width: 620px; margin: 26px auto 0; font-size: clamp(16px, 2.2vw, 19px);
  line-height: 1.7; color: var(--cream-soft);
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 34px; }
.btn {
  display: inline-block; padding: 13px 26px; border-radius: 999px; text-decoration: none;
  font-weight: 600; font-size: 15px; border: 1.5px solid transparent;
  transition: transform var(--dur-micro, 175ms) var(--ease-standard, ease-out),
              background-color var(--dur-micro,175ms) var(--ease-standard, ease-out),
              color var(--dur-micro,175ms) var(--ease-standard, ease-out),
              border-color var(--dur-micro,175ms) var(--ease-standard, ease-out);
}
.btn--primary { background: var(--sun-warm); color: #3a2c10; }
.btn--primary:hover { background: #f2d488; transform: translateY(-2px); }
.btn--ghost { border-color: rgba(238,243,224,.4); color: var(--cream); }
.btn--ghost:hover { border-color: var(--sun-warm); color: #fff; transform: translateY(-2px); }

.scroll-cue { position: absolute; bottom: 4vh; left: 50%; transform: translateX(-50%); width: 26px; height: 42px; border: 2px solid rgba(238,243,224,.45); border-radius: 14px; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--sun-warm); animation: cue 1.6s var(--ease-in-out-cubic, ease-in-out) infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 80% { opacity: 0; transform: translateY(14px); } 100% { opacity: 0; } }

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  padding-block: 30px 50px;
}
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 18px 10px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(20,36,26,.5), rgba(20,36,26,.2));
  border: 1px solid rgba(143,185,107,.18);
}
.stat-num { font-family: "Fraunces", serif; font-size: clamp(2rem, 5vw, 3rem); font-weight: 500; color: var(--sun-warm); line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--cream-soft); line-height: 1.35; }

/* ---------- Species plates ---------- */
.species { padding-block: 30px 70px; }
.section-head { text-align: center; margin-bottom: 54px; }
.kicker { text-transform: uppercase; letter-spacing: .3em; font-size: 12px; font-weight: 600; color: var(--leaf); margin: 0 0 10px; }
.section-head h2 { font-size: clamp(2rem, 4.5vw, 3rem); margin: 0 0 14px; color: #fbf7ea; }
.section-sub { max-width: 560px; margin: 0 auto; color: var(--cream-soft); line-height: 1.7; }

.plate {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(20px, 4vw, 56px);
  align-items: center;
  background: linear-gradient(180deg, var(--parchment), #efe7d2);
  border: 1px solid var(--parchment-edge);
  border-radius: 22px; padding: clamp(22px, 3.5vw, 40px);
  margin-bottom: 30px;
  box-shadow: 0 24px 50px -28px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.6);
  color: var(--ink);
  transition: transform var(--dur-base, 500ms) var(--ease-soft),
              box-shadow var(--dur-base, 500ms) var(--ease-soft);
}
.plate:hover { transform: translateY(-4px); box-shadow: 0 34px 60px -26px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.6); }
.plate--rev .plate-figure { order: 2; }

.plate-figure {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 230px; padding: 10px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.7), transparent 62%),
    repeating-linear-gradient(0deg, rgba(120,110,80,.05) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, rgba(120,110,80,.05) 0 1px, transparent 1px 22px);
  border-radius: 16px; border: 1px dashed rgba(120,110,80,.3);
}
.plate-no {
  position: absolute; top: 10px; left: 14px;
  font-family: "Fraunces", serif; font-size: 13px; font-weight: 600; letter-spacing: .15em;
  color: var(--ink-soft); opacity: .7;
}
.specimen {
  max-height: 270px; width: auto; object-fit: contain;
  filter: drop-shadow(0 14px 16px rgba(60,50,30,.28));
  transition: transform var(--dur-base, 500ms) var(--ease-soft);
}
.plate:hover .specimen { transform: scale(1.05) rotate(-1deg); }
.specimen--svg { display: inline-flex; width: min(78%, 300px); }
.specimen--svg svg { width: 100%; height: auto; filter: drop-shadow(0 12px 14px rgba(60,50,30,.22)); }

.sp-name { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin: 0 0 4px; color: #25301f; letter-spacing: -.3px; }
.sp-latin { font-style: italic; font-family: "Fraunces", serif; color: #6a5a34; margin: 0 0 18px; font-size: 16px; }
.sp-fam { font-style: normal; color: var(--ink-soft); font-size: 13.5px; }
.sp-meta { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.sp-meta li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; font-size: 14.5px; color: #3c4232; line-height: 1.45; }
.sp-meta li span { text-transform: uppercase; font-size: 11px; letter-spacing: .12em; font-weight: 600; color: var(--moss); padding-top: 2px; }
.sp-desc { margin: 0; line-height: 1.72; color: #43492f; font-size: 15.5px; }
.sp-credit { margin: 12px 0 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9a8d68; }

/* ---------- Latin marquee ---------- */
.names { margin: 8px auto 0; max-width: 100%; padding-block: 22px; border-block: 1px solid rgba(143,185,107,.2); }
.marquee-track { will-change: transform; }
.names-row {
  font-family: "Fraunces", serif; font-style: italic; font-size: clamp(20px, 3vw, 34px);
  color: rgba(240,226,173,.42); white-space: nowrap;
}

/* ---------- About ---------- */
.about { padding-block: 70px 90px; }
.about-card {
  background: linear-gradient(180deg, rgba(22,40,28,.74), rgba(16,30,21,.74));
  border: 1px solid rgba(143,185,107,.22); border-radius: 24px;
  padding: clamp(28px, 5vw, 56px); text-align: center;
  backdrop-filter: blur(4px);
}
.about-card h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 18px; color: #fbf7ea; }
.about-card p { max-width: 640px; margin: 0 auto 16px; line-height: 1.75; color: var(--cream-soft); font-size: 16.5px; }
.about-foot { font-family: "Fraunces", serif; font-style: italic; font-size: clamp(18px, 3vw, 24px) !important; color: var(--sun-warm) !important; margin-top: 26px !important; }

/* ---------- Footer ---------- */
.site-foot { position: relative; z-index: 2; text-align: center; padding: 40px 24px 120px; color: var(--cream-soft); }
.foot-lead { font-family: "Fraunces", serif; font-size: 20px; color: var(--cream); margin: 0 0 10px; }
.foot-src { max-width: 620px; margin: 0 auto 8px; font-size: 13px; line-height: 1.6; opacity: .85; }
.foot-meta { font-size: 12px; opacity: .6; margin: 6px 0 0; }

/* ---------- Reveal (works with motion.js) ---------- */
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity var(--dur-base,500ms) var(--ease-standard,ease-out), transform var(--dur-base,500ms) var(--ease-standard,ease-out); transition-delay: var(--reveal-delay, 0ms); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .plate { grid-template-columns: 1fr; gap: 18px; text-align: left; }
  .plate--rev .plate-figure { order: 0; }
  .plate-figure { min-height: 190px; }
  .nav-links { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .motes { display: none; }
  .canopy-light, .flit-wing, .scroll-cue span { animation: none; }
  [data-reveal] { opacity: 1; transform: none; }
}
