/* ============================================================
 * CrossAIHub · Phase 4 · Design Tokens (delta over V1.0)
 * Milestone 4.1.1 · 2026-07-08
 * Source of truth: CROSSAIHUB_HOUSE_BIBLE.md Part 4
 * Governs: 15 Phase 4 LAWS
 * ============================================================ */

:root {
  /* ─── Colors (from House Bible Part 4) ───────────────────── */
  --ch-parchment-1: #FDFBF5;
  --ch-parchment-2: #F6EFDF;
  --ch-parchment-3: #EAE2CB;
  --ch-ink:         #2B2418;
  --ch-ink-warm:    #4A3820;
  --ch-sanctuary:   #3C2E1B;

  --ch-wax-burgundy:      #6B1F2E;
  --ch-wax-burgundy-warm: #7A2532;

  --ch-chalice-gold:       #B48748;
  --ch-chalice-gold-glint: #D6A868;

  --ch-madder:  #973C3C;
  --ch-indigo:  #3A4A6C;
  --ch-moss:    #6B7B4B;
  --ch-enamel:  #4C6C8F;
  --ch-flame:   #E9B25E;

  /* ─── Spacing ────────────────────────────────────────────── */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-breath: 96px;

  /* ─── Typography (only what 4.1 actually uses) ───────────── */
  --ff-serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --ff-sans:  "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;

  --fs-tag:      0.75rem;
  --fs-body:     1.05rem;
  --fs-lead:     1.25rem;
  --fs-title:    2.5rem;
  --fs-display:  4.5rem;

  --lh-body:     1.55;
  --lh-serif:    1.15;

  /* ─── Radii ──────────────────────────────────────────────── */
  --r-none: 0;
  --r-sm:   2px;
  --r-md:   4px;
  --r-lg:   8px;
  --r-pill: 999px;

  /* ─── Motion timings (Master Plan §10) ───────────────────── */
  --t-fade:            400ms;
  --t-crossfade:       700ms;
  --t-warm-crossfade:  900ms;
  --t-return-house:   1500ms;
  --t-door-open:      3000ms;
  --t-orb-min:       12000ms;
  --t-orb-max:       20000ms;

  --ease-door: cubic-bezier(0.22, 0.61, 0.36, 1.00);

  /* ─── Z-index (4 layers only) ────────────────────────────── */
  --z-scene:   0;
  --z-content: 10;
  --z-tooltip: 20;
  --z-modal:   30;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--ch-parchment-1);
  color: var(--ch-ink);
  font-family: var(--ff-serif);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ─── Accessibility ───────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: var(--s-3) var(--s-5);
  background: var(--ch-wax-burgundy);
  color: var(--ch-parchment-1);
  font-family: var(--ff-sans);
  z-index: var(--z-modal);
}
.skip-link:focus { left: var(--s-4); top: var(--s-4); }

/* C4 · Keyboard focus (visible for every focusable element) */
:focus-visible {
  outline: 2px solid var(--ch-chalice-gold);
  outline-offset: 4px;
  border-radius: 2px;
}

/* ─── The HouseScene shell ─────────────────────────────────── */
.house-scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;          /* C7 · dynamic viewport (iOS Safari) */
  min-height: 480px;
  overflow: hidden;
  background: var(--ch-parchment-1);   /* placeholder before hero paints */
  z-index: var(--z-scene);
}

.house-scene__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
}

@media (max-width: 899px) {
  .house-scene__image { object-position: 50% 60%; }
}
@media (max-width: 480px) {
  .house-scene__image { object-position: 50% 62%; }
}

/* ─── The WordMark ────────────────────────────────────────── */
.wordmark {
  position: absolute;
  top: var(--s-5);
  left: var(--s-5);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  z-index: var(--z-content);
  padding: var(--s-2);            /* larger focus ring hit-area */
}

.wordmark__cross {
  width: 32px;
  height: 32px;
  color: var(--ch-wax-burgundy);
  flex: 0 0 auto;
}

.wordmark__text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.wordmark__name {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-size: 1.75rem;
  color: var(--ch-ink);
  letter-spacing: -0.01em;
  text-shadow: 0 1px 6px rgba(253, 251, 245, 0.55);   /* legibility over any hero pixel */
}

