/* =====================================================================
   Mush Love: The Mushroom Atlas (home hero)
   PROMPT.md + spec §4 "Home → 1". Everything is namespaced under .hero.
   Layers inside the hero (one stacking context):
     0 .hero__bg (studio light / glow haze) · 1 .atlas-ghost (big latin genus)
     2 ground shadow · 3 photo fallback · 4 drag surface · 5 WebGL canvas (pointer-events none)
     6 UI that floats above the specimen (kicker, tabs, rail, dock, info card)
   ===================================================================== */

@property --sg { syntax: "<color>"; inherits: true; initial-value: #7cf3c4; }
@property --gx { syntax: "<length-percentage>"; inherits: true; initial-value: 38%; }
@property --gy { syntax: "<length-percentage>"; inherits: true; initial-value: 48%; }

.hero {
  --tab-w: 136px;
  --tab-crop: 52px;
  --info-w: clamp(320px, 29vw, 380px);
  --rail-btn: 38px;
  --hero-pad-top: 26px;
  --visible-h: calc(100vh - var(--header-h) - var(--announce-h));
  --visible-h: calc(100svh - var(--header-h) - var(--announce-h));
  position: relative;
  isolation: isolate;
  height: var(--visible-h);
  min-height: 640px;
  overflow: hidden;
  overflow: clip;
  color: var(--ink);
  transition: --sg .9s var(--ease), --gx .7s var(--ease), --gy .7s var(--ease);
}

/* ------------------------------------------------------------ background */
.hero__bg { position: absolute; left: 0; right: 0; top: 0; height: var(--band-h, 100%); z-index: 0; pointer-events: none; }
.hero__bg::before,
.hero__bg::after { content: ""; position: absolute; inset: 0; transition: opacity .8s var(--ease); }
.hero__bg::before { /* daylight: a soft studio sweep behind the specimen */
  background:
    radial-gradient(calc(var(--gr, 620px) * .82) calc(var(--gr, 620px) * .62) at var(--gx, 38%) var(--gy, 48%), rgba(255, 252, 244, .95), rgba(255, 252, 244, 0) 72%),
    radial-gradient(ellipse 70% 40% at var(--gx, 38%) 104%, rgba(var(--shadow), .07), transparent 70%),
    linear-gradient(180deg, transparent 60%, rgba(var(--shadow), .035));
}
.hero__bg::after { /* glow: bioluminescent haze tinted by the active specimen */
  opacity: 0;
  background:
    radial-gradient(calc(var(--gr, 620px) * .62) calc(var(--gr, 620px) * .52) at var(--gx, 38%) var(--gy, 48%), color-mix(in srgb, var(--sg) 13%, transparent), transparent 72%),
    radial-gradient(ellipse 90% 55% at var(--gx, 38%) 112%, color-mix(in srgb, var(--sg) 9%, transparent), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, .35));
}
[data-glow="on"] .hero__bg::before { opacity: 0; }
[data-glow="on"] .hero__bg::after { opacity: 1; }

/* The latin genus, set large and faint down the right edge of the stage like the spine label of a
   botanical plate: clear of the specimen, the caption and the rail, so the whole word stays legible. */
.atlas-ghost {
  position: absolute; z-index: 1;
  left: calc(var(--sr, 62%) - 1.04em); top: calc(var(--st, 180px) + 34px);
  margin: 0;
  pointer-events: none; user-select: none;
  white-space: nowrap;
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  font-size: clamp(76px, 7.2vw, 122px);
  line-height: 1;
  letter-spacing: -.035em;
  color: color-mix(in srgb, var(--ink) 6%, transparent);
  transition: color .8s var(--ease), opacity .6s var(--ease);
}
.atlas-ghost span { display: block; }
[data-glow="on"] .atlas-ghost { color: color-mix(in srgb, var(--sg) 9%, transparent); }

.hero__gl {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s var(--ease);
}
.hero.has-gl .hero__gl { opacity: 1; }

/* ---------------------------------------------------------------- layout */
.hero__inner {
  position: relative;
  /* min-height can make the hero taller than the screen; keep the working area inside the first view */
  height: min(100%, max(520px, var(--visible-h)));
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--info-w);
  column-gap: clamp(16px, 2.2vw, 36px);
}
.hero__main {
  min-width: 0; min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  padding: var(--hero-pad-top) 0 14px;
}

/* kicker: what this hero is, since the PROMPT's sidebar brand is gone (centred over the stage) */
.atlas-kicker {
  position: relative; z-index: 6;
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 4px 16px;
  margin-bottom: 16px;
  text-align: center;
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility 0s;
}
.atlas-kicker__text {
  font-family: var(--font-display); font-style: italic; font-size: 15.5px; line-height: 1.3;
  font-variation-settings: "SOFT" 100, "WONK" 0;
  color: var(--muted);
}

