@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

/* ============================================================================
   THE SPECIMEN — stylesheet for the Example Domain story site
   ----------------------------------------------------------------------------
   The artifact stays canonical (#eee page, #fdfdff card, #348 link, system-ish
   sans). Everything added by this stylesheet is *annotation layer*: surveyor
   orange, mono labels, crop corners, dimension lines, elevation as a system.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   01 · TOKENS
   ------------------------------------------------------------------------ */

:root {
  /* — canonical artifact colours (never altered) — */
  --c-page: #eeeeee;
  --c-card: #fdfdff;
  --c-blue: #348;
  --c-specimen-ink: #333;

  /* — site chrome / annotation — */
  --c-ink: #1a1a1e;
  --c-ink-soft: #565a66;
  --c-hair: #d6d9e0;
  --c-orange: #ff4a17;
  --c-chamber: #0a1524;
  --c-paper: #f4f0e6;
  --c-paper-ink: #2a2620;

  /* — 8pt spacing scale — */
  --s-1: 0.5rem;   /*  8px */
  --s-2: 1rem;     /* 16px */
  --s-3: 1.5rem;   /* 24px */
  --s-4: 2rem;     /* 32px */
  --s-5: 3rem;     /* 48px */
  --s-6: 4rem;     /* 64px */
  --s-7: 6rem;     /* 96px */
  --s-8: 8rem;     /* 128px */

  /* — modular type scale · perfect fourth 1.333 · root 1rem — */
  --t-label: 0.75rem;    /* 12px */
  --t-body: 1rem;        /* 16px */
  --t-lede: 1.333rem;    /* 21px */
  --t-h3: 1.777rem;      /* 28px */
  --t-h2: 2.369rem;      /* 38px */
  --t-h1: 3.157rem;      /* 50px */
  --t-display: 5.61rem;  /* 90px */

  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 62ch;
  --measure-tight: 38ch;

  /* — elevation system: one light position drives every shadow — */
  --light-y: 0.18em;
  --lift-0: 0 0 0 rgba(10, 21, 36, 0);
  --lift-1: 0 0.03em 0.06em rgba(10, 21, 36, 0.07),
            0 0.18em 0.45em rgba(10, 21, 36, 0.05);
  --lift-2: 0 0.06em 0.12em rgba(10, 21, 36, 0.08),
            0 0.36em 0.9em rgba(10, 21, 36, 0.07);
  --lift-3: 0 0.1em 0.2em rgba(10, 21, 36, 0.09),
            0 0.55em 1.5em rgba(10, 21, 36, 0.08);
  --lift-4: 0 0.18em 0.36em rgba(10, 21, 36, 0.1),
            0 0.95em 2.6em rgba(10, 21, 36, 0.1);
  --lift-pressed: inset 0 1px 2px rgba(10, 21, 36, 0.16);

  /* — motion — */
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.18s;
  --dur: 0.4s;
  --dur-slow: 0.8s;

  /* — grain (feTurbulence, inlined) — */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23grain)'/%3E%3C/svg%3E");

  --header-h: 4.5rem;
}

@media (min-width: 48rem) {
  :root {
    --header-h: 3.5rem;
  }
}

/* ---------------------------------------------------------------------------
   02 · RESET & BASE
   ------------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--c-page);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.6;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain over the gray — turns default browser gray into exhibition surface. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background-image: var(--grain);
  background-size: 220px 220px;
  background-repeat: repeat;
  opacity: 0.035;
  mix-blend-mode: multiply;
}

img,
svg,
video {
  max-width: 100%;
  display: block;
}

a {
  color: var(--c-blue);
  text-underline-offset: 0.18em;
}

p {
  margin: 0 0 var(--s-2);
  max-width: var(--measure);
}

ul,
ol {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

::selection {
  background: var(--c-orange);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---------------------------------------------------------------------------
   03 · SKIP LINK
   ------------------------------------------------------------------------ */

