/* scope.css · the BOUNDARY page for the Halcyon candidate branch.
   ============================================================
   The boundary is the sharing rule: a status and a short summary can be
   shared, and every controlled file stays protected. This page makes that one
   rule legible with the live node-graph map on the left (proof-map.js, fed the
   real six-department dataset and styled by proof-map.css) and two plain
   columns (Can be shared / Stays protected) on the right.

   The map sits on a focused dark "viewer" panel (.scope-map-canvas reuses
   .analysis-stage from halcyon.css) so the node-graph engine, which is tuned for
   a dark ground, reads cleanly whether the page theme is light or dark. Every
   color here is a Datum token, so theme.js flips light/dark for free. Text
   always sits in its own panel, never over the map art.

   Legibility: AA on the ground color, readable measure, no horizontal overflow
   at 1280px or 375px (minmax(0,1fr) tracks, min-width:0 content cols).

   MOTION CONTRACT: motion is OFF by default. Inside
   @media (prefers-reduced-motion:no-preference) the .settle elements rise into
   place via a self-completing CSS animation, so the reveal never depends on a
   JS observer firing (the right column is always readable). motion.js may still
   add .in for its own bookkeeping; the animation does not need it. Reduced
   motion shows the full page instantly, fully readable, no movement.
   ============================================================ */

/* the page lead example a newcomer reads first */
.scope-example {
  margin: 0 0 var(--space-5);
  max-width: 78ch;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-dim);
}
.scope-example::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 2px;
  margin: 0 10px 5px 0;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: middle;
}

/* the stage is map + boundary detail, stacking under 920px */
.scope-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
@media (max-width: 920px) {
  .scope-stage { grid-template-columns: minmax(0, 1fr); }
}

/* the map frame: a titled card whose body is the dark map viewer. Copy never
   overlaps the art — the head, the legend, and the read line each sit in their
   own row. */
.scope-map {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  min-width: 0;
}

.scope-map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.scope-map-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* the three emphasis buttons (All / Ready to share / Held for review). They
   drive proof-map.js via data-pm-mode; the engine repaints on click. */
.scope-modes {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.scope-mode {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.scope-mode:hover {
  color: var(--text);
  border-color: var(--border-accent);
}
.scope-mode.is-active,
.scope-mode[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--border-accent);
}
.scope-mode:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* the dark map viewer. .analysis-stage (halcyon.css) gives the dark ground +
   rounded frame; here we tighten its height so it fills the card without a
   blank band, and let the SVG fill the width with its own aspect ratio. */
.scope-map .scope-map-canvas.analysis-stage {
  min-height: 0;
  display: grid;
  align-content: center;
  padding: var(--space-3) var(--space-2);
}
.scope-map .scope-map-canvas .halcyon-proof-map {
  display: block;
  width: 100%;
  height: auto;
}

/* the legend reads under the art, its own row, never on top of it. The
   .scene-legend class is kept (the site-preservation test asserts it) but its
   halcyon.css overlay positioning is overridden here so the text never sits on
   the map art and always clears AA on the light card. */
.scope-map .scene-legend.scope-legend {
  position: static;
  left: auto;
  bottom: auto;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin: 0;
  padding: var(--space-3) 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.scope-legend span { display: inline-flex; align-items: center; }
.scope-legend .legend-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}
.legend-dot.dot-blue { background: var(--accent); }
.legend-dot.dot-gold { background: var(--gold); }
.legend-dot.dot-coral { background: var(--warn-color); }
.legend-dot.dot-gate { background: var(--gold-deep); box-shadow: 0 0 0 3px var(--gold-pale); }

/* the plain read line under the legend */
.scope-map-read {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* the side stack: the boundary question + the counts + the two cross columns */
.scope-side { display: grid; gap: var(--space-4); min-width: 0; }

/* the boundary question that sits above the two columns. Plain, legible. */
.scope-side-q {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: var(--space-3);
}

/* the live "this department at a glance" counts the engine fills */
.scope-side .pm-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.scope-side .pm-count {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  min-width: 0;
}
.scope-side .pm-count-num {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.scope-side .pm-count-num.is-share { color: var(--accent); }
.scope-side .pm-count-num.is-held { color: var(--warn-color); }
.scope-side .pm-count-cap {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  line-height: 1.3;
}

/* the two boundary cards: a clean shared / protected contract */
.cross-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.cross-card .cross-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.cross-card h3 {
  margin: 0 0 var(--space-2);
  font-size: 15px;
  color: var(--text);
}
.cross-card p {
  margin: 0 0 var(--space-3);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
}
.cross-card .clean-list { margin: 0; padding: 0; list-style: none; }
.cross-card .clean-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}
.cross-card .clean-list li:last-child { border-bottom: 0; }

.scope-rule { border-left: 3px solid var(--accent); }
.scope-rule-list { margin: 0; padding: 0; list-style: none; }
.scope-rule-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.scope-rule-list li:last-child { border-bottom: 0; }
.scope-rule-list strong { color: var(--text); }
.cross-in { border-left: 3px solid var(--accent); }
.cross-in .cross-tag { color: var(--accent); }
.cross-out { border-left: 3px solid var(--gold); }
.cross-out .cross-tag { color: var(--gold); }
.cross-out .clean-list li { color: var(--text-dim); }

.provider-note {
  margin-top: var(--space-2);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}

.scope-foot { margin-top: var(--space-6); }

@media (max-width: 540px) {
  .scope-map { padding: var(--space-3); }
  .scope-map-head { gap: var(--space-2); }
}

/* ============================================================
   MOTION. The only place anything animates. Reduced motion stays still.
   VISIBLE-BY-DEFAULT contract: a .settle element's resting opacity is 1, so if
   the reveal animation never plays (a backgrounded tab, an accessibility tool,
   any paused-animation state) the content is still fully readable. When motion
   is allowed, the keyframe carries its own opening state (from{opacity:0}) and
   plays the fade-rise once, so there is no flash and no JS observer dependency.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .settle {
    animation: scope-settle 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  /* a gentle stagger so the eye reads top to bottom; one-and-done */
  .scope-example.settle { animation-delay: 0.02s; }
  .scope-map.settle { animation-delay: 0.06s; }
  .scope-side-q.settle { animation-delay: 0.10s; }
  .scope-side .cross-card.cross-in.settle { animation-delay: 0.16s; }
  .scope-side .cross-card.cross-out.settle { animation-delay: 0.22s; }
  .scope-side .cross-card.settle:last-of-type { animation-delay: 0.28s; }
}

@keyframes scope-settle {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