.wordmark__tag {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ch-ink-warm);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(253, 251, 245, 0.55);
}

/* ─── The WaxSeal (M4: no longer a link; C2 fix) ──────────── */
.wax-seal {
  position: absolute;
  top: var(--s-5);
  right: var(--s-5);
  width: 128px;
  height: 128px;
  z-index: var(--z-content);
  transition:
    transform 500ms var(--ease-door),
    filter    500ms var(--ease-door);
  filter: drop-shadow(0 4px 12px rgba(107, 31, 46, 0.35));
}

.wax-seal:hover {
  transform: rotate(6deg);
  filter:
    drop-shadow(0 4px 12px rgba(107, 31, 46, 0.35))
    drop-shadow(0 0 24px rgba(212, 168, 104, 0.7));
}

/* C3 · Reduced motion — vestibular-safe fallback */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .wax-seal:hover {
    transform: none;
    filter: drop-shadow(0 4px 12px rgba(107, 31, 46, 0.35));
  }
}

/* Mobile scaling · M5 raises tag to 14px */
@media (max-width: 899px) {
  .wax-seal { width: 96px; height: 96px; }
  .wordmark__name { font-size: 1.5rem; }
  .wordmark__tag { font-size: 0.9rem; }        /* was 0.8rem = 12.8px, now 14.4px */
}
@media (max-width: 480px) {
  .wax-seal { width: 88px; height: 88px; top: var(--s-4); right: var(--s-4); }
  .wordmark { top: var(--s-4); left: var(--s-4); gap: var(--s-2); padding: var(--s-1); }
  .wordmark__cross { width: 24px; height: 24px; }
  .wordmark__name { font-size: 1.25rem; }
  .wordmark__tag { font-size: 0.875rem; }      /* 14px minimum · M5 */
}

/* ─── Preview-only diagnostic strip ────────────────────────── */
.milestone-marker {
  position: fixed;
  bottom: var(--s-4);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--s-2) var(--s-5);
  background: rgba(107, 31, 46, 0.92);
  color: var(--ch-parchment-1);
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--r-pill);
  z-index: var(--z-modal);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ============================================================
 * Phase 4 · Milestone 4.2 · Threshold Reel
 * 20-second cinematic arrival — CSS-driven, GPU-friendly
 * All timings mirror _data/threshold_reel.json
 * ============================================================ */

/* Hero image will move; hint the compositor */
.house-scene__image {
  will-change: transform;
  transform-origin: 50% 60%;   /* dolly toward the doorway */
  transition: opacity var(--t-warm-crossfade) var(--ease-door);
}

/* Beat 0 — Arrival fade-in (fires immediately when .reel-active is added) */
.house-scene__image { opacity: 0; }
.reel-active .house-scene__image { opacity: 1; }

/* Beat 1 — Parallax Dolly (still 0-3s, dolly 3-5s in 4.3) */
.reel-active .house-scene__image {
  animation: ch-dolly 5000ms var(--ease-door) forwards;
}

@keyframes ch-dolly {
  0%   { transform: scale(1.000); }
  60%  { transform: scale(1.000); }
  100% { transform: scale(1.055); }
}

/* Beat 3 · 4.3 — Threshold crossfade to interior hallway (scene 4) at t=12s */
.house-scene__interior {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  opacity: 0;
  z-index: 1;
  will-change: opacity;
}

.reel-active .house-scene__interior {
  animation: ch-threshold-cross 3000ms var(--ease-door) 12000ms forwards;
}