.skip-link {
  position: fixed;
  top: var(--s-1);
  left: var(--s-1);
  z-index: 10000;
  transform: translateY(-180%);
  padding: var(--s-1) var(--s-2);
  background: var(--c-ink);
  color: var(--c-paper);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  box-shadow: var(--lift-3);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--c-orange);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
   04 · SITE HEADER + CHAPTER NAV
   ------------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  gap: var(--s-1);
  padding: var(--s-1) var(--s-2);
  background: rgba(238, 238, 238, 0.9);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  backdrop-filter: blur(10px) saturate(1.15);
  border-bottom: 1px solid var(--c-hair);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(
    90deg,
    var(--c-orange) 0,
    var(--c-orange) 3.5rem,
    transparent 3.5rem
  );
  pointer-events: none;
}

.site-title {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-ink);
  margin: 0;
  white-space: nowrap;
}

.site-title::before {
  content: "◻";
  display: inline-block;
  margin-right: 0.6em;
  color: var(--c-orange);
  font-size: 0.9em;
  transform: translateY(-0.05em);
}

.site-subtitle {
  display: none;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  margin: 0;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}

.chapter-nav {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.chapter-nav::-webkit-scrollbar {
  display: none;
}

.chapter-nav ul {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-nav li {
  flex: 0 0 auto;
}

.chapter-nav a {
  display: inline-block;
  position: relative;
  padding: var(--s-1) 0;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.chapter-nav a::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 1px;
  background: var(--c-orange);
  transition: width var(--dur) var(--ease-out);
}

.chapter-nav a:hover,
.chapter-nav a:focus-visible {
  color: var(--c-ink);
}

.chapter-nav a:hover::before,
.chapter-nav a:focus-visible::before {
  width: 100%;
}

@media (min-width: 48rem) {
  .site-header {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--s-4);
    padding: var(--s-1) var(--s-4);
    min-height: var(--header-h);
  }

  .site-subtitle {
    display: block;
    justify-self: center;
  }

  .chapter-nav {
    justify-self: end;
    overflow: visible;
  }
}

@media (min-width: 64rem) {
  .site-header {
    padding-inline: var(--s-5);
  }
}

/* ---------------------------------------------------------------------------
   05 · STORY SHELL — pinned specimen viewer + scrolling column
   ------------------------------------------------------------------------ */

.story-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  width: 100%;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 var(--s-2);
}

.anchor-target,
.chapter {
  scroll-margin-top: calc(var(--header-h) + var(--s-3));
}

@media (min-width: 60rem) {
  .story-shell {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
    column-gap: var(--s-6);
    padding: 0 var(--s-4);
  }
}

@media (min-width: 78rem) {
  .story-shell {
    column-gap: var(--s-7);
    padding-inline: var(--s-5);
  }
}

/* ---------------------------------------------------------------------------
   06 · VIEWER PANEL (pinned)
   ------------------------------------------------------------------------ */

.viewer-panel {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  height: 42vh;
  min-height: 15rem;
  max-height: 26rem;
  padding: var(--s-2) 0 var(--s-2);
  background: linear-gradient(
    180deg,
    var(--c-page) 0%,
    var(--c-page) 82%,
    rgba(238, 238, 238, 0) 100%
  );
}

.viewer-panel__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  padding-inline: var(--s-1);
  border-bottom: 1px solid var(--c-hair);
  padding-bottom: var(--s-1);
}

.viewer-panel__meta > :first-child {
  color: var(--c-orange);
}

.viewer-stage {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--s-2);
  overflow: hidden;
  border-radius: 2px;
}

/* Surveyor graph paper, masked to a soft radial falloff. */
.viewer-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--c-hair) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-hair) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center center;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(
    ellipse 78% 68% at 50% 50%,
    #000 12%,
    rgba(0, 0, 0, 0.35) 55%,
    transparent 82%
  );
  mask-image: radial-gradient(
    ellipse 78% 68% at 50% 50%,
    #000 12%,
    rgba(0, 0, 0, 0.35) 55%,
    transparent 82%
  );
}

