/* dc-theme — shared design tokens + component classes for the diagram embeds.
   This file is the single source of truth; every diagram in this folder links
   it (<link rel="stylesheet" href="dc-theme.css">). Layout (absolute
   positions, per-diagram widths) stays inline in each diagram; this file owns
   colors, typography, and component chrome. Legacy Claude Design-era diagrams
   hardcode the same values inline and render identically. */

:root {
  /* ink */
  --ink: #2b3245;
  --ink-2: #6b7488;
  --muted: #9aa1b2;

  /* role colors (set per-actor via the .dc-<role> classes below) */
  --indigo: #5b63d6;      --indigo-rgb: 91, 99, 214;   --indigo-tint: #eef0fc;
  --teal: #1ba2a6;        --teal-rgb: 27, 162, 166;    --teal-tint: #e3f4f4;
  --green: #2fae6b;       --green-rgb: 47, 174, 107;   --green-tint: #e3f4ea;
  --orange: #d98a2b;      --orange-rgb: 217, 138, 43;  --orange-tint: #f9efe0;
  --red: #cf6b4a;         --red-rgb: 207, 107, 74;     --red-tint: #f7e8e2;
  --pink: #c65d90;        --pink-rgb: 198, 93, 144;    --pink-tint: #f6e7ee;

  /* chrome */
  --guide: #cdd4e0;       /* idle wire */
  --border: #c3cbd9;      /* neutral dashed boundary */
  --border-2: #d7dced;    /* thin umbrella frame */
  --page: #e7ebf2;
  --stage: #f3f5f9;
  --grid-dot: #e1e5ee;
  --track: #eef1f6;       /* gauge track */

  /* elevation (one ink, four sizes) */
  --shadow-hero: 0 14px 36px rgba(30, 40, 80, 0.10);
  --shadow-card: 0 12px 30px rgba(30, 40, 80, 0.10);
  --shadow-sm: 0 8px 20px rgba(30, 40, 80, 0.10);
  --shadow-xs: 0 4px 12px rgba(30, 40, 80, 0.10);

  --font-ui: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body { margin: 0; }

@keyframes flowdash { to { stroke-dashoffset: -120; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- stage scaffold ---- */

.dc-page {
  position: fixed; inset: 0;
  background: var(--page);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  font-family: var(--font-ui);
}
.dc-stage {
  position: relative; width: 1280px; height: 720px;
  background: var(--stage);
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 30px 30px;
  transform-origin: center; flex: none; overflow: hidden;
}

/* every diagram keeps the 1280x720 composition frame; the playback bar lives
   in a dedicated band below it, never over the artwork.
   plain (dc.run adds --controls): 80px band (720-800), embed at 16 / 10.
   narrated (narrate() adds --narrated): 160px band — plate 720-800, bar
   below it — embed at --embed-ar: 16 / 11.
   Below 32rem both bands deepen for touch (stage 900 / 1120); see the phone
   layout block after the controls section. */
.dc-stage--controls { height: 800px; }
.dc-stage--narrated { height: 880px; }

/* ---- role classes: set the current color on any subtree ---- */

.dc-indigo { --c: var(--indigo); --c-rgb: var(--indigo-rgb); --tint: var(--indigo-tint); }
.dc-teal   { --c: var(--teal);   --c-rgb: var(--teal-rgb);   --tint: var(--teal-tint); }
.dc-green  { --c: var(--green);  --c-rgb: var(--green-rgb);  --tint: var(--green-tint); }
.dc-orange { --c: var(--orange); --c-rgb: var(--orange-rgb); --tint: var(--orange-tint); }
.dc-red    { --c: var(--red);    --c-rgb: var(--red-rgb);    --tint: var(--red-tint); }
.dc-pink   { --c: var(--pink);   --c-rgb: var(--pink-rgb);   --tint: var(--pink-tint); }

/* ---- components ---- */

/* actor card: default radius 20 / card shadow; --lg for hero panels,
   --sm / --xs for nested levels. Width/height/padding stay inline. */
.dc-card { background: #ffffff; border-radius: 20px; box-shadow: var(--shadow-card); }
.dc-card--lg { border-radius: 24px; box-shadow: var(--shadow-hero); }
.dc-card--sm { border-radius: 14px; box-shadow: var(--shadow-sm); }
.dc-card--xs { border-radius: 12px; box-shadow: var(--shadow-xs); }

.dc-title { font-family: var(--font-ui); font-weight: 600; font-size: 17px; color: var(--ink); }
.dc-sub { font-family: var(--font-mono); font-weight: 400; font-size: 12px; color: var(--muted); }
.dc-num { font-family: var(--font-mono); font-weight: 500; color: var(--c, var(--ink)); line-height: 1; }

/* uppercase tracked caption along a wire; JS drives color to var(--c) when active */
.dc-caption {
  font-family: var(--font-mono); font-weight: 500; font-size: 13px;
  letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--muted); transition: color 0.35s;
}

/* small color-key dot (legends, boundary labels) */
.dc-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--c, var(--muted)); }

/* legend row under the stage content */
.dc-legend { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }

/* server-rack slat (stack 3 in a flex column, gap 5-6px) */
.dc-slat {
  box-sizing: border-box; width: 58px; height: 13px; border-radius: 5px;
  background: var(--tint); border: 2px solid var(--c);
  display: flex; align-items: center; padding: 0 7px;
}
.dc-slat::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--c); }

