/* Vivarium reproduction page styles — shared across all
 * src/layer1_wasm/<slug>/index.html and src/layer2_docker/<slug>/index.html
 * pages. Matches the Vivarium Core design system established by the
 * docs/landing site (teal #00d4aa accents, Space Grotesk + Inter +
 * JetBrains Mono fonts, dark canvas with bioluminescent atmosphere).
 *
 * Light/dark switching follows the user's OS preference via
 * prefers-color-scheme — these pages are usually opened in a fresh tab
 * from a verdict link, so we cannot rely on a cross-page theme toggle.
 */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;700&display=swap');

/* Theme tokens — matches rspress's pattern: html gets a `dark` class when
 * the user (or the inline early-theme script) decides dark mode is on,
 * else stays at the default :root values. The toggle in chrome.js writes
 * to localStorage['rspress-theme-appearance'] and flips html.dark, so
 * docs site and reproduction pages share one source of truth.
 */

:root {
  color-scheme: light;

  --vh-bg: #f5fbf9;
  --vh-bg-deep: #ffffff;
  --vh-text: #04221c;
  --vh-text-muted: #3a554f;
  --vh-text-dim: #5a7570;
  --vh-accent-teal: #00b894;
  --vh-accent-teal-bright: #00d4aa;
  --vh-accent-violet: #5229d4;
  --vh-accent-violet-bright: #7c5cff;
  --vh-accent-coral: #d7383b;
  --vh-hairline: rgba(4, 34, 28, 0.12);
  --vh-card-bg: rgba(4, 34, 28, 0.025);
  --vh-window-chrome: #e8ede9;
  --vh-window-bg: #00110e;
  --vh-code-bg: #001713;
  --vh-terminal-bg: #0a1f1a;
  --vh-terminal-border: rgba(0, 212, 170, 0.45);
  --vh-reproduced-bg: rgba(0, 212, 170, 0.12);
  --vh-reproduced-fg: #00624d;
  --vh-reproduced-border: rgba(0, 212, 170, 0.4);
  --vh-unreproduced-bg: rgba(255, 113, 108, 0.12);
  --vh-unreproduced-fg: #82071e;
  --vh-unreproduced-border: rgba(255, 113, 108, 0.4);
  --vh-pending-bg: rgba(124, 92, 255, 0.12);
  --vh-pending-fg: #4816cb;
  --vh-pending-border: rgba(124, 92, 255, 0.4);
}

html.dark {
  color-scheme: dark;

  --vh-bg: #00110e;
  --vh-bg-deep: #000508;
  --vh-text: #ffffff;
  --vh-text-muted: #a8b3b0;
  --vh-text-dim: #71807d;
  --vh-accent-teal: #00d4aa;
  --vh-accent-teal-bright: #33e5ba;
  --vh-accent-violet: #7c5cff;
  --vh-accent-violet-bright: #a18eff;
  --vh-accent-coral: #ff716c;
  --vh-hairline: rgba(255, 255, 255, 0.08);
  --vh-card-bg: rgba(255, 255, 255, 0.025);
  --vh-window-chrome: #18181b;
  --vh-window-bg: #000508;
  --vh-reproduced-fg: #33e5ba;
  --vh-unreproduced-fg: #ff716c;
  --vh-pending-fg: #a18eff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--vh-bg);
  color: var(--vh-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Subtle radial atmosphere — matches the home hero's "lit from within"
 * teal/violet glow. Only painted on dark mode where it has impact. */
html.dark body::before {
  content: '';
  position: fixed;
  top: -10%;
  left: -10%;
  width: 60%;
  height: 50%;
  background: radial-gradient(circle, rgba(0, 212, 170, 0.08), transparent 60%);
  filter: blur(60px);
  pointer-events: none;
  z-index: -1;
}

html.dark body::after {
  content: '';
  position: fixed;
  bottom: -10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.06), transparent 60%);
  filter: blur(60px);
  pointer-events: none;
  z-index: -1;
}

/* ---------- Top nav (mirrors rspress's <header class="rp-nav">) ---------- */

.vh-topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--vh-hairline);
  background: var(--vh-bg);
  font-family: 'Inter', sans-serif;
}

@media (min-width: 1280px) {
  .vh-topnav {
    padding: 0 2rem;
  }
}

.vh-topnav__left,
.vh-topnav__right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vh-topnav__brand-link {
  display: inline-flex;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--vh-text);
  text-decoration: none;
  border: 0;
  transition: opacity 0.18s ease;
}

.vh-topnav__brand-link:hover {
  opacity: 0.7;
  border-bottom: 0;
}

.vh-topnav__menu {
  display: none;
  flex: 1 1 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 1.5rem;
  margin: 0 1rem;
}

@media (min-width: 960px) {
  .vh-topnav__menu {
    display: flex;
  }
}