/* Soft cool scrim so the card never sits on raw gray. */
.viewer-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 60% at 50% 48%,
    rgba(255, 255, 255, 0.72) 0%,
    rgba(253, 253, 255, 0) 72%
  );
}

.viewer-stage.is-active {
  border-radius: 2px;
}

.viewer-note {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  padding-inline: var(--s-1);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--s-1);
  max-width: none;
}

.viewer-note::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--c-orange);
  flex: 0 0 auto;
}

@media (min-width: 60rem) {
  .viewer-panel {
    top: var(--header-h);
    height: calc(100vh - var(--header-h) - var(--s-2));
    max-height: none;
    padding: var(--s-3) 0 var(--s-2);
    background: none;
  }

  .viewer-stage {
    padding: var(--s-3);
  }
}

/* ---------------------------------------------------------------------------
   07 · THE SPECIMEN CARD (canonical)
   ------------------------------------------------------------------------ */

.specimen-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 34rem;
  padding: 2em;
  background: var(--c-card);
  color: var(--c-specimen-ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.5em;
  box-shadow: var(--lift-1);
  transition: box-shadow var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out),
    filter var(--dur-slow) var(--ease-out);
}

.specimen-card p {
  margin: 1em 0;
  font-size: 1em;
  line-height: 1.5;
  max-width: 46ch;
  color: var(--c-specimen-ink);
}

.specimen-card__title {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 2em;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--c-specimen-ink);
}

.specimen-link {
  color: var(--c-blue);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.08em;
  transition: border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.specimen-link:hover,
.specimen-link:focus-visible {
  border-bottom-color: currentColor;
  color: #2a3a7a;
}

.specimen-card--canonical {
  box-shadow: var(--lift-1);
}

/* ---------------------------------------------------------------------------
   08 · ANNOTATION LAYERS · CROP CORNERS
   ------------------------------------------------------------------------ */

.annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: multiply;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-orange);
  transition: opacity var(--dur) var(--ease-out);
}

.annotation-layer.is-active,
.viewer-stage.is-active > .annotation-layer,
.viewer-panel.is-active .annotation-layer {
  opacity: 1;
}

.annotation-layer--corners {
  inset: 10% 4%;
  clip-path: inset(0 100% 100% 0);
  transition: opacity var(--dur) var(--ease-out),
    clip-path var(--dur) var(--ease-out);
}

.annotation-layer--corners.is-active,
.viewer-stage.is-active > .annotation-layer--corners {
  clip-path: inset(0 0 0 0);
  animation: xray-travel 9s var(--ease-in-out) infinite;
}

.crop-corner {
  position: absolute;
  width: 1.375rem;
  height: 1.375rem;
  border: 0 solid var(--c-orange);
  opacity: 0.95;
}

.crop-corner--tl {
  top: 0;
  left: 0;
  border-top-width: 2px;
  border-left-width: 2px;
}

.crop-corner--tr {
  top: 0;
  right: 0;
  border-top-width: 2px;
  border-right-width: 2px;
}

.crop-corner--bl {
  bottom: 0;
  left: 0;
  border-bottom-width: 2px;
  border-left-width: 2px;
}

.crop-corner--br {
  bottom: 0;
  right: 0;
  border-bottom-width: 2px;
  border-right-width: 2px;
}

.crop-corner::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--c-orange);
  border-radius: 50%;
}

.crop-corner--tl::after { top: -3px; left: -3px; }
.crop-corner--tr::after { top: -3px; right: -3px; }
.crop-corner--bl::after { bottom: -3px; left: -3px; }
.crop-corner--br::after { bottom: -3px; right: -3px; }

@media (min-width: 60rem) {
  .annotation-layer--corners {
    inset: 19% 5%;
  }
}

/* ---------------------------------------------------------------------------
   09 · CHAPTER 02 · ANATOMY — dimension lines, dots, labels, callouts
   ------------------------------------------------------------------------ */

