/* ============================================================
   EHONEY — core stylesheet
   A gallery-grade lepidopterist's cabinet, in CSS.
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --parchment: #ece1c8;
  --parchment-2: #e4d7b9;
  --card: #f3ece0;
  --card-2: #efe6d4;
  --mahogany: #3f2417;
  --mahogany-2: #51301f;
  --ink: #2a1d12;
  --ink-soft: #5a4a38;
  --gilt-1: #9a7b34;
  --gilt-2: #c2a154;
  --gilt-3: #e7cf94;
  --green: #2f4a31;
  --green-deep: #20351f;
  --rule: #c9b78f;
  --rule-soft: #d8c9a4;

  --teal: #1c6e72;
  --violet: #7a4fd0;
  --amber: #b3892f;

  --shadow-case: 0 1px 0 rgba(255,255,255,.5), 0 18px 40px -22px rgba(42,29,18,.55), 0 2px 8px -4px rgba(42,29,18,.4);
  --shadow-lift: 0 1px 0 rgba(255,255,255,.6), 0 34px 60px -28px rgba(42,29,18,.6), 0 6px 18px -8px rgba(42,29,18,.42);
  --shadow-pin: 0 2px 3px rgba(42,29,18,.45);

  --ff-display: "Playfair Display", Georgia, serif;
  --ff-body: "EB Garamond", Georgia, serif;
  --ff-mono: "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1200px;
  --gut: clamp(20px, 5vw, 64px);
  --nav-h: 80px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--ff-body);
  font-size: 19px;
  line-height: 1.66;
  color: var(--ink);
  background:
    radial-gradient(120% 80% at 50% -10%, var(--card) 0%, var(--parchment) 46%, var(--parchment-2) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--green); color: var(--card); }

/* ---------- paper grain + letterpress overlays ---------- */
body::before, body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 9000;
}
body::before { /* grain */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/></svg>");
  opacity: 0.05; mix-blend-mode: multiply;
}
body::after { /* faint horizontal letterpress lines */
  background-image: repeating-linear-gradient(0deg, rgba(42,29,18,.035) 0 1px, transparent 1px 4px);
  opacity: 0.5;
}

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }
.wrap-wide { max-width: 1340px; }
section { position: relative; }
.section-pad { padding-block: clamp(64px, 10vw, 132px); }
.center { text-align: center; }

/* ---------- type ---------- */
h1, h2, h3, h4 { font-family: var(--ff-display); font-weight: 700; line-height: 1.04; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
.display {
  font-size: clamp(44px, 8vw, 104px);
  line-height: 0.98;
  letter-spacing: -0.025em;
}
h2.title { font-size: clamp(32px, 5vw, 60px); }
h3 { font-size: clamp(22px, 2.6vw, 30px); }
.italic { font-style: italic; }
.em-green { color: var(--green); font-style: italic; }
.em-gilt { color: var(--gilt-1); font-style: italic; }
p { margin: 0 0 1.1em; text-wrap: pretty; }
.lead { font-size: clamp(20px, 2.4vw, 26px); line-height: 1.5; color: var(--ink-soft); }
.measure { max-width: 64ch; }
.measure-sm { max-width: 46ch; }

/* small-caps engraved label */
.label {
  font-family: var(--ff-mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gilt-1);
  font-weight: 500;
}
.label-ink { color: var(--ink-soft); }
.mono { font-family: var(--ff-mono); font-size: 0.78em; letter-spacing: 0.04em; }

/* hairline rules */
.rule { height: 1px; background: var(--rule); border: 0; margin: 0; }
.rule-double { border: 0; height: 4px; background:
  linear-gradient(var(--rule),var(--rule)) top/100% 1px no-repeat,
  linear-gradient(var(--rule),var(--rule)) bottom/100% 1px no-repeat; }
.gilt-rule { height: 2px; border: 0; background: linear-gradient(90deg, transparent, var(--gilt-2) 18%, var(--gilt-3) 50%, var(--gilt-2) 82%, transparent); }

/* eyebrow with flanking rules */
.eyebrow { display: inline-flex; align-items: center; gap: 14px; }
.eyebrow::before, .eyebrow::after { content: ""; width: 34px; height: 1px; background: var(--gilt-1); opacity: .7; }
.eyebrow.solo::before { display: none; }

/* section heading block */
.heading-block { display: flex; flex-direction: column; gap: 18px; }
.heading-block.center { align-items: center; }

/* ---------- buttons ---------- */
.btn {
  --bg: var(--green);
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--ff-mono); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 15px 26px; border-radius: 2px;
  background: var(--bg); color: var(--card);
  border: 1px solid rgba(42,29,18,.25);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 8px 20px -12px rgba(42,29,18,.7);
  transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s, background .25s;
}
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 16px 30px -14px rgba(42,29,18,.7); }
.btn:active { transform: translateY(0); }
.btn-gilt { --bg: linear-gradient(180deg, var(--gilt-2), var(--gilt-1)); color: var(--ink); border-color: rgba(42,29,18,.3); }
.btn-ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--rule); box-shadow: none;
}
.btn-ghost:hover { border-color: var(--gilt-1); background: rgba(154,123,52,.06); }
.btn-dark { --bg: var(--mahogany); color: var(--gilt-3); }
.btn-sm { padding: 10px 18px; font-size: 11px; }

