/* WYLD demo — components: pinned track, species index, tables, filters,
   bands, journal list, trust block, chips, accordion */

/* ---------- pinned horizontal ---------- */
.pin { position: relative; }
.pin__vp { position: sticky; top: 0; height: 100vh; overflow: hidden; }
.pin__track { display: flex; height: 100%; will-change: transform; }
.panel { position: relative; flex: 0 0 auto; height: 100%; }
.panel--img { width: min(74vw, 1000px); }
.panel--type { width: min(58vw, 780px); display: grid; align-content: center; padding-inline: clamp(28px, 5vw, 92px); }
.panel--data { width: min(84vw, 1180px); display: grid; grid-template-columns: 1.35fr .65fr; }
.panel__fig { position: relative; overflow: hidden; height: 100%; }
.panel__fig img { width: 100%; height: 100%; object-fit: cover; }
.panel__grad { position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(to top, rgba(10,11,10,.86), transparent); }
.panel__cap { position: absolute; inset: auto 0 0 0; padding: clamp(22px, 4vh, 46px) clamp(22px, 3.4vw, 54px); display: grid; gap: 14px; }
.panel__num { font-family: var(--f-display); font-size: clamp(3rem, 7vw, 7rem); line-height: .8; font-weight: 300; letter-spacing: -.02em; color: rgba(241,237,228,.34); }
.panel__side { border-left: 1px solid var(--line-d); padding: clamp(22px, 4vh, 46px) clamp(20px, 2.4vw, 38px); display: grid; align-content: end; gap: 22px; }
.pin__bar { position: absolute; inset: auto var(--gutter) clamp(20px, 3.4vh, 40px) var(--gutter); display: flex; align-items: center; gap: 20px; }
.pin__line { flex: 1; height: 1px; background: var(--line-d); position: relative; }
.pin__line i { position: absolute; inset: 0 auto 0 0; background: var(--bone); transform: scaleX(0); transform-origin: left; }
.pin__pad { display: grid; align-content: center; padding-inline: var(--gutter); }
.pin__pad--start { width: min(46vw, 620px); }
.pin__pad--end { width: clamp(40px, 12vw, 220px); }

.dl-m { display: grid; grid-template-columns: auto 1fr; column-gap: clamp(16px, 2vw, 34px); row-gap: 9px; }
.dl-m dt { color: var(--stone); }
.dl-m dd { text-align: right; }
.g-dark .dl-m dt { color: rgba(241,237,228,.5); }

/* ---------- species index ---------- */
.spx { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.spx__list { border-top: 1px solid var(--line); }
.spx__row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: clamp(14px, 2vw, 30px);
  width: 100%; text-align: left;
  padding: clamp(16px, 2.2vh, 26px) 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink); transition: color .35s ease;
}
.spx__row .d { transition: transform .5s var(--ease), opacity .35s ease; opacity: .62; }
.spx__row.is-on .d, .spx__row:hover .d { opacity: 1; transform: translateX(clamp(6px, 1vw, 18px)); }
.spx__row.is-on .spx__n, .spx__row:hover .spx__n { color: var(--ember); }
.spx__n { color: var(--stone); transition: color .3s ease; }
.spx__thumb { display: none; width: 56px; height: 56px; object-fit: cover; }
.spx__stage { position: relative; overflow: hidden; background: var(--paper); }
.spx__stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity .7s var(--ease), transform 1.2s var(--ease); }
.spx__stage img.is-on { opacity: 1; transform: none; }
/* The fade ramp is locked to the padding, so it always ends exactly where the
   first line of text begins — every line sits on a full-strength scrim no
   matter how bright the photograph or how tall the block. */
.spx__meta {
  --scrim-pad: clamp(48px, 8vh, 76px);
  position: absolute; inset: auto 0 0 0;
  padding: var(--scrim-pad) clamp(18px, 3vh, 34px) clamp(18px, 3vh, 34px);
  background: linear-gradient(to top,
    rgba(10,11,10,.9) 0,
    rgba(10,11,10,.9) calc(100% - var(--scrim-pad)),
    rgba(10,11,10,0) 100%);
  color: var(--bone); display: grid; gap: 12px;
}
.spx__note { max-width: 44ch; font-size: .9375rem; line-height: 1.55; color: rgba(241,237,228,.86); }
@media (max-width: 900px) {
  .spx { grid-template-columns: 1fr; }
  .spx__stage { display: none; }
  .spx__thumb { display: block; }
  .spx__row { grid-template-columns: auto 1fr auto; }
}