.specimen-card--anatomy {
  filter: grayscale(0.88) brightness(0.97);
  box-shadow: var(--lift-2);
  outline: 1px dashed rgba(255, 74, 23, 0.4);
  outline-offset: 14px;
}

.anatomy-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.dim-line {
  position: absolute;
  left: var(--x, 12%);
  top: var(--y, 50%);
  width: var(--w, 8rem);
  height: 1px;
  background: var(--c-orange);
  transform-origin: 0 50%;
  transform: rotate(var(--r, 0deg));
}

.dim-line::before,
.dim-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--c-orange);
}

.dim-line::before { left: 0; }
.dim-line::after { right: 0; }

.dim-line--tick {
  width: 1px;
  height: var(--w, 4rem);
  background: repeating-linear-gradient(
    180deg,
    var(--c-orange) 0 2px,
    transparent 2px 6px
  );
}

.dim-line--tick::before,
.dim-line--tick::after {
  top: auto;
  left: -4px;
  width: 9px;
  height: 1px;
}

.dim-line--tick::before { top: 0; }
.dim-line--tick::after { bottom: 0; }

.dim-dot {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--c-orange);
  box-shadow: 0 0 0 3px rgba(255, 74, 23, 0.16);
  animation: dot-pulse 2.6s var(--ease-in-out) infinite;
}

.dim-label {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  transform: translate(var(--tx, 0), var(--ty, -50%));
  padding: 0.15em 0.5em;
  background: var(--c-page);
  color: var(--c-orange);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  mix-blend-mode: multiply;
}

.anatomy-callouts {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.callout {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  transform: translate(var(--tx, 0), var(--ty, -50%));
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 12rem;
  padding: 0.2em 0;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-orange);
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.is-active .callout,
.viewer-stage.is-active .callout {
  opacity: 1;
}

.callout::before {
  content: "";
  flex: 0 0 auto;
  width: 1.5rem;
  height: 1px;
  background: var(--c-orange);
}

.callout::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--c-orange);
}

.callout--radius {
  --x: 68%;
  --y: 22%;
  flex-direction: row-reverse;
  text-align: right;
}

.callout--radius::before {
  width: 2.25rem;
}

.callout--padding {
  --x: 4%;
  --y: 44%;
  --tx: -100%;
}

.callout--padding::before {
  display: none;
}

.callout--shadow {
  --x: 30%;
  --y: 88%;
  --ty: 0;
  flex-direction: row;
}

.callout--baseline {
  --x: 8%;
  --y: 66%;
  --tx: -100%;
  flex-direction: row-reverse;
  text-align: right;
}

.callout strong {
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: 0.06em;
}

.callout span {
  display: block;
  color: var(--c-ink-soft);
  letter-spacing: 0.06em;
}

@media (min-width: 60rem) {
  .callout {
    max-width: 14rem;
  }

  .callout--padding { --x: 2%; }
  .callout--baseline { --x: 4%; }
  .callout--radius { --x: 72%; --y: 18%; }
  .callout--shadow { --x: 34%; --y: 92%; }
}

/* ---------------------------------------------------------------------------
   10 · CHAPTER 03 · THE BLUE LINK — arrow + target
   ------------------------------------------------------------------------ */

.specimen-link--target {
  position: relative;
  z-index: 8;
  display: inline-block;
  padding: 0 0.15em;
  color: var(--c-blue);
  background: rgba(255, 74, 23, 0.08);
  box-shadow: 0 0 0 1px var(--c-orange);
  outline-offset: 0;
}

.specimen-link--target::after {
  content: "";
  position: absolute;
  right: -0.55em;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--c-orange);
  animation: dot-pulse 2.2s var(--ease-in-out) infinite;
}

.annotation-layer--link {
  z-index: 9;
}

.callout--link {
  --x: 88%;
  --y: 62%;
  --tx: -100%;
  flex-direction: row-reverse;
  text-align: right;
  color: var(--c-orange);
}

