/* ============================================================
   .s-blackbox — Act 5 · Signature opinion.
   "Black-box tests: the unit is behavior."

   Two-step reveal that proves the point instead of asserting it:
     step 0  two tests + the production method, all clean.
     step 1  agent refactors the production method (rename +
             extract helper). The white-box test ALSO gets a
             diff — the agent had to rewrite the verify() chain
             to keep it green. The black-box test is byte-for-
             byte identical and still passes.

   The point isn't "white-box fails" (no one merges failing
   PRs). The point is: white-box tests force the agent to
   co-edit the test alongside the code, so the test stops
   pinning the contract. The black-box test pins the contract
   regardless of how the internals are reshaped.

   Three-column stage (equal widths so each code card breathes):
     LEFT   — white-box test card  (terminal · mocks/verify)
     CENTER — SUT card             (terminal · production code)
     RIGHT  — black-box test card  (terminal · behavior)

   Theme: light slide (cream paper). All three cards are dark
   navy terminals so they read as sibling files — same idiom
   as .s-specs-vs-tests and .s-skill.
   ============================================================ */

.s-blackbox::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, var(--grid) 1.2px, transparent 1.4px);
  background-size: 44px 44px;
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   Body grid — header / stage / tagline
   ============================================================ */
.s-blackbox .body {
  position: absolute;
  inset: 56px 0 56px 0;
  z-index: 1;
  padding: 30px var(--pad-x) 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: 20px;
}

/* === Header === */
.s-blackbox .head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 48px;
}
.s-blackbox .head .eyebrow {
  grid-column: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--accent-ink);
  margin-bottom: 12px;
}
.s-blackbox .head .title {
  grid-column: 1;
  font-size: 60px;
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0;
  color: var(--fg);
}
.s-blackbox .head .title em {
  font-style: normal;
  color: var(--accent);
}
.s-blackbox .head .sub {
  grid-column: 2;
  margin: 0 0 10px 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  line-height: 1.3;
  color: var(--fg-dim);
  text-align: right;
}
.s-blackbox .head .sub .t-warn { color: var(--accent-2-ink); font-weight: 600; }

/* ============================================================
   Stage — three equal columns. Each card needs to hold a code
   panel plus optional diff, so they share width budget evenly.
   ============================================================ */
.s-blackbox .stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  column-gap: 18px;
  align-items: stretch;
}

/* ============================================================
   Cards — shared dark-terminal envelope.
   All three cards (white-box test, SUT, black-box test) use
   the same panel-bar.term + code body idiom so they read as
   sibling files in the project.
   ============================================================ */
.s-blackbox .card {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  background: #060D3A;
  border: 1px solid rgba(10, 21, 84, 0.30);
  box-shadow:
    0 24px 60px rgba(10, 21, 84, 0.22),
    0 4px 12px rgba(10, 21, 84, 0.10);
  transition: box-shadow 350ms ease, border-color 350ms ease;
}