/* ------------------------------------------------------------------ tabs */
.atlas-tabs {
  position: relative; z-index: 6;
  display: flex; justify-content: center; gap: 10px;
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility 0s;
}
.atlas-tab {
  position: relative;
  flex: 0 1 var(--tab-w); min-width: 0;
  display: grid; justify-items: center; align-content: start;
  padding: 8px 8px 11px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  color: var(--ink);
  transition: transform .4s var(--ease), background-color .35s var(--ease), border-color .35s var(--ease), box-shadow .4s var(--ease);
}
.atlas-tab:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -18px rgba(var(--shadow), .55); }
.atlas-tab:active { transform: translateY(0) scale(.97); }
.atlas-tab__crop {
  width: var(--tab-crop); aspect-ratio: 1; border-radius: 50%;
  margin-bottom: 7px;
  background-color: var(--chip);
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow .4s var(--ease), transform .6s var(--ease);
}
.atlas-tab:hover .atlas-tab__crop { transform: rotate(-8deg) scale(1.04); }
.atlas-tab__text { display: grid; min-width: 0; }
.atlas-tab__name {
  font-family: var(--font-display); font-size: 15.5px; line-height: 1.15; letter-spacing: -.01em;
  font-variation-settings: "SOFT" 100, "WONK" 0;
}
.atlas-tab__latin {
  font-family: var(--font-display); font-style: italic; font-size: 12.5px; line-height: 1.25;
  color: var(--muted); margin-top: 1px;
}
.atlas-tab[aria-selected="true"] {
  background: var(--moss-tint);
  border-color: color-mix(in srgb, var(--moss) 45%, transparent);
}
.atlas-tab[aria-selected="true"] .atlas-tab__crop {
  box-shadow: inset 0 0 0 1.5px var(--moss), 0 0 0 3px color-mix(in srgb, var(--moss) 14%, transparent);
}
[data-glow="on"] .atlas-tab[aria-selected="true"] {
  border-color: color-mix(in srgb, var(--sg) 40%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sg) 12%, transparent), 0 12px 34px -18px color-mix(in srgb, var(--sg) 70%, transparent);
}
[data-glow="on"] .atlas-tab[aria-selected="true"] .atlas-tab__crop {
  box-shadow: inset 0 0 0 1.5px var(--sg), 0 0 18px -2px color-mix(in srgb, var(--sg) 65%, transparent);
}
.atlas-tab:focus-visible { outline-offset: 3px; }

/* ----------------------------------------------------------------- stage */
.atlas-stage {
  position: relative;
  min-height: 0;
  margin-top: 6px;
  -webkit-user-select: none; user-select: none;
}
.atlas-surface {
  position: absolute; inset: 0; z-index: 4;
  border-radius: var(--r);
  cursor: grab;
  touch-action: pan-y;               /* vertical swipes still scroll the page on touch screens */
  -webkit-tap-highlight-color: transparent;
}
.atlas-surface:focus-visible { outline: 2px solid var(--moss); outline-offset: -2px; }
[data-glow="on"] .atlas-surface:focus-visible { outline-color: var(--glow); }
.hero.is-dragging, .hero.is-dragging .atlas-surface { cursor: grabbing; }

/* ground shadow, CSS-positioned until the engine runs, then JS places it under the projected specimen */
.atlas-shadow {
  position: absolute; z-index: 2;
  left: 50%; bottom: 15%;
  width: min(62%, 460px); height: 44px;
  translate: -50% 0;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, rgba(var(--shadow), .26), rgba(var(--shadow), .08) 62%, transparent);
  transition: opacity .5s var(--ease), transform .6s var(--ease);
}
.hero.is-switching:not(.has-gl) .atlas-shadow { opacity: 0; transform: scaleX(.4); }
.hero.is-loading:not(.has-gl) .atlas-shadow { opacity: 0; }
.hero.has-gl .atlas-shadow {
  opacity: 0; /* until the first frame places it (inline style) */
  left: 0; top: 0; bottom: auto; width: 460px; translate: none;
  transform-origin: 0 0;
  transition: none;
  will-change: transform, opacity;
}
[data-glow="on"] .atlas-shadow {
  background: radial-gradient(closest-side, color-mix(in srgb, var(--sg) 32%, transparent), color-mix(in srgb, var(--sg) 7%, transparent) 60%, transparent);
}

/* photo fallback (no WebGL / builder failure) */
.atlas-fallback {
  position: absolute; z-index: 3;
  left: 50%; top: 44%;
  width: min(260px, 70%); aspect-ratio: 1;
  translate: -50% -50%;
  transform: rotate(var(--fr, 0deg)) scale(var(--fz, 1));
  border-radius: 50%;
  background-color: var(--chip);
  background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px var(--line), 0 30px 60px -30px rgba(var(--shadow), .5);
  pointer-events: none;
  transition: transform .7s var(--ease);
}
[data-glow="on"] .atlas-fallback { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sg) 60%, transparent), 0 0 60px -10px color-mix(in srgb, var(--sg) 45%, transparent); }
html:not(.js) .hero .atlas-fallback { display: block !important; }

