/* ============================================================
   Anchor Method — interactive phase demo
   Mounts into #anchorDemo (see Consulting.html).
   A 5-step stepper swaps a "screen" that visualizes the actual
   deliverable of each phase. Vanilla JS, uses site.css tokens,
   works in light + dark.
   ============================================================ */

.am-wrap { margin-top: 44px; }

/* ---------- stepper ---------- */
.am-stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  position: relative;
}
.am-step {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 14px 13px;
  cursor: pointer; text-align: left;
  font-family: var(--sans);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}
.am-step:hover { border-color: color-mix(in srgb, var(--ink) 24%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.am-step.is-active { border-color: var(--accent); box-shadow: var(--shadow-md), 0 0 0 1px var(--accent); }
.am-step-top { display: flex; align-items: center; gap: 8px; width: 100%; }
.am-step-num {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--bg-alt); color: var(--ink-faint);
  border: 1px solid var(--line);
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.am-step.is-active .am-step-num { background: var(--accent); color: #fff; border-color: var(--accent); }
.am-step.is-done .am-step-num { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); border-color: transparent; }
.am-step-name { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.am-step-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.am-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 10px; font-weight: 700; letter-spacing: 0.04em; box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.5); }
html[data-theme="dark"] .am-badge { box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.05); }
.am-badge--outside { background: var(--bg-alt); border: 1px solid var(--line); color: var(--ink-soft); }
.am-badge--in { background: rgba(217,115,13,0.10); border: 1px solid rgba(217,115,13,0.24); color: var(--accent); }
.am-badge--ai { background: rgba(123,108,246,0.10); border: 1px solid rgba(123,108,246,0.26); color: #7b6cf6; }
.am-badge--own { background: rgba(31,138,91,0.10); border: 1px solid rgba(31,138,91,0.26); color: #1f8a5b; }
html[data-theme="dark"] .am-badge--ai { color: #a89df8; }
html[data-theme="dark"] .am-badge--own { color: #4bbf8b; }
.am-step .am-step-badge { display: none; }
@media (max-width: 760px) {
  .am-stepper { grid-template-columns: 1fr 1fr; }
  .am-step-name { font-size: 14px; }
}

/* ---------- stage ---------- */
.am-stage {
  margin-top: 18px;
  display: grid; grid-template-columns: 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 900px) { .am-stage { grid-template-columns: 1fr 340px; } }

/* visual (the screen) */
.am-visual {
  position: relative;
  min-height: 392px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
@media (min-width: 900px) { .am-visual { border-bottom: none; border-right: 1px solid var(--line); } }

/* whiteboard surface for "outside Notion" phases */
.am-visual.surface-board {
  background-color: var(--bg-alt);
  background-image: radial-gradient(color-mix(in srgb, var(--ink-faint) 32%, transparent) 1px, transparent 1px);
  background-size: 19px 19px;
}
.am-board-tag {
  position: absolute; top: 14px; left: 16px; z-index: 3;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-faint);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; box-shadow: var(--shadow-sm);
}
.am-board-tag svg { width: 12px; height: 12px; }

/* info panel */
.am-info { padding: 26px 26px 28px; display: flex; flex-direction: column; }
.am-info-kicker { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.am-info-phase { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.am-info-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 10px; }
.am-info-what { font-size: 15.5px; line-height: 1.62; color: var(--ink-soft); }
.am-info-output {
  margin-top: auto; padding-top: 20px;
}
.am-output-card {
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: 12px; padding: 15px 17px;
  display: flex; flex-direction: column; gap: 6px;
}
.am-output-label { display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.am-output-label svg { width: 13px; height: 13px; color: var(--accent); }
.am-output-card p { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.45; margin: 0; }

/* ---------- content renders in its visible final state ----------
   (No opacity-based entrance: browser timelines pause in hidden tabs,
   which can strand a hidden start-state. Reliability over flourish.) */

/* ===================================================== */
/* 1 · MAP — mind map                                     */
/* ===================================================== */
.am-mindmap { position: absolute; inset: 0; }
.am-connector { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.am-connector path {
  fill: none; stroke: color-mix(in srgb, var(--accent) 55%, var(--line));
  stroke-width: 2; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.am-node {
  position: absolute; transform: translate(-50%, -50%);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 13px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow-md); white-space: nowrap;
  display: flex; align-items: center; gap: 7px; z-index: 2;
}
.am-node .nd-ic { font-size: 14px; }
.am-node.am-core {
  background: var(--ink); color: var(--bg);
  border-color: var(--ink); font-size: 14px; font-weight: 700;
  padding: 11px 18px; box-shadow: var(--shadow-lg);
}
html[data-theme="dark"] .am-node.am-core { background: var(--accent); color: #fff; border-color: var(--accent); }
.am-node.am-leaf-accent { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* ===================================================== */
/* 2 · BLUEPRINT — schema diagram                         */
/* ===================================================== */
.am-schema { position: absolute; inset: 0; padding: 44px 22px 22px; display: flex; align-items: center; justify-content: center; gap: 0; }
.am-schema-row { display: flex; align-items: center; justify-content: center; gap: 0; width: 100%; max-width: 560px; }
.am-ent {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; overflow: hidden; flex: 1; min-width: 0;
  box-shadow: var(--shadow-md);
}
.am-ent-head {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: var(--bg-alt); font-size: 13px; font-weight: 700; color: var(--ink);
}
.am-ent-head .ent-ic { width: 15px; height: 15px; color: var(--accent); }
.am-ent-field {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; font-size: 12px; border-bottom: 1px solid var(--line);
}
.am-ent-field:last-child { border-bottom: none; }
.am-ent-field .ef-name { color: var(--ink-soft); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-ent-field .ef-type { font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-faint); flex: none; }
.am-ent-field .ef-type.rel { color: var(--accent); }
.am-rel {
  flex: none; width: 48px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--ink-faint);
}
.am-rel svg { width: 100%; height: 16px; }
.am-rel .rel-card { font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
@media (max-width: 560px) {
  .am-schema { padding: 40px 16px 18px; }
  .am-rel { width: 30px; }
  .am-ent-head { font-size: 12px; }
}

/* ===================================================== */
/* 3 · BUILD — Notion workspace                           */
/* ===================================================== */
.am-notion { position: absolute; inset: 0; display: grid; grid-template-columns: 150px 1fr; }
.am-nb-side { background: var(--bg-alt); border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.am-nb-ws { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink); padding: 4px 6px 10px; }
.am-nb-ws .ws-ic { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.am-nb-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); padding: 5px 7px; border-radius: 6px; }
.am-nb-item.is-sel { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); font-weight: 600; }
.am-nb-item .it-ic { font-size: 13px; }
.am-nb-main { overflow: hidden; padding: 16px 18px; }
.am-nb-title { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; margin-bottom: 3px; }
.am-nb-title .nt-ic { font-size: 19px; }
.am-nb-sub { font-size: 11.5px; color: var(--ink-faint); margin-bottom: 13px; }
.am-tbl { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; box-shadow: var(--shadow-sm); font-size: 12.5px; }
.am-tr { display: grid; grid-template-columns: 1.4fr 0.9fr 0.8fr 0.5fr; border-bottom: 1px solid var(--line); }
.am-tr:last-child { border-bottom: none; }
.am-tr.head { background: var(--bg-alt); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); }
.am-td { padding: 7px 11px; display: flex; align-items: center; gap: 6px; min-width: 0; border-right: 1px solid var(--line); }
.am-td:last-child { border-right: none; }
.am-tr.head .am-td { border-right-color: transparent; }
.am-td .cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-tr.body { /* entrance handled by transition system */ }
.am-tr .nm { font-weight: 600; color: var(--ink); }
.am-pill { font-size: 10.5px; font-weight: 600; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.am-pill.g { background: color-mix(in srgb, #2E9E63 18%, transparent); color: #2E9E63; }
.am-pill.o { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.am-pill.y { background: color-mix(in srgb, #C99A2E 20%, transparent); color: #b5871f; }
html[data-theme="dark"] .am-pill.g { color: #5FCE96; }
html[data-theme="dark"] .am-pill.y { color: #e3b65a; }
.am-av { width: 17px; height: 17px; border-radius: 50%; flex: none; background: var(--line); color: var(--ink-soft); font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
@media (max-width: 560px) {
  .am-notion { grid-template-columns: 0 1fr; }
  .am-nb-side { display: none; }
}

/* ===================================================== */
/* 4 · ACTIVATE — AI agents                               */
/* ===================================================== */
.am-agents { position: relative; padding: 18px 18px 52px; display: flex; flex-direction: column; gap: 11px; }
.am-agents-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); }
.am-agents-h .ah-ic { width: 17px; height: 17px; }
.am-agent {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 13px 15px; box-shadow: var(--shadow-sm);
  transition: opacity 0.18s ease, filter 0.18s ease;
}
.am-agent:not(.is-on) { opacity: 0.5; }
.am-agent:not(.is-on) .am-agent-ic { filter: grayscale(1); }
.am-agent:not(.is-on) .am-agent-stat .dot { background: var(--ink-faint); box-shadow: none; }
.am-agent:not(.is-on) .am-agent-stat { color: var(--ink-faint); }
.am-agent-ic {
  width: 36px; height: 36px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent);
}
.am-agent-ic svg { width: 19px; height: 19px; }
.am-agent-body { flex: 1; min-width: 0; }
.am-agent-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.am-agent-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; line-height: 1.4; }
.am-agent-stat { font-size: 11px; color: var(--accent); font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 5px; }
.am-agent-stat .dot { width: 6px; height: 6px; border-radius: 50%; background: #2E9E63; box-shadow: 0 0 0 3px color-mix(in srgb, #2E9E63 20%, transparent); }
.am-toggle { flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; border: none; padding: 0; transition: background 0.18s ease; }
.am-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.18s cubic-bezier(.2,.7,.3,1); }
.am-toggle.is-on { background: var(--accent); }
.am-toggle.is-on::after { transform: translateX(16px); }

/* ===================================================== */
/* 5 · HANDOVER — ownership kit                           */
/* ===================================================== */
.am-handover { position: relative; padding: 18px 18px 52px; display: grid; grid-template-columns: 1fr 1fr; gap: 11px; align-content: start; }
.am-deliv {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 13px 14px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 9px;
}
.am-deliv-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.am-deliv-h .dh-ic { width: 16px; height: 16px; color: var(--accent); flex: none; }
.am-thumb {
  position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden;
  background: linear-gradient(130deg, #1E0F04, #6B380E 55%, #D9730D);
  display: flex; align-items: center; justify-content: center;
}
.am-thumb .play { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center; }
.am-thumb .play svg { width: 13px; height: 13px; color: #1a1a1a; margin-left: 2px; }
.am-thumb .dur { position: absolute; bottom: 6px; right: 7px; font-size: 10px; font-weight: 600; color: #fff; background: rgba(0,0,0,0.5); border-radius: 4px; padding: 1px 6px; }
.am-sop-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-soft); cursor: pointer; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; transition: background 0.14s ease; }
.am-sop-row:hover { background: var(--bg-alt); }
.am-sop-row .check { width: 15px; height: 15px; flex: none; border-radius: 4px; background: transparent; border: 1.5px solid var(--line); color: transparent; display: flex; align-items: center; justify-content: center; font-size: 9px; transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease; }
.am-sop-row .check svg { opacity: 0; transition: opacity 0.14s ease; }
.am-sop-row.is-done { color: var(--ink-soft); }
.am-sop-row.is-done .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.am-sop-row.is-done .check svg { opacity: 1; }
.am-checkin { display: flex; align-items: baseline; gap: 7px; }
.am-checkin .big { font-size: 26px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; line-height: 1; }
.am-checkin .lbl { font-size: 12px; color: var(--ink-soft); }
.am-notif { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-soft); }
.am-notif .mini-tog { width: 30px; height: 17px; border-radius: 999px; background: var(--line); position: relative; flex: none; cursor: pointer; border: none; padding: 0; transition: background 0.18s ease; }
.am-notif .mini-tog::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform 0.18s cubic-bezier(.2,.7,.3,1); }
.am-notif .mini-tog.is-on { background: var(--accent); }
.am-notif .mini-tog.is-on::after { transform: translateX(13px); }
.am-deliv.span2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .am-handover { grid-template-columns: 1fr; } }

/* ===================================================== */
/* INTERACTIVITY — drag affordances, hint + reset chips   */
/* ===================================================== */
.am-node.drag-free { cursor: grab; touch-action: none; transition: box-shadow 0.16s ease, border-color 0.16s ease; }
.am-node.drag-free:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.am-node.is-grabbing { cursor: grabbing; box-shadow: 0 14px 30px rgba(0,0,0,0.22); }
.am-core.drag-free:hover { border-color: var(--ink); }

.am-ent.drag-item { cursor: grab; transition: box-shadow 0.16s ease, border-color 0.16s ease, transform 0.16s ease; }
.am-ent.drag-item:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.am-tr.body.drag-item { cursor: grab; transition: background 0.14s ease; }
.am-tr.body.drag-item:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }

.am-ent.is-dragging { box-shadow: 0 16px 34px rgba(0,0,0,0.2); border-color: var(--accent); }
.am-tr.body.is-dragging { background: var(--card); border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 12px 28px rgba(0,0,0,0.18); }
.am-visual .drag-ph { box-sizing: border-box; border-radius: 9px; background: color-mix(in srgb, var(--accent) 8%, transparent); border: 1.5px dashed color-mix(in srgb, var(--accent) 42%, var(--line)); }

/* affordance chips, pinned to the visual's bottom corners */
.am-hint-chip {
  position: absolute; left: 16px; bottom: 14px; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-faint);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px 5px 9px; box-shadow: var(--shadow-sm);
  pointer-events: none;
}
.am-hint-chip svg { width: 13px; height: 13px; opacity: 0.7; }
.am-reset-chip {
  position: absolute; right: 14px; bottom: 14px; z-index: 5;
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 13px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}
.am-reset-chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
body.drag-active { cursor: grabbing; -webkit-user-select: none; user-select: none; }
