/* ══════════════════════════════════════════════════════════════════
   c9-diagrams.css  —  Cloud 9 AV v13  Technical Diagram Sections
   Scoped to .diag-section — no global overrides.
══════════════════════════════════════════════════════════════════ */

/* ── Section wrapper ─────────────────────────────────────────────── */
.diag-section { position: relative; overflow: hidden; }

/* Subtle radial glow that inherits the page accent color */
.diag-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, var(--diag-glow, rgba(13,206,192,0.04)), transparent 70%);
  pointer-events: none;
}

/* ── Header copy ─────────────────────────────────────────────────── */
.diag-intro {
  color: var(--t2);
  max-width: 54ch;
  margin-inline: auto;
  line-height: 1.78;
  font-size: clamp(.93rem, 2vw, 1.05rem);
  margin-top: .75rem;
  margin-bottom: 0;
}

/* ── Frame ───────────────────────────────────────────────────────── */
.diag-frame {
  border-radius: 12px;
  border: 1px solid var(--bdr);
  overflow: hidden;
  background: var(--surf);
  position: relative;
  /* Subtle inner glow on hover */
  transition: border-color .3s;
}
.diag-frame:hover { border-color: var(--diag-accent, var(--cyan)); }

/* ── Canvas ──────────────────────────────────────────────────────── */
.diag-canvas {
  width: 100%;
  height: clamp(300px, 44vw, 520px);
  display: block;
  cursor: crosshair;
}

/* ── Legend strip ────────────────────────────────────────────────── */
.diag-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem 1.4rem;
  padding: .9rem 1.5rem;
  border-top: 1px solid var(--bdr);
  background: var(--bg);
}
.diag-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .76rem;
  color: var(--t3);
  font-family: var(--f-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.diag-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}
.diag-rect {
  width: 18px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: .7;
}
.diag-line {
  width: 22px;
  height: 2px;
  border-radius: 1px;
  flex-shrink: 0;
  opacity: .8;
}
/* Dashed line swatch */
.diag-dash {
  width: 22px;
  height: 2px;
  background: repeating-linear-gradient(90deg, currentColor 0, currentColor 5px, transparent 5px, transparent 9px);
  flex-shrink: 0;
  opacity: .8;
}

/* ── Diagram title chip (shows top-right of canvas) ──────────────── */
.diag-chip {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: var(--surf2, var(--surf));
  border: 1px solid var(--bdr);
  border-radius: 4px;
  font-family: var(--f-mono);
  font-size: .65rem;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--t3);
  padding: .3rem .6rem;
  pointer-events: none;
  z-index: 2;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .diag-canvas  { height: clamp(220px, 66vw, 300px); }
  .diag-legend  { padding: .65rem 1rem; gap: .4rem .9rem; }
  .diag-item    { font-size: .68rem; }
  .diag-chip    { display: none; }
}

/* ── Drag hint overlay ───────────────────────────────────────────── */
.diag-frame { cursor: grab; }
.diag-frame:active { cursor: grabbing; }
.diag-canvas { cursor: inherit; }
/* Hint text that fades after first interaction */
.diag-frame::after {
  content: '⤢  DRAG TO ROTATE';
  position: absolute;
  bottom: 3.2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--f-mono);
  font-size: .65rem;
  letter-spacing: .12em;
  color: var(--t3);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity .4s;
  white-space: nowrap;
}
.diag-frame:active::after { opacity: 0; }

/* ── Side-by-side layout: text left, 3D canvas right ────────────────
   Gives the canvas dedicated space — model is NEVER behind text.
   Reverts to stacked on mobile.
──────────────────────────────────────────────────────────────────── */
.diag-row {
  display: grid;
  grid-template-columns: 1fr 1.55fr;
  gap: 2.5rem 3rem;
  align-items: center;
}
.diag-row.diag-row--flip {
  grid-template-columns: 1.55fr 1fr;
}
.diag-row.diag-row--flip .diag-text { order: 2; }
.diag-row.diag-row--flip .diag-frame { order: 1; }

.diag-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.diag-text .eyebrow { margin-bottom: 0; }
.diag-text .sec-title { font-size: clamp(1.5rem, 3.5vw, 2.2rem); margin: 0; line-height: 1.25; }
.diag-text .diag-intro { margin: 0; }

/* Canvas taller so model has room */
.diag-canvas { height: clamp(340px, 46vw, 560px); }

/* Legend moved inside text column on side layout */
.diag-row .diag-legend {
  border-top: none;
  padding: 0;
  background: transparent;
  flex-wrap: wrap;
}

@media (max-width: 860px) {
  .diag-row, .diag-row.diag-row--flip { grid-template-columns: 1fr; }
  .diag-row.diag-row--flip .diag-text,
  .diag-row.diag-row--flip .diag-frame { order: unset; }
  .diag-canvas { height: clamp(260px, 65vw, 380px); }
  .diag-row .diag-legend { border-top: 1px solid var(--bdr); padding: .65rem 1rem; background: var(--bg); }
}

/* ═══════════════════════════════════════════════════════════
   V20 — Diagram Full-Height (no border, no radius, fills half)
═══════════════════════════════════════════════════════════ */

/* Remove the wrap constraint so section is truly full-bleed */
.diag-section { padding-block: 0 !important; }
.diag-section > .wrap { max-width: 100% !important; width: 100% !important; padding-inline: 0 !important; }

/* The row takes the full viewport width and height of the section */
.diag-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 0 !important;
  align-items: stretch;
  min-height: clamp(420px, 55vw, 680px);
}
.diag-row.diag-row--flip {
  grid-template-columns: 1.6fr 1fr;
}

/* Text column: padded content area */
.diag-text {
  padding: clamp(3rem, 6vw, 5.5rem) clamp(2rem, 4vw, 4rem);
  justify-content: center;
  background: var(--page);
}

/* Frame: no border, no radius, full bleed, fills entire right half */
.diag-frame {
  border: none !important;
  border-radius: 0 !important;
  background: var(--surf) !important;
  height: 100% !important;
  min-height: clamp(420px, 55vw, 680px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.diag-frame:hover { border-color: transparent !important; }
.diag-frame::after { display: none !important; } /* remove drag hint */

/* Canvas fills the frame */
.diag-canvas {
  flex: 1;
  width: 100%;
  height: 100% !important;
  min-height: 0;
}

/* Legend sits at the bottom inside the frame */
.diag-row .diag-legend {
  border-top: 1px solid var(--bdr);
  padding: 0.75rem 1.5rem;
  background: var(--surf2);
  flex-shrink: 0;
}

/* Mobile: stack vertically, diagram below text */
@media (max-width: 768px) {
  .diag-section { padding-block: 0 !important; }
  .diag-row,
  .diag-row.diag-row--flip {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .diag-row.diag-row--flip .diag-text  { order: 1; }
  .diag-row.diag-row--flip .diag-frame { order: 2; }
  .diag-text { padding: 2.5rem 1.5rem; }
  .diag-frame { min-height: clamp(280px, 70vw, 420px); }
}