.vh-topnav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--vh-text-muted);
  text-decoration: none;
  border: 0;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.vh-topnav__link:hover {
  color: var(--vh-text);
  border-bottom: 0;
}

.vh-topnav__icon,
.vh-topnav__theme {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 0;
  background: transparent;
  color: var(--vh-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.vh-topnav__icon:hover,
.vh-topnav__theme:hover {
  background: color-mix(in srgb, var(--vh-text) 8%, transparent);
  color: var(--vh-text);
  border: 0;
}

.vh-topnav__icon svg,
.vh-topnav__theme svg {
  width: 18px;
  height: 18px;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 2rem;
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  main {
    padding: 2.25rem 2rem 2.5rem;
  }
}

/* ---------- Output section + progress bar (loading UX) ----------
 *
 * The progress bar and the `<pre id="output">` share a grid cell so
 * swapping between them doesn't shift the rest of the page. Min-height
 * keeps the cell at a comfortable size even before either element has
 * any content.
 */

.vh-output-section {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto;
}

.vh-output-section h2 {
  /* keep the section heading on its own row above the swap zone */
  grid-row: 1 / 2;
}

.vh-output-section .vh-progress,
.vh-output-section .vh-output {
  grid-row: 2 / 3;
  grid-column: 1 / 2;
  min-height: 7rem;
  transition: opacity 0.45s ease;
}

.vh-output {
  /* Hidden until the reproduction is done; chrome.js adds .is-revealed */
  opacity: 0;
  pointer-events: none;
}

.vh-output.is-revealed {
  opacity: 1;
  pointer-events: auto;
}

.vh-progress {
  margin: 0;
  padding: 1.5rem 1.5rem 1.25rem;
  border: 1px solid var(--vh-terminal-border);
  border-radius: 8px;
  background: var(--vh-terminal-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.vh-progress.is-done {
  opacity: 0;
  pointer-events: none;
}

.vh-progress__bar {
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

:root:not(.dark) .vh-progress__bar {
  background: rgba(0, 0, 0, 0.08);
}

.vh-progress__fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, var(--vh-accent-teal-bright), var(--vh-accent-violet-bright));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.45);
}

.vh-progress__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vh-progress__label {
  color: var(--vh-accent-teal-bright);
}

.vh-progress__bytes {
  color: var(--vh-text-dim);
}

/* ---------- Header ---------- */

header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--vh-hairline);
}

.kicker {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--vh-hairline);
  border-radius: 9999px;
  background: rgba(0, 212, 170, 0.05);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65rem;
  color: var(--vh-accent-teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 1rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--vh-text);
}

h1 a {
  color: inherit;
  border-bottom: 2px solid var(--vh-accent-teal);
  text-decoration: none;
  transition: border-color 0.18s ease;
}

h1 a:hover {
  border-bottom-color: var(--vh-accent-teal-bright);
}

h2 {
  margin: 0 0 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--vh-text-dim);
  font-weight: 600;
}

.lede {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--vh-text-muted);
  max-width: 640px;
}

/* ---------- Body sections ---------- */

section {
  margin-bottom: 1.75rem;
}

a {
  color: var(--vh-accent-teal);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 212, 170, 0.4);
  transition: border-color 0.18s ease;
}

a:hover {
  border-bottom-color: var(--vh-accent-teal);
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  background: var(--vh-card-bg);
  border-radius: 4px;
  color: var(--vh-text);
  border: 1px solid var(--vh-hairline);
}

/* ---------- Reproduction script (code block) ---------- */

pre {
  margin: 0;
  padding: 1.25rem 1.5rem;
  background: var(--vh-code-bg);
  border: 1px solid var(--vh-hairline);
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  color: #e0e6e3;
}

pre code {
  background: transparent;
  padding: 0;
  border: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}

/* ---------- Verdict pill (the money element) ---------- */

.verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-radius: 8px;
  border: 1px solid;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.verdict::before {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: currentColor;
  content: '';
  flex-shrink: 0;
}

.verdict.pending {
  background: var(--vh-pending-bg);
  color: var(--vh-pending-fg);
  border-color: var(--vh-pending-border);
}

.verdict.pending::before {
  animation: vh-pulse 1.6s ease-in-out infinite;
}

.verdict.reproduced {
  background: var(--vh-reproduced-bg);
  color: var(--vh-reproduced-fg);
  border-color: var(--vh-reproduced-border);
  box-shadow: 0 0 24px rgba(0, 212, 170, 0.18);
}

.verdict.unreproduced {
  background: var(--vh-unreproduced-bg);
  color: var(--vh-unreproduced-fg);
  border-color: var(--vh-unreproduced-border);
  box-shadow: 0 0 24px rgba(255, 113, 108, 0.18);
}

@keyframes vh-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Output / terminal block ---------- */

