/* =====================================================================
   MUGGER CITY — Anatomy Gallery (Gallery 03)
   One specimen, two states: external (organic) and internal (x-ray).
   Reuses palette + type from styles.css :root.
   ===================================================================== */

.anatomy {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(2.5rem, 5vw, 4.25rem) clamp(1.5rem, 5vw, 4.5rem)
           clamp(2rem, 4vw, 3.25rem);
  overflow: hidden;
  isolation: isolate;

  /* external (default) theme tokens */
  --a-tone: #ece5d6;
  --a-surface: rgba(248, 245, 238, 0.74);
  --a-ink: #34382c;
  --a-ink-soft: #5f6253;
  --a-accent: #9c7e3f;
  --a-strong: #28331f;
  --a-hair: rgba(40, 51, 31, 0.16);
  --a-glow: rgba(255, 253, 247, 0.5);
  --hot-halo: rgba(247, 243, 233, 0.86);

  transition: color 0.9s var(--ease);
}

/* internal — clinical x-ray theme */
.anatomy[data-mode="internal"] {
  --a-tone: #18222f;
  --a-surface: rgba(30, 43, 60, 0.55);
  --a-ink: #d3dce7;
  --a-ink-soft: #93a3b7;
  --a-accent: #87b4cd;
  --a-strong: #eaf1f7;
  --a-hair: rgba(150, 178, 205, 0.22);
  --a-glow: rgba(120, 160, 200, 0.14);
  --hot-halo: rgba(13, 22, 36, 0.72);
}

/* ---- atmosphere ----------------------------------------------------- */
.anat-atmos {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--a-tone);
  transition: background-color 0.9s var(--ease);
}
.anat-atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 92% at 50% 32%, var(--a-glow), transparent 56%);
  transition: background 0.9s var(--ease);
}
.anat-atmos::before {
  content: "";
  position: absolute;
  inset: -50%;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}
.anatomy[data-mode="internal"] .anat-atmos::before { mix-blend-mode: screen; opacity: 0.4; }

.anat-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity 0.9s var(--ease);
}
.anat-bg-organic { color: var(--river); opacity: 0.06; }
.anat-bg-grid {
  opacity: 0;
  background-image:
    linear-gradient(rgba(150, 178, 205, 0.5) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150, 178, 205, 0.5) 1px, transparent 1px);
  background-size: 54px 54px;
  background-position: center;
  -webkit-mask-image: radial-gradient(120% 100% at 50% 45%, #000 40%, transparent 80%);
          mask-image: radial-gradient(120% 100% at 50% 45%, #000 40%, transparent 80%);
}
.anatomy[data-mode="internal"] .anat-bg-organic { opacity: 0; }
.anatomy[data-mode="internal"] .anat-bg-grid { opacity: 0.5; }

.anat-archive {
  position: absolute;
  right: clamp(1.5rem, 5vw, 4.5rem);
  bottom: clamp(1.5rem, 3vw, 2.4rem);
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--a-ink-soft);
  opacity: 0.6;
  transition: color 0.9s var(--ease);
}

/* ---- shell ---------------------------------------------------------- */
.anatomy-inner {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

/* ---- header + toggle ------------------------------------------------ */
.anatomy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
}

.anat-eyebrow {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--a-accent);
  transition: color 0.9s var(--ease);
}
.anat-title {
  margin: 0.7rem 0 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 300;
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  letter-spacing: 0.01em;
  color: var(--a-strong);
  line-height: 1.02;
  transition: color 0.9s var(--ease);
}
.anat-intro {
  margin: 0.85rem 0 0;
  max-width: 42ch;
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.7;
  color: var(--a-ink-soft);
  transition: color 0.9s var(--ease);
}
.anat-class {
  margin: 0.95rem 0 0;
  font-size: 0.6rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--a-ink-soft);
  opacity: 0.8;
  transition: color 0.9s var(--ease);
}

.view-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.4rem;
}
.vt-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.2rem 0;
  font: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--a-ink-soft);
  cursor: pointer;
  position: relative;
  transition: color 0.5s var(--ease);
}
.vt-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 1px;
  background: var(--a-accent);
  transform: scaleX(0);
  transition: transform 0.5s var(--ease), background-color 0.9s var(--ease);
}
.vt-btn:hover { color: var(--a-strong); }
.vt-btn.is-active { color: var(--a-strong); }
.vt-btn.is-active::after { transform: scaleX(1); }
.vt-btn:focus-visible { outline: 1px solid var(--a-accent); outline-offset: 4px; }
.vt-div {
  width: 1px;
  height: 14px;
  background: var(--a-hair);
  transition: background-color 0.9s var(--ease);
}