/* loader */
.atlas-loader {
  position: absolute; z-index: 6;
  left: 50%; top: 44%;
  translate: -50% -50%;
  display: grid; justify-items: center; gap: 12px;
  font-size: 12.5px; color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity .4s var(--ease), visibility 0s .4s;
}
.hero.is-loading .atlas-loader { opacity: 1; visibility: visible; transition-delay: .15s, 0s; }
.atlas-loader__ring {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1.5px solid var(--line);
  border-top-color: var(--moss);
  animation: atlas-spin 1s linear infinite;
}
[data-glow="on"] .atlas-loader__ring { border-top-color: var(--sg); }
@keyframes atlas-spin { to { transform: rotate(360deg); } }

/* hint */
.atlas-hint {
  position: absolute; z-index: 6; top: 2px; right: 0;
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: var(--muted);
  pointer-events: none;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.atlas-hint .i { width: 16px; height: 16px; }
.hero.is-hinted .atlas-hint { opacity: 0; transform: translateY(-6px); }

/* icon rail */
.atlas-rail {
  position: absolute; z-index: 6; left: 0; top: 50%;
  translate: 0 -50%;
  display: grid; gap: 9px;
}
.atlas-btn {
  width: var(--rail-btn); height: var(--rail-btn); border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px -12px rgba(var(--shadow), .5);
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease), transform .25s var(--ease);
}
.atlas-btn .i { width: 17px; height: 17px; }
.atlas-btn:hover { border-color: var(--moss); }
.atlas-btn:active { transform: scale(.92); }
.atlas-btn.is-on { background: var(--moss-tint); border-color: color-mix(in srgb, var(--moss) 40%, transparent); color: var(--moss); }
.atlas-btn[aria-pressed="true"] { background: var(--moss); color: var(--moss-ink); border-color: var(--moss); }
[data-glow="on"] .atlas-btn[data-act="glow"][aria-pressed="true"] {
  background: var(--sg); border-color: var(--sg); color: #0c110b;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sg) 16%, transparent), 0 0 24px -2px color-mix(in srgb, var(--sg) 70%, transparent);
}

/* dock: turn pill stacked over the caption, so a two-line caption pushes the pill up instead of under it */
.atlas-dock {
  position: absolute; z-index: 6; left: 4%; right: 4%; bottom: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  pointer-events: none;
  /* desktop scroll parallax (--par from atlas.js): the controls bow out as the hero leaves */
  opacity: clamp(0, calc(1.5 - var(--par, 0) * 3.2), 1);
  transition: transform .7s var(--ease);
}
.atlas-turn {
  pointer-events: auto;
  display: flex; align-items: center; gap: 2px;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 10px 26px -18px rgba(var(--shadow), .55);
  font-size: 13px;
}
.atlas-turn button {
  height: 32px; min-width: 32px; padding: 0 7px;
  display: grid; place-items: center;
  border-radius: 999px;
  color: var(--ink);
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease);
}
.atlas-turn button:hover { background: var(--chip); }
.atlas-turn button:active { transform: scale(.92); }
.atlas-turn .i { width: 17px; height: 17px; }
.atlas-turn__full { font-weight: 800; font-size: 13px; letter-spacing: .02em; font-variant-numeric: tabular-nums; }

/* caption */
.atlas-caption {
  max-width: 100%;
  text-align: center;
  font-family: var(--font-display); font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-size: clamp(16px, 1.55vw, 20px); line-height: 1.3; letter-spacing: -.005em;
  color: var(--ink-2);
}
.atlas-caption span { display: inline-block; }
[data-glow="on"] .atlas-caption { color: var(--ink); text-shadow: 0 0 24px color-mix(in srgb, var(--sg) 45%, transparent); }

/* ------------------------------------------------------------- info card */
.hero__info {
  position: relative; z-index: 6;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: calc(var(--hero-pad-top) - 8px) 0 14px;
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility 0s;
}
.atlas-card {
  position: relative;
  flex: 0 1 auto; min-height: 0; /* content height (height eases on a switch); scrolls on very short screens */
  display: flex; flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  padding: 22px 22px 16px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  /* near-opaque paper instead of a backdrop blur: a blur over the live canvas re-renders every frame */
  background: color-mix(in srgb, var(--panel) 95%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 34px 70px -46px rgba(var(--shadow), .55);
  transition: background-color .6s var(--ease), border-color .6s var(--ease), box-shadow .6s var(--ease);
}
.atlas-card.is-resizing { overflow: hidden; }
.atlas-card::-webkit-scrollbar { width: 6px; }
.atlas-card::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }
[data-glow="on"] .atlas-card {
  background: color-mix(in srgb, var(--panel) 93%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--sg) 7%, transparent), 0 40px 80px -50px color-mix(in srgb, var(--sg) 40%, transparent);
}
.atlas-detail { flex: 1 0 auto; display: flex; flex-direction: column; }
/* Two column wrappers, flattened into one flex column unless the stacked tablet layout splits them.
   Default order follows the PROMPT (product row after "Where it grows"); short screens lift it up. */