.callout--link::before {
  width: 3rem;
}

.arrow {
  position: absolute;
  left: var(--x, 4%);
  top: var(--y, 46%);
  width: var(--w, 9rem);
  height: auto;
  overflow: visible;
  pointer-events: none;
  transform: rotate(var(--r, 0deg));
  transform-origin: 50% 50%;
}

.arrow-path {
  fill: none;
  stroke: var(--c-orange);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 320;
  stroke-dashoffset: 320;
}

.is-active .arrow-path,
.viewer-stage.is-active .arrow-path {
  animation: draw-path 1.4s 0.15s var(--ease-out) forwards;
}

.arrow-head {
  fill: var(--c-orange);
  opacity: 0;
}

.is-active .arrow-head,
.viewer-stage.is-active .arrow-head {
  animation: head-in 0.3s 1.35s var(--ease-out) forwards;
}

/* ---------------------------------------------------------------------------
   11 · CHAPTER 04 · THE RESERVE — dark chamber, RFC document
   ------------------------------------------------------------------------ */

.chapter--reserve {
  position: relative;
  margin-block: var(--s-6);
  padding: var(--s-5) var(--s-3);
  background: var(--c-chamber);
  color: #c4d0e0;
  border-radius: 2px;
  overflow: hidden;
}

.chapter--reserve::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0) 45%
    ),
    radial-gradient(
      ellipse 90% 70% at 12% 0%,
      rgba(255, 74, 23, 0.14) 0%,
      rgba(255, 74, 23, 0) 62%
    );
}

.chapter--reserve .chapter-title {
  color: #f2f5fa;
}

.chapter--reserve .chapter-kicker {
  color: var(--c-orange);
}

.chapter--reserve .lede {
  color: #d8e1ee;
}

.rfc-document {
  position: relative;
  margin-top: var(--s-4);
  padding: var(--s-3);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
  color: #aeb9c9;
  overflow: hidden;
}

.rfc-document::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03) 0 1px,
    transparent 1px 7px
  );
  opacity: 0.6;
}

.rfc-document::after {
  content: "RFC 2606";
  position: absolute;
  top: var(--s-2);
  right: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.18em;
  color: var(--c-orange);
}

.rfc-document p {
  margin: 0 0 var(--s-2);
  max-width: 58ch;
}

.rfc-document p:last-child {
  margin-bottom: 0;
}

.rfc-list {
  list-style: none;
  margin: var(--s-3) 0 0;
  padding: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.rfc-list li {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: var(--s-2);
  align-items: baseline;
  padding: var(--s-1) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background-color var(--dur-fast) var(--ease-out),
    padding-left var(--dur-fast) var(--ease-out);
}

.rfc-list li:hover {
  background: rgba(255, 255, 255, 0.04);
  padding-left: var(--s-1);
}

.rfc-list li > :first-child {
  color: var(--c-orange);
}

.rfc-list li > :last-child {
  color: #c4d0e0;
}

.annotation-layer--reserve {
  mix-blend-mode: normal;
  color: var(--c-orange);
}

.callout--reserve {
  --x: 6%;
  --y: 14%;
  --tx: 0;
  color: var(--c-orange);
  mix-blend-mode: normal;
}

.callout--reserve strong {
  color: #f2f5fa;
}

.callout--reserve span {
  color: #8d9aad;
}

/* ---------------------------------------------------------------------------
   12 · CHAPTER 05 · THE TRIPLETS — difference blend stack
   ------------------------------------------------------------------------ */

.triplet-stack {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 14rem;
  margin-block: var(--s-4);
  padding: var(--s-5) var(--s-2);
  background: var(--c-chamber);
  border-radius: 2px;
  overflow: hidden;
}

.triplet-stack::after {
  content: "DIFFERENCE";
  position: absolute;
  right: var(--s-2);
  bottom: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

.triplet-card {
  grid-area: 1 / 1;
  width: min(100%, 18rem);
  padding: var(--s-3);
  background: var(--c-card);
  color: var(--c-specimen-ink);
  font-family: var(--font-sans);
  line-height: 1.45;
  border-radius: 0.5em;
  box-shadow: var(--lift-3);
  mix-blend-mode: difference;
  transition: transform var(--dur-slow) var(--ease-out),
    filter var(--dur-slow) var(--ease-out);
}

.triplet-card__title,
.triplet-card p {
  margin: 0;
  font-size: 0.9375rem;
}

.triplet-card--com {
  transform: translate(-9px, -7px);
}

.triplet-card--org {
  transform: translate(0, 0);
  filter: brightness(0.97);
}

.triplet-card--net {
  transform: translate(9px, 7px);
  filter: brightness(0.94);
}

.triplet-stack:hover .triplet-card--com {
  transform: translate(-22px, -15px);
}

.triplet-stack:hover .triplet-card--net {
  transform: translate(22px, 15px);
}

.triplet-list {
  list-style: none;
  margin: var(--s-4) 0 0;
  padding: 0;
  border-top: 1px solid var(--c-hair);
}

.triplet-list li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: var(--s-2);
  align-items: baseline;
  padding: var(--s-1) 0;
  border-bottom: 1px solid var(--c-hair);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink);
  transition: padding-left var(--dur-fast) var(--ease-out);
}

