/* Platform Blueprint — architectural CAD-style visualization */

.platform-blueprint {
  position: relative;
  overflow: hidden;
}

.bp-header {
  margin-bottom: var(--s-7);
  max-width: 720px;
}

.bp-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 720;
  max-height: 760px;
  border: var(--hairline);
  background: var(--color-bg);
}

.bp-svg {
  width: 100%;
  height: 100%;
  display: block;
  font-family: var(--font-mono);
}

/* Tick marks in corners — engineering drawing detail */
.bp-tick {
  fill: none;
  stroke: var(--titanium-faint);
  stroke-width: 1;
  opacity: 0.6;
}

/* Connection lines — drawn-in animation */
.bp-line {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1;
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  transition: stroke 0.25s, stroke-width 0.25s, opacity 0.3s;
}
.bp-line.is-drawn {
  animation: bp-draw 0.85s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}
.bp-line.is-active {
  stroke: var(--accent);
  stroke-width: 2;
}
.bp-stage.has-hover .bp-line:not(.is-active) {
  opacity: 0.25;
}
@keyframes bp-draw {
  to { stroke-dashoffset: 0; }
}

/* Connection endpoint dots */
.bp-endpoint {
  fill: var(--titanium-faint);
  opacity: 0;
  transition: fill 0.25s, opacity 0.3s, r 0.25s;
}
.bp-endpoint.is-visible { opacity: 1; }
.bp-endpoint.is-active {
  fill: var(--accent);
}

/* Dashed (in-progress) line for M.07 */
.bp-line.is-dashed {
  stroke-dasharray: 6 4;
}
.bp-line.is-dashed.is-drawn {
  /* dashed lines fade in instead of drawing */
  animation: bp-fade 0.85s ease-out forwards;
  stroke-dashoffset: 0;
}
@keyframes bp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Core block */
.bp-core { opacity: 0; transition: opacity 0.6s; }
.bp-core.is-visible { opacity: 1; }
.bp-core-box {
  fill: var(--color-bg);
  stroke: var(--titanium);
  stroke-width: 1.5;
}
.bp-core-corner {
  fill: var(--accent);
}
.bp-core-label {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 500;
  fill: var(--accent);
  letter-spacing: 0.08em;
}
.bp-core-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.28em;
  fill: var(--titanium-faint);
}
.bp-core-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--titanium-dim);
  letter-spacing: 0.04em;
}

/* Core pulse rings */
.bp-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0;
  transform-origin: 600px 360px;
  transform-box: fill-box;
}
.bp-pulse.is-active {
  animation: bp-pulse-ring 3.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}
.bp-pulse.pulse-2.is-active { animation-delay: 1.2s; }
.bp-pulse.pulse-3.is-active { animation-delay: 2.4s; }
@keyframes bp-pulse-ring {
  0%   { transform: scale(0.95); opacity: 0; }
  20%  { opacity: 0.6; }
  100% { transform: scale(1.55); opacity: 0; }
}

/* Modules */
.bp-module {
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.55s;
}
.bp-module.is-visible { opacity: 1; }

.bp-module-box {
  fill: var(--color-bg);
  stroke: var(--line-2);
  stroke-width: 1;
  transition: stroke 0.25s, stroke-width 0.25s, fill 0.25s;
}
.bp-module[data-id="m7"] .bp-module-box {
  stroke-dasharray: 5 3;
  fill: rgba(255,255,255,0.5);
}

.bp-module text { pointer-events: none; }
.bp-mod-id {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  fill: var(--titanium-faint);
  transition: fill 0.25s;
}
.bp-mod-name {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  fill: var(--titanium);
  letter-spacing: -0.01em;
  transition: fill 0.25s;
}
.bp-mod-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--titanium-dim);
  letter-spacing: 0.02em;
  transition: fill 0.25s;
}

/* Module corner ticks */
.bp-mod-corner {
  fill: none;
  stroke: var(--titanium-faint);
  stroke-width: 1;
  transition: stroke 0.25s;
}

.bp-module:hover .bp-module-box {
  stroke: var(--accent);
  stroke-width: 2;
  fill: var(--accent-12);
}
.bp-module:hover .bp-mod-name { fill: var(--accent); }
.bp-module:hover .bp-mod-corner { stroke: var(--accent); }

.bp-stage.has-hover .bp-module:not(:hover) { opacity: 0.32; }

