/* ──────────────────────────────────────────────────────────────
   Doctrine Atlas styles
   ────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg-canvas);
  color: var(--fg-1);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Topbar (matches landing) ─── */
.atlas-topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.atlas-topbar-inner {
  max-width: 1400px; margin: 0 auto;
  padding: 14px 32px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.atlas-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-2); text-decoration: none; letter-spacing: 0.4px;
}
.atlas-back:hover { color: var(--gold); }
.atlas-wordmark {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
}
.atlas-wm-text { display: flex; flex-direction: column; line-height: 1; }
.atlas-wm-text .wm { font-family: var(--font-serif); font-weight: 900; font-size: 24px; letter-spacing: -0.7px; }
.atlas-wm-text .tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: 1.8px; color: var(--gold); margin-top: 4px; }

/* ─── Page head ─── */
.atlas-head {
  padding: 64px 32px 32px;
  text-align: center;
  position: relative;
}
.atlas-marker {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 20px;
}
.atlas-marker .pipe { color: var(--rule); }
.atlas-h1 {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(56px, 7vw, 96px);
  line-height: 1.02;
  letter-spacing: -2.5px;
  color: var(--ink);
  margin: 0 0 18px;
}
.atlas-h1 em { color: var(--gold); font-style: italic; font-weight: 700; }
.atlas-sub {
  font-family: var(--font-serif);
  font-size: 19px; line-height: 1.6;
  color: var(--ink-2);
  max-width: 720px; margin: 0 auto 32px;
}
.atlas-sub b { color: var(--ink); }
.atlas-filters {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-bottom: 12px;
}
.atlas-filter {
  padding: 8px 18px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.4px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.atlas-filter:hover { border-color: var(--gold); color: var(--gold); }
.atlas-filter.is-active {
  background: var(--ink); color: #faf7f0; border-color: var(--ink);
}

/* ─── Stage ─── */
.atlas-stage {
  position: relative;
  max-width: 1400px;
  margin: 0 auto 32px;
  padding: 0 24px;
}
.atlas-svg-wrap {
  position: relative;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}
.atlas-svg {
  width: 100%; height: auto; display: block;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(191,155,48,0.06) 0%, transparent 55%),
    #fff;
}
.atlas-tag {
  position: absolute;
  top: 0; inset-inline-end: 0;
  background: var(--ink); color: #faf7f0;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1.5px;
  border-radius: 0 18px 0 8px;
  z-index: 2;
}

/* ─── SVG visual layers ─── */
.atlas-connection {
  stroke: var(--gold);
  stroke-width: 1;
  opacity: 0.12;
  fill: none;
  transition: opacity 0.25s, stroke-width 0.25s;
}
.atlas-connection.is-hot { opacity: 0.65; stroke-width: 1.6; }

.atlas-cluster-bg {
  fill: var(--gold);
  opacity: 0.04;
  transition: opacity 0.25s;
}
.atlas-cluster-bg.is-active { opacity: 0.10; }

.atlas-cluster-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.8px;
  fill: var(--gold);
  text-transform: uppercase;
  text-anchor: middle;
  pointer-events: none;
}
.atlas-cluster-label-he {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
  pointer-events: none;
}

.atlas-hub {
  fill: var(--ink);
}
.atlas-hub-ring {
  fill: none;
  stroke: var(--gold);
  stroke-width: 0.6;
  opacity: 0.45;
}
.atlas-hub-label {
  font-family: var(--font-serif);
  font-weight: 900;
  font-style: italic;
  fill: var(--gold);
  text-anchor: middle;
  pointer-events: none;
}
.atlas-hub-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  fill: rgba(250, 247, 240, 0.65);
  text-anchor: middle;
  pointer-events: none;
}

.atlas-node {
  cursor: pointer;
  transition: filter 0.18s;
}
.atlas-node-bg {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.6;
  transition: fill 0.18s, stroke 0.18s, stroke-width 0.18s;
}
.atlas-node-anchored .atlas-node-bg {
  fill: var(--ink);
}
.atlas-node-iris {
  fill: var(--gold);
  opacity: 0;
  transition: opacity 0.22s;
}
.atlas-node-anchored .atlas-node-iris { opacity: 1; }
.atlas-node-label {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 12px;
  fill: var(--ink);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s;
}
.atlas-node:hover .atlas-node-label,
.atlas-node.is-selected .atlas-node-label,
.atlas-node.is-anchored .atlas-node-label {
  opacity: 1;
}
.atlas-node:hover .atlas-node-bg,
.atlas-node.is-selected .atlas-node-bg {
  stroke: var(--gold); stroke-width: 2.4;
}
.atlas-node:hover {
  filter: drop-shadow(0 4px 8px rgba(191,155,48,0.35));
}
.atlas-node.is-dimmed { opacity: 0.18; }