.triplet-list li:hover {
  padding-left: var(--s-1);
}

.triplet-list li > :first-child {
  color: var(--c-orange);
}

.triplet-list li > :last-child {
  color: var(--c-ink-soft);
}

/* ---------------------------------------------------------------------------
   13 · CHAPTER 06 · THE EVERYWHERE — ticker
   ------------------------------------------------------------------------ */

.ticker-viewer {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding-block: var(--s-2);
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 8%,
    #000 92%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    transparent 0,
    #000 8%,
    #000 92%,
    transparent 100%
  );
}

.ticker {
  position: relative;
  display: flex;
  overflow: hidden;
  width: 100%;
  border-top: 1px solid var(--c-hair);
  border-bottom: 1px solid var(--c-hair);
  padding-block: var(--s-1);
}

.ticker__track {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  width: max-content;
  padding-right: var(--s-5);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  white-space: nowrap;
  animation: ticker-scroll 44s linear infinite;
  will-change: transform;
}

.ticker:hover .ticker__track,
.ticker:focus-within .ticker__track {
  animation-play-state: paused;
}

.ticker__track > * {
  flex: 0 0 auto;
}

.ticker__track > *::after {
  content: "·";
  margin-left: var(--s-5);
  color: var(--c-orange);
}

.ticker-count {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(2.4rem, 11vw, var(--t-display));
  font-weight: 500;
  line-height: 0.92;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--c-ink);
  margin: 0;
}

.ticker--chapter {
  margin-top: var(--s-4);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.5);
}

.ticker--chapter .ticker__track {
  animation-duration: 60s;
}

/* ---------------------------------------------------------------------------
   14 · CHAPTER 07 · THE RETURN — warm paper, unmodified replica
   ------------------------------------------------------------------------ */

.viewer-stage--return {
  background: var(--c-paper);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(42, 38, 32, 0.08);
}

.viewer-stage--return::before {
  opacity: 0.28;
  background-image: linear-gradient(
      rgba(42, 38, 32, 0.12) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(42, 38, 32, 0.12) 1px, transparent 1px);
}

.viewer-stage--return::after {
  background: radial-gradient(
    ellipse 74% 64% at 50% 50%,
    rgba(255, 253, 246, 0.85) 0%,
    rgba(244, 240, 230, 0) 74%
  );
}

.specimen-card--return {
  box-shadow: var(--lift-2);
}

.return-replica {
  position: relative;
  margin-top: var(--s-4);
  padding: var(--s-5) var(--s-3);
  background: var(--c-paper);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(42, 38, 32, 0.08);
  display: grid;
  place-items: center;
}

