/* Molehill homepage v3 — field-guide acts + the one dark chapter. */

/* ---- hero: the title page ---- */
.hero { padding: var(--sp-12) 0 var(--sp-8); }
.hero h1 { max-width: 14ch; font-size: clamp(44px, 7.6vw, 96px); }
.hero .lede { margin-top: var(--sp-3); }
.hero-cta { margin-top: var(--sp-4); display: flex; gap: 12px; flex-wrap: wrap; }
.hero .chips { margin-top: var(--sp-4); }

/* ---- the specimen schematic ---- */
.schematic { display: block; width: 100%; max-width: 860px; margin: var(--sp-4) auto 0; }
.schematic .fig { font-family: var(--font-mono); }
.motion .schematic .leader { opacity: 0; }
.motion .schematic.in .leader { opacity: 1; transition: opacity .7s var(--ease-out); }
.motion .schematic.in .leader:nth-child(2) { transition-delay: .18s; }
.motion .schematic.in .leader:nth-child(3) { transition-delay: .36s; }
.motion .schematic.in .leader:nth-child(4) { transition-delay: .54s; }
.motion .schematic .fig { opacity: 0; transition: opacity .5s var(--ease-out); }
.motion .schematic.in .fig { opacity: 1; }
.motion .schematic.in .fig:nth-child(1) { transition-delay: .5s; }
.motion .schematic.in .fig:nth-child(2) { transition-delay: .68s; }
.motion .schematic.in .fig:nth-child(3) { transition-delay: .86s; }
.motion .schematic.in .fig:nth-child(4) { transition-delay: 1.04s; }
/* once drawn, dotted leaders restore their dashes */
.schematic .leader { fill: none; }

/* ---- field demonstration widget ---- */
.demo { border: 1px solid var(--rule-strong); border-radius: var(--r-lg); background: var(--paper-plate); padding: var(--sp-3); box-shadow: 4px 4px 0 var(--rule); max-width: 760px; }
.demo-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.demo-tabs { display: flex; gap: 8px; flex-wrap: wrap; padding: var(--sp-3) 0; }
.dtab { font-size: 11.5px; font-family: var(--font-mono); border: 1px solid var(--rule-strong); border-radius: 7px 7px 0 0; border-bottom-width: 3px; padding: 7px 12px; background: var(--paper-soft); color: var(--ink-soft); white-space: nowrap;
  transition: opacity .4s var(--ease), transform .45s var(--ease-out), max-width .45s var(--ease), padding .45s var(--ease), margin .45s var(--ease); max-width: 220px; overflow: hidden; }
.dtab.dupe { border-color: var(--accent-soft); }
.demo.tidied .dtab.dupe { opacity: 0; transform: translateY(-14px) rotate(4deg); max-width: 0; padding-inline: 0; border-width: 0; }
.demo-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--rule); padding-top: 12px; }
.demo-foot .btn { padding: 9px 18px; }
.demo-reset { background: none; border: none; cursor: pointer; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-faint); }
.demo-reset:hover { color: var(--accent); }
.demo-verdict { color: var(--success); font-weight: 600; }