/* ---------- bands ---------- */
.band { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(24px, 5vw, 96px); padding-block: clamp(36px, 6vh, 78px); border-bottom: 1px solid var(--line); }
.band:first-child { border-top: 1px solid var(--line); }
.band--flip > .band__fig { order: 2; }
.band__fig { position: relative; overflow: hidden; aspect-ratio: 3/2; }
.band__fig img { width: 100%; height: 100%; object-fit: cover; }
.band__txt { display: grid; gap: 18px; max-width: 46ch; }
@media (max-width: 900px) { .band, .band--flip > .band__fig { grid-template-columns: 1fr; order: 0; } }

/* ---------- table ---------- */
.tbl { font-family: var(--f-ui); }
.tbl th, .tbl td { text-align: left; vertical-align: middle; padding: 0 clamp(10px, 1.4vw, 24px); }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; text-align: right; }
.tbl thead th { padding-bottom: 14px; border-bottom: 1px solid var(--line); color: var(--stone); font-weight: 400; white-space: nowrap; }
.tbl tbody tr { border-bottom: 1px solid var(--line); transition: background-color .3s ease, opacity .4s var(--ease), transform .4s var(--ease); }
.tbl tbody tr:hover { background: rgba(10,11,10,.035); }
.tbl tbody td { height: 74px; }
.tbl .c-exp { font-family: var(--f-display); font-size: clamp(1rem, 1.25vw, 1.25rem); letter-spacing: -.015em; line-height: 1.1; text-transform: none; }
.tbl .c-num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: .06em; font-size: 12px; }
.tbl tr.is-out { opacity: 0; transform: translateY(8px); }
.dot { display: inline-block; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: var(--ember); margin-right: 8px; vertical-align: middle; }
.cta-cell { display: inline-flex; align-items: center; gap: 8px; position: relative; }
.cta-cell::after { content: ''; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
tr:hover .cta-cell::after, .cta-cell:hover::after { transform: scaleX(1); }
@media (max-width: 900px) {
  .tbl .h-sm, .tbl .c-sm { display: none; }
  .tbl tbody td { height: 64px; }
}

/* ---------- row-hover preview ---------- */
.peek {
  position: fixed; top: 0; left: 0; z-index: 640;
  width: clamp(200px, 21vw, 320px); aspect-ratio: 3/2;
  margin: 0; overflow: hidden; background: var(--ink);
  pointer-events: none;
  opacity: 0; transition: opacity .32s var(--ease);
}
.peek img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.06); transition: transform .5s var(--ease); }
.peek.is-on { opacity: 1; }
.peek.is-on img { transform: none; }
@media (pointer: coarse) { .peek { display: none; } }
@media (prefers-reduced-motion: reduce) { .peek { display: none; } }

/* ---------- chips / filters ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); padding: 8px 13px; color: var(--moss);
  transition: border-color .3s ease, color .3s ease, background-color .3s ease;
}
.chip:hover { border-color: rgba(10,11,10,.34); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bone); }

/* ---------- journal list ---------- */
.jfeat { display: grid; gap: clamp(18px, 3vh, 34px); }
.jfeat__fig { position: relative; overflow: hidden; aspect-ratio: 16/9; }
.jfeat__fig img { width: 100%; height: 100%; object-fit: cover; }
.jlist { border-top: 1px solid var(--line); }
.jrow { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: clamp(18px, 3vw, 54px); padding-block: clamp(18px, 2.6vh, 30px); border-bottom: 1px solid var(--line); }
.jrow__txt { display: grid; gap: 10px; }
.jrow__t { transition: opacity .3s ease; }
.jrow:hover .jrow__t { opacity: .55; }
.jrow img { width: clamp(96px, 12vw, 168px); aspect-ratio: 4/3; object-fit: cover; }

/* ---------- trust ---------- */
.quote { display: grid; gap: 16px; align-content: start; }
.quote p { font-family: var(--f-display); font-size: clamp(1.0625rem, 1.35vw, 1.3125rem); line-height: 1.32; letter-spacing: -.01em; }
.furn { display: flex; flex-wrap: wrap; gap: 10px clamp(18px, 2.6vw, 44px); }
.furn a { position: relative; }
.furn a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.furn a:hover::after { transform: scaleX(1); }