.return-replica .specimen-card {
  box-shadow: var(--lift-2);
}

.return-note {
  margin: var(--s-3) 0 0;
  max-width: none;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  text-align: center;
}

/* ---------------------------------------------------------------------------
   15 · SCROLL COLUMN · CHAPTERS
   ------------------------------------------------------------------------ */

.scroll-column {
  position: relative;
  z-index: 10;
  padding-bottom: var(--s-7);
}

.chapter {
  position: relative;
  padding-block: var(--s-5);
}

.chapter + .chapter {
  border-top: 1px solid var(--c-hair);
}

.chapter--blank {
  padding-top: var(--s-5);
  border-top: 0;
}

.chapter-header {
  position: relative;
  z-index: 1;
  max-width: 42rem;
}

.chapter-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-orange);
  margin: 0;
}

.chapter-kicker::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 1px;
  background: currentColor;
  flex: 0 0 auto;
}

.chapter-title {
  margin: var(--s-2) 0 var(--s-3);
  font-family: var(--font-sans);
  font-size: clamp(1.777rem, 1.15rem + 2.6vw, var(--t-h2));
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: -0.024em;
  color: var(--c-ink);
}

.chapter-num {
  position: absolute;
  top: 0.06em;
  right: 0;
  z-index: 0;
  font-family: var(--font-mono);
  font-size: clamp(3.6rem, 15vw, var(--t-display));
  font-weight: 500;
  line-height: 0.78;
  letter-spacing: -0.04em;
  color: var(--c-hair);
  mix-blend-mode: multiply;
  opacity: 0.85;
  pointer-events: none;
  user-select: none;
}

.chapter--reserve .chapter-num {
  color: rgba(255, 255, 255, 0.08);
  mix-blend-mode: normal;
}

.lede {
  font-size: var(--t-lede);
  line-height: 1.5;
  font-weight: 400;
  color: var(--c-ink);
  max-width: var(--measure-tight);
  margin: 0 0 var(--s-3);
}

.chapter p {
  color: var(--c-ink-soft);
  max-width: var(--measure);
}

/* ---------------------------------------------------------------------------
   16 · SPECIMEN FACTS / MEASURE LIST / LINK SPEC
   ------------------------------------------------------------------------ */

.specimen-facts {
  display: grid;
  grid-template-columns: minmax(6.5rem, auto) minmax(0, 1fr);
  column-gap: var(--s-3);
  row-gap: 0;
  margin: var(--s-4) 0 0;
  border-top: 1px solid var(--c-hair);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.specimen-facts dt,
.specimen-facts dd {
  margin: 0;
  padding: var(--s-1) 0;
  border-bottom: 1px solid var(--c-hair);
}

.specimen-facts dt {
  color: var(--c-orange);
}

.specimen-facts dd {
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}

.measure-list {
  list-style: none;
  counter-reset: measure;
  margin: var(--s-4) 0 0;
  padding: 0;
  border-top: 1px solid var(--c-hair);
}

.measure-list li {
  counter-increment: measure;
  position: relative;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: var(--s-2);
  align-items: baseline;
  padding: var(--s-2) 0 var(--s-2) 0;
  border-bottom: 1px solid var(--c-hair);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  transition: padding-left var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.measure-list li::before {
  content: counter(measure, decimal-leading-zero);
  color: var(--c-orange);
}

.measure-list li:hover {
  padding-left: var(--s-1);
  color: var(--c-ink);
}

.link-spec {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-4) 0 0;
  padding: var(--s-3);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--c-hair);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}

.link-spec > * {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(0, 1fr);
  gap: var(--s-2);
  padding-bottom: var(--s-1);
  border-bottom: 1px solid var(--c-hair);
  margin: 0;
}

