/* ===== Comics carousel, adopted from claude.ai/design ===== */
/* Terminal style only for v1. Halftone + Editorial deferred. */

:root {
  --green: #00ff66;
  --green-dim: #00b347;
  --green-glow: rgba(0, 255, 102, 0.5);
  --ink: #0a0d0a;
  --paper: #f5f1e6;
  --red: #ff3b3b;
  --amber: #ffb020;
}

body.comics-body {
  background:
    radial-gradient(ellipse at top, rgba(0, 255, 102, 0.08), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(0,255,102,0.02) 3px, rgba(0,255,102,0.02) 4px),
    #050706;
}

.comics-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Masthead ===== */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px dashed rgba(0,255,102,0.3);
  flex-wrap: wrap;
}
.masthead .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.masthead .brand-mark {
  width: 38px; height: 38px;
  border: 2px solid var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: 16px;
  color: var(--green);
  position: relative;
}
.masthead .brand-mark small {
  font-size: 9px;
  position: absolute;
  bottom: 2px;
  right: 3px;
  opacity: 0.6;
}
.masthead .brand-mark::before,
.masthead .brand-mark::after {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border: 2px solid var(--green);
}
.masthead .brand-mark::before { top: -4px; left: -4px; border-right: none; border-bottom: none; }
.masthead .brand-mark::after { bottom: -4px; right: -4px; border-left: none; border-top: none; }
.masthead .brand-name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--green);
  text-transform: uppercase;
}
.masthead .brand-name .grey { color: rgba(0,255,102,0.5); font-weight: 400; }
.masthead-sub {
  font-size: 10.5px;
  color: rgba(0,255,102,0.55);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: 2px;
}
.masthead-meta {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: rgba(0,255,102,0.55);
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.masthead-meta span b { color: var(--green); font-weight: 700; }
.masthead-meta .pulse {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--green-glow);
  animation: pulse-blink 1.4s infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes pulse-blink { 0%, 60% { opacity: 1; } 80%, 100% { opacity: 0.2; } }

/* ===== Stage ===== */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.viewport {
  width: 100%;
  display: flex;
  justify-content: center;
}
.panel-wrap {
  position: relative;
  width: min(900px, calc(100vw - 80px));
  aspect-ratio: 1 / 1;
  background: var(--ink);
  border: 1px solid rgba(0,255,102,0.35);
  box-shadow:
    0 0 0 1px rgba(0,255,102,0.05),
    0 30px 80px -20px rgba(0,255,102,0.15),
    inset 0 0 80px rgba(0, 50, 20, 0.4);
  overflow: hidden;
  color: var(--green);
}
/* Fixed 1080×1080 canvas, scaled via JS --s var */
.canvas {
  position: absolute;
  top: 0; left: 0;
  width: 1080px;
  height: 1080px;
  transform-origin: top left;
  transform: scale(var(--s, 0.833));
}

/* Terminal CRT effect */
.panel-wrap.style-terminal::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg,
    rgba(0,255,102,0.03) 0,
    rgba(0,255,102,0.03) 1px,
    transparent 1px,
    transparent 3px);
  pointer-events: none;
  z-index: 4;
}
.panel-wrap.style-terminal::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
  pointer-events: none;
  z-index: 5;
}