.s-blackbox .panel-bar.term {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: #8A93BC;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.s-blackbox .panel-bar.term .dot {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
}
.s-blackbox .panel-bar.term .dot.r { background: #FF5F57; }
.s-blackbox .panel-bar.term .dot.y { background: #FEBC2E; }
.s-blackbox .panel-bar.term .dot.g { background: #28C840; }
.s-blackbox .panel-bar.term .path  { margin-left: 8px; color: #B4BAD8; font-weight: 500; }
.s-blackbox .panel-bar.term .grow  { flex: 1 1 auto; }

/* Status pills inside the panel bar — flip with step */
.s-blackbox .status-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  letter-spacing: 0.10em;
  text-transform: lowercase;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.s-blackbox .status-pill.st-pass {
  color: #8FD79F;
  background: rgba(40, 200, 64, 0.10);
  border-color: rgba(143, 215, 159, 0.55);
}
/* Amber "agent-edited" — caution, not failure. */
.s-blackbox .status-pill.st-edited {
  color: #F2C266;
  background: rgba(254, 188, 46, 0.14);
  border-color: rgba(242, 194, 102, 0.70);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.s-blackbox .status-pill.st-untouched {
  color: #8FD79F;
  background: rgba(40, 200, 64, 0.18);
  border-color: rgba(143, 215, 159, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
/* Center card status tags — code-state, not test-state. */
.s-blackbox .status-pill.st-stable {
  color: #8A93BC;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(138, 147, 188, 0.45);
  text-transform: lowercase;
}
.s-blackbox .status-pill.st-refactor {
  color: #F2C266;
  background: rgba(254, 188, 46, 0.12);
  border-color: rgba(242, 194, 102, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.10em;
}

/* Step toggle for status pills:
     step 0  → .st-pass + .st-stable visible
     step 1  → .st-edited (white), .st-refactor (SUT), .st-untouched (black) */
.s-blackbox .status-pill.st-edited,
.s-blackbox .status-pill.st-untouched,
.s-blackbox .status-pill.st-refactor { display: none; }
.s-blackbox[data-step="1"] .status-pill.st-pass,
.s-blackbox[data-step="1"] .status-pill.st-stable { display: none; }
.s-blackbox[data-step="1"] .card-white .status-pill.st-edited,
.s-blackbox[data-step="1"] .card-black .status-pill.st-untouched,
.s-blackbox[data-step="1"] .card-sut .status-pill.st-refactor { display: inline; }

/* Micro-glossary one-liner under the panel bar */
.s-blackbox .micro-gloss {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: #8A93BC;
  padding: 7px 18px 5px;
  background: rgba(255,255,255,0.015);
  border-bottom: 1px dashed rgba(255,255,255,0.07);
}

/* ============================================================
   Code panels — shared body styles
   ============================================================ */
.s-blackbox .panel-body.code {
  flex: 1 1 auto;
  padding: 12px 18px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  line-height: 1.42;
  color: #C8CCE4;
  display: flex;
  flex-direction: column;
  gap: 0;
  white-space: nowrap;
  overflow: hidden;
}
.s-blackbox .ln           { min-height: 1.42em; }
.s-blackbox .ln.indent    { padding-left: 22px; }
.s-blackbox .ln.indent-2  { padding-left: 44px; }

/* Setup block: the field declarations above @Test.
   Visually muted so the test method itself stays the focus, but
   the @Mock / @EnableKubeAPIServer annotations carry the contrast
   between "this test needs mocks" and "this test uses a real
   Kubernetes API server". */
.s-blackbox .ln.setup {
  font-size: 13px;
  line-height: 1.55;
  min-height: 1.55em;
  color: #8A93BC;
  letter-spacing: -0.005em;
}
.s-blackbox .ln.setup .t-anno { color: var(--orange-soft); opacity: 0.95; }
.s-blackbox .ln.setup .t-type { color: var(--cyan); opacity: 0.85; }
/* Visual breathing room between setup and the @Test method. */
.s-blackbox .ln.gap { min-height: 8px; }

/* Step-based body switching.
   Each card with step-dependent code carries two panel-bodies:
   .body-step-0 (default) and .body-step-1 (the diff view). */
.s-blackbox .panel-body.body-step-1 { display: none; }
.s-blackbox[data-step="1"] .panel-body.body-step-0 { display: none; }
.s-blackbox[data-step="1"] .panel-body.body-step-1 { display: flex; }

/* Code syntax colors — match s-specs-vs-tests.css */
.s-blackbox .t-anno { color: var(--orange-soft); }
.s-blackbox .t-kw   { color: #B89AE8; }
.s-blackbox .t-type { color: var(--cyan); }
.s-blackbox .t-fn   { color: var(--cyan); }
.s-blackbox .t-str  { color: #B6E3A8; }
/* Highlight verify(…) chain in white-box; assertThat in black-box */
.s-blackbox .t-fn.t-vrf { color: var(--orange-soft); font-weight: 600; }
.s-blackbox .t-fn.t-asr { color: #8FD79F; font-weight: 600; }

/* ============================================================
   Diff lines (inside .body-step-1).
   .rem  = removed (red gutter, soft red bg)
   .add  = added   (green gutter, soft green bg)
   .ctx  = context (no bg, neutral gutter)

   The leading <span class="g"> is a 14px gutter holding the +/-/space
   glyph. It sits flush-left and gives the diff its column alignment.
   ============================================================ */
.s-blackbox .ln.rem,
.s-blackbox .ln.add,
.s-blackbox .ln.ctx {
  padding: 1px 6px;
  margin: 0 -8px;
  border-radius: 3px;
}
.s-blackbox .ln .g {
  display: inline-block;
  width: 14px;
  margin-right: 4px;
  font-weight: 700;
  text-align: center;
  color: #5F668F;
}
.s-blackbox .ln.rem {
  background: rgba(240, 42, 90, 0.14);
}
.s-blackbox .ln.rem .g { color: #FF8794; }
.s-blackbox .ln.add {
  background: rgba(40, 200, 64, 0.14);
}
.s-blackbox .ln.add .g { color: #8FD79F; }
.s-blackbox .ln.ctx .g { color: #5F668F; }

/* ============================================================
   Card foot — short message that swaps on step.
   ============================================================ */
.s-blackbox .card-foot {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 11px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: #B4BAD8;
  flex-shrink: 0;
  min-height: 44px;
}
.s-blackbox .card-foot .foot-glyph {
  font-size: 18px;
  color: #8A93BC;
}
.s-blackbox .card-foot .foot-msg em {
  font-style: normal;
  color: #FFF;
  font-weight: 600;
}
.s-blackbox .card-foot .foot-msg-1 { display: none; }
.s-blackbox[data-step="1"] .card-foot .foot-msg-0 { display: none; }
.s-blackbox[data-step="1"] .card-foot .foot-msg-1 { display: inline; }

/* White-box foot on step 1: amber accent (caution, not failure) */
.s-blackbox[data-step="1"] .card-white .card-foot {
  background: linear-gradient(to bottom, rgba(254,188,46,0.10), rgba(254,188,46,0.04));
  border-top-color: rgba(242, 194, 102, 0.35);
}
.s-blackbox[data-step="1"] .card-white .card-foot .foot-glyph { color: #F2C266; }
.s-blackbox[data-step="1"] .card-white .card-foot .foot-msg em { color: #F8D78A; }

/* Center (SUT) foot on step 1: amber accent (active change) */
.s-blackbox[data-step="1"] .card-sut .card-foot {
  background: linear-gradient(to bottom, rgba(254,188,46,0.08), rgba(254,188,46,0.03));
  border-top-color: rgba(242, 194, 102, 0.30);
}
.s-blackbox[data-step="1"] .card-sut .card-foot .foot-glyph { color: #F2C266; }
.s-blackbox[data-step="1"] .card-sut .card-foot .foot-msg em { color: #F8D78A; }

/* Black-box foot on step 1: green accent (contract held) */
.s-blackbox[data-step="1"] .card-black .card-foot {
  background: linear-gradient(to bottom, rgba(40,200,64,0.10), rgba(40,200,64,0.04));
  border-top-color: rgba(143, 215, 159, 0.30);
}
.s-blackbox[data-step="1"] .card-black .card-foot .foot-glyph { color: #8FD79F; }
.s-blackbox[data-step="1"] .card-black .card-foot .foot-msg em { color: #B7E8C2; }

/* ============================================================
   Step-1 card halos.
   White-box + SUT get an amber halo (active change in flight).
   Black-box gets a green halo (contract held).
   ============================================================ */
.s-blackbox[data-step="1"] .card-white,
.s-blackbox[data-step="1"] .card-sut {
  border-color: rgba(242, 194, 102, 0.60);
  box-shadow:
    0 0 0 1px rgba(242, 194, 102, 0.40),
    0 24px 60px rgba(225, 99, 9, 0.18),
    0 4px 12px rgba(225, 99, 9, 0.10);
}
.s-blackbox[data-step="1"] .card-black {
  border-color: rgba(143, 215, 159, 0.50);
  box-shadow:
    0 0 0 1px rgba(143, 215, 159, 0.40),
    0 24px 60px rgba(40, 200, 64, 0.18),
    0 4px 12px rgba(40, 200, 64, 0.10);
}

/* ============================================================
   Tagline — strong opinion + chip strip
   ============================================================ */
.s-blackbox .tag-line {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 56px;
}
.s-blackbox .tag-line .quote {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--fg);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.s-blackbox .tag-line .quote .accent {
  color: var(--accent);
}
.s-blackbox .tag-line .chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
}
.s-blackbox .tag-line .chips-lbl {
  color: var(--fg-mute);
  letter-spacing: 0.08em;
  margin-right: 4px;
}
.s-blackbox .tag-line .chip {
  color: var(--fg-dim);
  padding: 3px 10px;
  border: 1px solid rgba(10, 21, 84, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

/* ============================================================
   Print — flatten step rules so export:pdf produces both pages
   without Chromium rasterising the halos as opaque rectangles.
   ============================================================ */
@media print {
  .s-blackbox .card { box-shadow: none; }
  .s-blackbox[data-step="1"] .card-white,
  .s-blackbox[data-step="1"] .card-sut {
    border-color: rgba(242, 194, 102, 0.85);
    box-shadow: 0 0 0 2px rgba(242, 194, 102, 0.45);
  }
  .s-blackbox[data-step="1"] .card-black {
    border-color: rgba(143, 215, 159, 0.85);
    box-shadow: 0 0 0 2px rgba(143, 215, 159, 0.40);
  }
  .s-blackbox[data-step="1"] .card-white .card-foot,
  .s-blackbox[data-step="1"] .card-sut .card-foot {
    background: rgba(254, 188, 46, 0.10);
  }
  .s-blackbox[data-step="1"] .card-black .card-foot {
    background: rgba(40, 200, 64, 0.10);
  }
}
