/* Project ZETA — PROMETHEUS research exhibit (v004).
   Loaded ONLY by research/prometheus/index.html. Every rule is scoped to .prom-* classes,
   so the shared site styles in main.css and all other pages are unaffected.
   Uses the ZETA design tokens (navy / ivory / gold, EB Garamond / Source Serif / Source Sans). */

/* ---------- Full-width exhibit container (overrides the 72rem site container) ---------- */
.prom-page { overflow-x: clip; }
.prom-exhibit {
  width: calc(100% - 4rem);
  max-width: min(1760px, calc(100vw - 4rem));
  margin-inline: auto;
  padding-block: var(--space-6) var(--space-8);
}
.prom-h2 {
  font-size: var(--step-3); margin: 0 0 var(--space-5);
  display: flex; align-items: baseline; gap: var(--space-4);
}
.prom-h2::after { content: ""; flex: 1 1 4rem; min-width: 2rem; border-top: 1px solid var(--rule); transform: translateY(-0.3em); }

/* ---------- Element 0–1: navigation, heading, invitation ---------- */
.prom-hero { display: grid; gap: var(--space-3); padding-bottom: var(--space-5); }
.prom-hero__nav { margin: 0; }
.prom-back-btn {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-family: var(--font-ui); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.03em;
  color: var(--navy-900); text-decoration: none;
  padding: 0.5rem 1rem; border: 1px solid var(--navy-700); border-radius: 999px; background: var(--bg);
}
.prom-back-btn:hover { background: var(--navy-900); color: var(--ivory-50); border-color: var(--navy-900); }
.prom-hero__title { margin: var(--space-3) 0 0; font-size: var(--step-4); line-height: 1.05; }
.prom-hero__invite { margin: 0; font-size: var(--step-1); line-height: 1.5; color: var(--charcoal-700); max-width: 72ch; }

/* ---------- Element 2: application preview card ---------- */
.prom-app { margin-bottom: var(--space-8); }
.prom-launch {
  display: block; position: relative; text-decoration: none; color: inherit;
  border: 1px solid var(--navy-800); border-radius: 10px; overflow: hidden;
  background: var(--navy-900);
  box-shadow: 0 2px 4px rgba(16, 29, 56, 0.08), 0 18px 48px rgba(16, 29, 56, 0.18);
  transition: box-shadow 160ms ease, transform 160ms ease;
}
.prom-launch:hover { box-shadow: 0 4px 8px rgba(16, 29, 56, 0.12), 0 26px 64px rgba(16, 29, 56, 0.26); }
.prom-launch:focus-visible { outline: 4px solid var(--focus); outline-offset: 4px; }
.prom-launch__frame { display: block; width: 100%; background: #fff; aspect-ratio: 16 / 8.4; max-height: 78vh; overflow: hidden; } /* width:100% stops max-height from shrinking the width via aspect-ratio transfer (v004 QA fix) */
.prom-launch__img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform 400ms ease; }
.prom-launch:hover .prom-launch__img { transform: scale(1.012); }
.prom-launch__cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem 1rem;
  padding: 1rem 1.25rem; background: var(--navy-900); color: var(--ivory-50);
  border-top: 3px solid var(--gold-300); font-family: var(--font-ui);
}
.prom-launch__icon {
  display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: var(--gold-300); color: var(--navy-950); font-size: 0.85rem; padding-left: 0.15rem;
}
.prom-launch__label { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.04em; }
.prom-launch__hint { font-size: 0.88rem; color: #c4c8d4; letter-spacing: 0.03em; }
.prom-launch:hover .prom-launch__cta { background: var(--navy-800); }
.prom-app__note { margin: var(--space-3) 0 0; font-family: var(--font-ui); font-size: 0.92rem; color: var(--charcoal-500); text-align: center; }
.prom-app__alt { margin: var(--space-1) 0 0; font-family: var(--font-ui); font-size: 0.92rem; text-align: center; }

/* ---------- Elements 3–4: commentary (author text, verbatim) ----------
   v008: a single, centred essay column (no columns, no column rule). v009: reading width 56rem (896 px) → 75rem (1200 px). Presentation only: the
   passage markup is still generated verbatim by tools/layout.py from content/authored/. */
.prom-commentary > .prom-h2 { max-width: 75rem; margin-inline: auto; margin-bottom: var(--space-5); }
.prom-commentary > .prom-h2::after { display: none; }
.prom-commentary .authored {
  max-width: 75rem; margin: 0 auto var(--space-7); padding-bottom: var(--space-7);
  columns: auto; column-rule: none; border: 0; position: relative;
}
.prom-commentary .authored p {
  max-width: none; margin: 0; text-align: left;
  font-family: var(--font-text); font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
  line-height: 1.75; color: var(--charcoal-900);
  hyphens: manual; -webkit-hyphens: manual; text-wrap: pretty;
}
.prom-commentary .authored p + p { margin-top: 1.375rem; }
/* Transition into the source-code organization: a short, centred gold rule */
.prom-commentary .authored::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 6rem; height: 1px; background: var(--gold-500);
}