@keyframes ch-threshold-cross {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* When threshold crossfade completes, the interior takes over — halo + door glow
 * should have faded by then. */

/* Beat 2 — Stop 1 (path halo + tooltip) */
.stop {
  position: absolute;
  z-index: var(--z-content);
  opacity: 0;
  pointer-events: none;
}

.stop--1 {
  bottom: 12vh;
  bottom: 12dvh;
  left: 50%;
  transform: translateX(-50%);
}

.reel-active .stop--1 {
  animation: ch-stop-appear 500ms var(--ease-door) 5000ms forwards,
             ch-stop-fadeout 1500ms var(--ease-door) 11500ms forwards;
}

@keyframes ch-stop-fadeout {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

@keyframes ch-stop-appear {
  from { opacity: 0; }
  to   { opacity: 1; pointer-events: auto; }
}

.stop__halo {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: radial-gradient(circle,
    rgba(241, 206, 132, 0.90) 0%,
    rgba(212, 168, 104, 0.60) 40%,
    rgba(212, 168, 104, 0.00) 70%);
  cursor: pointer;
  animation: ch-halo-pulse 2000ms ease-in-out 5400ms infinite;
  transition: transform 300ms var(--ease-door);
  filter: drop-shadow(0 0 12px rgba(233, 178, 94, 0.5));
}

.stop__halo:hover,
.stop__halo:focus-visible {
  transform: scale(1.12);
}

@keyframes ch-halo-pulse {
  0%   { transform: scale(1);    opacity: 0.85; }
  50%  { transform: scale(1.15); opacity: 1.00; }
  100% { transform: scale(1);    opacity: 0.85; }
}

.stop__tooltip {
  position: absolute;
  bottom: calc(100% + var(--s-4));
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding: var(--s-3) var(--s-5);
  background: rgba(253, 251, 245, 0.96);
  color: var(--ch-ink);
  font-family: var(--ff-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.4;
  border-radius: var(--r-md);
  box-shadow: 0 6px 18px rgba(107, 31, 46, 0.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity 400ms var(--ease-door),
              visibility 400ms,
              transform 400ms var(--ease-door);
  pointer-events: none;
  max-width: 320px;
  white-space: normal;
  text-align: center;
}

.stop.is-open .stop__tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Small triangle notch under the tooltip pointing to the halo */
.stop__tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(253, 251, 245, 0.96);
  border-bottom: 0;
}

/* Beat 4 — Door glow amplification */
.door-glow {
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%) scale(0.6);
  width: 42vw;
  height: 42vw;
  max-width: 520px;
  max-height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(233, 178, 94, 0.30) 0%,
    rgba(180, 135, 72, 0.14) 40%,
    rgba(180, 135, 72, 0.00) 70%);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: soft-light;
  z-index: var(--z-content);
  will-change: opacity, transform;
}

.reel-active .door-glow {
  animation: ch-door-glow 7000ms var(--ease-door) 5000ms forwards,
             ch-door-fade  1500ms var(--ease-door) 11500ms forwards;
}

@keyframes ch-door-glow {
  0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.6); }
  100% { opacity: 1;    transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes ch-door-fade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Beat 5 — Welcome Home caption */
.welcome-caption {
  position: absolute;
  bottom: 22vh;
  bottom: 22dvh;
  left: 50%;
  transform: translate(-50%, 12px);
  padding: var(--s-2) var(--s-6);
  color: var(--ch-ink);
  font-family: var(--ff-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.8rem;
  letter-spacing: 0.01em;
  text-align: center;
  text-shadow: 0 1px 10px rgba(253, 251, 245, 0.75);
  opacity: 0;
  pointer-events: none;
  z-index: var(--z-content);
  max-width: 80vw;
}

.reel-active .welcome-caption {
  animation: ch-welcome-appear 900ms var(--ease-door) 15000ms forwards;
}

@keyframes ch-welcome-appear {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 899px) {
  .welcome-caption { font-size: 1.5rem; bottom: 22vh; bottom: 22dvh; }
  .stop--1 { bottom: 14vh; bottom: 14dvh; }
}
@media (max-width: 480px) {
  .welcome-caption { font-size: 1.25rem; bottom: 24vh; bottom: 24dvh; }
  .stop--1 { bottom: 16vh; bottom: 16dvh; }
  .stop__halo { width: 40px; height: 40px; }
  .stop__tooltip { font-size: 0.98rem; max-width: 84vw; }
  .door-glow { width: 70vw; height: 70vw; }
}

/* ─── Reduced-motion fallback ─────────────────────────────── */
/* End state at t=20s rendered still, no animation, no dolly */
.reduced-motion .house-scene__image {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
.reduced-motion .stop,
.reduced-motion .welcome-caption,
.reduced-motion .door-glow {
  animation: none !important;
  opacity: 1 !important;
  pointer-events: auto;
}
.reduced-motion .stop__halo {
  animation: none !important;
  filter: drop-shadow(0 0 8px rgba(233, 178, 94, 0.4));
}
.reduced-motion .welcome-caption {
  transform: translateX(-50%) !important;
}
.reduced-motion .door-glow {
  transform: translate(-50%, -50%) scale(1.0) !important;
  opacity: 0.7 !important;
}
.reduced-motion .house-scene__interior {
  animation: none !important;
  opacity: 0 !important;   /* stay outside; visitor not auto-carried inside */
}

/* ============================================================
 * Phase 4 · Milestone 4.4 · Five Rooms Portals + Atlas
 * Rooms are places, not menu buttons. Each doorway is a room.
 * ============================================================ */

.rooms-hall {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--s-8) var(--s-5) var(--s-8);
  background: var(--ch-parchment-1);
  overflow: hidden;
}

@media (min-width: 900px) {
  .rooms-hall { padding: var(--s-breath) var(--s-8) var(--s-breath); }
}

.rooms-hall__header {
  max-width: 1200px;
  margin: 0 auto var(--s-7);
  text-align: center;
  font-family: var(--ff-serif);
}

.rooms-hall__kicker {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ch-ink-warm);
  margin: 0 0 var(--s-3);
}

.rooms-hall__title {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--ch-wax-burgundy);
  margin: 0 0 var(--s-3);
  line-height: 1.15;
}