/* ─── Detail panel ─── */
.atlas-detail {
  position: fixed;
  top: 60px; bottom: 24px;
  inset-inline-end: 24px;
  width: 380px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: var(--shadow-elev);
  padding: 28px 28px 24px;
  z-index: 60;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(.2, 1, .3, 1), opacity 0.25s;
  overflow-y: auto;
}
[dir="rtl"] .atlas-detail {
  transform: translateX(calc(-100% - 24px));
}
.atlas-detail.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.atlas-detail-close {
  position: absolute;
  top: 14px; inset-inline-end: 14px;
  width: 28px; height: 28px; border-radius: 6px;
  background: transparent; border: 0; cursor: pointer;
  font-family: var(--font-mono); font-size: 18px;
  color: var(--fg-3);
}
.atlas-detail-close:hover { color: var(--ink); background: var(--bg-hover); }
.atlas-detail-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.atlas-detail-tag .pipe { opacity: 0.5; }
.atlas-detail h2 {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.8px;
  color: var(--ink);
  margin: 0 0 16px;
}
.atlas-detail-rule { width: 50px; height: 2px; background: var(--gold); margin-bottom: 18px; }
.atlas-detail-row {
  margin-bottom: 18px;
  font-family: var(--font-serif);
}
.atlas-detail-row .label {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
}
.atlas-detail-row .value {
  font-family: var(--font-serif);
  font-size: 16px; font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
}
.atlas-detail-row .corpus {
  font-family: var(--font-serif);
  font-weight: 900; font-style: italic;
  font-size: 36px; color: var(--gold);
  line-height: 1;
}
.atlas-detail-row .corpus + .corpus-label {
  font-family: var(--font-mono);
  font-size: 10px; color: var(--fg-3);
  letter-spacing: 0.5px;
  margin-top: 4px;
}
.atlas-detail-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.atlas-detail-chip {
  display: inline-block;
  padding: 5px 12px;
  background: var(--bg-canvas);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
}
.atlas-detail-chip:hover { border-color: var(--gold); color: var(--gold); }
.atlas-detail-cta {
  margin-top: 12px;
  display: block;
  padding: 12px 18px;
  text-align: center;
  background: var(--gold);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-family: var(--font-sans);
  font-weight: 700; font-size: 14px;
  transition: background 0.12s;
}
.atlas-detail-cta:hover { background: var(--gold-strong); }
.atlas-detail-stats {
  display: flex; gap: 12px;
  padding: 12px 14px;
  background: var(--bg-canvas);
  border-radius: 10px;
  margin-bottom: 18px;
}
.atlas-detail-stats > div { flex: 1; }
.atlas-detail-stats .stat-num {
  font-family: var(--font-serif); font-weight: 900; font-style: italic;
  font-size: 32px; line-height: 1; color: var(--gold);
}
.atlas-detail-stats .stat-lab {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--fg-3); letter-spacing: 0.5px; margin-top: 4px;
}

/* ─── Legend ─── */
.atlas-legend {
  max-width: 1400px;
  margin: 0 auto 60px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-2);
}
.atlas-legend-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.atlas-legend-icon {
  flex-shrink: 0; width: 48px; height: 48px;
  display: grid; place-items: center;
}
.atlas-legend-icon svg { width: 100%; height: 100%; }
.atlas-legend-text { flex: 1; }
.atlas-legend-text b {
  display: block;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 4px;
}

@media (max-width: 880px) {
  .atlas-legend { grid-template-columns: 1fr; }
  .atlas-detail { width: calc(100% - 32px); inset-inline-end: 16px; }
}

/* ─── Illustration band (brand taste expansion) ─── */
.atlas-illust {
  max-width: 1400px;
  margin: 0 auto 64px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}
.atlas-illust-card {
  background: #fdfbf5;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 28px 28px 24px;
  position: relative;
  overflow: hidden;
}
.atlas-illust-art {
  height: 140px;
  margin-bottom: 20px;
  display: grid; place-items: center;
}
.atlas-illust-art svg { width: 100%; height: 100%; }
.atlas-illust-card h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.3;
}
.atlas-illust-card p {
  font-family: var(--font-serif);
  font-size: 14px; line-height: 1.7;
  color: var(--ink-2);
  margin: 0;
}
.atlas-illust-card .marker {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 1.4px;
  color: var(--gold);
  margin-bottom: 10px;
}
@media (max-width: 880px) {
  .atlas-illust { grid-template-columns: 1fr; }
}

/* ─── Footer (matches landing) ─── */
.atlas-footer {
  background: var(--bg-canvas);
  padding: 36px 32px 24px;
  border-top: 1px solid var(--rule);
}
.atlas-footer-inner {
  max-width: 1400px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px; color: var(--fg-3); letter-spacing: 0.4px;
}
.atlas-footer-inner a { color: var(--fg-3); text-decoration: none; }
.atlas-footer-inner a:hover { color: var(--gold); }


