/* ==========================================================================
   Projects — THE DECK. The Masher Arcana rendered as true tarot cards.
   Index (/projects): tilting card grid + engraved nameplates + filter pills.
   Detail (/projects/{slug}): two-plane hero with a living levitating card.
   Relies on theme.css: .section, .eyebrow, .reveal, [data-accent], .btn,
   .arcane, --ease-spring. projects.js feeds the custom properties:
     --rx / --ry   card rotation (deg)          --gx / --gy  glare position (%)
     --ga          glare sweep angle (deg)      --edge       edge-light 0..1
     --sx / --sy   shadow drift (unitless px)   --fan-shift  header fan parallax
   ========================================================================== */

/* --------------------------------------------------------------------------
   Index hero + fanned hand of card backs behind the headline
   -------------------------------------------------------------------------- */
.projects-hero {
  padding-top: var(--hero-pad-top);
  /* the rotated fan can poke past the viewport edge — never widen the page */
  overflow: clip;
}

.projects-head {
  position: relative;
}
.projects-head h1 {
  font-size: clamp(2.4rem, 5.6vw, 4rem);
  margin-top: 0.9rem;
}
.projects-head p {
  margin-top: 1.1rem;
  color: var(--star-3);
  font-size: 1.08rem;
  max-width: 58ch;
}

.head-fan {
  position: absolute;
  z-index: -1;
  top: -3.5rem;
  left: clamp(8rem, 30vw, 22rem);
  width: 340px;
  height: 300px;
  opacity: 0.4;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.head-fan img {
  position: absolute;
  top: 0;
  width: 128px;
  height: 192px;
  object-fit: cover;
  border-radius: var(--radius-s);
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.8);
  transform-origin: 50% 120%;
  transform: rotate(var(--fan-rot, 0deg))
             translateY(calc(var(--fan-shift, 0px) * var(--fan-f, 0.5)));
}
.head-fan img:nth-child(1) { --fan-rot: -14deg; --fan-f: 0.9;  left: 30px;  z-index: 1; }
.head-fan img:nth-child(2) { --fan-rot: 0deg;   --fan-f: 0.55; left: 106px; z-index: 2; top: -14px; }
.head-fan img:nth-child(3) { --fan-rot: 14deg;  --fan-f: 0.3;  left: 182px; z-index: 3; }

/* Soft vignette so the fan melts into the void behind the headline */
.head-fan::after {
  content: '';
  position: absolute;
  inset: -20%;
  background: radial-gradient(60% 60% at 50% 45%, transparent 40%, var(--void-0) 92%);
}

@media (max-width: 720px) {
  .head-fan { left: auto; right: -4rem; opacity: 0.22; }
}

/* --------------------------------------------------------------------------
   Filter pills
   -------------------------------------------------------------------------- */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: clamp(2.4rem, 4.5vw, 3.6rem);
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--star-3);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.3s var(--ease-spring), box-shadow 0.3s;
}
.filter-pill:hover {
  color: var(--star-1);
  border-color: var(--line-bright);
  transform: translateY(-1px);
}
.filter-pill:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.filter-pill[aria-pressed="true"] {
  color: #1a1206;
  background: linear-gradient(120deg, var(--gold), var(--ember));
  border-color: transparent;
  box-shadow: var(--glow-gold);
}

.filter-empty {
  margin-top: 2rem;
  color: var(--star-3);
  font-style: italic;
  font-family: var(--font-display);
}

/* --------------------------------------------------------------------------
   The Deck — grid of true tarot cards
   -------------------------------------------------------------------------- */
.projects-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  gap: 2.6rem 1.8rem;
}

.project-cell.is-hidden {
  display: none;
}

.tarot-link {
  display: block;
  height: 100%;
  color: inherit;
}
a.tarot-link:hover { color: inherit; }
a.tarot-link:focus-visible {
  outline: 2px solid var(--accent, var(--gold));
  outline-offset: 6px;
  border-radius: var(--radius-m);
}

/* Perspective stage: the card rotates inside this */
.tarot-scene {
  position: relative;
  perspective: 1000px;
  z-index: 0;
}

.tarot-card {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-card);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, var(--void-3), var(--void-1));
  outline: 1px solid rgba(242, 193, 78, 0.16);
  outline-offset: -1px;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0);
  transition: transform 0.75s var(--ease-spring);
  will-change: transform;
}
.tarot-scene.is-tilting .tarot-card {
  transition: transform 0.09s ease-out;
}

