/* Barnicle Productions — production motion + visual-module styles.
   Companion to motion.js. Failure-atomic: the html.motion gate class is added
   only by motion.js AFTER its reveal observers are wired, so if that file is
   missing/blocked/broken nothing here hides content. All hiding is scoped to
   screen (print always shows everything) and to prefers-reduced-motion:
   no-preference (reduced-motion users get calm static pages). */

/* ---------- Reveal system (motion-lab exp 08 promoted) ---------- */
.reveal,
.reveal-stagger > * {
  opacity: 1;
  transform: none;
}
@media screen and (prefers-reduced-motion: no-preference) {
  .motion .reveal,
  .motion .reveal-stagger > * {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .motion .reveal.in,
  .motion .reveal-stagger.in > * {
    opacity: 1;
    transform: none;
  }
  .motion .reveal-stagger.in > *:nth-child(2) { transition-delay: 90ms; }
  .motion .reveal-stagger.in > *:nth-child(3) { transition-delay: 180ms; }
  .motion .reveal-stagger.in > *:nth-child(4) { transition-delay: 270ms; }
  .motion .reveal-stagger.in > *:nth-child(5) { transition-delay: 360ms; }
  .motion .reveal-stagger.in > *:nth-child(6) { transition-delay: 450ms; }
  .motion .rw {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.35em);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  .motion .reveal-words.in .rw {
    opacity: 1;
    transform: none;
  }
}
@media print {
  .reveal, .reveal-stagger > *, .rw { opacity: 1 !important; transform: none !important; }
}
/* Accessible text for word-split headings (spans are aria-hidden) */
.sr-only-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* (Hero parallax support removed 2026-07: photo hero replaced by the
   constellation canvas, driven by motion.js section 2.) */

/* ---------- Brain-graph bloom panel ---------- */
.brainviz-panel {
  position: relative;
  background: var(--forest, #1d342b);
  border-radius: var(--radius, 8px);
  overflow: hidden;
  box-shadow: var(--shadow, 0 18px 40px rgba(21, 23, 24, 0.12));
}
.brainviz-panel canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1000 / 520; /* reserves space pre-JS: no layout shift */
  min-height: 300px;
}
.brainviz-panel .brainviz-legend {
  position: absolute;
  left: 16px;
  bottom: 12px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #cfd8cd; /* extended-palette: soft paper-on-forest (see QA note) */
}
.brainviz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.brainviz-legend i {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}
/* swatches match the canvas draw colors exactly (motion.js COLORS) */
.brainviz-legend .lg-hub i { background: #b98544; }
.brainviz-legend .lg-node i { background: #6f9982; }
.brainviz-legend .lg-accent i { background: #c98a74; }
.brainviz-caption {
  font-size: 0.85rem;
  color: var(--ink-soft, #363d3f);
  margin-top: 10px;
}
.brainviz-media {
  margin-top: 16px;
}
.brainviz-media .bv-frame {
  position: relative;
}
.brainviz-media video {
  width: 100%;
  border-radius: var(--radius, 8px);
  display: block;
}
.bv-phases {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.bv-phases span {
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: #cfd8cd;
  background: rgba(21, 23, 24, 0.72);
  border: 1px solid rgba(212, 202, 189, 0.35);
  border-radius: 5px;
  padding: 3px 8px;
  transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}
.bv-phases span.on {
  background: var(--brass, #b98544);
  color: #17120c;
  border-color: var(--brass, #b98544);
  font-weight: 700;
}
@media (max-width: 560px) {
  .bv-phases span { font-size: 0.6rem; padding: 2px 6px; }
}

/* ---------- Glass-box pipeline ---------- */
.pipeline-viz {
  margin: 8px 0 20px;
}
.pv-track {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.pv-station {
  position: relative;
  background: var(--surface, #fff);
  border: 1.5px solid var(--line, #d4cabd);
  border-radius: var(--radius, 8px);
  padding: 12px 10px 10px;
  text-align: center;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}
.pv-station .pv-num {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--clay, #9a5841);
  display: block;
}
.pv-station .pv-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  display: block;
  margin-top: 2px;
}
.pv-station .pv-gate {
  display: inline-block;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  background: var(--brass, #b98544);
  color: #17120c; /* dark-on-brass, same pairing as .button-primary */
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 7px;
  margin-top: 6px;
}
.pv-station.on {
  border-color: var(--forest-2, #2f5545);
  box-shadow: 0 6px 18px rgba(29, 52, 43, 0.18);
}
@media screen and (prefers-reduced-motion: no-preference) {
  .pv-station.on { transform: translateY(-3px); }
  .pv-station.on .pv-gate {
    animation: pv-pulse 1.4s ease-in-out 8; /* finite: settles once the point lands */
  }
}
@keyframes pv-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 133, 68, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(185, 133, 68, 0); }
}
.pv-chipline {
  position: relative;
  height: 22px;
  margin: 10px 2px 0;
}
.pv-chipline .pv-rail {
  position: absolute;
  left: 4%; right: 4%; top: 50%;
  border-top: 1.5px dashed var(--line, #d4cabd);
}
.pv-chip {
  position: absolute;
  top: 50%;
  left: 10%;
  transform: translate(-50%, -50%);
  background: var(--forest, #1d342b);
  color: var(--paper, #f7f4ee);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  border-radius: 5px;
  padding: 3px 8px;
  white-space: nowrap;
}
@media screen and (prefers-reduced-motion: no-preference) {
  .pv-chip { transition: left 0.9s cubic-bezier(0.45, 0.05, 0.35, 1); }
}
[data-pipeline][data-stage="0"] .pv-chip { left: 10%; }
[data-pipeline][data-stage="1"] .pv-chip { left: 30%; }
[data-pipeline][data-stage="2"] .pv-chip { left: 50%; }
[data-pipeline][data-stage="3"] .pv-chip { left: 70%; }
[data-pipeline][data-stage="4"] .pv-chip { left: 90%; }
[data-pipeline][data-stage="3"] .pv-chip {
  background: var(--brass, #b98544);
  color: #17120c;
  font-weight: 700;
}
@media (max-width: 720px) {
  .pv-track { grid-template-columns: repeat(5, minmax(96px, 1fr)); }
  .pipeline-viz { overflow-x: auto; padding-bottom: 6px; }
  .pipeline-viz > * { min-width: 560px; }
}

/* ---------- ICM layer stack ---------- */
.layer-stack {
  display: grid;
  gap: 10px;
  margin: 16px 0 6px;
  max-width: 720px;
}
.layer {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 14px;
  align-items: baseline;
  background: var(--surface, #fff);
  border: 1.5px solid var(--line, #d4cabd);
  border-left: 5px solid var(--forest-2, #2f5545);
  border-radius: var(--radius, 8px);
  padding: 12px 16px;
}
.layer:nth-child(1) { border-left-color: var(--forest, #1d342b); }
.layer:nth-child(2) { border-left-color: var(--forest-2, #2f5545); }
.layer:nth-child(3) { border-left-color: #5c7d6b; /* extended-palette: forest-3 candidate */ }
.layer:nth-child(4) { border-left-color: var(--brass, #b98544); }
.layer:nth-child(5) { border-left-color: var(--clay, #9a5841); }
.layer b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
}
.layer p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft, #363d3f);
}
.layer .layer-q {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--clay, #9a5841);
}
@media (max-width: 560px) {
  .layer { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Footer barnacle breathe ---------- */
@media screen and (prefers-reduced-motion: no-preference) {
  .footer-brand img {
    animation: barnacle-breathe 7s ease-in-out 8; /* finite */
  }
}
@keyframes barnacle-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