/* ─── Anchor-Case Zoom mode ─── */
.atlas-node, .atlas-cluster-bg, .atlas-cluster-label, .atlas-cluster-label-he,
.atlas-hub, .atlas-hub-ring, .atlas-hub-label, .atlas-hub-sub, .atlas-connection {
  transition: opacity 0.4s var(--ease-out, cubic-bezier(.2,1,.3,1));
}
.atlas-node.is-faded { opacity: 0.10; pointer-events: none; }
.atlas-cluster-bg.is-faded, .atlas-connection.is-faded,
.atlas-hub.is-faded, .atlas-hub-ring.is-faded,
.atlas-hub-label.is-faded, .atlas-hub-sub.is-faded,
.atlas-cluster-label.is-faded, .atlas-cluster-label-he.is-faded { opacity: 0.06; }
.atlas-node.is-focused {
  transition: transform 0.6s var(--ease-out, cubic-bezier(.2,1,.3,1));
}
.atlas-node.is-focused .atlas-node-label { opacity: 1; font-size: 16px; font-weight: 900; }

.atlas-case {
  cursor: default;
  animation: atlas-case-in 0.55s var(--ease-stamp, cubic-bezier(.2,1.6,.5,1)) both;
}
@keyframes atlas-case-in {
  0%   { opacity: 0; transform: translate(var(--cx), var(--cy)) scale(0.4); }
  100% { opacity: 1; }
}
.atlas-case-conn {
  stroke: var(--gold);
  stroke-width: 1.2;
  opacity: 0.55;
  stroke-dasharray: 4 3;
}
.atlas-case-bg {
  fill: #0f172a;
  stroke: var(--gold);
  stroke-width: 2;
  transition: fill 0.2s, stroke-width 0.2s, transform 0.2s;
  transform-origin: 0 0;
  transform-box: fill-box;
}
.atlas-case:hover .atlas-case-bg { fill: var(--gold); stroke-width: 3; }
.atlas-case-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  fill: var(--gold);
  letter-spacing: 0.3px;
  pointer-events: none;
}
.atlas-case:hover .atlas-case-ref { fill: #0f172a; }
.atlas-case-year {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: rgba(250, 247, 240, 0.65);
  pointer-events: none;
}
.atlas-case:hover .atlas-case-year { fill: #0f172a; }
.atlas-case-label { pointer-events: none; }
.atlas-case-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  fill: var(--ink);
}
.atlas-case-holding {
  font-family: var(--font-serif);
  font-size: 12px;
  fill: var(--fg-2);
  font-style: italic;
}

/* Back button */
.atlas-zoom-back {
  position: absolute;
  top: 18px; inset-inline-start: 18px;
  z-index: 5;
  background: var(--ink);
  color: #faf7f0;
  border: 0;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.8px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s, transform 0.25s var(--ease-out, cubic-bezier(.2,1,.3,1)), background 0.15s;
  pointer-events: none;
}
.atlas-zoom-back.is-visible {
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}
.atlas-zoom-back:hover { background: var(--gold-strong); }
.atlas-zoom-back span { color: var(--gold); font-size: 14px; font-weight: 700; }


/* ─── Multi-entity graph: statutes & judges ─── */
.atlas-statute-bg {
  fill: #fdfbf5;
  stroke: var(--success);
  stroke-width: 1.5;
  rx: 6;
}
.atlas-statute-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  fill: var(--success);
  text-anchor: middle;
  pointer-events: none;
}
.atlas-statute-year {
  font-family: var(--font-mono);
  font-size: 8px;
  fill: var(--fg-3);
  text-anchor: middle;
  pointer-events: none;
}
.atlas-judge-bg {
  fill: var(--bg-canvas);
  stroke: #6e44b3;
  stroke-width: 1.5;
  stroke-dasharray: 3 2;
}
.atlas-judge-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 11px;
  font-weight: 700;
  fill: #6e44b3;
  text-anchor: middle;
  pointer-events: none;
}

/* Relation types (5 visual codes) */
.atlas-rel-establishes { stroke: var(--success); stroke-width: 1.2; opacity: 0.45; }
.atlas-rel-cites       { stroke: var(--fg-3); stroke-width: 0.8; opacity: 0.3; stroke-dasharray: 2 2; }
.atlas-rel-authored    { stroke: #6e44b3; stroke-width: 1.2; opacity: 0.4; stroke-dasharray: 4 2; }

/* Legend panel (floating, in-stage) */
.atlas-keylegend {
  position: absolute;
  top: 18px; inset-inline-end: 18px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-2);
  box-shadow: var(--shadow-card);
  z-index: 4;
  max-width: 260px;
}
.atlas-legend-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 700;
}
.atlas-legend-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0;
  font-size: 11px;
}
.atlas-legend-swatch {
  width: 24px; height: 14px;
  display: inline-grid; place-items: center;
  flex-shrink: 0;
}
.atlas-legend-swatch svg { width: 100%; height: 100%; }
.atlas-legend-row b {
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 12px;
}
.atlas-keylegend hr {
  border: 0;
  border-top: 1px dashed var(--rule);
  margin: 8px 0;
}
