/* =========================================================
   Vivarium Landing Page
   Aesthetic: simple, monumental, flat. Type + space + motion.
   Palette: warm cream, ink, teal, ocean, green, terracotta.
   No gradients. No shadows.
   ========================================================= */

/* ---------- TOKENS ---------- */
:root {
  --paper:       #FAF7F0;  /* warm cream, page background */
  --paper-warm:  #FFFFFF;  /* white, lifted surfaces      */
  --panel-dark:  #16242B;  /* ink, dark panels            */

  --ink:         #16242B;  /* primary text & structure    */
  --ink-soft:    rgba(22, 36, 43, 0.74);
  --ink-muted:   rgba(22, 36, 43, 0.66);
  --ink-faint:   rgba(22, 36, 43, 0.30);
  --rule:        rgba(22, 36, 43, 0.12);
  --rule-strong: rgba(22, 36, 43, 0.20);

  --on-dark:       #FAF7F0;
  --on-dark-soft:  rgba(250, 247, 240, 0.78);
  --on-dark-muted: rgba(250, 247, 240, 0.56);

  --accent:      #1D9E75;  /* teal, primary accent        */
  --accent-deep: #0F4C5C;  /* ocean, deep accent          */
  --ocean:       #0F4C5C;
  --green:       #639922;
  --mist:        #DCE6E4;
  --mint:        #BFE9D9;
  --terracotta:  #B4452F;
  --on-accent:   #16242B;  /* text on the teal accent, fixed in both themes */

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --container: 920px;
  --gutter: clamp(20px, 5vw, 64px);
  --reveal-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- DARK THEME (brand colors only: ink bg, ocean surfaces, teal accent) ---------- */
:root[data-theme="dark"] {
  --paper:       #16242B;  /* ink, page background        */
  --paper-warm:  #0F4C5C;  /* ocean, lifted surfaces      */
  --panel-dark:  #0F4C5C;  /* ocean, prompt/CTA panels    */

  --ink:         #FAF7F0;  /* cream, primary text         */
  --ink-soft:    rgba(250, 247, 240, 0.78);
  --ink-muted:   rgba(250, 247, 240, 0.62);
  --ink-faint:   rgba(250, 247, 240, 0.32);
  --rule:        rgba(250, 247, 240, 0.14);
  --rule-strong: rgba(250, 247, 240, 0.22);

  --accent-deep: #1D9E75;  /* teal reads on ink; ocean would not */
  --mist:        #0F4C5C;  /* ocean band instead of light mist   */
}

/* ---------- RESET + BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--terracotta); color: #FAF7F0; }
:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- SCROLL REVEAL ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--reveal-ease), transform 0.8s var(--reveal-ease);
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }
.reveal[data-delay="4"] { transition-delay: 0.32s; }

/* ---------- TYPOGRAPHY ---------- */
.display-hero {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.04em;
  margin: 0;
  color: var(--ink);
}
.display-l {
  font-size: clamp(21px, 2.4vw, 28px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink);
}

/* ---------- HEADER (deep ocean band, both themes) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 16px 0;
  background: var(--ocean);
  border-bottom: 1px solid rgba(250, 247, 240, 0.14);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.wordmark { display: inline-flex; align-items: center; transition: opacity 0.2s; }
.wordmark:hover { opacity: 0.8; }
.wordmark-logo { display: block; height: 28px; width: auto; }
.wordmark-logo-footer { height: 26px; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: rgba(250, 247, 240, 0.78);
  transition: color 0.2s;
}
.nav-link:hover { color: #FAF7F0; }
.nav-cta {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  padding: 9px 18px;
  border-radius: 999px;
  transition: background 0.2s, color 0.2s;
}
.nav-cta:hover { background: #FAF7F0; color: var(--ocean); }

/* theme switch */
.theme-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid rgba(250, 247, 240, 0.32);
  border-radius: 999px;
  background: rgba(250, 247, 240, 0.14);
  transition: background 0.2s;
}
.theme-toggle:hover { background: rgba(250, 247, 240, 0.22); }
.theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FAF7F0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.25s var(--reveal-ease);
}
:root[data-theme="dark"] .theme-toggle-knob { left: 29px; }
.theme-toggle-knob svg { width: 12px; height: 12px; color: var(--ocean); }
.ic-sun { display: block; }
.ic-moon { display: none; }
:root[data-theme="dark"] .ic-sun { display: none; }
:root[data-theme="dark"] .ic-moon { display: block; }

@media (max-width: 680px) {
  .nav-link { display: none; }
}