.rooms-hall__verse {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ch-ink);
  margin: 0 0 var(--s-2);
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
}

.rooms-hall__citation {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
  margin: 0;
}

/* Five doorways row + Atlas */
.rooms-grid {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}

@media (min-width: 640px)  { .rooms-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px)  { .rooms-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1200px) { .rooms-grid { grid-template-columns: repeat(5, 1fr); } }

/* Individual room doorway card */
.room-doorway {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--ch-parchment-2);
  border: 1px solid rgba(107, 31, 46, 0.08);
  box-shadow: 0 4px 16px rgba(60, 46, 27, 0.08);
  transition: transform 500ms var(--ease-door), box-shadow 500ms var(--ease-door);
}

.room-doorway:hover,
.room-doorway:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(60, 46, 27, 0.16);
}

.room-doorway__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--ch-sanctuary);
}

.room-doorway__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 700ms var(--ease-door);
  will-change: transform;
}

.room-doorway:hover .room-doorway__image,
.room-doorway:focus-visible .room-doorway__image {
  transform: scale(1.04);
}

/* Warm inner shadow — makes the preview feel like looking through a doorway */
.room-doorway__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 32px rgba(43, 36, 24, 0.35);
  pointer-events: none;
}

/* Small brass Latin cross at eye height on each doorframe */
.room-doorway__cross {
  position: absolute;
  top: 40%;
  right: var(--s-4);
  width: 18px;
  height: 18px;
  z-index: 2;
  opacity: 0.85;
  color: var(--ch-chalice-gold);
  pointer-events: none;
}

.room-doorway__label {
  padding: var(--s-4) var(--s-5) var(--s-5);
  text-align: left;
  border-top: 1px solid rgba(107, 31, 46, 0.06);
}

.room-doorway__name {
  display: block;
  font-family: var(--ff-serif);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--ch-wax-burgundy);
  margin: 0 0 var(--s-1);
}

.room-doorway__subtitle {
  display: block;
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--ch-ink-warm);
  margin: 0 0 var(--s-2);
}

.room-doorway__verse {
  display: block;
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ch-ink);
  margin: 0 0 var(--s-2);
}

.room-doorway__citation {
  display: block;
  font-family: var(--ff-sans);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
}

/* Atlas doorway — larger, wider, farther in the frame */
.atlas-doorway {
  max-width: 1400px;
  margin: var(--s-8) auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-5);
  padding: 0;
  text-decoration: none;
  color: inherit;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--ch-sanctuary);
  border: 1px solid rgba(107, 31, 46, 0.08);
  box-shadow: 0 6px 22px rgba(60, 46, 27, 0.14);
  transition: transform 500ms var(--ease-door), box-shadow 500ms var(--ease-door);
}