.link-spec > *:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.link-spec strong {
  font-weight: 600;
  color: var(--c-blue);
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------------------
   17 · SITE FOOTER
   ------------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--c-hair);
  margin-top: var(--s-6);
  padding: var(--s-5) var(--s-2) var(--s-7);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-3);
  max-width: 76rem;
  margin: 0 auto;
}

.footer-grid > * {
  min-width: 0;
}

.footer-grid h2,
.footer-grid h3 {
  margin: 0 0 var(--s-1);
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-orange);
}

.footer-grid p {
  margin: 0 0 var(--s-1);
  color: var(--c-ink-soft);
  max-width: 34ch;
  line-height: 1.7;
}

.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-1);
}

.footer-grid a {
  color: var(--c-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.footer-grid a:hover,
.footer-grid a:focus-visible {
  color: var(--c-orange);
  border-bottom-color: var(--c-orange);
}

@media (min-width: 48rem) {
  .site-footer {
    padding-inline: var(--s-4);
  }

  .footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-4);
  }
}

/* ---------------------------------------------------------------------------
   18 · KEYFRAMES
   ------------------------------------------------------------------------ */

@keyframes xray-travel {
  0% {
    clip-path: inset(4% 74% 84% 4%);
  }
  18% {
    clip-path: inset(4% 6% 82% 64%);
  }
  36% {
    clip-path: inset(74% 8% 4% 6%);
  }
  54% {
    clip-path: inset(70% 62% 6% 10%);
  }
  72% {
    clip-path: inset(28% 26% 46% 30%);
  }
  100% {
    clip-path: inset(4% 74% 84% 4%);
  }
}

@keyframes draw-path {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes head-in {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes dot-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 74, 23, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 74, 23, 0);
  }
}

@keyframes ticker-scroll {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes chapter-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 2rem, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes panel-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 1rem, 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* ---------------------------------------------------------------------------
   19 · SCROLL-DRIVEN REVEAL (progressive enhancement)
   ------------------------------------------------------------------------ */

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) and (min-width: 48rem) {
    .chapter {
      animation: chapter-reveal linear both;
      animation-timeline: view();
      animation-range: entry 4% cover 26%;
    }

    .chapter--blank {
      animation: none;
      opacity: 1;
      transform: none;
    }
  }
}

@media (prefers-reduced-motion: no-preference) {
  .viewer-stage .specimen-card {
    animation: panel-reveal 0.7s var(--ease-out) both;
  }
}

/* ---------------------------------------------------------------------------
   20 · HOVER / FOCUS MICRO-INTERACTIONS
   ------------------------------------------------------------------------ */

.specimen-card:hover {
  box-shadow: var(--lift-2);
}

.specimen-card--anatomy:hover {
  filter: grayscale(0.6) brightness(1);
}

.viewer-stage:hover .specimen-card--canonical {
  box-shadow: var(--lift-2);
}

.viewer-panel__meta > :last-child {
  transition: color var(--dur-fast) var(--ease-out);
}

.viewer-panel:hover .viewer-panel__meta > :last-child {
  color: var(--c-ink);
}

/* ---------------------------------------------------------------------------
   21 · REDUCED MOTION
   ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .ticker__track {
    animation: none;
    transform: none;
  }

  .annotation-layer--corners.is-active {
    clip-path: inset(0 0 0 0);
  }

  .arrow-path {
    stroke-dashoffset: 0;
  }

  .arrow-head {
    opacity: 1;
  }

  .callout,
  .annotation-layer {
    opacity: 1;
  }
}

/* ---------------------------------------------------------------------------
   22 · DARK-MODE SURFACE GUARD + PRINT
   ------------------------------------------------------------------------ */

@media (prefers-color-scheme: dark) {
  :root {
    --c-page: #eeeeee;
    --c-card: #fdfdff;
  }
}

@media print {
  .site-header,
  .viewer-panel,
  .skip-link,
  .site-footer {
    display: none;
  }

  body {
    background: #fff;
  }

  body::before {
    display: none;
  }

  .story-shell {
    display: block;
    padding: 0;
  }
}