.tarot-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Glare sweep — a band of candlelight that follows the pointer */
.tarot-card::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: linear-gradient(var(--ga, 115deg),
              transparent 30%,
              rgba(255, 244, 216, 0.26) 47%,
              rgba(255, 255, 255, 0.07) 55%,
              transparent 70%);
  background-size: 220% 220%;
  background-position: var(--gx, 50%) var(--gy, 50%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.45s;
  pointer-events: none;
}
.tarot-scene.is-tilting .tarot-card::after { opacity: 1; }

/* Gold edge-light that gathers on the side tilted toward the pointer */
.tarot-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  padding: 1.5px;
  background: radial-gradient(130% 130% at var(--gx, 50%) var(--gy, 50%),
              rgba(255, 221, 135, 0.95),
              rgba(242, 193, 78, 0.3) 42%,
              transparent 72%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: calc(var(--edge, 0) * 0.9);
  transition: opacity 0.5s;
  pointer-events: none;
}

/* Soft drop shadow that drifts opposite the tilt */
.tarot-shadow {
  position: absolute;
  left: 7%;
  right: 7%;
  bottom: -5.5%;
  height: 11%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.6), transparent 72%);
  filter: blur(13px);
  transform: translate(calc(var(--sx, 0) * 1px), calc(var(--sy, 0) * 1px));
  transition: transform 0.75s var(--ease-spring);
  pointer-events: none;
}
.tarot-scene.is-tilting .tarot-shadow {
  transition: transform 0.09s ease-out;
}

/* Fallback face — shown only if the card art fails to load */
.tarot-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  border-radius: inherit;
  background:
    radial-gradient(80% 60% at 50% 30%, var(--accent-dim, var(--gold-dim)), transparent 70%),
    linear-gradient(165deg, var(--void-3), var(--void-1));
  box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.22), inset 0 0 60px rgba(0, 0, 0, 0.55);
}
.tarot-card.is-artless .tarot-fallback { display: flex; }
.tarot-card.is-artless .tarot-art { visibility: hidden; }
.tarot-fallback-glyph {
  width: 38%;
  color: var(--accent, var(--gold));
  filter: drop-shadow(0 0 14px var(--accent-dim, transparent));
}
.tarot-fallback-glyph svg { width: 100%; height: auto; }
.tarot-fallback-num {
  font-size: 0.95rem;
  color: var(--accent-hot, var(--gold-hot));
  opacity: 0.85;
}

/* Hover lift on live cards (tilt itself comes from projects.js) */
a.tarot-link .tarot-scene {
  transition: transform 0.5s var(--ease-spring);
}
a.tarot-link:hover .tarot-scene,
a.tarot-link:focus-visible .tarot-scene {
  transform: translateY(-6px);
}

/* --------------------------------------------------------------------------
   Face-down cards — coming soon, breathing in the athanor
   -------------------------------------------------------------------------- */
.tarot-link.is-coming { cursor: default; }

.tarot-card--facedown {
  outline-color: rgba(242, 193, 78, 0.1);
}
.tarot-card--facedown .tarot-art { opacity: 0.85; }

.tarot-glow {
  position: absolute;
  inset: -10% -16%;
  z-index: -2;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, var(--accent-dim, var(--ember-dim)), transparent 70%);
  filter: blur(18px);
  animation: athanor-breathe 6.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes athanor-breathe {
  0%, 100% { opacity: 0.3;  transform: scale(0.96); }
  50%      { opacity: 0.85; transform: scale(1.05); }
}

/* --------------------------------------------------------------------------
   Engraved nameplate beneath each card
   -------------------------------------------------------------------------- */
.tarot-plate {
  position: relative;
  margin-top: 1.15rem;
  padding: 0.85rem 0.9rem 0.9rem;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -8px 18px rgba(0, 0, 0, 0.28);
  transition: border-color 0.35s, box-shadow 0.35s;
}
.tarot-plate::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent, var(--gold)) 55%, transparent), transparent);
  opacity: 0.55;
  transition: opacity 0.35s;
}
a.tarot-link:hover .tarot-plate,
a.tarot-link:focus-visible .tarot-plate {
  border-color: color-mix(in srgb, var(--accent, var(--gold)) 40%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), inset 0 -8px 18px rgba(0, 0, 0, 0.28), 0 0 30px -10px var(--accent-dim);
}
a.tarot-link:hover .tarot-plate::before,
a.tarot-link:focus-visible .tarot-plate::before { opacity: 1; }