.atlas-detail__col { display: contents; }
.atlas-detail__col--b > * { order: 1; }
.atlas-detail__col--a > .atlas-product { order: 2; }
.atlas-detail__col--b > .atlas-closeup { order: 3; }

.atlas-detail__eyebrow { display: flex; justify-content: space-between; gap: 12px; }
.atlas-detail__count { font-variant-numeric: tabular-nums; letter-spacing: .14em; opacity: .8; }
.hero .atlas-detail__name {
  margin-top: 8px;
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(40px, 4.2vw, 54px); line-height: 1; letter-spacing: -.025em;
  font-variation-settings: "SOFT" 100, "WONK" 0;
}
.atlas-detail__latin {
  margin-top: 6px;
  font-family: var(--font-display); font-style: italic; font-size: 15px; color: var(--muted);
}
.atlas-detail__tags { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.atlas-detail__tags li {
  padding: 6px 13px; border-radius: 999px;
  background: var(--chip);
  font-size: 11.5px; font-weight: 700; line-height: 1.2; color: var(--ink-2);
}
.atlas-detail__desc { margin-top: 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.hero .atlas-detail__h2 {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display); font-weight: 400; font-size: 21px; line-height: 1.15; letter-spacing: -.01em;
}
.atlas-traits { display: grid; gap: 8px; margin-top: 10px; }
.atlas-trait { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; font-size: 13px; line-height: 1.4; align-items: start; }
.atlas-trait dt { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.atlas-trait dd { color: var(--ink); }
.atlas-trait .i, .atlas-habitat .i { width: 18px; height: 18px; color: var(--moss); }
[data-glow="on"] .atlas-trait .i, [data-glow="on"] .atlas-habitat .i { color: var(--sg); }
.atlas-habitat { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.atlas-habitat__label { display: none; color: var(--muted); }

/* product row (the PROMPT's "featured card" folded in) */
.atlas-product {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 32px; align-items: center; gap: 10px;
  margin: 16px 0 14px;
  padding: 9px 10px 9px 9px;
  border-radius: var(--r-s);
  background: var(--chip);
  color: inherit; text-decoration: none;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), background-color .3s var(--ease);
}
.atlas-product:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -22px rgba(var(--shadow), .6); }
[data-glow="on"] .atlas-product:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--sg) 25%, transparent), 0 16px 34px -22px color-mix(in srgb, var(--sg) 60%, transparent); }
.atlas-product__thumb { width: 40px; height: 52px; border-radius: 8px; overflow: hidden; background: #fff; }
.atlas-product__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.atlas-product:hover .atlas-product__thumb img { transform: scale(1.08); }
[data-glow="on"] .atlas-product__thumb { background: #e9e4d8; }
[data-glow="on"] .atlas-product__thumb img { filter: brightness(.9); }
.atlas-product__text { display: grid; min-width: 0; }
.atlas-product__kicker { font-family: var(--font-display); font-style: italic; font-size: 12.5px; line-height: 1.25; color: var(--accent); font-variation-settings: "SOFT" 100, "WONK" 1; }
.atlas-product__name { font-family: var(--font-display); font-size: 15.5px; line-height: 1.2; letter-spacing: -.01em; margin-top: 1px; }
.atlas-product__meta { font-size: 11.5px; line-height: 1.35; color: var(--muted); }
.atlas-product__price { font-family: var(--font-display); font-size: 19px; letter-spacing: -.01em; }
.atlas-product__go {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--moss); color: var(--moss-ink);
  transition: transform .45s var(--ease), background-color .3s var(--ease);
}
.atlas-product__go .i { width: 16px; height: 16px; }
.atlas-product:hover .atlas-product__go { transform: rotate(-45deg); }
.atlas-product:focus-visible { outline-offset: 3px; }

/* close-up detail */
.atlas-closeup {
  position: sticky; bottom: 0; z-index: 1;
  margin-top: auto;
  width: 100%;
  background: var(--panel);
  display: grid; grid-template-columns: 76px minmax(0, 1fr) 18px; align-items: center; gap: 14px;
  padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r-s);
  text-align: left; color: var(--ink);
  transition: border-color .3s var(--ease), background-color .3s var(--ease);
}
.atlas-closeup:hover, .atlas-closeup[aria-pressed="true"] { border-color: var(--moss); background: var(--moss-tint); }
/* when the card scrolls (very short screens) the pinned button gets a paper strip above it, so text
   never shows as a sliver behind it */
