/* ============================================================
 *  ChipFlow — Chip + Lab tab styles
 *  Maps the ITG-LC palette to ChipFlow's existing teal/dark theme
 *  and styles the Lab interactive 3D viewer.
 * ============================================================ */

/* Inject the variables that chip.css depends on, scoped to the
   chip and lab tabs only. Keeps colors consistent with the rest
   of the site (teal #00e5ff on deep navy). */
#tab-chip,
#tab-lab {
  --ink:        #060b18;          /* primary background  */
  --ink-2:      #0d1529;
  --ink-3:      #111827;
  --ink-4:      #1e2d4a;
  --paper:      #e8edf5;          /* primary text        */
  --paper-2:    #b6c0d4;
  --muted:      #7a8aaa;
  --rule:       #1e2d4a;
  --silicon:    #00e5ff;          /* primary accent      */
  --silicon-2:  #0099b3;
  --uv:         #b45af0;
  --molten:     #ffa947;
  --cu:         #c2410c;

  --body:       'Inter', system-ui, sans-serif;
  --display:    'Space Grotesk', sans-serif;
  --mono:       'Space Grotesk', ui-monospace, monospace;
  --editorial:  'Space Grotesk', Georgia, serif;
}

/* Tab content background fills the viewport between the header and footer */
#tab-chip,
#tab-lab {
  background: var(--ink);
  color: var(--paper);
  min-height: calc(100vh - 104px);
  padding-top: 104px; /* clear the fixed header + tab bar */
}

/* The chip.css's .chip-section already has its own padding-top, so trim ours
   when chip.css is the inner wrapper. We override that here. */
#tab-chip .chip-section {
  padding-top: 60px;
  border-top: none;
}

/* ─── Section header (matching chip.css's .section-header) ─────────────── */
.cl-section {
  padding: 60px 48px 100px;
  position: relative;
  background: var(--ink);
}
.cl-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  margin-bottom: 60px;
  flex-wrap: wrap;
  gap: 20px;
}
.cl-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--silicon);
}
.cl-display {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(36px, 5.5vw, 72px);
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--paper);
}
.cl-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.cl-mono {
  font-family: var(--mono);
  letter-spacing: 0.05em;
}

/* ─── Lab grid ────────────────────────────────────────────────────────── */
.cl-lab {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 40px;
  align-items: stretch;
}
.cl-lab-stage {
  aspect-ratio: 4/3;
  background: radial-gradient(circle at 50% 50%, var(--ink-2), var(--ink) 80%);
  border: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
}
.cl-lab-panel {
  border: 1px solid var(--rule);
  padding: 28px;
  background: var(--ink-2);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.cl-lab-panel h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.cl-layer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cl-layer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.cl-layer:hover {
  background: var(--ink-3);
}
.cl-layer.active {
  border-left-color: var(--silicon);
  background: var(--ink-3);
  color: var(--silicon);
}
.cl-layer .dim {
  color: var(--muted);
}
.cl-lab-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cl-lab-controls button {
  padding: 10px 14px;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.cl-lab-controls button:hover {
  border-color: var(--silicon);
  color: var(--silicon);
}
.cl-lab-controls button.active {
  background: var(--silicon);
  color: var(--ink);
  border-color: var(--silicon);
}

/* Captions inside the 3D stages */
.cl-stage-caption {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.12em;
  pointer-events: none;
}
.cl-stage-readout {
  position: absolute;
  top: 20px;
  right: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--silicon);
  letter-spacing: 0.12em;
  pointer-events: none;
}

/* ─── Loading state for the React lazy-load ─────────────────────────── */
.cl-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}
.cl-loading::after {
  content: "...";
  animation: cl-blink 1.4s steps(4, end) infinite;
  margin-left: 6px;
  width: 18px;
  display: inline-block;
}
@keyframes cl-blink {
  0%   { opacity: 0.2; }
  50%  { opacity: 1; }
  100% { opacity: 0.2; }
}

/* When the Chip / Lab tabs are showing, hide the global site footer
   that lives between the process and materials tabs in DOM order. */
body.tab-chip .site-footer,
body.tab-lab  .site-footer {
  display: none;
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .cl-lab { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #tab-chip .chip-explorer {
    grid-template-columns: 1fr;
  }
  .cl-section { padding: 40px 24px 80px; }
  .cl-section-header { flex-direction: column; align-items: flex-start; }
}