/* Projects without an arcana numeral render an empty span — hide it so the
   plate/mini-plate spacing doesn't reserve a blank line. */
.plate-numeral:empty,
.mini-numeral:empty { display: none; }

.plate-numeral {
  display: block;
  font-size: 0.66rem;
  color: var(--accent, var(--gold));
  opacity: 0.85;
  margin-bottom: 0.3rem;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
}

.plate-name {
  font-size: 1.16rem;
  font-weight: 580;
  letter-spacing: 0.005em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
}

.plate-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.8rem;
  margin-top: 0.65rem;
}

/* Metrics come from the shared theme.css .chip; only the accent skin lives here. */
.chip {
  color: var(--accent-hot, var(--star-3));
  background: var(--accent-dim, rgba(255, 255, 255, 0.05));
  border-color: color-mix(in srgb, var(--accent, #fff) 22%, transparent);
  white-space: nowrap;
}

/* Status chips: Live = jade, Beta = violet, In the Athanor = ember */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}
.status--live { color: var(--jade); }
.status--beta { color: var(--violet-hot); }
.status--soon { color: var(--ember-hot); }
.status--live .status-dot { animation: status-breathe 3s ease-in-out infinite; }

@keyframes status-breathe {
  0%, 100% { box-shadow: 0 0 6px currentColor; opacity: 1; }
  50%      { box-shadow: 0 0 14px currentColor; opacity: 0.7; }
}

/* --------------------------------------------------------------------------
   Index CTA
   -------------------------------------------------------------------------- */
.projects-cta { text-align: center; }
.projects-cta-inner { max-width: 640px; }
.projects-cta .eyebrow::after {
  content: '';
  width: 34px; height: 1px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.projects-cta h2 {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  margin-top: 1rem;
}
.projects-cta p {
  margin: 1.1rem auto 2.2rem;
  color: var(--star-3);
  font-size: 1.06rem;
  max-width: 46ch;
}

/* --------------------------------------------------------------------------
   Detail hero — two planes: the living card and the words
   -------------------------------------------------------------------------- */
.detail-hero {
  padding-top: var(--hero-pad-top);
  overflow: hidden;
}

.back-link {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--star-3);
  margin-bottom: 2.6rem;
  transition: color 0.3s;
}
.back-link:hover { color: var(--accent-hot, var(--gold-hot)); }
.back-link svg { transition: transform 0.35s var(--ease-spring); }
.back-link:hover svg { transform: translateX(-4px); }
.back-link:focus-visible { outline: 2px solid var(--accent, var(--gold)); outline-offset: 3px; }

.detail-hero-grid {
  display: grid;
  grid-template-columns: minmax(240px, 380px) minmax(0, 1fr);
  gap: clamp(2.5rem, 5.5vw, 5rem);
  align-items: center;
}

/* Left plane: the card floats above its own pool of light */
.detail-card-plane {
  position: relative;
  max-width: 380px;
  width: 100%;
  justify-self: center;
}

.arcana-float {
  animation: card-levitate 6s ease-in-out infinite;
  will-change: transform;
}
@keyframes card-levitate {
  0%, 100% { transform: translateY(6px); }
  50%      { transform: translateY(-6px); }
}
.arcana-float.is-paused,
.arcana-pool.is-paused,
.tarot-glow.is-paused { animation-play-state: paused; }

.tarot-scene--hero .tarot-card {
  border-radius: var(--radius-card);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.85);
}
.tarot-scene--hero .tarot-shadow {
  bottom: -7%;
  filter: blur(18px);
}

/* Ambient glow pool beneath the levitating card */
.arcana-pool {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -2.6rem;
  height: 5.2rem;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(50% 70% at 50% 40%,
              color-mix(in srgb, var(--accent, var(--gold)) 38%, transparent),
              transparent 75%);
  filter: blur(24px);
  animation: pool-breathe 6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes pool-breathe {
  0%, 100% { opacity: 0.55; transform: scaleX(0.94); }
  50%      { opacity: 0.95; transform: scaleX(1.04); }
}

.arcana-caption {
  margin-top: 3.4rem;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--accent, var(--gold));
  opacity: 0.7;
}