/* icon chip: rounded square, tint fill, solid accent border; put the SVG inside */
.dc-chip {
  box-sizing: border-box; border-radius: 11px;
  background: var(--tint); border: 2px solid var(--c);
  display: flex; align-items: center; justify-content: center;
}

/* dashed group boundary in the owner's color (or .dc-boundary--neutral).
   --c falls back to --border so the border stays valid with no role class. */
.dc-boundary {
  border: 2px dashed color-mix(in srgb, var(--c, var(--border)) 40%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--c, var(--border)) 5%, transparent);
}
.dc-boundary--neutral { border-color: var(--border); background: rgba(255, 255, 255, 0.45); }
.dc-boundary-label {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; color: var(--c, var(--ink-2));
}
.dc-boundary-label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }

/* thin umbrella frame grouping several boundaries */
.dc-frame { border: 1.5px solid var(--border-2); border-radius: 30px; background: rgba(255, 255, 255, 0.55); }

/* corner check badge: <svg class="dc-badge"> with circle+path inside */
.dc-badge { position: absolute; top: -11px; right: -11px; opacity: 0; }

/* gauge */
.dc-gauge { position: relative; height: 6px; border-radius: 3px; background: var(--track); }
.dc-gauge-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--c, var(--green)); }
.dc-gauge-tick { position: absolute; top: -2px; bottom: -2px; width: 2px; border-radius: 1px; background: var(--border); }

/* ---- narration plate (mounted by dc-narrate.js into the band below the
   composition; the band offset, its opacity and the dwell width stay inline) ----
   desktop card height is exactly the 80px plate band: 18+18 padding, 29 text,
   12 gap, 3 track. */

.dc-plate {
  position: absolute; left: 160px; right: 160px;
  display: flex; flex-direction: column; align-items: center;
}
.dc-plate-card {
  box-sizing: border-box; max-width: 100%;
  padding: 18px 32px; border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.dc-plate-text {
  font-family: var(--font-mono); font-weight: 500; font-size: 20px;
  line-height: 1.45; letter-spacing: .005em; color: var(--ink);
  text-align: center; white-space: nowrap;
}
.dc-plate-track {
  width: 100%; height: 3px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.dc-plate-bar { height: 100%; border-radius: 999px; background: var(--muted); }

/* ---- playback controls (mounted by dc.run; always visible — pinned renders
   exclude the bar via pin-diff.sh's freeze style) ---- */

.dc-controls {
  position: absolute; left: 50%; top: 734px;
  transform: translateX(-50%) scale(var(--ctl-scale, 1));
  transform-origin: 50% 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 4px 16px; border-radius: 999px;
  background: #ffffff; box-shadow: var(--shadow-sm);
}
/* the bar (52px tall) centers in its band: plain 734-786 in the 720-800 band;
   narrated 814-866, below the plate, 14px gaps both sides */
.dc-stage--narrated .dc-controls { top: 814px; }
.dc-controls button {
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--ink); cursor: pointer; touch-action: manipulation;
}
@media (hover: hover) {
  .dc-controls button:hover { background: var(--track); }
}

.dc-scrub { position: relative; width: 240px; height: 44px; cursor: pointer; touch-action: none; }
.dc-scrub-track, .dc-scrub-fill {
  position: absolute; left: 0; top: 50%; height: 6px; margin-top: -3px;
  border-radius: 3px; background: var(--border); width: 100%;
}
.dc-scrub-fill { background: var(--muted); width: 0%; }
.dc-scrub-handle {
  position: absolute; top: 50%; left: 0%; width: 16px; height: 16px;
  margin: -8px 0 0 -8px; border-radius: 50%; background: var(--ink);
}

/* ---- phone layout ----
   A stage scaled to ~350px renders a 44px button at 12px and 20px text at 5px,
   so below 32rem the bands deepen and their contents are counter-sized:

     bar band  180px (720-900 plain, 940-1120 narrated), bar scaled to 3x by
               controls() in dc-timeline.js, bottom-anchored so it grows into
               the band. Narrated stages drop the scrubber: prev/next cover
               navigation and the plate carries its own dwell bar.
     plate band 220px (720-940). Text at 48px wraps within 1120px, so the
               longest stop in the corpus (56 chars) sets two lines; a card of
               two lines is 203px, and the card centers in the band.

   Stage 900 plain / 1120 narrated, so the post's embed boxes take
   --embed-ar-touch: 16 / 11.25 and 16 / 14 under the same breakpoint (34rem
   there, on the article's width, against 32rem here on the iframe's). The
   composition keeps the full width; the box grows. */
@media (max-width: 32rem) {
  .dc-stage--controls { height: 900px; }
  .dc-stage--narrated { height: 1120px; }
  .dc-controls { top: 834px; }
  .dc-stage--narrated .dc-controls { top: 1054px; }
  .dc-stage--narrated .dc-scrub { display: none; }

  .dc-plate { left: 40px; right: 40px; height: 220px; justify-content: center; }
  .dc-plate-card { padding: 24px 40px; border-radius: 26px; gap: 18px; }
  .dc-plate-text { font-size: 48px; white-space: normal; text-wrap: balance; }
  .dc-plate-track { height: 6px; }
}
@media (pointer: coarse) {
  .dc-controls button { -webkit-tap-highlight-color: transparent; }
}

/* ---- SVG wires (classes apply to <line>/<path>) ---- */

.dc-guide {
  stroke: var(--guide); stroke-width: 3; stroke-linecap: round;
  stroke-dasharray: 2 11; animation: flowdash 3s linear infinite;
}
.dc-wire { stroke: var(--c); stroke-width: 4; stroke-linecap: round; }