/* ---- stage: panel + specimen --------------------------------------- */
.anatomy-stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 330px) 1fr;
  align-items: center;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(1.5rem, 3vw, 2.5rem) 0 0;
}

/* the museum label */
.anat-panel {
  align-self: center;
  max-width: 360px;
  padding: clamp(1.4rem, 2vw, 1.9rem);
  background: var(--a-surface);
  border: 1px solid var(--a-hair);
  border-radius: 2px;
  transition: background-color 0.9s var(--ease), border-color 0.9s var(--ease);
}
.panel-index {
  margin: 0 0 1.1rem;
  font-size: 0.58rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--a-accent);
  transition: color 0.9s var(--ease);
}
.panel-body { display: block; }
.panel-part {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 2.4vw, 2.05rem);
  line-height: 1.08;
  color: var(--a-strong);
  transition: color 0.9s var(--ease);
}
.panel-title {
  margin: 0.3rem 0 0;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--a-accent);
  transition: color 0.9s var(--ease);
}
.panel-desc {
  margin: 1.05rem 0 0;
  font-size: 0.86rem;
  line-height: 1.72;
  font-weight: 300;
  color: var(--a-ink-soft);
  transition: color 0.9s var(--ease);
}
/* what makes it special (optional) */
.panel-special { margin: 1.05rem 0 0; }
.special-text {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.72;
  font-weight: 300;
  color: var(--a-ink-soft);
  transition: color 0.9s var(--ease);
}
.special-points {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}
.special-points li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.32rem;
  font-size: 0.84rem;
  line-height: 1.6;
  font-weight: 300;
  color: var(--a-ink-soft);
  transition: color 0.9s var(--ease);
}
.special-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.66em;
  width: 6px;
  height: 1px;
  background: var(--a-accent);
  transition: background-color 0.9s var(--ease);
}

/* shared small archival section label */
.facts-k, .super-k, .ia-k {
  display: block;
  font-size: 0.57rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--a-accent);
  margin-bottom: 0.5rem;
  transition: color 0.9s var(--ease);
}

/* fascinating facts */
.panel-facts-wrap {
  margin: 1.15rem 0 0;
  padding: 0.95rem 0 0;
  border-top: 1px solid var(--a-hair);
  transition: border-color 0.9s var(--ease);
}
.panel-facts { margin: 0; padding: 0; list-style: none; }
.panel-facts li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.42rem;
  font-size: 0.84rem;
  line-height: 1.62;
  font-weight: 300;
  color: var(--a-ink-soft);
  transition: color 0.9s var(--ease);
}
.panel-facts li:last-child { margin-bottom: 0; }
.panel-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 6px;
  height: 1px;
  background: var(--a-accent);
  opacity: 0.85;
  transition: background-color 0.9s var(--ease);
}

/* superpower */
.panel-super {
  margin: 1.15rem 0 0;
  padding: 0.95rem 0 0;
  border-top: 1px solid var(--a-hair);
  transition: border-color 0.9s var(--ease);
}
.super-v {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.04rem;
  line-height: 1.4;
  color: var(--a-strong);
  transition: color 0.9s var(--ease);
}

/* interactive feature (a quiet museum-station note) */
.panel-interactive {
  margin: 1.1rem 0 0;
  padding: 0.95rem 0 0;
  border-top: 1px solid var(--a-hair);
  transition: border-color 0.9s var(--ease);
}
.ia-name {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.0rem;
  line-height: 1.35;
  color: var(--a-strong);
  transition: color 0.9s var(--ease);
}
.ia-items {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.7;
  color: var(--a-ink-soft);
  opacity: 0.9;
  transition: color 0.9s var(--ease);
}

/* gentle content swap */
.anat-panel.swap .panel-body { animation: labelSwap 0.6s var(--ease); }

/* ---- specimen viewport --------------------------------------------- */
.anat-viewport {
  position: relative;
  width: 100%;
  max-width: 1080px;
  aspect-ratio: 2131 / 546;
  margin: 0 auto;
  justify-self: center;
}

.specimen-stack { position: absolute; inset: 0; }
.croc-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
.croc-ext { filter: drop-shadow(0 20px 22px rgba(40, 51, 31, 0.14)); }
.croc-int { filter: drop-shadow(0 18px 26px rgba(10, 22, 40, 0.35)); }
.croc-img.is-shown { opacity: 1; }