.atlas-closeup::before {
  content: ""; position: absolute; left: -2px; right: -2px; bottom: calc(100% + 1px); height: 26px;
  background: linear-gradient(to top, var(--panel) 25%, color-mix(in srgb, var(--panel) 0%, transparent));
  pointer-events: none;
  opacity: 0; transition: opacity .25s var(--ease);
}
.atlas-card.is-overflowing .atlas-closeup::before { opacity: 1; }
.atlas-closeup__lens {
  position: relative;
  width: 76px; aspect-ratio: 1; border-radius: 50%;
  background-color: var(--chip); background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 20px -14px rgba(var(--shadow), .7);
  transition: transform .6s var(--ease), box-shadow .4s var(--ease);
}
.atlas-closeup__lens::after { /* glass highlight */
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 42%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
}
.atlas-closeup:hover .atlas-closeup__lens { transform: scale(1.05) rotate(-6deg); }
.atlas-closeup[aria-pressed="true"] .atlas-closeup__lens { box-shadow: inset 0 0 0 2px var(--moss), 0 0 0 4px color-mix(in srgb, var(--moss) 16%, transparent); }
[data-glow="on"] .atlas-closeup[aria-pressed="true"] .atlas-closeup__lens { box-shadow: inset 0 0 0 2px var(--sg), 0 0 22px -2px color-mix(in srgb, var(--sg) 60%, transparent); }
.atlas-closeup__text { display: grid; gap: 3px; min-width: 0; }
.atlas-closeup__title { font-family: var(--font-display); font-size: 18px; line-height: 1.15; letter-spacing: -.01em; }
.atlas-closeup__desc { font-size: 11.5px; line-height: 1.4; color: var(--muted); }
.atlas-closeup__chev { width: 18px; height: 18px; color: var(--muted); transition: transform .45s var(--ease), color .3s var(--ease); }
.atlas-closeup:hover .atlas-closeup__chev { color: var(--ink); }
.atlas-closeup[aria-pressed="true"] .atlas-closeup__chev { transform: rotate(180deg); color: var(--moss); }

.atlas-fda { font-size: 10px; line-height: 1.45; color: var(--muted); padding-inline: 4px; }

/* ------------------------------------------------------- zoomed / close-up */
/* Zoomed past ~1.25× the specimen outgrows the stage: the kicker, hint, caption and ghost step back, and
   the FDA line gets a paper backing so it stays readable over the specimen. */
.atlas-kicker, .atlas-hint { transition: opacity .5s var(--ease), transform .5s var(--ease); }
.atlas-caption { transition: opacity .45s var(--ease); }
.atlas-fda { transition: background-color .45s var(--ease), box-shadow .45s var(--ease); }
.hero.is-zoomed :is(.atlas-kicker, .atlas-hint, .atlas-caption, .atlas-ghost) { opacity: 0; }
.hero.is-zoomed .atlas-fda {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--bg) 92%, transparent);
  border-radius: 4px;
}

/* ----------------------------------------------------- focus (Expand) mode */
.hero.is-focus { cursor: grab; }
.hero.is-focus .atlas-surface { touch-action: none; }
.hero.is-focus :is(.atlas-kicker, .atlas-tabs) {
  opacity: 0; transform: translateY(-16px); pointer-events: none; visibility: hidden;
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility 0s .5s;
}
.hero.is-focus .hero__info {
  opacity: 0; transform: translateX(24px); pointer-events: none; visibility: hidden;
  transition: opacity .5s var(--ease), transform .5s var(--ease), visibility 0s .5s;
}
.hero.is-focus .atlas-ghost { color: transparent; }
.hero.is-focus .atlas-dock { transform: translateX(var(--focus-dx, 0px)); opacity: 1; }
@media (min-width: 901px) {
  /* Expand fills the screen under the sticky header (the page is scrolled so the hero meets it) */
  .hero.is-focus { height: calc(100vh - var(--header-h)); height: calc(100svh - var(--header-h)); min-height: 0; }
  .hero.is-focus .hero__inner { height: 100%; }
}

/* --------------------------------------------------------------- intro */
/* data-boot (set inline, before first paint) hides decorative chrome until the intro plays it in.
   The heading, Latin name and the selected tab are never hidden. */
