/* ============================================================
   /architecture interactive map — Paper/Clay re-theme.
   Isolated stylesheet (D3/dagre SVG page). Tokens from aweb.css.
   Owner legend colors are semantic categories:
     aweb = blue #3b82f6, customer = clay (accent), shared = purple #9333ea
   ============================================================ */

.architecture-page { position: relative; z-index: 1; padding: 56px 0 80px; }

.architecture-hero { max-width: 880px; text-align: center; margin: 0 auto; }
.architecture-kicker,
.architecture-eyebrow {
  font-family: var(--font-mono);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--step--1);
  font-weight: 600;
}
.architecture-hero h1 { margin: 16px auto 18px; max-width: 880px; font-size: var(--step-4); line-height: 1.04; letter-spacing: -0.03em; }
.architecture-lede { max-width: 720px; margin: 0 auto; color: var(--muted); font-size: var(--step-1); line-height: 1.5; }
.architecture-section-lede { max-width: 800px; margin: 14px auto 0; color: var(--muted); font-size: var(--step-1); line-height: 1.5; }

/* ---- Sticky toggle bar ---- */
.architecture-toggles-sticky {
  position: sticky; top: 60px; z-index: 30;
  margin: 28px 0; padding: 14px 0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.architecture-actions { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.architecture-toggle { display: inline-flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.architecture-toggle span { color: var(--faint); font-family: var(--font-mono); font-size: var(--step--1); padding: 0 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.architecture-toggle button { color: var(--muted); background: transparent; border: 0; padding: 8px 16px; border-radius: 999px; font: inherit; font-size: var(--step-0); font-weight: 600; cursor: pointer; transition: color 0.18s, background 0.18s; }
.architecture-toggle button:hover { color: var(--ink); }
.architecture-toggle button.is-active { color: var(--accent-ink); background: var(--accent); }

.architecture-legend { display: inline-flex; gap: 16px; align-items: center; color: var(--faint); font-size: var(--step--1); font-family: var(--font-mono); letter-spacing: 0.04em; }
.architecture-legend span { display: inline-flex; gap: 7px; align-items: center; }
.architecture-legend i,
.owner-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.owner-aweb, .owner-aweb.owner-dot { background: #3b82f6; }
.owner-customer, .owner-customer.owner-dot { background: var(--accent); }
.owner-shared, .owner-shared.owner-dot, .owner-mixed.owner-dot { background: #9333ea; }

/* ---- Map ---- */
.architecture-map-container { margin-bottom: 56px; }
.architecture-svg-wrap {
  position: relative; min-height: 720px; height: 80vh;
  border-radius: 28px; border: 1px solid var(--line-strong);
  /* tinted panel so the near-white node boxes have contrast and read clearly */
  background:
    radial-gradient(circle at 18% 12%, var(--accent-soft), transparent 34%),
    radial-gradient(circle at 80% 88%, rgba(59,130,246,0.06), transparent 36%),
    var(--bg-tint);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
#architecture-map { display: block; cursor: grab; user-select: none; }
.architecture-map-hint { margin-top: 16px; text-align: center; font-family: var(--font-mono); font-size: var(--step--1); color: var(--faint); letter-spacing: 0.04em; }

/* ---- Edges ---- */
.architecture-edge path { fill: none; stroke: var(--faint); stroke-width: 1.75; transition: stroke 0.28s, stroke-dasharray 0.28s; }
.architecture-edge.edge-suppressed path { stroke: var(--line-strong); stroke-dasharray: 4 5; }
.architecture-edge text { fill: var(--muted); font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.04em; text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 5px; }
.architecture-callout text { fill: var(--accent); font-family: var(--font-mono); font-size: 15px; font-weight: 600; letter-spacing: 0.04em; paint-order: stroke; stroke: var(--bg); stroke-width: 5px; }

/* ---- Nodes ---- */
.architecture-node foreignObject { overflow: visible; }
.architecture-node-button {
  position: relative; width: 100%; height: 100%; text-align: left;
  color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: 16px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 10px 26px -18px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: border-color 0.20s, transform 0.20s, box-shadow 0.20s, opacity 0.30s, filter 0.30s;
}
.architecture-node-button:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 16px 36px -18px rgba(0,0,0,0.42); }
.architecture-node.is-selected .architecture-node-button { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft), 0 22px 56px -30px rgba(0,0,0,0.4); }
/* ownership reads at full strength — matches the legend dots */
.architecture-node[data-owner="aweb"] .architecture-node-button { border-color: #3b82f6; border-width: 2px; }
.architecture-node[data-owner="customer"] .architecture-node-button { border-color: var(--accent); border-width: 2px; }
.architecture-node[data-owner="shared"] .architecture-node-button,
.architecture-node[data-owner="mixed"] .architecture-node-button { border-color: #9333ea; border-width: 2px; }

.architecture-node[data-muted="true"] .architecture-node-button { opacity: 0.34; filter: grayscale(0.55); }
.architecture-node[data-muted="true"] .architecture-node-button:hover { opacity: 0.65; filter: grayscale(0.20); }

.architecture-node-affordance { position: absolute; top: 14px; right: 16px; color: var(--accent); font-family: var(--font-mono); font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0; transform: translateX(4px); transition: opacity 0.20s ease, transform 0.20s ease; pointer-events: none; }
.architecture-node:hover .architecture-node-affordance,
.architecture-node-button:focus-visible .architecture-node-affordance { opacity: 0.92; transform: translateX(0); }
.architecture-node.is-expanded .architecture-node-affordance { opacity: 0; }
.architecture-node-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.architecture-node-always-subs { display: block; margin-top: 6px; }
.architecture-node-sub[data-always="true"] { display: flex; padding: 6px 10px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 5px 5px 0; gap: 8px; font-family: var(--font-mono); font-size: 13px; align-items: center; }
.architecture-node-sub[data-always="true"] span { color: var(--faint); }
.architecture-node-sub[data-always="true"] strong { color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: 0; }

.architecture-node-eyebrow { color: var(--accent); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.architecture-node-button strong { font-size: 22px; line-height: 1.10; letter-spacing: -0.015em; }

.architecture-node-summary,
.architecture-node-subs,
.architecture-node-badges,
.architecture-capability-chips { opacity: 0; max-height: 0; overflow: hidden; transition: opacity 0.20s ease, max-height 0.28s ease; pointer-events: none; }
.architecture-node:hover .architecture-node-summary { opacity: 0.92; max-height: 110px; margin-top: 2px; }
.architecture-node.is-expanded .architecture-node-summary,
.architecture-node.is-expanded .architecture-node-subs,
.architecture-node.is-expanded .architecture-node-badges,
.architecture-node.is-expanded .architecture-capability-chips { opacity: 1; max-height: 280px; pointer-events: auto; margin-top: 4px; }
.architecture-node-summary { display: block; color: var(--muted); font-size: 15px; line-height: 1.38; }
.architecture-node-subs { display: block; }
.architecture-node.is-expanded .architecture-node-subs { display: grid; gap: 6px; }
.architecture-node-sub { display: flex; justify-content: space-between; gap: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13px; }
.architecture-node-sub span { color: var(--faint); font-family: var(--font-mono); letter-spacing: 0.04em; }
.architecture-node-sub strong { font-size: 13px; font-family: var(--font-mono); color: var(--ink); font-weight: 600; }

.architecture-node-badges,
.architecture-detail-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.architecture-node-badges span,
.architecture-capability-chips span,
.architecture-detail-badges span { padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; }
.architecture-capability-chips span { background: var(--surface-2); color: var(--muted); }
.architecture-capability-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- Drawer ---- */
.architecture-drawer { position: fixed; right: 0; top: 0; height: 100vh; width: 480px; max-width: calc(100vw - 32px); z-index: 200; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -30px 0 80px -30px rgba(0,0,0,0.45); transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.16, 1); overflow-y: auto; padding: 76px 36px 44px; }
.architecture-drawer.is-open { transform: translateX(0); }
.architecture-drawer-backdrop { position: fixed; inset: 0; z-index: 190; background: rgba(8,5,2,0.45); opacity: 0; pointer-events: none; transition: opacity 0.22s ease; }
.architecture-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; cursor: pointer; }
.architecture-drawer-close { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 12px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; line-height: 1; cursor: pointer; transition: background 0.18s, transform 0.18s, color 0.18s; }
.architecture-drawer-close:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-1px); }
.architecture-drawer-close-icon { font-size: 22px; line-height: 1; font-family: inherit; }
.architecture-drawer-close-label { font-weight: 600; }
.architecture-drawer-content h2 { margin: 12px 0 16px; font-size: 32px; line-height: 1.12; letter-spacing: -0.025em; }
.architecture-drawer-content p { color: var(--muted); line-height: 1.6; font-size: 17px; }
.architecture-owner-line { display: inline-flex; gap: 10px; align-items: center; margin: 20px 0 8px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-family: var(--font-mono); font-size: 15px; }
.architecture-detail-copy { display: grid; gap: 14px; margin: 20px 0; }
.architecture-detail-copy p { line-height: 1.6; font-size: 17px; }
.architecture-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.architecture-links a { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent); border-radius: 999px; padding: 10px 18px; font-size: 15px; font-family: var(--font-mono); letter-spacing: 0.04em; text-decoration: none; transition: background 0.18s, border-color 0.18s; }
.architecture-links a:hover { background: var(--accent-soft); border-color: var(--accent); }
.architecture-drawer-home { display: grid; gap: 18px; }
.architecture-drawer-home h2 { margin: 8px 0 0; font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; }
.architecture-drawer-prompt { color: var(--faint) !important; font-size: 16px !important; line-height: 1.55; border-left: 3px solid var(--accent); padding-left: 16px; margin: 6px 0 0; }
.architecture-mode-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, var(--accent-soft), transparent); }
.architecture-mode-card span { display: block; color: var(--accent); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase; }
.architecture-mode-card small { display: block; margin-top: 10px; color: var(--muted); font-size: 16px; line-height: 1.55; }

/* ---- Flows ---- */
.architecture-flows { margin-top: 24px; }
.architecture-flows h2 { margin: 12px 0 6px; font-size: var(--step-3); line-height: 1.10; letter-spacing: -0.03em; }
.architecture-flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.architecture-flow-card { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); overflow: hidden; transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s; }
.architecture-flow-card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: 0 16px 36px -22px rgba(0,0,0,0.25); }
.architecture-flow-card[open] { border-color: var(--accent); box-shadow: 0 18px 42px -26px rgba(0,0,0,0.3); }
.architecture-flow-card summary { list-style: none; cursor: pointer; padding: 20px; }
.architecture-flow-card summary::-webkit-details-marker { display: none; }
.architecture-flow-card summary span { color: var(--accent); font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.10em; }
.architecture-flow-card summary strong { display: block; margin: 10px 0 8px; line-height: 1.14; font-size: 22px; letter-spacing: -0.015em; }
.architecture-flow-card summary small { color: var(--muted); line-height: 1.45; display: block; font-size: 16px; }
.architecture-flow-card ol { margin: 0; padding: 0 22px 24px 42px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.architecture-flow-card li + li { margin-top: 10px; }

/* ---- Footer cards ---- */
.architecture-footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 40px; }
.architecture-surface-card { padding: 26px 28px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); }
.architecture-surface-card h2 { margin-top: 10px; font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; }
.architecture-surface-card p { color: var(--muted); margin-top: 14px; line-height: 1.6; font-size: 16px; }
.architecture-surfaces { display: grid; gap: 10px; margin-top: 18px; }
.architecture-surface { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface-2); }
.architecture-surface strong { display: block; line-height: 1.15; font-size: 17px; }
.architecture-surface span { color: var(--muted); font-size: 16px; line-height: 1.5; }

@media (max-width: 980px) {
  .architecture-flow-grid { grid-template-columns: repeat(2, 1fr); }
  .architecture-footer-grid { grid-template-columns: 1fr; }
  .architecture-svg-wrap,
  #architecture-map { min-height: 560px; }
  .architecture-svg-wrap { height: 70vh; }
  .architecture-drawer { width: 360px; }
}
@media (max-width: 640px) {
  .architecture-page { padding-top: 40px; }
  .architecture-hero h1 { font-size: 36px; }
  .architecture-actions { gap: 10px; }
  .architecture-legend { display: none; }
  .architecture-flow-grid { grid-template-columns: 1fr; }
  .architecture-drawer { width: 100%; }
}