/* contact shadow / baseline */
.anat-baseline {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 4%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--a-hair) 14%, var(--a-hair) 86%, transparent);
  transition: opacity 0.9s var(--ease), background-color 0.9s var(--ease);
}
.anat-viewport::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3.2%;
  width: 66%;
  height: 22px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(40, 51, 31, 0.2) 0%, rgba(40, 51, 31, 0.07) 46%, transparent 72%);
  filter: blur(7px);
  z-index: -1;
  transition: opacity 0.9s var(--ease);
}
.anatomy[data-mode="internal"] .anat-viewport::after { opacity: 0.35; }

.anat-specimen-id {
  position: absolute;
  left: 4%;
  bottom: -1.4rem;
  margin: 0;
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--a-ink-soft);
  transition: color 0.9s var(--ease);
}
.id-scale { color: var(--a-accent); transition: color 0.9s var(--ease); }

/* ---- x-ray scan beam ------------------------------------------------ */
.scan-beam {
  position: absolute;
  top: 4%;
  bottom: 4%;
  left: -14%;
  width: 12%;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent,
    rgba(190, 214, 232, 0.28) 45%, rgba(220, 234, 244, 0.5) 50%,
    rgba(190, 214, 232, 0.28) 55%, transparent);
  filter: blur(1px);
}
.anatomy.sweeping .scan-beam { animation: beamSweep 0.95s var(--ease); }
@keyframes beamSweep {
  0%   { left: -14%; opacity: 0; }
  14%  { opacity: 0.95; }
  86%  { opacity: 0.95; }
  100% { left: 102%; opacity: 0; }
}

/* ---- hotspots ------------------------------------------------------- */
.hotspot-layer { position: absolute; inset: 0; }
.hot {
  position: absolute;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.55s var(--ease);
}
.anatomy[data-mode="external"] .hot-ext,
.anatomy[data-mode="internal"] .hot-int { opacity: 1; visibility: visible; }

/* ring + a contrasting backing disc so the marker reads on any part of the
   specimen; a clear themed ring, a high-contrast centre, a soft grounding shadow */
.hot::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--hot-halo);
  border: 1.5px solid var(--a-accent);
  box-shadow: 0 1px 4px rgba(12, 16, 10, 0.32);
  transition: inset 0.35s var(--ease), background-color 0.9s var(--ease),
              border-color 0.9s var(--ease), box-shadow 0.35s var(--ease);
}
.hot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--a-strong);
  transform: translate(-50%, -50%);
  transition: width 0.35s var(--ease), height 0.35s var(--ease),
              background-color 0.9s var(--ease);
}
.hot:hover::before { inset: 2px; box-shadow: 0 2px 7px rgba(12, 16, 10, 0.38); }
.hot:hover::after { width: 6px; height: 6px; }
.hot.is-active::before {
  inset: 1px;
  border-width: 2px;
  background: var(--a-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-accent) 24%, transparent),
              0 2px 8px rgba(12, 16, 10, 0.4);
}
.hot.is-active::after { width: 7px; height: 7px; background: var(--hot-halo); }
.hot:focus-visible { outline: none; }
.hot:focus-visible::before {
  inset: 1px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--a-accent) 32%, transparent),
              0 2px 8px rgba(12, 16, 10, 0.4);
}

/* ---- entrance ------------------------------------------------------- */
.reveal-a { opacity: 0; transform: translateY(16px); }
.anatomy.in-view .reveal-a { animation: rise 1.2s var(--ease) forwards; }
.anatomy.in-view .anatomy-stage { animation-delay: 0.16s; }

/* ===================================================================== */
/*  Responsive                                                           */
/* ===================================================================== */
@media (max-width: 900px) {
  .anatomy-head { flex-direction: column; gap: 1.4rem; align-items: flex-start; }
  .view-toggle { padding-top: 0; }
  .anatomy-stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(2rem, 6vw, 3rem);
  }
  .anat-viewport { order: 1; max-width: 680px; }
  .anat-panel {
    order: 2;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    text-align: center;
  }
  /* keep bulleted lists readable (left-aligned) within the centred panel */
  .panel-facts, .special-points {
    text-align: left;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
  }
  .anat-specimen-id { left: 50%; transform: translateX(-50%); }
}

@media (max-width: 560px) {
  .anatomy { padding-left: 1.25rem; padding-right: 1.25rem; }
  .hot { width: 30px; height: 30px; } /* larger tap targets */
  .anat-intro { font-size: 0.88rem; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-a { opacity: 1; transform: none; }
  .anatomy.in-view .reveal-a { animation: none; }
  .croc-img { transition: opacity 0.2s linear; }
  .anatomy.sweeping .scan-beam { animation: none; }
  .anat-panel.swap .panel-body { animation: none; }
}
