.phase-two {
  --phase-accent: #7ee7ce;
  --phase-accent-rgb: 126, 231, 206;
  background:
    radial-gradient(circle at 78% 3%, rgba(81, 111, 255, .13), transparent 34rem),
    radial-gradient(circle at 6% 20%, rgba(34, 211, 166, .1), transparent 28rem),
    linear-gradient(180deg, #030d12 0%, #04110f 45%, #030d0c 100%);
}

.phase-two .article-shell { width: min(980px, 100%); }
.phase-two .proof-label::before { content: "✓"; }

.phase2-hero {
  isolation: isolate;
  background:
    linear-gradient(145deg, rgba(var(--phase-accent-rgb), .1), transparent 45%),
    linear-gradient(145deg, rgba(11, 31, 41, .97), rgba(5, 20, 24, .92));
  border-color: rgba(var(--phase-accent-rgb), .26);
}

.phase2-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .22;
  background-image:
    linear-gradient(rgba(var(--phase-accent-rgb), .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--phase-accent-rgb), .08) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(125deg, #000, transparent 68%);
}

.phase2-hero::after { border-color: rgba(var(--phase-accent-rgb), .18); }
.phase2-hero .eyebrow { color: var(--phase-accent); }
.phase2-hero .hero-proof { border-color: rgba(var(--phase-accent-rgb), .28); }
.phase2-hero .proof-number { color: #f8fbff; text-shadow: 0 0 42px rgba(var(--phase-accent-rgb), .19); }

.hero-violet { --phase-accent: #bda7ff; --phase-accent-rgb: 189, 167, 255; }
.hero-blue { --phase-accent: #74c9ff; --phase-accent-rgb: 116, 201, 255; }
.hero-cyan { --phase-accent: #66eadc; --phase-accent-rgb: 102, 234, 220; }
.hero-amber { --phase-accent: #ffd27a; --phase-accent-rgb: 255, 210, 122; }
.hero-gold { --phase-accent: #f8c867; --phase-accent-rgb: 248, 200, 103; }

.four-up { grid-template-columns: repeat(4, 1fr); }
.four-up .stat-card { min-width: 0; }
.four-up .stat-card .value { font-size: clamp(1.55rem, 3.5vw, 2.35rem); overflow-wrap: anywhere; }

.section-kicker {
  display: block;
  margin: 58px 0 -45px;
  color: var(--mint);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .13em;
}

.source-deck { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin: 24px 0; }
.source-deck:has(.source-card:only-child) { grid-template-columns: 1fr; }
.source-card {
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  border: 1px solid rgba(85, 230, 193, .16);
  border-radius: 17px;
  background: rgba(0, 0, 0, .14);
}
.source-card-top { display: flex; justify-content: space-between; gap: 18px; align-items: baseline; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.source-card-top span { color: var(--mint); font-size: 1.1rem; font-weight: 950; letter-spacing: -.03em; }
.source-card-top strong { font-size: .78rem; text-align: right; }
.source-card > p { min-height: 2.8em; margin: 13px 0; color: var(--muted); font-size: .8rem; }
.source-card dl { display: grid; gap: 11px; margin: 0; }
.source-card dl div { min-width: 0; }
.source-card dt { color: var(--dim); font-size: .65rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.source-card dd { margin: 2px 0 0; color: #d0dedb; font-size: .76rem; overflow-wrap: anywhere; }
.source-card code { color: #a4eddd; font-size: .67rem; }
.source-links { display: flex; gap: 12px; margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); }
.source-links a { font-size: .74rem; font-weight: 800; }

.alignment-proof {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin: 20px 0;
  padding: 17px;
  border: 1px solid rgba(246, 197, 92, .22);
  border-radius: 14px;
  background: rgba(246, 197, 92, .055);
}
.alignment-icon { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: rgba(246, 197, 92, .12); color: var(--gold); font-size: 1.25rem; font-weight: 900; }
.alignment-proof strong { display: block; }
.alignment-proof p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }

.comparison-bars {
  margin: 25px 0 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(6, 22, 25, .72);
}
.series-key { display: flex; flex-wrap: wrap; gap: 16px; padding: 13px 17px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: .72rem; }
.series-key span { display: inline-flex; gap: 7px; align-items: center; }
.series-key i { width: 18px; height: 5px; border-radius: 999px; }
.key-a, .series-a { background: linear-gradient(90deg, #9d87ff, #c9bbff); }
.key-b, .series-b { background: linear-gradient(90deg, #24b7df, #62e4d3); }
.comparison-row { display: grid; grid-template-columns: minmax(155px, .65fr) minmax(320px, 1.6fr); gap: 20px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.comparison-row:last-child { border-bottom: 0; }
.comparison-label strong, .comparison-label span { display: block; }
.comparison-label strong { font-size: .82rem; }
.comparison-label span { color: var(--dim); font-size: .69rem; }
.series-stack { display: grid; gap: 7px; }
.series-line { display: grid; grid-template-columns: 60px minmax(100px, 1fr) 64px; gap: 10px; align-items: center; }
.series-name { color: var(--muted); font-size: .68rem; font-weight: 850; }
.series-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .055); }
.series-track i { display: block; width: var(--bar); height: 100%; border-radius: inherit; }
.series-line b { color: #e7f6f2; font-size: .73rem; text-align: right; font-variant-numeric: tabular-nums; }

.metric-stack strong, .metric-stack span, .comparison-table td:first-child span, .source-table td span { display: block; }
.metric-stack span, .comparison-table td:first-child span { margin-top: 3px; color: var(--dim); font-size: .68rem; white-space: nowrap; }
.comparison-table { min-width: 980px; }
.comparison-table td { vertical-align: top; }

.button-stack { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.button-stack .button { min-width: 160px; }

/* Interactive matrix */
.matrix-page .page-shell { width: min(1320px, calc(100% - 36px)); }
.matrix-hero { --phase-accent: #55e6c1; --phase-accent-rgb: 85, 230, 193; }
.matrix-hero h1 { max-width: 12ch; }
.artifact-heading { display: flex; justify-content: space-between; gap: 22px; align-items: flex-end; margin-top: 55px; }
.artifact-heading .section-kicker { margin: 0 0 8px; }
.artifact-heading h2 { margin: 0; }
.matrix-controls { display: inline-flex; gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 13px; background: rgba(4, 18, 20, .8); }
.metric-button { min-height: 40px; padding: 0 15px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 850; cursor: pointer; }
.metric-button:hover { color: var(--ink); }
.metric-button[aria-pressed="true"] { border-color: rgba(85, 230, 193, .25); background: rgba(85, 230, 193, .1); color: var(--mint); }
.matrix-status { margin: 12px 0 17px; color: var(--muted); font-size: .82rem; }
.matrix-shell { position: relative; overflow: auto; border: 1px solid var(--line-strong); border-radius: 22px; background: rgba(5, 19, 22, .9); box-shadow: 0 30px 90px rgba(0, 0, 0, .22); }
.heatmap { min-width: 1040px; }
.heatmap caption { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.heatmap th { padding: 15px 10px; text-align: center; }
.heatmap th:first-child { position: sticky; left: 0; z-index: 4; min-width: 126px; text-align: left; background: #071a1c; box-shadow: 10px 0 18px rgba(0, 0, 0, .12); }
.heatmap thead th:first-child { z-index: 5; }
.heatmap thead th span { display: block; max-width: 110px; margin: 4px auto 0; color: var(--dim); font-size: .58rem; line-height: 1.25; text-transform: none; letter-spacing: 0; }
.heatmap tbody th { padding: 0; }
.matrix-pair { width: 100%; min-height: 68px; padding: 10px 14px; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .84rem; font-weight: 950; text-align: left; cursor: pointer; }
.matrix-pair span { display: block; margin-top: 1px; color: var(--dim); font-size: .62rem; font-weight: 700; text-transform: capitalize; }
.matrix-pair:hover, .matrix-pair[aria-current="true"] { background: rgba(85, 230, 193, .07); color: var(--mint); }
.matrix-cell { position: relative; isolation: isolate; min-width: 125px; height: 68px; padding: 11px 8px; overflow: hidden; text-align: center; vertical-align: middle; }
.matrix-cell::before { content: ""; position: absolute; inset: 4px; z-index: -1; border-radius: 10px; background: linear-gradient(135deg, #13aa87, #1978a0); opacity: calc(.06 + var(--heat) * .7); transition: opacity .22s ease; }
.matrix-value { display: block; color: #effffc; font-size: .91rem; font-weight: 950; font-variant-numeric: tabular-nums; }
.matrix-cell small { display: block; margin-top: 2px; color: rgba(220, 244, 238, .58); font-size: .6rem; }

.pair-detail { display: grid; grid-template-columns: minmax(0, .75fr) minmax(500px, 1.25fr); gap: 25px; align-items: center; margin: 24px 0 55px; padding: clamp(22px, 4vw, 34px); border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(140deg, rgba(85, 230, 193, .07), rgba(7, 24, 28, .76)); }
.pair-detail h2 { margin: 0 0 8px; font-size: 1.65rem; }
.pair-detail p { margin: 0; font-size: .86rem; }
.pair-detail-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.pair-detail-stats div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0, 0, 0, .12); }
.pair-detail-stats span { display: block; color: var(--dim); font-size: .61rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.pair-detail-stats strong { display: block; margin-top: 4px; font-size: .78rem; overflow-wrap: anywhere; }
.pair-detail-stats code { font-size: .7rem; }

.comparison-card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.comparison-card { padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: rgba(9, 29, 31, .72); }
.comparison-card > span { color: var(--gold); font-size: .66rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.comparison-card h3 { margin: 9px 0 17px; }
.comparison-card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.comparison-card-metrics div { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .025); }
.comparison-card-metrics small, .comparison-card-metrics strong { display: block; }
.comparison-card-metrics small { color: var(--dim); font-size: .64rem; }
.comparison-card-metrics strong { margin-top: 2px; font-size: 1.15rem; }
.comparison-card p { min-height: 3em; margin: 14px 0; font-size: .76rem; }
.comparison-card a { font-size: .76rem; font-weight: 850; }
.source-table { min-width: 1120px; }
.source-table td { vertical-align: top; text-align: left; }
.source-table code { display: block; max-width: 285px; overflow-wrap: anywhere; white-space: normal; }

@media (max-width: 1000px) {
  .four-up { grid-template-columns: repeat(2, 1fr); }
  .pair-detail { grid-template-columns: 1fr; }
  .comparison-card-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .comparison-row { grid-template-columns: 1fr; gap: 10px; }
  .source-deck { grid-template-columns: 1fr; }
  .source-card > p { min-height: 0; }
  .artifact-heading { align-items: flex-start; flex-direction: column; }
  .pair-detail-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .matrix-page .page-shell { width: calc(100% - 24px); }
  .four-up, .comparison-card-grid { grid-template-columns: 1fr; }
  .source-card-top { align-items: flex-start; flex-direction: column; gap: 4px; }
  .source-card-top strong { text-align: left; }
  .alignment-proof { grid-template-columns: 1fr; }
  .series-line { grid-template-columns: 50px minmax(80px, 1fr) 57px; gap: 7px; }
  .pair-detail-stats { grid-template-columns: 1fr; }
  .button-stack { width: 100%; }
  .button-stack .button { width: 100%; }
  .matrix-controls { width: 100%; }
  .metric-button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .matrix-cell::before { transition: none; }
}