.btn .arrow { transition: transform .25s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- cards / specimen plates ---------- */
.plate {
  position: relative;
  background:
    linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: var(--shadow-case);
  transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s;
}
.plate::after { /* inner hairline frame */
  content: ""; position: absolute; inset: 7px;
  border: 1px solid var(--rule-soft); border-radius: 1px;
  pointer-events: none;
}
.plate.lift:hover { transform: translateY(-6px); box-shadow: var(--shadow-lift); }

/* pin for pinned specimens */
.pin {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gilt-3), var(--gilt-1) 70%, #6e5520);
  box-shadow: var(--shadow-pin);
  z-index: 3;
}
.pin::after { content: ""; position: absolute; top: 7px; left: 50%; width: 1px; height: 16px; background: linear-gradient(#8c7032, transparent); transform: translateX(-50%); }

/* rarity tag */
.rarity {
  font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft);
}
.rarity::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gilt-1); }
.rarity[data-r="Common"]::before { background: var(--gilt-1); }
.rarity[data-r="Glasswing"]::before { background: var(--teal); }
.rarity[data-r="Birdwing"]::before { background: var(--violet); }
.rarity[data-r="Ghost"]::before { background: #b9a888; box-shadow: 0 0 6px rgba(243,236,224,.9); }

/* ---------- moth flutter animation ---------- */
.cm-moth { overflow: visible; }
.cm-wings {
  transform-box: view-box;
  transform-origin: 120px 118px;
  animation-name: cm-flutter;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  will-change: transform;
}
@keyframes cm-flutter {
  0%, 100% { transform: scaleX(1) scaleY(1); }
  50% { transform: scaleX(0.86) scaleY(1.012); }
}
.cm-antenna { transform-box: view-box; transform-origin: 120px 60px; animation: cm-sway 5.5s ease-in-out infinite; }
@keyframes cm-sway { 0%,100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
@media (prefers-reduced-motion: reduce) {
  .cm-wings { animation: none; transform: scaleX(.93); }
  .cm-antenna { animation: none; }
}
/* emerge animation for freshly woven / bred moths */
.cm-emerge { animation: cm-emerge 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes cm-emerge {
  0% { opacity: 0; transform: scale(.6) rotate(-4deg); filter: blur(6px); }
  60% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* ---------- navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 1000;
  height: var(--nav-h);
  display: flex; align-items: center;
  transition: height .3s ease, background .3s ease, box-shadow .3s ease, border-color .3s;
  border-bottom: 1px solid transparent;
}
.nav.condensed {
  height: 60px;
  background: rgba(236,225,200,.86);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-bottom-color: var(--rule);
  box-shadow: 0 10px 30px -24px rgba(42,29,18,.8);
}
.nav-inner { width: 100%; max-width: 1340px; margin-inline: auto; padding-inline: var(--gut); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand .mark svg { width: 100%; height: 100%; }
.brand .name { font-family: var(--ff-display); font-weight: 700; font-size: 22px; letter-spacing: .02em; }
.brand .name .eh { color: var(--green); }
.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
  position: relative; padding: 8px 14px;
  font-family: var(--ff-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
  transition: color .25s;
}
.nav-link:hover, .nav-link.active { color: var(--ink); }
/* sliding active underline */
.nav-underline {
  position: absolute; bottom: 2px; height: 1.5px; background: var(--gilt-1);
  transition: left .35s cubic-bezier(.3,.8,.3,1), width .35s cubic-bezier(.3,.8,.3,1), opacity .3s;
  opacity: 0; pointer-events: none;
}
.nav-cta { display: inline-flex; gap: 10px; align-items: center; }
.burger { display: none; width: 44px; height: 44px; border: 1px solid var(--rule); border-radius: 2px; background: transparent; position: relative; }
.burger span { position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--ink); transition: transform .3s, opacity .3s; }
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 21px; }
.burger span:nth-child(3) { top: 27px; }
.burger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* mobile menu sheet */
.mobile-menu {
  position: fixed; inset: 0 0 0 auto; width: min(86vw, 360px); z-index: 1200;
  background: linear-gradient(180deg, var(--card), var(--parchment));
  border-left: 1px solid var(--rule);
  box-shadow: -30px 0 60px -30px rgba(42,29,18,.7);
  transform: translateX(100%); transition: transform .4s cubic-bezier(.3,.8,.3,1);
  padding: calc(var(--nav-h) + 16px) 30px 30px; display: flex; flex-direction: column; gap: 4px;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu a { padding: 14px 6px; border-bottom: 1px solid var(--rule-soft); font-family: var(--ff-display); font-size: 24px; }
.mobile-menu a .num { font-family: var(--ff-mono); font-size: 11px; color: var(--gilt-1); margin-right: 12px; letter-spacing: .1em; }
.scrim { position: fixed; inset: 0; background: rgba(42,29,18,.32); z-index: 1100; opacity: 0; pointer-events: none; transition: opacity .35s; }
.scrim.open { opacity: 1; pointer-events: auto; }

/* ---------- scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }
.reveal[data-d="4"] { transition-delay: .32s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- footer ---------- */
.footer { background: linear-gradient(180deg, var(--mahogany), var(--ink)); color: #d8c8ae; margin-top: 40px; position: relative; }
.footer::before { content:""; position:absolute; top:0; left:0; right:0; height:2px; background: linear-gradient(90deg, transparent, var(--gilt-2), transparent); }
.footer a { color: #cbb88f; transition: color .2s; }
.footer a:hover { color: var(--gilt-3); }
.footer .label { color: var(--gilt-2); }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 40px; padding-block: 72px 40px; }
.footer-col h4 { color: #efe2c6; font-size: 15px; font-family: var(--ff-mono); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 16px; }
.footer-col a { display: block; padding: 6px 0; font-size: 17px; }
.footer .brand .name { color: #efe2c6; }
.footer .brand .name .eh { color: var(--gilt-3); }
.footer-bottom { border-top: 1px solid rgba(201,183,143,.22); padding-block: 22px 40px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-family: var(--ff-mono); font-size: 11.5px; letter-spacing: .08em; color: #b7a586; }

/* ---------- misc utilities ---------- */
.grid { display: grid; gap: 24px; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-s { gap: 12px; } .gap-m { gap: 24px; } .gap-l { gap: 40px; }
.wrap-flex { flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  padding: 7px 13px; border: 1px solid var(--rule); border-radius: 100px; color: var(--ink-soft);
  background: rgba(243,236,224,.6);
}
.divider-leaf { display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--gilt-1); }
.divider-leaf::before, .divider-leaf::after { content: ""; height: 1px; width: min(120px, 22vw); background: var(--rule); }

@media (max-width: 900px) {
  .nav-links, .nav-cta .btn { display: none; }
  .burger { display: block; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
}
@media (max-width: 560px) {
  body { font-size: 18px; }
  .footer-grid { grid-template-columns: 1fr; }
}