@media (min-width: 900px) {
  .atlas-doorway { grid-template-columns: 3fr 2fr; }
}

.atlas-doorway:hover,
.atlas-doorway:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(60, 46, 27, 0.20);
}

.atlas-doorway__frame {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
}

.atlas-doorway__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-door);
}

.atlas-doorway:hover .atlas-doorway__image,
.atlas-doorway:focus-visible .atlas-doorway__image {
  transform: scale(1.03);
}

.atlas-doorway__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 40px rgba(43, 36, 24, 0.45);
  pointer-events: none;
}

.atlas-doorway__body {
  padding: var(--s-6) var(--s-6) var(--s-7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--ch-parchment-1);
}

.atlas-doorway__kicker {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold-glint);
  margin: 0 0 var(--s-3);
}

.atlas-doorway__title {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: var(--ch-parchment-1);
  margin: 0 0 var(--s-3);
  line-height: 1.15;
}

.atlas-doorway__verse {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ch-parchment-2);
  margin: 0 0 var(--s-3);
}

.atlas-doorway__citation {
  font-family: var(--ff-sans);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold-glint);
  margin: 0 0 var(--s-5);
}

.atlas-doorway__enter {
  display: inline-block;
  font-family: var(--ff-sans);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold-glint);
  border-bottom: 1px solid var(--ch-chalice-gold);
  padding-bottom: 4px;
}

/* Small entrance blessing at bottom of rooms hall */
.rooms-hall__blessing {
  max-width: 1200px;
  margin: var(--s-8) auto 0;
  text-align: center;
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--ch-ink-warm);
  padding: var(--s-5) var(--s-4);
  border-top: 1px solid rgba(180, 135, 72, 0.24);
}

.rooms-hall__blessing__citation {
  display: block;
  font-family: var(--ff-sans);
  font-style: normal;
  font-size: var(--fs-tag);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
  margin-top: var(--s-2);
}

/* Reduced motion — rooms static */
.reduced-motion .room-doorway,
.reduced-motion .atlas-doorway {
  transition: none !important;
}
.reduced-motion .room-doorway__image,
.reduced-motion .atlas-doorway__image {
  transition: none !important;
  transform: none !important;
}

/* ============================================================
 * Phase 4 · Milestone 4.5 · Video Modal + Atlas orb engine
 * ============================================================ */

/* Video / orb modal shared styles */
.video-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 36, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  animation: ch-modal-fade 400ms var(--ease-door) both;
}

.video-modal,
.orb-card {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, 720px);
  max-height: 88vh;
  overflow: auto;
  background: var(--ch-parchment-1);
  color: var(--ch-ink);
  z-index: calc(var(--z-modal) + 1);
  border-radius: var(--r-md);
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.42);
  animation: ch-modal-in 500ms var(--ease-door) both;
  outline: none;
}

@keyframes ch-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ch-modal-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

.video-modal__close,
.orb-card__close {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--ch-ink-warm);
  font-family: var(--ff-serif);
  font-size: 1.75rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 200ms var(--ease-door);
}
.video-modal__close:hover,
.orb-card__close:hover {
  background: rgba(107, 31, 46, 0.08);
  color: var(--ch-wax-burgundy);
}

.video-modal__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--ch-sanctuary);
}
.video-modal__poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-modal__body {
  padding: var(--s-6) var(--s-6) var(--s-7);
}
.video-modal__kicker {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
  margin: 0 0 var(--s-3);
}
.video-modal__title {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--ch-wax-burgundy);
  margin: 0 0 var(--s-2);
  line-height: 1.15;
}
.video-modal__subtitle {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ch-ink-warm);
  margin: 0 0 var(--s-5);
}
.video-modal__caption {
  font-family: var(--ff-serif);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ch-ink);
  margin: 0 0 var(--s-6);
}
.video-modal__actions {
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
}
.video-modal__done {
  font-family: var(--ff-sans);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ch-parchment-1);
  background: var(--ch-wax-burgundy);
  border: 0;
  padding: var(--s-3) var(--s-5);
  cursor: pointer;
  border-radius: var(--r-pill);
  transition: background 200ms var(--ease-door);
}
.video-modal__done:hover { background: var(--ch-wax-burgundy-warm); }