/* ---------- HERO ---------- */
.hero {
  padding: clamp(44px, 8vh, 80px) 0 clamp(36px, 6vh, 60px);
}
.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.hero .display-hero { max-width: 14ch; }
.hero-sub {
  font-size: clamp(15px, 1.2vw, 17px);
  font-weight: 400;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 30ch;
  margin: 28px 0 0;
}
.hero-cta-row { margin-top: 40px; }

/* hero mark: "one mark, infinite" - it forms, is held, and emanates endlessly */
.hero-mark {
  order: -1;
  position: relative;
  width: clamp(116px, 17vw, 156px);
  aspect-ratio: 1;
  margin: 0 0 clamp(18px, 3vh, 32px);
}
.hero-emanate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.hero-emanate .em,
.hero-emanate .shield {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  transform-origin: 100px 100px;
}
.hero-emanate .em {
  opacity: 0;
  animation: emanate 3.8s linear infinite;
}
.hero-emanate .em2 { animation-delay: 1.27s; }
.hero-emanate .em3 { animation-delay: 2.54s; }
.hero-emanate .shield {
  opacity: 0.3;
  animation: shieldPulse 4.6s var(--reveal-ease) infinite;
}
.hero-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 52%;
  height: 52%;
  background: var(--accent);
  -webkit-mask: url(brand/VivariumBlackFavIcon180.svg) center / contain no-repeat;
          mask: url(brand/VivariumBlackFavIcon180.svg) center / contain no-repeat;
  opacity: 0;
  transform: scale(0.4);
  transform-origin: center;
  animation: coreForm 0.9s 0.15s var(--reveal-ease) forwards,
             coreBreathe 6s 1.05s ease-in-out infinite;
}

@keyframes emanate {
  0%   { transform: scale(1);   opacity: 0; }
  12%  { opacity: 0.55; }
  100% { transform: scale(2.0); opacity: 0; }
}
@keyframes shieldPulse {
  0%, 100% { transform: scale(1);    opacity: 0.3; }
  50%      { transform: scale(1.05); opacity: 0.5; }
}
@keyframes coreForm {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes coreBreathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}

.scroll-cue {
  margin-top: clamp(48px, 8vh, 96px);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  transition: color 0.2s;
}
.scroll-cue:hover { color: var(--ink); }
.scroll-chevron {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  animation: nudge 1.8s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50%      { transform: rotate(45deg) translate(3px, 3px); }
}

/* ---------- SECTIONS ---------- */
section { padding: clamp(52px, 8vh, 88px) 0; }
.section-head { margin-bottom: clamp(28px, 4vw, 44px); }
.section-sub {
  font-size: clamp(14px, 1vw, 15px);
  color: var(--ink-muted);
  margin: 18px 0 0;
  max-width: 44ch;
}

