/* Scene 4 -- "The encoder is the CNN you already know."

   Layout:
     hero
     mini-map
     sample selector strip
     pipeline row:
       input | conv | enc1 | pool | pool1 | conv | enc2 | pool | pool2 | conv | enc3
     caption + footnote
     controls

   Pipeline panels are sized proportional to spatial extent. Pool outputs
   share px with the next conv-block input so the eye reads "this collapses
   to that". Pool cards get a slightly different border accent to keep them
   distinguishable when several panels are lit at once. */

.s4-root .s4-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.s4-hero h1 { font-size: 28px; }
.s4-hero .lede em { font-style: italic; color: var(--ink); }

.s4-mini-host { align-self: flex-start; }

/* ---------------------------------------------------------------------------
   Sample selector strip
   --------------------------------------------------------------------------- */

.s4-selector {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 4px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.s4-selector-label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  flex: 0 0 auto;
}

.s4-selector-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1 1 auto;
}

.s4-thumb {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 3px;
  cursor: pointer;
  transition: border-color 120ms ease-out, transform 120ms ease-out;
}
.s4-thumb:hover { border-color: var(--ink-secondary); }
.s4-thumb.active {
  border-color: var(--cnn-pos);
  box-shadow: 0 0 0 2px var(--cnn-pos);
  transform: translateY(-1px);
}
.s4-thumb-host { display: block; }
.s4-thumb canvas { display: block; image-rendering: pixelated; }

/* ---------------------------------------------------------------------------
   Pipeline row
   --------------------------------------------------------------------------- */

.s4-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 16px 8px 22px;
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.s4-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.s4-stage-note {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-style: italic;
  font-size: 12px;
  color: var(--ink-secondary);
  text-align: center;
  max-width: 14ch;
  line-height: 1.25;
}

.s4-input-host,
.s4-card-body {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg);
}
.s4-input-host canvas,
.s4-card-body canvas {
  display: block;
  image-rendering: pixelated;
}

.s4-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  opacity: 0.45;
  transition: opacity 220ms ease-out, border-color 220ms ease-out;
}
.s4-card.s4-visible {
  opacity: 1;
  border-color: var(--ink-secondary);
}
/* Pool cards get an amber accent on the lit border so they stand out
   from conv-block cards in a long lit pipeline. */
.s4-card-pool.s4-visible {
  border-color: var(--cnn-accent);
}

.s4-card-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  padding-bottom: 2px;
}
.s4-card-name {
  font-weight: 600;
  color: var(--ink);
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11px;
}
.s4-card-sub {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

/* Arrows between stages -- amber chevron + a one-line op label below.
   Pool arrows use a slightly heavier/different hue so the viewer can scan
   the pipeline and read "conv, pool, conv, pool, conv" without looking at
   the labels. */
.s4-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 24px;
  color: var(--cnn-accent);
  line-height: 1;
  padding: 0 2px;
  flex: 0 0 auto;
}
.s4-arrow-pool {
  color: var(--ink-secondary);
  font-weight: 600;
}
.s4-arrow-label {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-style: italic;
  font-size: 11px;
  color: var(--ink-secondary);
  margin-top: 4px;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Caption / footnote / controls
   --------------------------------------------------------------------------- */

.s4-caption {
  margin: 4px 4px 0;
  text-align: center;
  font-size: 14.5px;
  min-height: 1.4em;
}
.s4-footnote {
  margin: 0 4px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-secondary);
  font-style: italic;
}
.s4-footnote code {
  font-family: "SF Mono", Menlo, monospace;
  font-style: normal;
  font-size: 11.5px;
  background: var(--card-bg);
  padding: 0 4px;
  border-radius: 2px;
}
.s4-controls { margin-top: 6px; }

/* ---------------------------------------------------------------------------
   Responsive: at narrower widths stack vertically and rotate the arrows.
   The 6-panel pipeline crosses ~1300px when laid out fully, so we kick in
   the column layout earlier than the original 4-panel version.
   --------------------------------------------------------------------------- */

@media (max-width: 1320px) {
  .s4-pipeline {
    flex-direction: column;
  }
  .s4-arrow {
    transform: rotate(90deg);
    padding: 8px 0;
  }
  .s4-arrow-label {
    transform: rotate(-90deg);
    margin-top: 0;
  }
}