/* Orb card (open a verse orb) */
.orb-card {
  padding: var(--s-6) var(--s-6) var(--s-7);
}
.orb-card__kicker {
  font-family: var(--ff-sans);
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
  margin: 0 0 var(--s-3);
}
.orb-card__title {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: var(--ch-wax-burgundy);
  margin: 0 0 var(--s-4);
  line-height: 1.15;
}
.orb-card__verse {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--ch-ink);
  margin: 0 0 var(--s-3);
}
.orb-card__citation {
  font-family: var(--ff-sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
  margin: 0 0 var(--s-5);
}
.orb-card__cross {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--s-3);
  border-top: 1px solid rgba(180, 135, 72, 0.28);
  padding-top: var(--s-4);
}
.orb-card__cross-label {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ch-ink-warm);
}
.orb-card__link {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ch-wax-burgundy);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px solid rgba(107, 31, 46, 0.35);
  transition: color 200ms var(--ease-door), border-color 200ms var(--ease-door);
}
.orb-card__link:hover {
  color: var(--ch-wax-burgundy-warm);
  border-bottom-color: var(--ch-wax-burgundy-warm);
}

/* Atlas atrium engine */
.atrium {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(43, 36, 24, 0.35) 0%, rgba(43, 36, 24, 0.15) 40%, rgba(43, 36, 24, 0.55) 100%),
    var(--ch-sanctuary);
}
.atrium__hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  z-index: 0;
}
.atrium__header {
  position: relative;
  z-index: 2;
  padding: var(--s-8) var(--s-5) var(--s-5);
  text-align: center;
  color: var(--ch-parchment-1);
}
@media (min-width: 900px) {
  .atrium__header { padding: var(--s-breath) var(--s-8) var(--s-6); }
}
.atrium__kicker {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold-glint);
  margin: 0 0 var(--s-3);
}
.atrium__title {
  font-family: var(--ff-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(2rem, 5vw, 3.25rem);
  color: var(--ch-parchment-1);
  margin: 0 0 var(--s-4);
  line-height: 1.1;
}
.atrium__verse {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ch-parchment-2);
  margin: 0 0 var(--s-2);
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
}
.atrium__citation {
  font-family: var(--ff-sans);
  font-size: var(--fs-tag);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ch-chalice-gold);
  margin: 0 0 var(--s-6);
}

.atrium__bell {
  max-width: 32rem;
  margin: 0 auto;
  display: flex;
  gap: var(--s-2);
  align-items: center;
  padding: var(--s-3) var(--s-4);
  background: rgba(253, 251, 245, 0.06);
  border: 1px solid rgba(180, 135, 72, 0.32);
  border-radius: var(--r-pill);
}
.atrium__bell::before {
  content: "🔔";
  font-size: 0.9rem;
  opacity: 0.7;
}
.atrium__bell input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--ch-parchment-1);
  font-family: var(--ff-serif);
  font-size: 1rem;
  padding: 0;
  outline: none;
}
.atrium__bell input::placeholder { color: rgba(253, 251, 245, 0.6); font-style: italic; }
.atrium__bell-clear {
  display: none;
  background: transparent;
  border: 0;
  color: var(--ch-parchment-2);
  font-family: var(--ff-sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.atrium__field {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 70vh;
  min-height: 500px;
}

/* Individual orb */
.orb {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 44px;
  min-height: 44px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: radial-gradient(circle,
    rgba(241, 206, 132, 0.95) 0%,
    rgba(212, 168, 104, 0.7) 40%,
    rgba(180, 135, 72, 0.35) 75%,
    rgba(180, 135, 72, 0) 100%);
  color: var(--ch-sanctuary);
  font-family: var(--ff-serif);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  animation: ch-orb-drift 16s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 12px rgba(233, 178, 94, 0.4));
  transition: transform 500ms var(--ease-door), filter 500ms var(--ease-door);
}
.orb:hover, .orb:focus-visible {
  transform: translate(-50%, -50%) scale(1.14);
  filter: drop-shadow(0 0 18px rgba(233, 178, 94, 0.75));
}
.orb--dim { opacity: 0.18; pointer-events: none; }

.orb__label { white-space: nowrap; }

.orb[data-orb-type="psalm"]   { background-image: radial-gradient(circle, rgba(233, 178, 94, 0.98) 0%, rgba(212, 168, 104, 0.7) 40%, transparent 100%); }
.orb[data-orb-type="place"]   { background-image: radial-gradient(circle, rgba(214, 168, 104, 0.98) 0%, rgba(180, 135, 72, 0.7) 40%, transparent 100%); }
.orb[data-orb-type="figure"]  { background-image: radial-gradient(circle, rgba(180, 135, 72, 0.98) 0%, rgba(122, 88, 32, 0.7) 40%, transparent 100%); }
.orb[data-orb-type="prophet"] { background-image: radial-gradient(circle, rgba(159, 112, 64, 0.98) 0%, rgba(122, 88, 32, 0.65) 40%, transparent 100%); color: var(--ch-parchment-1); }

@keyframes ch-orb-drift {
  0%   { transform: translate(-50%, -50%) translateY(0); }
  100% { transform: translate(-50%, -50%) translateY(-14px); }
}

/* Reduced motion — orbs still, layout stays */
.reduced-motion .orb,
.atrium--grid .orb {
  animation: none !important;
}
.atrium--grid .atrium__field {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s-4);
  height: auto;
  padding: 0 var(--s-5) var(--s-8);
  position: relative;
}
.atrium--grid .orb {
  position: static;
  transform: none;
  animation: none;
}