/* Right plane: the words */
.eyebrow--accent { color: var(--accent, var(--gold)); }
.eyebrow--accent::before {
  background: linear-gradient(90deg, transparent, var(--accent, var(--gold)));
}

.detail-title {
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
  margin-top: 1rem;
}

.detail-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  color: var(--accent-hot, var(--star-2));
  margin-top: 1.1rem;
  line-height: 1.4;
}

.detail-desc {
  margin-top: 1.4rem;
  color: var(--star-2);
  font-size: 1.08rem;
  max-width: 62ch;
}

.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin-top: 2.4rem;
}

@media (max-width: 900px) {
  .detail-hero-grid {
    grid-template-columns: 1fr;
    gap: 3.4rem;
  }
  .detail-card-plane { max-width: 280px; }
  .arcana-caption { margin-top: 2.8rem; }
}

/* --------------------------------------------------------------------------
   Detail features — each ingredient sealed with a gold rune tick
   -------------------------------------------------------------------------- */
.detail-features { padding-top: clamp(1.5rem, 4vw, 3rem); }

.feature-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 2.5rem;
}

.feature-grid li {
  position: relative;
  padding: 1.1rem 1.2rem 1.1rem 2.7rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.008));
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--star-2);
  font-size: 0.99rem;
  line-height: 1.5;
  transition: border-color 0.35s, transform 0.35s var(--ease-spring), opacity 0.9s var(--ease-spring);
}
.feature-grid li:hover {
  border-color: color-mix(in srgb, var(--accent, #fff) 35%, transparent);
  transform: translateX(4px);
}

/* The rune tick: a small gold check with a crossing engraver's stroke */
.feature-grid li::before {
  content: '';
  position: absolute;
  left: 1.1rem;
  top: 1.5rem;
  width: 10px;
  height: 5px;
  border-left: 1.6px solid var(--gold);
  border-bottom: 1.6px solid var(--gold);
  transform: rotate(-48deg);
  filter: drop-shadow(0 0 4px rgba(242, 193, 78, 0.5));
}
.feature-grid li::after {
  content: '';
  position: absolute;
  left: calc(1.1rem + 8px);
  top: calc(1.5rem - 5px);
  width: 1.6px;
  height: 5px;
  background: var(--gold-hot);
  transform: rotate(38deg);
  opacity: 0.85;
}

@media (max-width: 720px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   Related strip — mini arcana draws
   -------------------------------------------------------------------------- */
.mini-arcana-strip {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  gap: 2rem 1.6rem;
  max-width: 720px;
}

.mini-arcana {
  display: block;
  color: inherit;
  text-align: center;
}
a.mini-arcana:hover { color: inherit; }
a.mini-arcana:focus-visible {
  outline: 2px solid var(--accent, var(--gold));
  outline-offset: 5px;
  border-radius: var(--radius-s);
}

.mini-frame {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-s);
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, var(--void-3), var(--void-1));
  outline: 1px solid rgba(242, 193, 78, 0.14);
  outline-offset: -1px;
  box-shadow: 0 16px 36px -16px rgba(0, 0, 0, 0.7);
  transition: transform 0.45s var(--ease-spring), box-shadow 0.45s, outline-color 0.45s;
}
a.mini-arcana:hover .mini-frame,
a.mini-arcana:focus-visible .mini-frame {
  transform: translateY(-6px) rotate(-1.2deg);
  outline-color: color-mix(in srgb, var(--accent, var(--gold)) 55%, transparent);
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.8), 0 0 34px -8px var(--accent-dim);
}

.mini-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(80% 60% at 50% 35%, var(--accent-dim, var(--gold-dim)), transparent 70%),
    linear-gradient(165deg, var(--void-3), var(--void-1));
}
.mini-frame.is-artless .mini-fallback { display: flex; }
.mini-frame.is-artless .mini-art { visibility: hidden; }
.mini-fallback svg {
  width: 42%;
  height: auto;
  color: var(--accent, var(--gold));
}