/* ---------- BUTTONS ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 30px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  border-radius: 999px;
  transition: background 0.22s, color 0.22s;
}
.btn-primary:hover { background: var(--accent); color: var(--on-accent); }
.btn-primary:active { background: var(--ocean); color: #FAF7F0; }
.btn-primary-lg { padding: 18px 38px; font-size: 16px; }

/* ---------- DEMO (prompt) ---------- */
.demo-inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.demo-inner .section-head { max-width: none; }
.prompt { width: 100%; max-width: 680px; margin-top: clamp(36px, 6vw, 64px); }
.prompt-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-dark);
  border: 1px solid var(--rule-strong);
  border-radius: 18px;
  padding: 22px 22px 22px 26px;
  min-height: 84px;
  text-align: left;
}
.prompt-typed {
  flex: 1;
  font-size: clamp(14px, 1.6vw, 16px);
  color: var(--on-dark);
  min-width: 0;
}
.prompt-cursor {
  color: var(--accent);
  margin-left: -8px;
  animation: blink 1.05s steps(1) infinite;
}
.prompt-btn {
  flex-shrink: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
}
.prompt-steps {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  max-width: 680px;
}
.prompt-step {
  font-size: 14px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.prompt-check {
  color: var(--green);
  font-weight: 700;
}
.prompt-result {
  margin: 22px 0 0;
  min-height: 1.5em;
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--ink);
  font-weight: 500;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.prompt-name { color: var(--accent-deep); font-weight: 700; }

/* JS hides these until cued; without JS they stay visible */
.prompt.is-animating .prompt-step,
.prompt.is-animating .prompt-result { opacity: 0; transform: translateY(6px); }
.prompt.is-animating .prompt-step.is-visible,
.prompt.is-animating .prompt-result.is-visible { opacity: 1; transform: none; }

@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ---------- BUILD (word cycle) ---------- */
.build { text-align: center; }
.build-inner { display: flex; flex-direction: column; align-items: center; }
.build-line {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.04em;
  margin: 0;
  color: var(--ink);
  text-align: center;
}
.build-lead { display: block; }
.cycle-word {
  display: block;
  min-height: 1.1em;
  color: var(--accent);
  transition: opacity 0.32s ease, transform 0.32s ease;
}
.cycle-word.is-swapping { opacity: 0; transform: translateY(10px); }
.build-sub { margin-top: 32px; text-align: center; max-width: 40ch; }

/* ---------- HOW ---------- */
.steps { list-style: none; margin: 0; padding: 0; }
.step {
  display: grid;
  grid-template-columns: minmax(90px, 0.4fr) 1fr;
  gap: clamp(20px, 5vw, 64px);
  padding: clamp(28px, 4vw, 44px) 0;
  border-top: 1px solid var(--rule);
}
.step:first-child { border-top: 1px solid var(--rule-strong); }
.step-num {
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1;
}
.step-title {
  font-size: clamp(17px, 1.6vw, 20px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--ink);
}
.step-text {
  font-size: clamp(14px, 1.1vw, 15px);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  max-width: 52ch;
}

@media (max-width: 620px) {
  .step { grid-template-columns: 1fr; gap: 10px; }
}
@media (max-width: 420px) {
  .prompt-box { padding: 16px 16px 16px 18px; }
}

/* ---------- PRINCIPLES ---------- */
.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule-strong);
}
.principle {
  padding: clamp(32px, 4vw, 52px) clamp(24px, 3vw, 48px) clamp(32px, 4vw, 52px) 0;
  border-bottom: 1px solid var(--rule);
}
.principle:nth-child(odd) { border-right: 1px solid var(--rule); padding-right: clamp(32px, 4vw, 64px); }
.principle:nth-child(even) { padding-left: clamp(32px, 4vw, 64px); }
.principle-title {
  font-size: clamp(16px, 1.5vw, 19px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  color: var(--ink);
}
.principle-text {
  font-size: clamp(14px, 1vw, 15px);
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  max-width: 42ch;
}

@media (max-width: 720px) {
  .principles { grid-template-columns: 1fr; }
  .principle, .principle:nth-child(odd), .principle:nth-child(even) {
    border-right: none;
    padding: clamp(28px, 6vw, 40px) 0;
  }
}

/* ---------- FAQ ---------- */
.faq-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule-strong); }
.faq-item { border-bottom: 1px solid var(--rule); }
.faq-item details { padding: clamp(20px, 2.4vw, 30px) 0; }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  cursor: pointer;
  list-style: none;
  font-size: clamp(15px, 1.3vw, 18px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
  transition: color 0.2s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent-deep); }
.faq-q-text { flex: 1; }
.faq-q-icon {
  flex-shrink: 0;
  font-size: 26px;
  font-weight: 300;
  color: var(--ink-muted);
  transition: transform 0.3s var(--reveal-ease), color 0.2s;
}
.faq-item details[open] .faq-q-icon { transform: rotate(45deg); color: var(--accent); }
.faq-a { margin-top: 16px; max-width: 64ch; }
.faq-a p { font-size: clamp(14px, 1vw, 15px); line-height: 1.65; color: var(--ink-soft); margin: 0 0 12px; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a em { font-style: italic; color: var(--ink); }

/* ---------- CTA ---------- */
.cta { text-align: center; }
.cta-inner { display: flex; flex-direction: column; align-items: center; }
.cta-sub {
  font-size: clamp(14px, 1.1vw, 16px);
  color: var(--ink-muted);
  margin: 20px 0 36px;
}
.fine-print {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 20px 0 0;
}

/* ---------- FOOTER ---------- */
.site-footer { padding: 48px 0; background: #16242B; border-top: 1px solid rgba(250, 247, 240, 0.14); }
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-meta {
  font-size: 13px;
  color: rgba(250, 247, 240, 0.7);
  margin: 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.footer-sep { color: rgba(250, 247, 240, 0.3); }
.footer-link { color: #FAF7F0; transition: color 0.2s; }
.footer-link:hover { color: var(--mint); }

/* ---------- MOTION PREFERENCES ---------- */
@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;
  }
  .reveal { opacity: 1; transform: none; }
  .prompt-step, .prompt-result { opacity: 1; transform: none; }
  .hero-core { opacity: 1; transform: none; animation: none; }
  .hero-emanate .em { animation: none; opacity: 0; }
  .hero-emanate .shield { animation: none; opacity: 0.35; }
}