/* Info card (positioned by JS) */
.bp-info {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity 0.22s, transform 0.22s;
  background: var(--color-bg);
  border: 1.5px solid var(--accent);
  padding: 14px 18px;
  min-width: 260px;
  max-width: 320px;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(59,33,24,0.08);
}
.bp-info.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.bp-info-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--titanium-faint);
}
.bp-info-title {
  font-size: 16px;
  font-weight: 500;
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.bp-info-desc {
  font-size: 12px;
  color: var(--titanium-dim);
  margin-top: 6px;
  line-height: 1.5;
}
.bp-info-metrics {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 13px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  letter-spacing: 0.02em;
}
.bp-info-cta {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--titanium-faint);
  margin-top: 8px;
}

/* Coordinate labels — engineering drawing accent */
.bp-coord {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  fill: var(--titanium-faint);
}

/* ============================================ */
/* Living Document Stream — process visualization */
/* ============================================ */

.platform-stream {
  position: relative;
  overflow: hidden;
}

.stream-header {
  margin-bottom: var(--s-7);
  max-width: 720px;
}

.stream-stage {
  position: relative;
  width: 100%;
  height: clamp(560px, 78vh, 760px);
  border: var(--hairline);
  background: var(--color-bg);
  overflow: hidden;
}

.stream-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* HUD overlay labels */
.stream-hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--font-mono);
}

.stream-hud-label {
  position: absolute;
  font-size: 9px;
  letter-spacing: 0.24em;
  color: var(--titanium-faint);
  text-transform: uppercase;
}
.stream-hud-label.tl { top: 16px; left: 18px; }
.stream-hud-label.tr { top: 16px; right: 18px; }
.stream-hud-label.bl { bottom: 16px; left: 18px; }
.stream-hud-label.br { bottom: 16px; right: 18px; }

.stream-counter {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--titanium-dim);
}
.stream-counter strong {
  color: var(--accent);
  font-weight: 500;
  margin: 0 6px;
}

/* ============================================ */
/* Module color variants — Blueprint            */
/* 3 tones across 6 modules + muted for in-progress */
/* ============================================ */

/* WARM (terracotta family) — M.02, M.04 */
.bp-module[data-tone="warm"] .bp-module-box { fill: var(--accent-12); }
.bp-module[data-tone="warm"] .bp-mod-id    { fill: var(--accent); }
.bp-module[data-tone="warm"] .bp-mod-accent { fill: var(--accent); }
.bp-line[data-tone="warm"] { stroke: rgba(139,51,38,0.40); }
.bp-endpoint[data-tone="warm"] { fill: var(--accent); }