/* ---- the dark chapter ---- */
.chapter {
  position: relative; overflow: hidden; color: var(--night-ink);
  background: radial-gradient(120% 95% at 50% 72%, #101736 0%, var(--night) 62%);
  padding: var(--sp-8) 0; margin-top: var(--sp-8);
  /* night-local token overrides so shared components read correctly */
  --accent: #a5b4fc; --accent-soft: #6d79e8; --link: #a5b4fc;
  --ink-soft: var(--night-ink-soft); --rule: var(--night-rule);
  --mole: #4a495e; --paper-sunken: var(--night-soft);
}
.chapter .eyebrow { color: #a5b4fc; }
.chapter h2 { color: var(--night-ink); max-width: 14ch; }
.chapter-inner { position: relative; z-index: 1; }
#terrain-holder { position: absolute; inset: 0; z-index: 0; pointer-events: none; display: none; }
.mx #terrain-holder { display: block; }
#terrain-holder canvas { width: 100%; height: 100%; display: block; }
.stage-wrap { max-width: 680px; margin: var(--sp-4) auto 0; aspect-ratio: 720 / 300; position: relative; }
.stage { width: 100%; height: 100%; display: block; }
.stage .caption { font-size: 12.5px; fill: #a5b4fc; font-family: var(--font-mono); }
.motion .stage-wrap { opacity: 0; } /* home.js reveals after initial states set */
.mx .stage-wrap { display: none; }
.mx .chapter { min-height: 100vh; display: flex; align-items: flex-start; }
.mx .chapter .chapter-inner { padding-top: max(72px, 9vh); }
.mole3d { position: absolute; left: 50%; bottom: 35%; width: 92px; margin-left: -46px; z-index: 1; display: none; }
.mx .mole3d { display: block; }
.cap3d { position: absolute; left: 0; right: 0; bottom: 29.5%; height: 22px; font-family: var(--font-mono); font-size: 12.5px; color: #a5b4fc; z-index: 1; display: none; pointer-events: none; }
.mx .cap3d { display: block; }
.cap3d span { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
.scroll-cue { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .04em; color: #c7d2fe; z-index: 1; display: none; transition: opacity .4s; }
.mx .scroll-cue { display: block; animation: cue-pulse 2.6s ease-in-out infinite; }
@keyframes cue-pulse { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mx .scroll-cue { animation: none; } }

/* header adapts while the chapter is in view */
header.site { transition: background .35s ease, border-color .35s ease; }
.home header.site.over-dark { background: rgba(7, 11, 24, .88); border-color: var(--night-rule); }
.home header.site.over-dark .brand, .home header.site.over-dark .nav-links a { color: var(--night-ink); }
.home header.site.over-dark .nav-links a:hover,
.home header.site.over-dark .nav-links a[aria-current="page"] { color: #c7d2fe; }
.home header.site.over-dark .nav-cta { color: #c7d2fe; border-color: #c7d2fe; }

/* ---- jump-nav: the catalogue tab-index ---- */
.jumpnav { position: sticky; top: 57px; z-index: 9; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-block: 1px solid var(--rule); }
.jumpnav .wrap { display: flex; gap: 6px; overflow-x: auto; padding-block: 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; max-width: none; }
.jumpnav .wrap::-webkit-scrollbar { display: none; }
.jumpnav a { flex: 0 0 auto; font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; letter-spacing: .02em; color: var(--ink-soft); padding: 7px 13px; border-radius: var(--r-pill); border: 1px solid transparent; }
.jumpnav a:hover { color: var(--accent); text-decoration: none; background: var(--accent-tint); }
.jumpnav a[aria-current="true"] { color: var(--accent); background: var(--accent-tint); border-color: var(--accent-soft); }
.jumpnav .count { color: var(--ink-faint); margin-left: 6px; }
.jumpnav a:first-child { margin-left: auto; }
.jumpnav a:last-child { margin-right: auto; }
.idx-cat, #start-here, #tools { scroll-margin-top: 118px; }

/* ---- principles ---- */
.principles { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-4) var(--sp-6); margin-top: var(--sp-4); }
.principle { display: grid; grid-template-columns: 56px 1fr; gap: 4px 0; align-items: start; }
.principle .p-no { font-family: var(--font-mono); font-size: 13px; color: var(--accent); padding-top: 4px; }
.principle p { font-size: var(--fs-sm); color: var(--ink-soft); margin-top: 4px; }

/* schematic header grid */
.schem-grid { display: flex; justify-content: space-between; align-items: end; gap: var(--sp-4); flex-wrap: wrap; }

@media (max-width: 600px) {
  .hero { padding-top: var(--sp-8); }
  .jumpnav { top: 53px; }
}