/* Selective focus: the rows you are not pointing at fall very slightly out of
   focus, the way everything outside the plane of focus does at f/2.8. Small
   enough that it registers as attention rather than as a blur effect. */
@media (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .spx__list .spx__row, .tbl tbody tr, .jlist .jrow {
    transition: filter .35s var(--ease), opacity .35s var(--ease),
                background-color .3s ease, transform .4s var(--ease);
  }
  .spx__list:hover .spx__row:not(:hover),
  .tbl tbody:hover tr:not(:hover),
  .jlist:hover .jrow:not(:hover) { filter: blur(.7px); opacity: .58; }
}

/* Illuminated fraction of the moon on a departure date. Wildlife moves
   differently on a full moon and trackers plan around it; nobody else will
   look twice. Waxing fills from the right limb, waning from the left. */
.moon {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .5; margin-right: 7px;
  vertical-align: -1px; overflow: hidden; position: relative;
}
.moon::after {
  content: ''; position: absolute; top: -1px; bottom: -1px; width: calc(var(--lit, 0) * 100%);
  background: currentColor;
  left: auto; right: 0;
}
.moon--waning::after { left: 0; right: auto; }
tr:hover .moon { opacity: .9; }

/* Film frame counter on the drag galleries — a 36-exposure roll is a shared
   memory for anyone who shot one. */
.gal-count { font-variant-numeric: tabular-nums; }

.ph {
  display: inline-block; vertical-align: super;
  font-family: var(--f-mono); font-size: 9px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--stone); margin-left: .5em;
}

/* ---------- palette switcher (DEMO TOOL) ---------- */
/* The container is a fixed anchor sized by the toggle alone: the list is taken
   out of flow so it cannot push the button away from the corner, and nothing
   invisible is ever a hit target. */
.pbar {
  position: fixed; right: clamp(14px, 2vw, 26px); bottom: clamp(14px, 2vw, 26px);
  z-index: 600; display: grid; justify-items: end;
  pointer-events: none;
}
.pbar__toggle {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--bone); color: var(--ink);
  border: 1px solid var(--line); padding: 10px 13px;
  pointer-events: auto;
}
.pbar__dot { width: 8px; height: 8px; background: var(--ember); display: block; }
.pbar__list {
  position: absolute; bottom: calc(100% + 8px); right: 0;
  display: grid; gap: 1px; background: var(--bone); border: 1px solid var(--line);
  padding: 10px; min-width: 176px;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.pbar.is-open .pbar__list { opacity: 1; transform: none; pointer-events: auto; }
.pbar__note { color: var(--stone); padding: 2px 6px 8px; }
.pbar__opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 6px; color: var(--moss); text-align: left;
  transition: color .25s ease, background-color .25s ease;
}
.pbar__opt:hover { color: var(--ink); background: rgba(var(--ink-rgb), .04); }
.pbar__opt[aria-pressed="true"] { color: var(--ink); }
.pbar__opt[aria-pressed="true"] .pbar__sw { outline: 1px solid var(--ink); outline-offset: 2px; }
.pbar__sw { display: flex; flex: 0 0 auto; }
.pbar__sw i { display: block; width: 11px; height: 11px; }
@media (max-width: 640px) {
  .pbar { right: 10px; bottom: 10px; }
  .pbar__toggle span:not(.pbar__dot) { display: none; }
  .pbar__toggle { padding: 11px; }
}
@media print { .pbar { display: none; } }

/* ---------- reduced motion / no-JS degradation ---------- */
@media (prefers-reduced-motion: reduce) {
  .pin { height: auto !important; }
  .pin__vp { position: static; height: auto; }
  .pin__track { transform: none !important; overflow-x: auto; scrollbar-width: none; }
  .pin__track::-webkit-scrollbar { display: none; }
  .panel { height: min(78vh, 720px); }
  .pin__bar { display: none; }
  .pin__pad { display: none; }
}
html:not(.js) .pin { height: auto !important; }
html:not(.js) .pin__vp { position: static; height: auto; }
html:not(.js) .pin__track { flex-direction: column; }
html:not(.js) .panel { width: 100%; height: auto; min-height: 60vh; }
html:not(.js) .pin__bar, html:not(.js) .pin__pad, html:not(.js) .pre, html:not(.js) .cur, html:not(.js) .cur-ring { display: none; }
html:not(.js) .spx__stage { display: none; }
html:not(.js) .spx { grid-template-columns: 1fr; }