/* BEIGE (sand family) — M.03, M.06 */
.bp-module[data-tone="beige"] .bp-module-box { fill: rgba(220, 203, 184, 0.55); }
.bp-module[data-tone="beige"] .bp-mod-id    { fill: #8A6A4E; }
.bp-module[data-tone="beige"] .bp-mod-accent { fill: #8A6A4E; }
.bp-line[data-tone="beige"] { stroke: rgba(138, 106, 78, 0.45); }
.bp-endpoint[data-tone="beige"] { fill: #8A6A4E; }

/* COOL (blue family) — M.01, M.05 */
.bp-module[data-tone="cool"] .bp-module-box { fill: rgba(191, 205, 209, 0.45); }
.bp-module[data-tone="cool"] .bp-mod-id    { fill: #4E6E78; }
.bp-module[data-tone="cool"] .bp-mod-accent { fill: #4E6E78; }
.bp-line[data-tone="cool"] { stroke: rgba(78, 110, 120, 0.45); }
.bp-endpoint[data-tone="cool"] { fill: #4E6E78; }

/* MUTED (in-progress) — M.07 */
.bp-module[data-tone="muted"] .bp-module-box { fill: rgba(191, 205, 209, 0.18); }
.bp-module[data-tone="muted"] .bp-mod-id    { fill: var(--titanium-faint); }

/* Top accent strip — sits inside the module box */
.bp-mod-strip {
  transition: opacity 0.25s;
}

/* Hover still overrides to bordeaux for consistency of interaction */
.bp-module:hover .bp-module-box {
  fill: var(--accent-15);
  stroke: var(--accent);
  stroke-width: 2;
}
.bp-module:hover .bp-mod-name { fill: var(--accent); }
.bp-module:hover .bp-mod-id   { fill: var(--accent); }
.bp-module:hover .bp-mod-corner { stroke: var(--accent); }

/* ============================================ */
/* MEDIA FRAME — placeholder slot for screencast/photo */
/* Used in each module section AND core section */
/* ============================================ */

.media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: var(--hairline);
  background-color: var(--color-bg);
  background-image: radial-gradient(circle, rgba(59,33,24,0.10) 1px, transparent 1.2px);
  background-size: 18px 18px;
  background-position: 0 0;
  overflow: hidden;
}

/* Tone variants — match module palette */
.media-frame[data-tone="warm"] {
  background-color: rgba(139,51,38,0.04);
  border-color: rgba(139,51,38,0.18);
}
.media-frame[data-tone="beige"] {
  background-color: rgba(220, 203, 184, 0.20);
  border-color: rgba(138, 106, 78, 0.22);
}
.media-frame[data-tone="cool"] {
  background-color: rgba(191, 205, 209, 0.16);
  border-color: rgba(78, 110, 120, 0.22);
}

/* Engineering corner ticks — like the Blueprint stage */
.media-frame::before,
.media-frame::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--titanium-faint);
  border-style: solid;
}
.media-frame::before {
  top: 10px; left: 10px;
  border-width: 1px 0 0 1px;
}
.media-frame::after {
  bottom: 10px; right: 10px;
  border-width: 0 1px 1px 0;
}
.media-frame > .media-frame-tr {
  position: absolute; top: 10px; right: 10px;
  width: 18px; height: 18px;
  border-top: 1px solid var(--titanium-faint);
  border-right: 1px solid var(--titanium-faint);
}
.media-frame > .media-frame-bl {
  position: absolute; bottom: 10px; left: 10px;
  width: 18px; height: 18px;
  border-bottom: 1px solid var(--titanium-faint);
  border-left: 1px solid var(--titanium-faint);
}

/* Center label */
.media-frame-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  pointer-events: none;
}
.media-frame-eyebrow {
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--titanium-faint);
}
.media-frame-spec {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--titanium-dim);
}
.media-frame-hint {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--titanium-faint);
  margin-top: 12px;
  text-transform: uppercase;
}

/* HUD labels in frame corners (like Blueprint) */
.media-frame-hud {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--titanium-faint);
}
.media-frame-hud.tl-text { top: 14px; left: 36px; }
.media-frame-hud.br-text { bottom: 14px; right: 36px; }

/* When real media (img/video) is dropped in — hide placeholder UI */
.media-frame > img,
.media-frame > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #1a1410;
}
.media-frame:has(> img),
.media-frame:has(> video) {
  background-image: none;
  background-color: #1a1410;
}
.media-frame:has(> img) .media-frame-label,
.media-frame:has(> video) .media-frame-label { display: none; }

/* HUD labels get a chip-style backdrop when video is present so they stay readable */
.media-frame:has(> video) .media-frame-hud,
.media-frame:has(> img) .media-frame-hud {
  padding: 4px 8px;
  background: rgba(26, 20, 16, 0.62);
  color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2;
}
.media-frame:has(> video) .media-frame-hud.tl-text,
.media-frame:has(> img) .media-frame-hud.tl-text { top: 10px; left: 10px; }
.media-frame:has(> video) .media-frame-hud.br-text,
.media-frame:has(> img) .media-frame-hud.br-text { bottom: 10px; right: 10px; }

/* Hide the engineering corner ticks when media is present — they collide with content */
.media-frame:has(> video)::before,
.media-frame:has(> video)::after,
.media-frame:has(> img)::before,
.media-frame:has(> img)::after { display: none; }
.media-frame:has(> video) > .media-frame-tr,
.media-frame:has(> video) > .media-frame-bl,
.media-frame:has(> img) > .media-frame-tr,
.media-frame:has(> img) > .media-frame-bl { display: none; }

/* Video native controls — give them room and align with the frame */
.media-frame > video {
  z-index: 1;
}

/* ============================================ */
/* Section tone — cool (blue family) */
/* ============================================ */
.tone-cool {
  background-color: rgba(191, 205, 209, 0.18);
}

/* Subtle frame above a module — full-width banner row */
.module-media-row {
  margin-bottom: var(--s-7);
}

/* Responsive */
@media (max-width: 900px) {
  .bp-stage { aspect-ratio: auto; height: 540px; }
  .bp-mod-name { font-size: 12px; }
  .bp-core-label { font-size: 14px; }
  .stream-stage { height: 420px; }
}