.atrium__error {
  text-align: center;
  color: var(--ch-parchment-2);
  font-family: var(--ff-serif);
  font-style: italic;
  padding: var(--s-6);
}

/* ============================================================
 * Phase 4.5 · Small watch button inside Stop tooltips
 * ============================================================ */
.stop__watch {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding: 6px 14px;
  font-family: var(--ff-sans);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ch-parchment-1);
  background: var(--ch-wax-burgundy);
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background 200ms var(--ease-door);
}
.stop__watch:hover { background: var(--ch-wax-burgundy-warm); }
.stop__watch::after {
  content: "▶";
  font-size: 0.6rem;
  opacity: 0.85;
}

/* Reduced motion — modal fade collapses */
.reduced-motion .video-modal,
.reduced-motion .orb-card,
.reduced-motion .video-modal__backdrop {
  animation-duration: 1ms !important;
}

/* Global small polish */
@media (min-width: 900px) {
  :focus-visible { outline-offset: 6px; }
}
.rooms-hall,
.atrium {
  padding-bottom: max(var(--s-8), env(safe-area-inset-bottom));
}
.wordmark {
  padding-top: max(0px, env(safe-area-inset-top));
  padding-left: max(0px, env(safe-area-inset-left));
}
.wax-seal {
  padding-top: max(0px, env(safe-area-inset-top));
  padding-right: max(0px, env(safe-area-inset-right));
}

/* ─── Phase 4.9.1A · Atlas fallback panel ─────────────────── */
.atrium__beneath {
  margin: var(--s-breath) auto 0;
  max-width: 720px;
  padding: 0 var(--s-4) var(--s-8);
  color: var(--ch-parchment-1);
}
.atrium__beneath-kicker {
  font-family: var(--ff-serif);
  font-style: italic;
  font-size: var(--fs-tag);
  color: var(--ch-chalice-gold-glint);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 var(--s-2);
}
.atrium__beneath-title {
  font-family: var(--ff-serif);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--ch-parchment-1);
  margin: 0 0 var(--s-5);
  line-height: var(--lh-serif);
}
.atrium__beneath-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--s-3);
}
.atrium__beneath-list a {
  color: var(--ch-chalice-gold-glint);
  text-decoration: none;
  font-family: var(--ff-serif);
  font-size: var(--fs-body);
  padding: var(--s-2) 0;
  border-bottom: 1px solid rgba(214, 168, 104, 0.15);
  display: block;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.atrium__beneath-list a:hover,
.atrium__beneath-list a:focus-visible {
  color: var(--ch-parchment-1);
  border-color: var(--ch-chalice-gold);
  outline: none;
}