/* ===== Panel ===== */
.panel {
  position: absolute;
  inset: 0;
  display: block;
  color: var(--green);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.panel[hidden] { display: none !important; }

.panel-tag {
  position: absolute;
  top: 32px; left: 32px;
  font-size: 16px;
  letter-spacing: 0.25em;
  font-weight: 700;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
}
.panel-tag .dot {
  width: 10px; height: 10px;
  background: currentColor;
  border-radius: 50%;
}
.panel-num {
  position: absolute;
  top: 32px; right: 32px;
  font-size: 16px;
  letter-spacing: 0.25em;
  font-weight: 700;
  z-index: 6;
  opacity: 0.7;
}
.panel-caption {
  position: absolute;
  bottom: 24px; left: 32px; right: 32px;
  z-index: 6;
  font-size: 14px;
  letter-spacing: 0.15em;
  font-weight: 500;
  text-transform: uppercase;
  opacity: 0.45;
  text-align: center;
}
.panel-content {
  position: absolute;
  top: 100px;
  left: 70px;
  right: 70px;
  bottom: 90px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.panel-label {
  font-size: 18px;
  letter-spacing: 0.3em;
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
}
.panel-headline {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: 76px;
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.panel-body {
  font-size: 22px;
  line-height: 1.45;
  font-weight: 500;
  opacity: 0.9;
  margin-top: auto;
}
.panel-body code {
  background: rgba(0, 255, 102, 0.12);
  color: var(--green);
  padding: 1px 6px;
  border: 1px solid rgba(0, 255, 102, 0.3);
  font-size: 0.95em;
  font-family: inherit;
}

/* Plain-language "what just happened" footer (added per user note) */
.panel-plain {
  border-top: 1px dashed rgba(0,255,102,0.25);
  padding-top: 16px;
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.5;
  font-style: italic;
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
}
.panel-plain b { color: var(--green); font-style: normal; }

/* ===== Diagram chars (Panel 01) ===== */
.panel-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin: 30px 0;
}
.dchar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.dchar-label {
  font-size: 14px;
  letter-spacing: 0.15em;
  opacity: 0.7;
  text-transform: uppercase;
}
.dchar-box {
  border: 2px solid currentColor;
  padding: 20px 28px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(0, 255, 102, 0.04);
  text-transform: uppercase;
  position: relative;
}
.dchar-box::before, .dchar-box::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border: 2px solid currentColor;
}
.dchar-box::before { top: -3px; left: -3px; border-right: none; border-bottom: none; }
.dchar-box::after { bottom: -3px; right: -3px; border-left: none; border-top: none; }
.dchar-arrow {
  font-size: 18px;
  letter-spacing: 0.2em;
  opacity: 0.65;
  font-weight: 700;
}

/* ===== Hooded figure (Panel 02) ===== */
.panel-figure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 80px;
  margin: 40px 0;
}
.figure-hooded {
  width: 200px;
  height: 240px;
  position: relative;
}
.figure-hooded .hood {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 80px;
  background: #8B3FBF;
  clip-path: polygon(50% 0%, 100% 60%, 95% 100%, 5% 100%, 0% 60%);
  opacity: 0.85;
}
.figure-hooded .hood-body {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 160px;
  height: 170px;
  background: #8B3FBF;
  clip-path: polygon(15% 0, 85% 0, 100% 100%, 0% 100%);
  opacity: 0.75;
}
.figure-clipboard {
  width: 160px;
  height: 220px;
  border: 3px solid currentColor;
  background: rgba(0, 255, 102, 0.05);
  padding: 16px;
  position: relative;
}
.figure-clipboard .clip-tag {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid currentColor;
}
.figure-clipboard .clip-line {
  height: 4px;
  background: currentColor;
  margin: 10px 0;
  opacity: 0.4;
}
.figure-clipboard .clip-line:nth-child(3) { width: 80%; }
.figure-clipboard .clip-line:nth-child(4) { width: 60%; }

/* ===== Terminal window (Panel 03) ===== */
.terminal {
  border: 2px solid currentColor;
  background: rgba(0,0,0,0.7);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin: 20px 0;
}
.terminal-title {
  background: currentColor;
  color: var(--ink);
  padding: 10px 16px;
  font-size: 14px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.terminal-title .led {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.5;
}
.terminal-body {
  padding: 18px 20px;
  font-size: 19px;
  line-height: 1.6;
}
.term-line { white-space: pre; }
.term-line .prompt { opacity: 0.55; margin-right: 8px; }
.term-line.term-output { opacity: 0.7; color: var(--amber); }
.term-cursor {
  display: inline-block;
  width: 11px; height: 20px;
  background: currentColor;
  vertical-align: middle;
  animation: pulse-blink 1s infinite;
  margin-left: 3px;
}

/* ===== Time-skip (Panel 04) ===== */
.timeskip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 30px 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.15em;
}
.timeskip-tick { color: var(--green); }
.timeskip-arrow { opacity: 0.5; flex: 1; text-align: center; letter-spacing: 0.05em; }
.merge-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border: 2px solid currentColor;
  background: rgba(0, 255, 102, 0.08);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  align-self: flex-start;
}
.merge-button .merge-icon {
  color: var(--green);
  font-size: 28px;
  font-weight: 800;
}

