/* ==========================================================================
   assets/css/inspect.css
   Inspect Mode: engineering view. Triggered via root class .inspect-active
   (set on <html> pre-paint and on <body> by app.js, persisted in localStorage).
   Reveals the engineering behind projects and infrastructure, not page source.
   ========================================================================== */

/* ---------- Hidden by default ---------- */
.inspect-only,
.inspect-overlay-block,
.inspect-spec-box { display: none; }

/* ---------- Token swap: blueprint / telemetry theme ---------- */
.inspect-active {
  --surface: #0E0F11;
  --surface-alt: #16181B;
  --ink: #E9E7E1;
  --ink-soft: #8D929B;
  --rule: 1px solid rgba(233, 231, 225, 0.12);
  --accent: var(--accent-engineer);
  --code: #3DDC97;
  color-scheme: dark;
}
html.inspect-active { background: var(--surface); }

.inspect-active body {
  background-color: var(--surface);
  background-image:
    linear-gradient(rgba(0, 102, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 102, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
}

/* ---------- Reveal ---------- */
.inspect-active .inspect-only { display: block; }
.inspect-active .inspect-only.is-inline { display: inline-flex; }
.inspect-active .inspect-overlay-block,
.inspect-active .inspect-spec-box { display: block; animation: inspect-in .35s var(--ease) both; }
.inspect-active .editorial-only { display: none; }

@keyframes inspect-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Toggle button states ---------- */
.inspect-active .inspect-btn {
  border-color: var(--accent-engineer);
  background: rgba(0, 102, 255, 0.14);
  color: #fff;
}
.inspect-active .inspect-btn .led {
  background: var(--code);
  box-shadow: 0 0 8px var(--code);
}

/* ---------- Editorial blocks become instrument panels ---------- */
.inspect-active .block-red,
.inspect-active .block-dark,
.inspect-active .block-sand {
  background: rgba(22, 24, 27, 0.92);
  color: var(--ink);
  --ink-soft: #8D929B;
  border-block: 1px solid rgba(0, 102, 255, 0.35);
}
.inspect-active .pillar-card + .pillar-card { border-color: rgba(0, 102, 255, 0.35); }
.inspect-active .display em,
.inspect-active .h-xl em { color: var(--accent-engineer); }

/* ---------- Annotated elements: [data-spec="..."] ---------- */
[data-spec] { position: relative; }
.inspect-active [data-spec] {
  outline: 1px dashed rgba(0, 102, 255, 0.55);
  outline-offset: 6px;
}
.inspect-active [data-spec]::before {
  content: attr(data-spec);
  position: absolute;
  top: -1.55rem;
  left: -6px;
  z-index: 5;
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-engineer);
  padding: .12rem .4rem;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ---------- Media: crop marks + neutral grade ---------- */
.inspect-active .media-frame img,
.inspect-active .video-facade img {
  filter: grayscale(1) contrast(1.08) brightness(.82);
}
.inspect-active .media-frame::after {
  content: '';
  position: absolute; inset: 10px;
  pointer-events: none;
  background:
    linear-gradient(var(--code), var(--code)) top left / 14px 1px,
    linear-gradient(var(--code), var(--code)) top left / 1px 14px,
    linear-gradient(var(--code), var(--code)) top right / 14px 1px,
    linear-gradient(var(--code), var(--code)) top right / 1px 14px,
    linear-gradient(var(--code), var(--code)) bottom left / 14px 1px,
    linear-gradient(var(--code), var(--code)) bottom left / 1px 14px,
    linear-gradient(var(--code), var(--code)) bottom right / 14px 1px,
    linear-gradient(var(--code), var(--code)) bottom right / 1px 14px;
  background-repeat: no-repeat;
}
.media-exif {
  position: absolute; right: 10px; bottom: 10px;
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--code);
  background: rgba(14, 15, 17, 0.8);
  padding: .2rem .45rem;
}

/* ---------- Telemetry grid (hero) ---------- */
.inspect-overlay-block {
  margin-top: 1.5rem;
  border: 1px solid rgba(0, 102, 255, 0.45);
  background: rgba(22, 24, 27, 0.9);
}
.inspect-overlay-block .overlay-head {
  display: flex; justify-content: space-between; gap: 1rem;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .05em;
  color: var(--code);
  padding: .5rem .9rem;
  border-bottom: 1px solid rgba(0, 102, 255, 0.3);
}
.telemetry-grid {
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 680px) { .telemetry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.telemetry-grid > div {
  padding: .9rem;
  display: flex; flex-direction: column; gap: .3rem;
  border-top: 1px solid rgba(233, 231, 225, 0.08);
}
@media (min-width: 680px) {
  .telemetry-grid > div { border-top: 0; }
  .telemetry-grid > div + div { border-left: 1px solid rgba(233, 231, 225, 0.08); }
}
.telemetry-grid span {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.telemetry-grid strong {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .9rem;
  color: var(--ink);
}

/* ---------- Spec box (projects + infrastructure) ---------- */
.inspect-spec-box {
  border: 1px solid rgba(0, 102, 255, 0.45);
  border-left: 3px solid var(--accent-engineer);
  background: rgba(22, 24, 27, 0.92);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.6;
}
.inspect-spec-box h3 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .68rem;
  letter-spacing: .08em;
  color: var(--code);
  padding: .6rem 1rem;
  border-bottom: 1px solid rgba(0, 102, 255, 0.25);
  display: flex; justify-content: space-between; gap: 1rem;
}
.inspect-spec-box ul { list-style: none; }
.inspect-spec-box li {
  padding: .6rem 1rem;
  display: grid;
  gap: .15rem;
  border-bottom: 1px solid rgba(233, 231, 225, 0.06);
}
@media (min-width: 680px) {
  .inspect-spec-box li { grid-template-columns: 11rem 1fr; gap: 1rem; }
}
.inspect-spec-box li:last-child { border-bottom: 0; }
.inspect-spec-box li strong {
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .05em;
  padding-top: .1rem;
}
.inspect-spec-box li span { color: var(--ink); }

/* Pipeline diagram (ASCII-like flow) */
.pipeline {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem;
  padding: .8rem 1rem;
  border-top: 1px solid rgba(0, 102, 255, 0.25);
}
.pipeline li {
  list-style: none;
  font-family: var(--font-mono);
  font-size: .68rem;
  border: 1px solid rgba(61, 220, 151, 0.5);
  color: var(--code);
  padding: .2rem .5rem;
}
.pipeline li + li::before {
  content: '→';
  color: var(--ink-soft);
  margin-right: .4rem;
  margin-left: -.1rem;
}
.pipeline li + li { border-left-width: 1px; }

/* Header badge in inspect mode */
.inspect-active .telemetry-badge { color: var(--code); }

/* Footer build line */
.build-line { color: var(--ink-soft); }

/* Labels on clipped media frames sit inside the frame */
.inspect-active .media-frame[data-spec]::before { top: 12px; left: auto; right: 12px; }
.inspect-active .video-facade[data-spec] { outline-offset: 4px; overflow: visible; }

/* Pipeline chips must not inherit the spec-box row grid */
.inspect-spec-box .pipeline li {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  grid-template-columns: none;
  padding: .2rem .5rem;
  border: 1px solid rgba(61, 220, 151, 0.5);
}
.inspect-spec-box .pipeline li + li::before { margin: 0 .2rem 0 0; }