.js .hero[data-boot] :is(.atlas-kicker, .atlas-tab:not([aria-selected="true"]), .atlas-detail__col > :not(.atlas-detail__name, .atlas-detail__latin), .atlas-btn, .atlas-dock, .atlas-ghost span, .atlas-fda, .atlas-hint) { opacity: 0; }
/* data-await: the hero loaded below the fold (under the home video hero); chrome stays hidden until it scrolls into view and the intro plays. */
.js .hero[data-await] :is(.atlas-kicker, .atlas-tab:not([aria-selected="true"]), .atlas-detail__col > :not(.atlas-detail__name, .atlas-detail__latin), .atlas-btn, .atlas-dock, .atlas-ghost span, .atlas-fda, .atlas-hint) { opacity: 0; }
.js .hero[data-boot][data-deep] :is(.atlas-tab, .atlas-detail__name, .atlas-detail__latin) { opacity: 0; } /* deep link: about to be replaced */
.hero.is-intro .atlas-kicker { animation: atlas-rise .9s var(--ease) 40ms backwards; }
.hero.is-intro .atlas-tab:not([aria-selected="true"]) { animation: atlas-rise .9s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
.hero.is-intro .atlas-btn { animation: atlas-slide .8s var(--ease) backwards; }
.hero.is-intro .atlas-btn:nth-child(1) { animation-delay: 420ms; }
.hero.is-intro .atlas-btn:nth-child(2) { animation-delay: 480ms; }
.hero.is-intro .atlas-btn:nth-child(3) { animation-delay: 540ms; }
.hero.is-intro .atlas-btn:nth-child(4) { animation-delay: 600ms; }
.hero.is-intro .atlas-turn { animation: atlas-rise .9s var(--ease) 640ms backwards; }
.hero.is-intro .atlas-caption span { animation: atlas-rise 1s var(--ease) 720ms backwards; }
.hero.is-intro .atlas-hint { animation: atlas-fade 1s var(--ease) 900ms backwards; }
.hero.is-intro .atlas-fda { animation: atlas-fade 1s var(--ease) 900ms backwards; }
.hero.is-intro .atlas-ghost span { animation: atlas-ghost-in 1.6s var(--ease) 100ms backwards; }
@keyframes atlas-rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes atlas-slide { from { opacity: 0; transform: translateX(-12px); } }
@keyframes atlas-fade { from { opacity: 0; } }
@keyframes atlas-ghost-in { from { opacity: 0; transform: translateY(-6%); } }

/* --------------------------------------------------- no-JS / no-3D states */
html:not(.js) .hero :is(.atlas-rail, .atlas-turn, .atlas-hint) { display: none; }

/* ------------------------------------------------- short desktop screens */
@media (min-width: 901px) and (max-height: 960px) {
  .hero { --hero-pad-top: 20px; }
  .atlas-kicker { margin-bottom: 12px; }
  .hero__info { padding-top: 14px; }
  .atlas-card { padding: 18px 20px 14px; }
  .hero .atlas-detail__name { font-size: clamp(38px, 3.6vw, 48px); margin-top: 6px; }
  .atlas-detail__tags { margin-top: 12px; }
  .atlas-detail__desc { margin-top: 10px; font-size: 13px; line-height: 1.5; }
  .hero .atlas-detail__h2 { margin-top: 12px; padding-top: 11px; font-size: 19px; }
  .atlas-traits { gap: 5px; margin-top: 8px; }
  .atlas-habitat { margin-top: 8px; }
  .atlas-product { margin: 12px 0 10px; }
  .atlas-closeup { grid-template-columns: 58px minmax(0, 1fr) 18px; gap: 12px; padding: 8px; }
  .atlas-closeup__lens { width: 58px; }
  .atlas-closeup__title { font-size: 17px; }
}
@media (min-width: 901px) and (max-height: 820px) {
  .hero { --hero-pad-top: 16px; --tab-crop: 42px; }
  .atlas-kicker { margin-bottom: 10px; }
  .atlas-tab { padding: 6px 8px 8px; }
  .atlas-tab__crop { margin-bottom: 4px; }
  .atlas-tab__latin { font-size: 11.5px; }
  .hero__info { padding-top: 10px; gap: 8px; }
  .atlas-card { padding: 15px 18px 12px; }
  .hero .atlas-detail__name { font-size: clamp(32px, 2.9vw, 40px); }
  .atlas-detail__tags { margin-top: 9px; }
  .atlas-detail__tags li { padding: 5px 11px; }
  .atlas-detail__desc { margin-top: 9px; font-size: 12.5px; line-height: 1.47; }
  .atlas-detail__col--a > .atlas-product { order: 0; margin: 11px 0 0; padding-block: 6px; } /* keep the shop link above the fold */
  .atlas-product__thumb { height: 44px; }
  /* section heads become quiet labels */
  .hero .atlas-detail__h2 {
    margin-top: 11px; padding-top: 10px;
    font-family: var(--font-sans); font-size: 10.5px; font-weight: 800; line-height: 1.3;
    letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  }
  .atlas-traits { gap: 3px; margin-top: 7px; }
  /* "Where it grows" folds into a trait-style row */
  .atlas-detail__h2--grows { display: none; }
  .atlas-habitat {
    display: grid; grid-template-columns: 18px 82px minmax(0, 1fr); column-gap: 12px;
    margin-top: 3px; color: var(--ink);
  }
  .atlas-habitat__label { display: block; }
  .atlas-detail__col--b > .atlas-closeup { margin-top: 11px; }
  .atlas-closeup { grid-template-columns: 46px minmax(0, 1fr) 18px; gap: 11px; padding: 6px 8px; }
  .atlas-closeup__lens { width: 46px; }
  .atlas-closeup__title { font-size: 16px; }
  .atlas-closeup__desc { font-size: 11px; line-height: 1.35; }
}
/* laptops up to ~760px tall: the stage is height-bound, so the card can take more width (fewer lines) */
@media (min-width: 1180px) and (max-height: 760px) {
  .hero { --info-w: clamp(340px, 30.5vw, 440px); }
}
/* very short: the "Key Traits" label stays for screen readers only; a hairline still opens the list */
@media (min-width: 901px) and (max-height: 724px) {
  .atlas-detail__col--b > .atlas-detail__h2:not(.atlas-detail__h2--grows) {
    position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; border: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .atlas-traits { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
}
/* laptops around 650 to 700px tall: a lighter top band so the stage, pill and caption all fit above the fold */
@media (min-width: 901px) and (max-height: 700px) {
  .hero { --hero-pad-top: 12px; --tab-crop: 34px; --rail-btn: 34px; }
  .atlas-kicker { margin-bottom: 8px; }
  .atlas-kicker__text { display: none; }
  .atlas-tab {
    grid-template-columns: var(--tab-crop) auto;
    justify-items: start; align-items: center; align-content: center;
    column-gap: 9px;
    padding: 4px 12px 4px 5px;
    text-align: left;
  }
  .atlas-tab__crop { margin: 0; }
  .atlas-tab__latin { display: none; }
  .atlas-tab__name { font-size: 14.5px; white-space: nowrap; }
  .atlas-stage { margin-top: 4px; }
  .atlas-rail { gap: 7px; }
  .atlas-btn .i { width: 16px; height: 16px; }
  .atlas-dock { gap: 8px; bottom: 4px; }
  .atlas-turn button { height: 30px; min-width: 30px; }
  .atlas-caption { font-size: 15.5px; }
  .hero__info { padding-top: 8px; padding-bottom: 10px; gap: 6px; }
  .atlas-card { padding: 13px 16px 10px; }
  .atlas-detail__eyebrow { font-size: 10.5px; }
  .hero .atlas-detail__name { font-size: 34px; margin-top: 4px; }
  .atlas-detail__latin { margin-top: 3px; font-size: 14px; }
  .atlas-detail__tags { margin-top: 8px; gap: 5px; }
  .atlas-detail__tags li { padding: 4px 10px; font-size: 11px; }
  .atlas-detail__desc { margin-top: 8px; font-size: 12.5px; line-height: 1.45; }
  .atlas-detail__col--a > .atlas-product { margin-top: 10px; }
  .atlas-product__thumb { height: 40px; width: 34px; }
  .atlas-product { grid-template-columns: 34px minmax(0, 1fr) auto 30px; }
  .atlas-product__go { width: 30px; height: 30px; }
  .hero .atlas-detail__h2 { margin-top: 9px; padding-top: 8px; }
  .atlas-trait, .atlas-habitat { font-size: 12.5px; line-height: 1.35; }
  .atlas-traits { margin-top: 6px; gap: 2px; }
  .atlas-detail__col--b > .atlas-closeup { margin-top: 9px; }
  .atlas-closeup { grid-template-columns: 40px minmax(0, 1fr) 18px; gap: 10px; padding: 5px 8px; }
  .atlas-closeup__lens { width: 40px; }
  .atlas-closeup__title { font-size: 15px; }
  .atlas-fda { font-size: 9.5px; line-height: 1.4; }
}

/* ---------------------------------------------------------------- tablet */
@media (max-width: 1100px) {
  .hero { --tab-w: 128px; --tab-crop: 46px; --info-w: clamp(300px, 34vw, 340px); }
  .atlas-tab__name { font-size: 14.5px; }
  .atlas-tab__latin { font-size: 11.5px; }
  .atlas-kicker__text { font-size: 14.5px; }
  .atlas-trait { grid-template-columns: 100px minmax(0, 1fr); }
  .atlas-habitat { grid-template-columns: 18px 70px minmax(0, 1fr); }
}
/* compact horizontal tabs (crop left, names right): the 2×2 grid on small laptops, and phones */
@media (min-width: 901px) and (max-width: 1000px), (max-width: 600px) {
  .atlas-tab {
    grid-template-columns: 38px minmax(0, 1fr);
    justify-items: start; align-items: center; align-content: center;
    column-gap: 10px;
    padding: 6px 10px;
    text-align: left;
  }
  .atlas-tab__crop { width: 38px; margin: 0; }
  .atlas-tab__name { white-space: nowrap; }
  .atlas-tab__latin { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .atlas-tab:hover .atlas-tab__crop { transform: rotate(-8deg); }
}
@media (min-width: 901px) and (max-width: 1000px) {
  .atlas-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 420px; margin-inline: auto; }
}

/* ---------------------------------------------- stacked: tablets + phones */
@media (max-width: 900px) {
  .hero {
    --hero-pad-top: 18px;
    height: auto;
    min-height: 600px;
  }
  .hero__inner { display: block; height: auto; padding-inline: 0; }
  .hero__main { display: flex; flex-direction: column; padding: var(--hero-pad-top) 0 0; }
  .atlas-kicker { justify-content: flex-start; text-align: left; padding-inline: var(--gutter); margin-bottom: 12px; gap: 2px 14px; }

  .atlas-tabs {
    justify-content: flex-start;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    padding: 4px var(--gutter) 6px;
  }
  .atlas-tabs::-webkit-scrollbar { display: none; }
  .atlas-tab { flex: 1 1 0; min-width: 0; max-width: 220px; scroll-snap-align: start; }

  .atlas-stage { height: 58svh; min-height: 360px; max-height: 660px; margin: 4px var(--gutter) 0; }
  .atlas-ghost { font-size: clamp(64px, 10.5vw, 92px); }

  .hero__info { padding: 12px var(--gutter) clamp(40px, 8vw, 72px); gap: 12px; }
  .atlas-card {
    overflow: visible;
    padding: clamp(20px, 3.4vw, 32px) clamp(18px, 3.4vw, 36px) clamp(16px, 3vw, 28px);
    border-radius: var(--r-l);
    background: var(--panel);
  }
  [data-glow="on"] .atlas-card { background: var(--panel); }
  .atlas-card.is-resizing { overflow: hidden; }
  .atlas-closeup { position: static; margin-top: 16px; }
  .atlas-closeup::before { display: none; }
  .hero__bg { -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
  .atlas-fda { font-size: 10.5px; max-width: 72ch; }
  .hero.is-focus .hero__info { transform: translateY(24px); }
  /* Expand: the stage grows to fill the screen under the header (the page is scrolled to it) */
  .hero.is-focus .atlas-stage { height: calc(100vh - var(--header-h) - 16px); height: calc(100svh - var(--header-h) - 16px); max-height: none; }
}
/* stacked tablet: the card's two columns sit side by side */
@media (min-width: 600px) and (max-width: 900px) {
  .atlas-detail { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); column-gap: clamp(24px, 4vw, 48px); align-items: start; }
  .atlas-detail__col { display: flex; flex-direction: column; }
  .atlas-detail__col--b > .atlas-detail__h2:first-child { margin-top: 2px; padding-top: 0; border-top: 0; }
  .atlas-detail__col--a > .atlas-product { margin-bottom: 0; }
  .hero .atlas-detail__name { font-size: clamp(40px, 6vw, 52px); }
}

/* ----------------------------------------------------------------- phone */
@media (max-width: 760px) {
  .hero { --rail-btn: 34px; --hero-pad-top: 14px; }
  .atlas-kicker { margin-bottom: 10px; gap: 2px 12px; }
  .atlas-kicker__text { font-size: 14px; }
  .atlas-tab:hover { transform: none; box-shadow: none; }
  .atlas-stage { margin-top: 2px; }
  .atlas-rail { gap: 7px; }
  .atlas-btn .i { width: 16px; height: 16px; }
  .atlas-dock { gap: 8px; bottom: 2px; left: 2%; right: 2%; }
  .atlas-turn button { height: 30px; min-width: 30px; }
  .atlas-caption { font-size: 15px; }
  .atlas-hint { display: none; }
  .atlas-shadow { bottom: 17%; height: 30px; }
  .atlas-fallback { width: min(200px, 60%); }
  .atlas-ghost { font-size: 15.5vw; top: calc(var(--st, 180px) + 12px); }
  .hero__info { padding-top: 10px; }
  .hero .atlas-detail__name { font-size: 34px; }
  .hero .atlas-detail__h2 { font-size: 19px; }
  .atlas-detail__desc { font-size: 14.5px; }
  .atlas-trait, .atlas-habitat { font-size: 13.5px; }
  .atlas-trait { grid-template-columns: 104px minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .atlas-tab { flex: 0 0 180px; }
  .atlas-tab__name { font-size: 14.5px; }
}
@media (max-width: 380px) {
  .atlas-product { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .atlas-product__go { display: none; }
}

/* -------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero, .hero * { animation: none !important; }
  .atlas-loader__ring { animation: atlas-spin 1.6s linear infinite !important; }
}