/* ---------- Element 5: compact Roman-numeral index ---------- */
.prom-index { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--surface); padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4); }
.prom-index__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--space-1) var(--space-7); }
@media (min-width: 52rem) {
  /* Reads down each column: I–III, then IV–VI */
  .prom-index__list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, auto); grid-auto-flow: column; }
}
.prom-index__list li { margin: 0; }
.prom-index__list a { display: flex; align-items: baseline; gap: 0.75rem; padding: 0.45rem 0; text-decoration: none; color: var(--navy-900); font-family: var(--font-display); font-size: 1.22rem; line-height: 1.3; }
.prom-index__list a:hover .prom-index__title { text-decoration: underline; text-decoration-color: var(--gold-500); text-underline-offset: 0.2em; }
.prom-index__num { flex: none; min-width: 2.6rem; font-family: var(--font-display); font-weight: 600; color: var(--gold-700); letter-spacing: 0.04em; }

/* ---------- Element 6: expansion control ---------- */
.prom-depth-details { margin: 0; }
.prom-depth-toggle {
  list-style: none; display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer;
  font-family: var(--font-ui); font-size: 1.02rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--ivory-50); background: var(--navy-900); border: 1px solid var(--navy-900);
  padding: 0.75rem 1.35rem; border-radius: 999px; user-select: none;
}
.prom-depth-toggle::-webkit-details-marker { display: none; }
.prom-depth-toggle::marker { content: ""; }
.prom-depth-toggle:hover { background: var(--navy-800); }
.prom-depth-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.prom-depth-toggle__icon { width: 0.55rem; height: 0.55rem; border-right: 2px solid var(--gold-300); border-bottom: 2px solid var(--gold-300); transform: translateY(-0.15rem) rotate(45deg); transition: transform 160ms ease; }
.prom-depth-details[open] > .prom-depth-toggle { background: var(--bg); color: var(--navy-900); }
.prom-depth-details[open] > .prom-depth-toggle .prom-depth-toggle__icon { transform: translateY(0.15rem) rotate(-135deg); border-color: var(--gold-700); }

/* ---------- Elements 7–9: expanded examination ---------- */
.prom-depth { margin-top: var(--space-6); padding-top: var(--space-6); border-top: 2px solid var(--navy-900); }
.prom-fig { margin: 0; }
.prom-fig img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: 6px; }
.prom-fig figcaption { margin-top: var(--space-3); padding-top: var(--space-2); border-top: 1px solid var(--rule); font-family: var(--font-ui); font-size: 0.93rem; color: var(--charcoal-700); line-height: 1.5; }
.prom-fig--wide { margin-bottom: var(--space-7); }
.prom-fig--wide img { padding: clamp(0.5rem, 1.5vw, 1.5rem); }

.prom-sec { padding-block: var(--space-6); border-top: 1px solid var(--rule); display: grid; gap: var(--space-5) clamp(1.5rem, 3vw, 3.5rem); scroll-margin-top: var(--space-5); }
.prom-sec__head { margin: 0; }
.prom-sec__num { margin: 0; font-family: var(--font-display); font-size: clamp(2.4rem, 2rem + 1.6vw, 3.4rem); line-height: 1; font-weight: 500; color: var(--gold-700); letter-spacing: 0.04em; }
.prom-sec__title { margin: var(--space-2) 0 var(--space-3); font-family: var(--font-display); font-size: var(--step-2); line-height: 1.2; color: var(--navy-900); }
.prom-sec__desc { margin: 0 0 var(--space-4); font-family: var(--font-text); font-style: italic; font-size: var(--step-1); line-height: 1.5; color: var(--charcoal-700); max-width: 60ch; }
.prom-sec__main { min-width: 0; }
.prom-fig--side { min-width: 0; align-self: start; }
/* v018 — Code Organization without the final-application code viewers. Each subsection is its numeral, title and
   description; II, III, V and VI keep their diagram beside the text (text column centred on the diagram, so the text
   no longer sits above an empty column), I and IV are text-only and compact. One rhythm for all six on desktop and
   phone; the diagram follows the text on narrow screens. */