/* ===== Restore flow (Panel 05) ===== */
.restore-flow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0;
  flex-wrap: nowrap;
}
.restore-step {
  border: 2px solid currentColor;
  padding: 14px 20px;
  background: rgba(0, 255, 102, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.restore-label {
  font-size: 12px;
  letter-spacing: 0.2em;
  opacity: 0.65;
  text-transform: uppercase;
  font-weight: 700;
}
.restore-value {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.restore-value.match-hit {
  color: var(--amber);
}
.restore-arrow {
  font-size: 28px;
  font-weight: 800;
  opacity: 0.55;
}

/* ===== Co-resident reader (Panel 06) ===== */
.coresident { margin: 20px 0; }
.cores-box {
  position: relative;
  border: 2px solid currentColor;
  padding: 30px 30px 50px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  background: rgba(0, 255, 102, 0.04);
}
.cores-process {
  border: 2px dashed currentColor;
  padding: 20px;
  text-align: center;
}
.cores-poison { color: #ff9966; opacity: 0.95; }
.cores-trusted { color: var(--green); }
.cores-pid {
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.65;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.cores-name {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cores-jwt {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  border: 2px solid currentColor;
  background: rgba(0, 255, 102, 0.12);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.15em;
}
.cores-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.cores-divider-line {
  width: 2px;
  height: 80px;
  background: var(--red);
  opacity: 0.6;
  position: relative;
}
.cores-divider-line::before,
.cores-divider-line::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 28px;
  height: 2px;
  background: var(--red);
  transform: translateX(-50%) rotate(45deg);
}
.cores-divider-line::before { top: 30%; }
.cores-divider-line::after { top: 50%; transform: translateX(-50%) rotate(-45deg); }
.cores-divider-cross {
  color: var(--red);
  font-size: 36px;
  font-weight: 800;
}
.cores-divider-label {
  color: var(--red);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
}
.cores-jobtag {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.25em;
  opacity: 0.55;
  text-transform: uppercase;
  font-weight: 700;
}
.cores-arrow {
  text-align: center;
  margin-top: 14px;
  font-size: 16px;
  letter-spacing: 0.1em;
  opacity: 0.7;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

/* ===== Publish stats (Panel 07) ===== */
.publish-stat {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 24px 0 8px;
}
.publish-stat .big {
  font-size: 140px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.85;
  text-shadow: 0 0 40px var(--green-glow);
}
.publish-stat .lbl {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.6;
  text-transform: uppercase;
}
.publish-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 20px 0;
}
.pub-pkg {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 8px 12px;
  border-left: 3px solid currentColor;
  background: rgba(0, 255, 102, 0.03);
}
.pub-pkg.pub-more { opacity: 0.55; font-style: italic; border-left-color: rgba(0,255,102,0.3); }

/* ===== Defender findings + fix (Panel 08) ===== */
.findings { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 16px; }
.finding {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border: 2px solid currentColor;
  background: rgba(0, 255, 102, 0.04);
}
.finding-id {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.finding-sev {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.18em;
  padding: 4px 12px;
}
.finding-high .finding-sev { color: var(--amber); border: 2px solid var(--amber); }
.finding-critical .finding-sev { color: var(--red); border: 2px solid var(--red); }
.fix-snippets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.fix-snippet {
  border: 2px solid currentColor;
  background: rgba(0,0,0,0.4);
  overflow: hidden;
}
.fix-file {
  background: currentColor;
  color: var(--ink);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.fix-snippet pre {
  padding: 14px 16px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--green);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* ===== Carousel controls ===== */
.controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  width: min(900px, calc(100vw - 80px));
}
.nav-btn {
  background: transparent;
  border: 1px solid var(--green);
  color: var(--green);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.18em;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
}
.nav-btn:hover:not(:disabled) {
  background: var(--green);
  color: var(--ink);
  box-shadow: 0 0 24px var(--green-glow);
}
.nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.nav-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.counter {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: rgba(0,255,102,0.7);
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.counter b { color: var(--green); font-size: 16px; }

/* ===== Thumbnails ===== */
.thumbs {
  display: flex;
  gap: 8px;
  width: min(900px, calc(100vw - 80px));
  overflow-x: auto;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
}
.thumb {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  background: var(--ink);
  border: 1px solid rgba(0,255,102,0.25);
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: rgba(0,255,102,0.5);
  font-weight: 700;
  letter-spacing: 0.1em;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  transition: all 0.15s ease;
}
.thumb:hover { border-color: var(--green); color: var(--green); }
.thumb.active {
  border-color: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
  color: var(--green);
}
.thumb::after {
  content: attr(data-idx);
  position: absolute;
  top: 4px; left: 6px;
  font-size: 8px;
  opacity: 0.7;
}

/* ===== Footer + references ===== */
.comics-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(0,255,102,0.4);
  text-transform: uppercase;
  padding-top: 16px;
  border-top: 1px dashed rgba(0,255,102,0.2);
  flex-wrap: wrap;
  gap: 12px;
}
.comics-footer a { color: var(--green); border: none; }
.comics-footer a:hover { color: var(--green); border-bottom: 1px solid var(--green); }

/* The episode-footnote already exists in /assets/style.css and stays. */

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .comics-shell { padding: 16px 12px 32px; }
  .masthead { gap: 12px; padding-bottom: 12px; }
  .masthead-meta { font-size: 10px; gap: 10px; }
  .panel-wrap { width: calc(100vw - 32px); }
  .controls { width: calc(100vw - 32px); gap: 12px; }
  .nav-btn { padding: 8px 14px; font-size: 11px; letter-spacing: 0.12em; }
  .thumbs { width: calc(100vw - 32px); }
}