.mini-plate {
  display: block;
  margin-top: 0.75rem;
}
.mini-numeral {
  display: block;
  font-size: 0.6rem;
  color: var(--accent, var(--gold));
  opacity: 0.8;
  margin-bottom: 0.2rem;
}
.mini-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 560;
  color: var(--star-1);
}
.mini-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.mini-arcana.is-coming { cursor: default; }
.mini-arcana.is-coming .mini-art { opacity: 0.8; }

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
    gap: 2rem 1.1rem;
  }
  .plate-name { font-size: 1rem; }
  .plate-meta { gap: 0.4rem 0.55rem; }
  .chip { font-size: 0.55rem; padding: 0.22rem 0.5rem; }
  .status { font-size: 0.6rem; }
  .detail-meta { gap: 1.1rem; }
}

/* --------------------------------------------------------------------------
   THE DRAW — the header fan becomes a live deck. projects.js arms the fan
   (.draw-ready + role=button) and runs the choreography; everything below
   is inert without it, so the no-JS fan stays purely decorative.
   -------------------------------------------------------------------------- */

/* Armed fan: clickable, breathing, spreads + brightens on hover/focus */
.head-fan.draw-ready {
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.4s ease;
}
@media (max-width: 720px) {
  /* smaller, quieter hand on phones — headline stays the protagonist */
  .head-fan.draw-ready {
    opacity: 0.34;
    transform: scale(0.72);
    transform-origin: top right;
  }
}
.head-fan.draw-ready:hover,
.head-fan.draw-ready:focus-visible { opacity: 0.8; }
.head-fan.draw-ready:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 8px;
  border-radius: var(--radius-m);
}

/* The headline's transparent block box paints above the fan — let pointer
   events fall through it so the armed fan behind is clickable. */
.projects-head.has-draw .eyebrow,
.projects-head.has-draw h1 { pointer-events: none; }

/* Hover spread rides the individual `rotate` property so it composes with
   (and never lags) the scroll-parallax `transform`. */
.head-fan.draw-ready img {
  rotate: 0deg;
  transition: rotate 0.5s var(--ease-spring), filter 0.4s ease, opacity 0.3s ease;
}
.head-fan.draw-ready:hover img,
.head-fan.draw-ready:focus-visible img { filter: brightness(1.16); }
.head-fan.draw-ready:hover img:nth-child(1),
.head-fan.draw-ready:focus-visible img:nth-child(1) { rotate: -5deg; }
.head-fan.draw-ready:hover img:nth-child(3),
.head-fan.draw-ready:focus-visible img:nth-child(3) { rotate: 5deg; }

/* While a card is out on the stage, its slot in the hand sits empty */
.head-fan.is-drawn img:nth-child(3) { opacity: 0; }

/* Soft breathing glow cupped behind the hand */
.fan-glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 270px;
  height: 230px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(242, 193, 78, 0.35), transparent 70%);
  filter: blur(16px);
  opacity: 0;
  pointer-events: none;
}
.draw-ready .fan-glow {
  opacity: 1;
  animation: fan-breathe 5.5s ease-in-out infinite;
}
.fan-glow.is-paused { animation-play-state: paused; }
@keyframes fan-breathe {
  0%, 100% { opacity: 0.35; transform: translate(-50%, -50%) scale(0.94); }
  50%      { opacity: 0.9;  transform: translate(-50%, -50%) scale(1.06); }
}

/* Small mono invitation resting ON the card fan (never in the page's text
   flow — below the fan it collides with the header lede) — armed by JS */
.fan-hint {
  position: absolute;
  left: 50%;
  bottom: 5.2rem;
  z-index: 4;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  white-space: nowrap;
  color: var(--gold-hot);
  text-shadow: 0 0 14px rgba(242, 193, 78, 0.6);
  background: rgba(6, 4, 15, 0.6);
  padding: 0.32rem 0.8rem;
  border: 1px solid rgba(242, 193, 78, 0.28);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.draw-ready .fan-hint { opacity: 0.9; }

@media (max-width: 720px) {
  .head-fan.draw-ready { right: -2.2rem; opacity: 0.45; }
  .head-fan.draw-ready:hover,
  .head-fan.draw-ready:focus-visible { opacity: 0.7; }
}

/* ---- The drawn card: dimming veil + fixed stage above the nav ------------ */
html.draw-open { overflow: hidden; }

/* Author display rules below would defeat the [hidden] UA style — restore it */
.draw-veil[hidden],
.draw-stage[hidden] { display: none; }

.draw-veil {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(6, 4, 15, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
  cursor: pointer;
}
.draw-veil.is-open { opacity: 1; }

.draw-stage {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.3rem;
  padding: 1.25rem;
  pointer-events: none; /* background clicks fall through to the veil */
}
.draw-stage .draw-card,
.draw-stage .draw-plate { pointer-events: auto; }

.draw-card {
  position: relative;
  width: min(300px, 30.6vh, 78vw); /* 30.6vh ≈ width of a 46vh-tall 2:3 card */
  aspect-ratio: 2 / 3;
  perspective: 1200px;
  will-change: transform;
}

.draw-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s var(--ease-spring);
}
.draw-stage.is-flipped .draw-card-inner { transform: rotateY(180deg); }
.draw-stage.is-returning .draw-card-inner { transition: transform 0.3s ease-in; }

.draw-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-card);
  outline: 1px solid rgba(242, 193, 78, 0.28);
  outline-offset: -1px;
  box-shadow: 0 42px 90px -26px rgba(0, 0, 0, 0.9), 0 0 70px -22px rgba(242, 193, 78, 0.5);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.draw-face--front { transform: rotateY(180deg); }