.prom-sec__head > .prom-sec__desc:last-child { margin-bottom: 0; }
.prom-sec--plain { padding-block: var(--space-5); }
@media (min-width: 62rem) {
  .prom-sec--plain { grid-template-columns: minmax(0, 1fr); }
  .prom-sec--diagram { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: center; }
  .prom-sec--diagram .prom-fig--side { align-self: center; }
}

/* Code panel (no line numbers, no gutters) */
.prom-code { margin: 0; border: 1px solid var(--navy-800); border-radius: 8px; overflow: hidden; background: #fff; }
.prom-code__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0.45rem 0.75rem 0.45rem 1rem; background: var(--navy-900); color: var(--ivory-50); font-family: var(--font-ui); font-size: 0.82rem; }
.prom-code__lang { font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-300); }
.prom-code__actions { display: inline-flex; align-items: center; gap: 0.5rem; }
.prom-copy { display: none; font: inherit; font-weight: 600; font-size: 0.82rem; padding: 0.25rem 0.75rem; border-radius: 4px; border: 1px solid rgba(247, 242, 231, 0.6); background: transparent; color: var(--ivory-50); cursor: pointer; }
.js .prom-copy { display: inline-block; }
.prom-copy:hover { border-color: var(--gold-300); color: var(--gold-300); }
.prom-copy:focus-visible { outline: 3px solid var(--gold-300); outline-offset: 2px; }
.prom-copy.is-copied { border-color: var(--gold-300); color: var(--navy-950); background: var(--gold-300); }
.prom-copy__status:empty { display: none; }
.prom-copy__status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.prom-code__scroll { overflow-x: auto; }
.prom-code__scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.prom-code pre { margin: 0; border: 0; border-radius: 0; background: #fff; padding: 1rem 1.15rem; font-size: 0.86rem; line-height: 1.6; overflow: visible; }
.prom-code pre code { background: none; padding: 0; font-size: inherit; white-space: pre; tab-size: 4; color: var(--charcoal-900); }
/* Prism tokens — same restrained palette as the site's code component (AA on white) */
.prom-code .token.comment, .prom-code .token.prolog { color: #5c6370; font-style: italic; }
.prom-code .token.keyword, .prom-code .token.builtin { color: #24396a; font-weight: 600; }
.prom-code .token.string, .prom-code .token.char, .prom-code .token.triple-quoted-string, .prom-code .token.string-interpolation { color: #2f5233; }
.prom-code .token.interpolation, .prom-code .token.interpolation .token.punctuation { color: #3d3f45; }
.prom-code .token.number, .prom-code .token.boolean, .prom-code .token.constant { color: #7d2a22; }
.prom-code .token.function, .prom-code .token.class-name { color: #6b4f14; }
.prom-code .token.punctuation, .prom-code .token.operator { color: #3d3f45; }
.prom-code .token.decorator { color: #5a3d78; }

/* ---------- Element 10: divider (outside the expander) ---------- */
.prom-section-divider {
  border: 0; height: 1px; margin: var(--space-8) 0 var(--space-7);
  background: linear-gradient(90deg, transparent, var(--gold-500) 12%, var(--navy-900) 50%, var(--gold-500) 88%, transparent);
  position: relative; overflow: visible;
}
.prom-section-divider::after {
  content: "◆"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%);
  padding: 0 0.85rem; background: var(--bg); color: var(--gold-500); font-size: 0.9rem; line-height: 1;
}


/* ---------- Enlarged application viewer (modal) ---------- */
html.prom-modal-open, html.prom-modal-open body { overflow: hidden; }
.prom-modal[hidden] { display: none; }
.prom-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; }
.prom-modal__backdrop { position: absolute; inset: 0; background: rgba(11, 20, 40, 0.78); }
.prom-modal__panel {
  position: relative; display: flex; flex-direction: column;
  width: 96vw; height: 94vh; height: 94dvh;
  background: var(--navy-900); border-radius: 10px; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.prom-modal__sentinel { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.prom-modal__bar { flex: none; display: flex; align-items: center; gap: 0.5rem 1rem; padding: 0.55rem 0.75rem; color: var(--ivory-50); font-family: var(--font-ui); border-bottom: 2px solid var(--gold-300); }
.prom-modal__close {
  font: inherit; font-size: 0.98rem; font-weight: 700; letter-spacing: 0.02em; cursor: pointer;
  padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid var(--gold-300);
  background: var(--gold-300); color: var(--navy-950); white-space: nowrap;
}
.prom-modal__close:hover { background: #e4cf9a; }
.prom-modal__title { margin: 0; flex: 1 1 auto; min-width: 0; font-size: 0.95rem; color: #e3e5ec; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.prom-modal__ro { display: inline-block; margin-left: 0.5rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 0.1rem 0.5rem; border: 1px solid #c4c8d4; border-radius: 999px; color: #e3e5ec; }
.prom-modal__tab { color: var(--gold-300); font-size: 0.92rem; font-weight: 600; white-space: nowrap; text-decoration: underline; text-underline-offset: 0.2em; }
.prom-modal__tab:hover { color: #e4cf9a; }
.prom-modal :focus-visible { outline: 3px solid var(--gold-300); outline-offset: 2px; }
.prom-modal__body { flex: 1 1 auto; min-height: 0; background: #fff; }
.prom-modal__frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 52rem) {
  .prom-exhibit { width: calc(100% - 2.5rem); max-width: calc(100vw - 2.5rem); padding-block: var(--space-5) var(--space-7); }
  .prom-launch__frame { aspect-ratio: 4 / 3.2; }
  .prom-launch__hint { flex-basis: 100%; text-align: center; }
  .prom-app { margin-bottom: var(--space-7); }
  .prom-index { padding: var(--space-3) var(--space-4); }
  .prom-index__list a { font-size: 1.1rem; }
  .prom-section-divider { margin: var(--space-7) 0 var(--space-6); }
}
@media (max-width: 40rem) {
  .prom-modal__panel { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
  .prom-modal__bar { flex-wrap: wrap; justify-content: space-between; }
  .prom-modal__title { order: 3; flex-basis: 100%; text-align: left; font-size: 0.85rem; }
}
@media (max-width: 30rem) {
  .prom-exhibit { width: calc(100% - 2rem); max-width: calc(100vw - 2rem); }
  .prom-launch__label { font-size: 1rem; text-align: center; }
  .prom-launch__cta { padding: 0.85rem 0.9rem; }
  .prom-depth-toggle { width: 100%; justify-content: center; }
  .prom-code pre { font-size: 0.8rem; padding: 0.85rem; }
  .prom-h2 { font-size: var(--step-2); }
  .prom-h2::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .prom-launch, .prom-launch__img, .prom-depth-toggle__icon { transition: none; }
  .prom-launch:hover .prom-launch__img { transform: none; }
}
@media (forced-colors: active) {
  .prom-depth-toggle, .prom-launch__cta, .prom-copy, .prom-modal__close { border: 1px solid ButtonText; }
}
@media print {
  .prom-modal, .prom-copy, .prom-launch__cta { display: none !important; }
  .prom-depth-details > *:not(summary) { display: block !important; }
}

/* v004 QA fix: keep diagram labels readable on narrow screens (horizontal scroll instead of shrinking to ~4px text) */
.prom-fig__hint { display: none; }
@media (max-width: 48rem) {
  .prom-fig__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 6px; }
  .prom-fig--wide .prom-fig__scroll img { width: 100%; min-width: 880px; max-width: none; }
  .prom-fig--side .prom-fig__scroll img { width: 100%; min-width: 560px; max-width: none; }
  .prom-fig__scroll:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  .prom-fig--wide .prom-fig__hint { display: block; }
  .prom-fig__hint { margin: var(--space-2) 0 0; font-family: var(--font-ui); font-size: 0.85rem; color: var(--charcoal-500); }
}
@media (max-width: 37.5rem) { .prom-fig--side .prom-fig__hint { display: block; } }

/* ==========================================================================
   v017 — withheld source code (PROMETHEUS). The withheld text is not in the page; these rules only draw the
   placeholder bars (prometheus-exhibit.js §3a) and the fine print beneath affected code. White-on-white with a slight
   ivory tone and a hairline, so a deliberate omission is recognisable without a dark block.
   ========================================================================== */
.prom-redact {
  display: inline-block; box-sizing: border-box; width: calc(var(--n, 12) * 1ch); max-width: 100%; height: 1.08em; vertical-align: -0.18em;
  overflow: hidden; white-space: pre; color: transparent !important; text-shadow: none !important;
  background: var(--ivory-100, #f7f2e7); border: 1px solid rgba(16, 29, 56, 0.16); border-radius: 2px;
}
.prom-redact::selection { color: transparent; }
@media (forced-colors: active) { .prom-redact { forced-color-adjust: none; background: Canvas; border-color: CanvasText; color: Canvas !important; } }
@media print { .prom-redact { border-color: #999; background: #fff; } }
.prom-redact-note, .prom-g22-note { margin: var(--space-2) 0 0; font-family: var(--font-ui); font-size: 0.82rem; line-height: 1.5; color: var(--charcoal-500); max-width: 68ch; }
.prom-modal__tab[hidden] { display: none !important; } /* v017: no download for PROMETHEUS source (the tab style sets display) */
