/* Hero 3, "The deck": six photo plates, fanned on a dark table.
   Desktop: the fan opens as the pointer comes near; the plate under the pointer lifts,
   tilts in 3D after the cursor and catches a sheen. iPhone: a pile you swipe through.
   Uses B's tokens (style.css): --basalt, --blue, --blue-n, --paper-n, --ink, --ink3, --gut, --maxw.
   Every class is scoped under .hx-deck. Motion is transforms and opacity only (hero-deck.js). */

.hx-deck {
  /* Plate size. iPhone: sized so the line, the deck and the controls fit with no scrolling. */
  --ch: clamp(232px, calc(100vh - 322px), 380px);
  --cw: min(calc(var(--ch) * .8), 74vw);
  --bd: 6px;            /* white print border */
  --lab: 36px;          /* the plate label under the photo */
  position: relative;
  overflow: hidden;     /* thrown plates leave the table without making the page scroll sideways */
  background: var(--basalt, #16191A);
  color: var(--paper-n, #F2F3EF);
  padding: 16px 0 18px;
}
@supports (height: 100svh) {
  .hx-deck { --ch: clamp(232px, calc(100svh - 322px), 380px); }
}
/* A soft pool of light on the table, under the plates. Painted once. */
.hx-deck::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 46% at 50% 74%, rgba(151, 153, 245, .10), rgba(151, 153, 245, 0) 70%),
              radial-gradient(90% 60% at 50% 80%, #252B2D 0%, rgba(37, 43, 45, 0) 72%);
}

.hx-deck .dk-wrap {
  position: relative;
  max-width: var(--maxw, 1440px); margin: 0 auto; padding: 0 var(--gut, 16px);
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "text" "stage" "bar";
}

/* ---------- The line ---------- */
.hx-deck .dk-text { grid-area: text; position: relative; z-index: 2; }
.hx-deck .dk-h {
  margin: 0;
  font-stretch: 125%; font-weight: 860;
  font-size: clamp(33px, 9.5vw, 104px); line-height: .9; letter-spacing: -.035em;
  color: #fff;
}
.hx-deck .dk-h span { display: block; }
.hx-deck .dk-h .dk-h-b { color: var(--blue-n, #9799F5); }
/* B's moving headings: "Start here." opens out to full width once, as the page arrives. */
@keyframes dk-widen { from { font-stretch: 76%; } to { font-stretch: 125%; } }
.hx-deck .dk-h .dk-h-b { animation: dk-widen 1.1s cubic-bezier(.2, .7, .2, 1) .2s both; }
.hx-deck .dk-sub {
  margin: 10px 0 0; max-width: 33em;
  font-size: 15px; line-height: 1.38; color: var(--ink2-n, #B3B9B6);
}
.hx-deck .dk-sub strong { color: #fff; font-weight: 650; }

/* ---------- The table and the plates ---------- */
.hx-deck .dk-stage {
  grid-area: stage; position: relative; z-index: 1;
  height: calc(var(--ch) + 30px); margin-top: 6px;
  touch-action: pan-y;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.hx-deck .dk-deck { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.hx-deck .dk-slot {
  position: absolute; left: 50%; top: 50%;
  width: var(--cw); height: var(--ch);
  margin: calc(var(--ch) / -2) 0 0 calc(var(--cw) / -2);
  will-change: transform;
}
/* Before the script places them, the plates sit in a loose pile (no jump when it starts). */
.hx-deck .dk-slot:nth-child(1) { transform: rotate(-1.5deg); z-index: 6; }
.hx-deck .dk-slot:nth-child(2) { transform: translate(14px, 8px) rotate(4.5deg) scale(.965); z-index: 5; }
.hx-deck .dk-slot:nth-child(3) { transform: translate(-16px, 12px) rotate(-5.5deg) scale(.94); z-index: 4; }
.hx-deck .dk-slot:nth-child(4) { transform: translate(10px, 15px) rotate(7.5deg) scale(.92); z-index: 3; }
.hx-deck .dk-slot:nth-child(5) { transform: translate(-8px, 17px) rotate(-8deg) scale(.905); z-index: 2; }
.hx-deck .dk-slot:nth-child(6) { transform: translate(0, 18px) rotate(2deg) scale(.9); z-index: 1; }

/* The shadow is its own layer, so lifting a plate only moves and fades it. */
.hx-deck .dk-shadow {
  position: absolute; left: 5%; right: 5%; top: 8%; bottom: 3%;
  background: rgba(0, 0, 0, .35);
  box-shadow: 0 20px 36px 2px rgba(0, 0, 0, .55);
  opacity: .7;
}

.hx-deck .dk-card {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) var(--lab); grid-template-columns: minmax(0, 1fr);
  background: #fff; color: var(--ink, #16191A);
  padding: var(--bd) var(--bd) 0;
  transform-origin: 50% 50%;
}
.hx-deck .dk-ph {
  grid-area: 1 / 1; position: relative; overflow: hidden;
  background: #2A2F31;
}
.hx-deck .dk-ph img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none;
}
.hx-deck .dk-scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 12, 13, .28) 0%, rgba(10, 12, 13, 0) 22%, rgba(10, 12, 13, 0) 40%, rgba(10, 12, 13, .5) 66%, rgba(10, 12, 13, .86) 100%);
}
/* Sheen: a band of light and a soft glare, moved with transforms only. */
.hx-deck .dk-sheen { position: absolute; inset: 0; overflow: hidden; opacity: 0; visibility: hidden; pointer-events: none; }
.hx-deck .dk-sheen i {
  position: absolute; left: -30%; top: -30%; width: 160%; height: 160%;
  background:
    radial-gradient(closest-side at 50% 50%, rgba(255, 255, 255, .34), rgba(255, 255, 255, .12) 38%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(115deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .14) 46%, rgba(255, 255, 255, .28) 50%, rgba(255, 255, 255, .14) 54%, rgba(255, 255, 255, 0) 62%);
}

/* Plate number, as on a field-guide plate */
.hx-deck .dk-no {
  grid-area: 1 / 1; align-self: start; justify-self: start; z-index: 2;
  margin: 0; background: var(--basalt, #16191A); color: #fff;
  font-stretch: 75%; font-weight: 800; font-size: 13px; line-height: 1; font-variant-numeric: tabular-nums;
  padding: 6px 7px 5px;
}
.hx-deck .dk-body {
  grid-area: 1 / 1; align-self: end; z-index: 2;
  padding: 0 13px 13px; color: #fff;
}
.hx-deck .dk-q {
  margin: 0;
  font-stretch: 118%; font-weight: 820;
  font-size: calc(var(--cw) * .112); line-height: .95; letter-spacing: -.028em;
  text-wrap: balance;
}
.hx-deck .dk-go { color: inherit; text-decoration: none; -webkit-touch-callout: none; -webkit-user-drag: none; }
/* Plates for guides not written yet use a button (it says "coming soon" when tapped); it looks the same. */
.hx-deck button.dk-go {
  font: inherit; letter-spacing: inherit; text-align: inherit; text-wrap: inherit;
  background: none; border: 0; border-radius: 0; padding: 0; margin: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
}
.hx-deck .dk-go::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.hx-deck .dk-go:focus-visible { outline: none; }
.hx-deck .dk-card:has(.dk-go:focus-visible) { outline: 3px solid #fff; outline-offset: 3px; }
.hx-deck .dk-a {
  margin: 7px 0 0; max-width: 24em;
  font-size: 13.5px; line-height: 1.32; color: rgba(255, 255, 255, .9);
  opacity: 0; transform: translate3d(0, 6px, 0);
  transition: opacity .3s var(--ease, ease), transform .3s var(--ease, ease);
}
.hx-deck .is-active .dk-a { opacity: 1; transform: none; }

/* The plate label: species and credit, in the white margin */
.hx-deck .dk-lab {
  grid-area: 2 / 1; margin: 0; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 0 1px; line-height: 1.1; white-space: nowrap;
}
.hx-deck .dk-sp { font-stretch: 75%; font-weight: 750; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.hx-deck .dk-sp i { font-weight: 500; font-style: italic; margin-left: 3px; }
.hx-deck .dk-cr { font-stretch: 75%; font-weight: 500; font-size: 10.5px; color: var(--ink3, #6A706E); overflow: hidden; text-overflow: ellipsis; }

/* Dimmer for the plates that aren't in front (opacity only) */
.hx-deck .dk-dim { position: absolute; inset: 0; background: #0B0D0E; opacity: 0; pointer-events: none; z-index: 4; }

/* The hurt-animal plate: tongue blue, no photo, the helpline large */
.hx-deck .dk-help .dk-ph { background: var(--blue, #3B3DB5); }
.hx-deck .dk-help .dk-ph::before {
  /* fine ruled lines, like a printed form, so the blue plate has some texture */
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .045) 0 1px, rgba(255, 255, 255, 0) 1px 22px);
}
.hx-deck .dk-help .dk-no { background: #fff; color: var(--blue, #3B3DB5); }
.hx-deck .dk-help .dk-body { align-self: stretch; display: flex; flex-direction: column; padding-top: 40px; }
.hx-deck .dk-help .dk-q { font-size: calc(var(--cw) * .118); }
.hx-deck .dk-call { margin: auto 0 0; }
.hx-deck .dk-org { display: block; font-stretch: 100%; font-weight: 650; font-size: 14px; line-height: 1.2; color: #E3E4FA; }
.hx-deck .dk-tel {
  position: relative; z-index: 5; display: inline-block;
  margin-top: 4px; padding: 2px 0 3px;
  font-stretch: 75%; font-weight: 820; font-size: calc(var(--cw) * .135); line-height: 1; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  color: #fff; text-decoration: none; border-bottom: 2px solid rgba(255, 255, 255, .45);
  -webkit-touch-callout: none;
}
.hx-deck .dk-tel:hover { border-bottom-color: #fff; }
.hx-deck .dk-tel:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.hx-deck .dk-help .dk-a { margin-top: 10px; }
.hx-deck .dk-help .dk-scrim { display: none; }

/* ---------- Under the deck: hint, counter, buttons ---------- */
.hx-deck .dk-bar {
  grid-area: bar; position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 4px;
}
.hx-deck.is-intro .dk-bar { opacity: 0; }
.hx-deck .dk-bar { transition: opacity .45s var(--ease, ease); }
.hx-deck .dk-hint {
  margin: 0; display: flex; align-items: center; gap: 8px;
  font-stretch: 75%; font-weight: 600; font-size: 14px; line-height: 1.25; color: var(--ink2-n, #B3B9B6);
}
.hx-deck .dk-hint svg { flex: none; width: 26px; height: 16px; color: var(--blue-n, #9799F5); }
.hx-deck .dk-hint-m { display: none; }
.hx-deck .dk-nav { display: flex; align-items: center; gap: 6px; }
.hx-deck .dk-count {
  min-width: 52px; text-align: center;
  font-stretch: 75%; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--ink2-n, #B3B9B6);
}
.hx-deck .dk-count b { color: #fff; font-weight: 800; }
.hx-deck .dk-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  color: #fff; background: transparent; border: 1.5px solid rgba(255, 255, 255, .34); border-radius: 2px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .15s var(--ease, ease), background-color .15s, border-color .15s, color .15s;
}
.hx-deck .dk-btn svg { width: 18px; height: 18px; }
@media (hover: hover) { .hx-deck .dk-btn:hover { background: #fff; color: var(--basalt, #16191A); border-color: #fff; } }
.hx-deck .dk-btn:active { transform: scale(.92); }
.hx-deck .dk-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.hx-deck .dk-vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- Pile mode (phones and narrow windows) ---------- */
.hx-deck.is-pile .dk-slot:not(.is-top) .dk-go::after,
.hx-deck.is-pile .dk-slot:not(.is-top) .dk-tel { pointer-events: none; }
.hx-deck.is-pile .dk-stage { cursor: grab; }
.hx-deck.is-pile.is-dragging .dk-stage { cursor: grabbing; }

/* ---------- Wider phones and tablets ---------- */
@media (min-width: 600px) and (max-width: 899px) {
  .hx-deck { --ch: clamp(300px, calc(100svh - 360px), 460px); --bd: 7px; --lab: 38px; }
  .hx-deck .dk-sub { font-size: 17px; }
  .hx-deck .dk-a { font-size: 15px; }
}

/* ---------- Desktop: the fan ---------- */
@media (min-width: 900px) {
  /* The line runs across the top; the fan of plates spreads wide beneath it. */
  .hx-deck {
    --ch: clamp(280px, calc(100vh - 446px), 450px);
    --cw: calc(var(--ch) * .77);
    --hf: clamp(44px, 5.5vw, 88px);
    --bd: 8px; --lab: 42px;
    padding: 30px 0 22px;
  }
  .hx-deck::before {
    background: radial-gradient(46% 40% at 50% 70%, rgba(151, 153, 245, .09), rgba(151, 153, 245, 0) 70%),
                radial-gradient(70% 60% at 50% 74%, #262C2E 0%, rgba(38, 44, 46, 0) 72%);
  }
  .hx-deck .dk-text { position: relative; }
  .hx-deck .dk-h { font-size: var(--hf); }
  .hx-deck .dk-sub {
    position: absolute; right: 0; bottom: calc(var(--hf) * .06);
    width: min(400px, 38%); margin: 0;
    font-size: clamp(16px, 1.3vw, 19px); line-height: 1.38;
  }
  .hx-deck .dk-stage { height: calc(var(--ch) + 118px); margin-top: 8px; }
  .hx-deck .dk-bar { justify-content: center; margin-top: -2px; }
  .hx-deck .dk-hint { font-size: 15.5px; }
  .hx-deck .dk-hint-t { display: none; }
  .hx-deck .dk-hint-m { display: inline; }
  .hx-deck .dk-nav { display: none; }
  .hx-deck .dk-body { padding: 0 16px 16px; }
  .hx-deck .dk-a { font-size: 14.5px; }
  .hx-deck .dk-sp { font-size: 13px; }
  .hx-deck .dk-cr { font-size: 11px; }
  .hx-deck .dk-no { font-size: 14px; padding: 7px 8px 6px; }
  .hx-deck .dk-help .dk-body { padding-top: 46px; }
  .hx-deck .dk-org { font-size: 15px; }
  .hx-deck .dk-stage { cursor: default; }
  .hx-deck .dk-slot { cursor: pointer; }
  /* Before the script deals them into the fan: a neat stack, front plate last. */
  .hx-deck .dk-slot:nth-child(1) { transform: translate(0, 34px) rotate(-2deg) scale(.965); z-index: 10; }
  .hx-deck .dk-slot:nth-child(2) { transform: translate(0, 34px) rotate(-1.2deg) scale(.965); z-index: 11; }
  .hx-deck .dk-slot:nth-child(3) { transform: translate(0, 34px) rotate(-.4deg) scale(.965); z-index: 12; }
  .hx-deck .dk-slot:nth-child(4) { transform: translate(0, 34px) rotate(.4deg) scale(.965); z-index: 13; }
  .hx-deck .dk-slot:nth-child(5) { transform: translate(0, 34px) rotate(1.2deg) scale(.965); z-index: 14; }
  .hx-deck .dk-slot:nth-child(6) { transform: translate(0, 34px) rotate(2deg) scale(.965); z-index: 15; }
}
@media (min-width: 900px) and (max-height: 760px) {
  .hx-deck { --cw: clamp(210px, 18vw, 280px); }
}

/* Reduced motion: no movement anywhere; the deck still works (hero-deck.js snaps instead of springing). */
@media (prefers-reduced-motion: reduce) {
  .hx-deck .dk-h .dk-h-b { animation: none; }
  .hx-deck .dk-a, .hx-deck .dk-btn, .hx-deck .dk-bar { transition: none; }
  .hx-deck .dk-a { transform: none; }
}