#output {
  background: var(--vh-terminal-bg);
  border: 1px solid var(--vh-terminal-border);
}

/* ---------- Meta line under the verdict ---------- */

.meta {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
  color: var(--vh-text-dim);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* ---------- Footer ---------- */

main > footer {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--vh-hairline);
}

main > footer .meta {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--vh-text-muted);
  letter-spacing: 0;
}

main > footer code {
  font-size: 0.85em;
}

/* ---------- Site-wide footer (matches rspress's themeConfig footer) ---------- */

.vh-footer {
  margin-top: 4rem;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--vh-hairline);
  background: var(--vh-bg);
  font-family: 'Inter', sans-serif;
}

.vh-footer__msg {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--vh-text-dim);
}

.vh-footer__msg a {
  color: var(--vh-accent-teal);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s ease;
}

.vh-footer__msg a:hover {
  border-bottom-color: var(--vh-accent-teal);
}

/* ---------- Path A — Layer 1 source-substitution branch-fix panel ----------
 *
 * Mounted by `_shared/path_a.ts` into a `<section id="path-a-mount">` that
 * recipes opt into. Shares the same teal/violet token language as the rest
 * of the recipe page chrome.
 */

.vh-path-a {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--vh-hairline);
  border-radius: 8px;
  background: var(--vh-card-bg);
}

.vh-path-a__eyebrow {
  margin: 0 0 0.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--vh-accent-teal);
}

.vh-path-a__heading {
  margin: 0 0 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.vh-path-a__lead {
  margin: 0 0 1.25rem;
  color: var(--vh-text-muted);
  font-size: 0.95rem;
}

.vh-path-a__field {
  display: block;
  margin-bottom: 1rem;
}

.vh-path-a__field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--vh-text-muted);
}

.vh-path-a__textarea,
.vh-path-a__input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--vh-hairline);
  border-radius: 6px;
  background: var(--vh-bg-deep);
  color: var(--vh-text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

.vh-path-a__textarea {
  min-height: 12rem;
  resize: vertical;
}

.vh-path-a__textarea:focus,
.vh-path-a__input:focus {
  outline: 2px solid var(--vh-accent-teal);
  outline-offset: -1px;
}

.vh-path-a__file {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--vh-text-muted);
}

.vh-path-a__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.vh-path-a__btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.vh-path-a__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.vh-path-a__btn--primary {
  border: 0;
  background: var(--vh-accent-teal);
  color: #00110e;
}

.vh-path-a__btn--primary:not(:disabled):hover {
  background: var(--vh-accent-teal-bright);
}

.vh-path-a__btn--ghost {
  border: 1px solid var(--vh-hairline);
  background: transparent;
  color: var(--vh-text);
}

.vh-path-a__btn--ghost:not(:disabled):hover {
  background: color-mix(in srgb, var(--vh-text) 8%, transparent);
}

.vh-path-a__status {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.vh-path-a__status--info {
  color: var(--vh-text-muted);
}

.vh-path-a__status--ok {
  color: var(--vh-reproduced-fg);
}

.vh-path-a__status--error {
  color: var(--vh-unreproduced-fg);
}

.vh-path-a__result-heading {
  margin: 1.5rem 0 0.5rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--vh-text-muted);
}

.vh-path-a__downloads {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.vh-path-a__download-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--vh-hairline);
  border-radius: 6px;
  background: var(--vh-bg-deep);
  flex-wrap: wrap;
}

.vh-path-a__download-side {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--vh-text-muted);
  min-width: 12rem;
}

.vh-path-a__verdict {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid;
}

.vh-path-a__verdict--reproduced {
  background: var(--vh-reproduced-bg);
  color: var(--vh-reproduced-fg);
  border-color: var(--vh-reproduced-border);
}

.vh-path-a__verdict--unreproduced {
  background: var(--vh-unreproduced-bg);
  color: var(--vh-unreproduced-fg);
  border-color: var(--vh-unreproduced-border);
}

.vh-path-a__download-link {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--vh-accent-teal);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s ease;
}

.vh-path-a__download-link:hover {
  border-bottom-color: var(--vh-accent-teal);
}

.vh-path-a__compare-link {
  margin: 0.75rem 0 0;
}

.vh-path-a__compare-anchor {
  font-size: 0.9rem;
  color: var(--vh-accent-teal);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.18s ease;
}

.vh-path-a__compare-anchor:hover {
  border-bottom-color: var(--vh-accent-teal);
}

.vh-path-a__semantics {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--vh-hairline);
}

.vh-path-a__semantics-heading {
  margin: 0 0 0.35rem;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  color: var(--vh-text-muted);
}

.vh-path-a__semantics-body {
  margin: 0;
  font-size: 0.85rem;
  color: var(--vh-text-muted);
}