/* Gold glint that sweeps the face as the flip passes halfway */
.draw-glint {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  transform: rotateY(180deg) translateZ(1px);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  pointer-events: none;
}
.draw-glint::before {
  content: '';
  position: absolute;
  top: -25%;
  bottom: -25%;
  left: -75%;
  width: 55%;
  transform: skewX(-18deg);
  background: linear-gradient(105deg,
              transparent,
              rgba(255, 236, 190, 0.45) 42%,
              rgba(255, 253, 244, 0.9) 50%,
              rgba(255, 236, 190, 0.45) 58%,
              transparent);
  mix-blend-mode: screen;
  opacity: 0;
}
.draw-stage.is-glinting .draw-glint::before {
  animation: draw-glint-sweep 0.55s ease-out forwards;
}
@keyframes draw-glint-sweep {
  from { opacity: 1; translate: 0 0; }
  to   { opacity: 0; translate: 350% 0; }
}

/* Caption plate: name + tagline + workshop link */
.draw-plate {
  position: relative;
  max-width: min(430px, 88vw);
  text-align: center;
  padding: 1.05rem 1.5rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: linear-gradient(180deg, rgba(23, 16, 51, 0.88), rgba(10, 7, 24, 0.88));
  box-shadow: var(--shadow-deep);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease-spring);
}
.draw-plate::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 16%;
  right: 16%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(242, 193, 78, 0.7), transparent);
}
.draw-stage.is-revealed .draw-plate {
  opacity: 1;
  transform: none;
}

.draw-name { font-size: 1.45rem; }
.draw-tagline {
  margin-top: 0.35rem;
  font-family: var(--font-display);
  font-style: italic;
  color: var(--star-2);
  font-size: 1.02rem;
  line-height: 1.45;
}
.draw-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  transition: color 0.3s;
}
.draw-link:hover { color: var(--gold-hot); }
.draw-link svg { transition: transform 0.35s var(--ease-spring); }
.draw-link:hover svg { transform: translateX(3px); }
.draw-link:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 4px;
  border-radius: 3px;
}

/* Reduced-motion draw (projects.js adds .draw-rm live, so a mid-session
   preference change is honoured): the draw still works — an instant swap
   with a 150ms crossfade instead of fly + flip. */
.draw-stage.draw-rm {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.draw-stage.draw-rm.is-open { opacity: 1; }
.draw-stage.draw-rm .draw-card-inner,
.draw-stage.draw-rm .draw-plate { transition: none; }
.draw-stage.draw-rm .draw-plate { transform: none; }

/* --------------------------------------------------------------------------
   Reduced motion — stillness, not brokenness
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .arcana-float,
  .arcana-pool,
  .tarot-glow { animation: none; }
  .status--live .status-dot { animation: none; }
  .tarot-card,
  .tarot-shadow,
  a.tarot-link .tarot-scene { transition: none; }
  .head-fan img { transform: rotate(var(--fan-rot, 0deg)); }

  /* THE DRAW under reduced motion */
  .draw-ready .fan-glow { animation: none; opacity: 0.5; }
  .head-fan.draw-ready,
  .head-fan.draw-ready img,
  .fan-hint,
  .draw-card-inner,
  .draw-plate { transition: none; }
  .draw-glint::before { animation: none; }
  .draw-veil { transition-duration: 0.15s; }
}
