:root {
  /* Portfolio palette; keep synchronized with index.html. */
  --bg: #07110F;
  --surface: #0B1715;
  --panel: rgba(18, 40, 36, .60);
  --panel-strong: rgba(21, 48, 43, .72);
  --text: #EDF7F4;
  --muted: #A8C4BC;
  /* Lifted from #78968E for small text over layered translucent panels. */
  --muted-2: #8BA99F;
  --border: rgba(148, 210, 195, .16);
  --border-strong: rgba(45, 212, 191, .38);
  --control-border: rgba(148, 210, 195, .58);
  --accent: #2DD4BF;
  --accent-bright: #67E8D5;
  --accent-2: #38BDF8;
  --on-accent: #04110E;
  --good: #4ADE80;
  --warn: #FBBF24;
  --accent-soft: rgba(45, 212, 191, .06);
  --accent-tint: rgba(45, 212, 191, .10);
  --accent-border: rgba(45, 212, 191, .16);
  --glow-teal: rgba(45, 212, 191, .18);
  --glow-aqua: rgba(56, 189, 248, .12);
  --glow-good: rgba(74, 222, 128, .06);
  --header-bg: rgba(7, 17, 15, .90);
  --focus-border: rgba(45, 212, 191, .75);
  --focus-shadow: 0 0 0 4px rgba(45, 212, 191, .12);
  --primary-gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --primary-hover-gradient: linear-gradient(135deg, var(--accent-bright), var(--accent-2));
  --logo-gradient: linear-gradient(135deg, var(--accent), var(--accent-bright));
  --accent-shadow: 0 8px 22px rgba(45, 212, 191, .12);
  --featured-shadow: 0 24px 64px rgba(0, 0, 0, .42);
  --shadow: 0 18px 50px rgba(0, 0, 0, .36);
  --danger: #ff8c9b;
  --warn-border: rgba(251, 191, 36, .30);
  --warn-soft: rgba(251, 191, 36, .07);
  --warn-glow: rgba(251, 191, 36, .025);
  --max: 1120px;
  --reading: 760px;
  --radius: 18px;
  --header-height: 70px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 22px);
}

body {
  margin: 0;
  min-width: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 15% 5%, var(--glow-teal), transparent 55%),
    radial-gradient(900px 600px at 90% 15%, var(--glow-aqua), transparent 60%),
    radial-gradient(800px 500px at 50% 95%, var(--glow-good), transparent 60%),
    var(--bg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.container {
  width: min(100% - 36px, var(--max));
  margin-inline: auto;
}

.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  left: 18px;
  top: 10px;
  z-index: 9999;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  transform: translateY(-160%);
}

.skip:focus {
  transform: translateY(0);
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
}

.headerInner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 900;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.brandMark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--logo-gradient);
  color: var(--on-accent);
  font-size: .85rem;
}

.headerNav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.headerNav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border-radius: 10px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 800;
}

.headerNav a:hover {
  background: var(--accent-tint);
  color: var(--accent-bright);
}

.headerNav .backLink {
  margin-left: 6px;
  border: 1px solid var(--control-border);
  background: var(--panel);
  color: var(--accent-bright);
}

main {
  overflow: hidden;
}

section {
  padding: 82px 0;
}

section + section {
  border-top: 1px solid var(--border);
}

.hero {
  padding: 88px 0 74px;
}

.heroGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(280px, .62fr);
  gap: 44px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent-bright);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  line-height: .93;
  letter-spacing: -.065em;
}

.heroLead {
  max-width: 780px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1.08rem, 2.2vw, 1.35rem);
  line-height: 1.55;
}

.tags,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags {
  margin-top: 24px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
}

.actions {
  margin-top: 30px;
}

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 15px;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--accent-bright);
  font-size: .9rem;
  font-weight: 850;
}

.btn:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.btn.primary {
  border-color: transparent;
  background: var(--primary-gradient);
  box-shadow: var(--accent-shadow);
  color: var(--on-accent);
}

.btn.primary:hover {
  background: var(--primary-hover-gradient);
}

.card:hover,
.card:focus-within {
  border-color: var(--border-strong);
}

footer a:hover {
  color: var(--accent-bright);
}

.heroAside,
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel-strong), var(--panel));
  box-shadow: var(--shadow);
}

.heroAside {
  padding: 22px;
}

.heroAside h2 {
  margin: 0;
  font-size: .77rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.heroAside ol {
  display: grid;
  gap: 13px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.heroAside li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: .9rem;
}

.authorityNumber {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--accent-tint);
  color: var(--accent-bright);
  font-size: .76rem;
  font-weight: 900;
}

.heroAside strong {
  color: var(--text);
}

.proofGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 48px;
}

.proof {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel);
}

.proof strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
  letter-spacing: -.04em;
}

.proof span {
  display: block;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
}

.experimentNote {
  margin: 14px 0 0;
  color: var(--muted-2);
  font-size: .82rem;
}

.sectionHead {
  max-width: 800px;
  margin-bottom: 32px;
}

.sectionHead h2 {
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.03;
  letter-spacing: -.045em;
}

.sectionHead p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.reading {
  max-width: var(--reading);
}

.reading p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 1.04rem;
}

.reading strong {
  color: var(--text);
}

.challengeGrid,
.constraintGrid,
.decisionGrid,
.statusGrid,
.failureGrid,
.lessonGrid,
.evidenceGrid {
  display: grid;
  gap: 14px;
}

.challengeGrid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 28px;
}

.constraintGrid,
.failureGrid,
.lessonGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.decisionGrid,
.evidenceGrid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.statusGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.infoCard,
.decisionCard,
.failureCard,
.lessonCard,
.evidenceCard {
  min-width: 0;
  padding: 22px;
}

.infoCard h3,
.failureCard h3,
.lessonCard h3,
.evidenceCard h3 {
  margin: 0 0 8px;
  font-size: 1.06rem;
  line-height: 1.28;
}

.infoCard p,
.failureCard p,
.lessonCard p,
.evidenceCard p {
  margin: 0;
  color: var(--muted);
  font-size: .91rem;
}

.constraintGrid .infoCard {
  box-shadow: none;
}

.kicker {
  display: block;
  margin-bottom: 11px;
  color: var(--accent-bright);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.architecture {
  margin: 0;
  padding: 28px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 25px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flowStep {
  position: relative;
  min-width: 0;
  min-height: 180px;
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.flowStep:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -21px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}

.flowStep span {
  display: block;
  color: var(--accent-bright);
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.flowStep strong {
  display: block;
  margin-top: 9px;
  font-size: .96rem;
  line-height: 1.25;
}

.flowStep p {
  margin: 9px 0 0;
  color: var(--muted-2);
  font-size: .77rem;
  line-height: 1.45;
}

.architectureNotes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.architectureNote {
  padding: 15px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: .85rem;
}

.architectureNote strong {
  color: var(--text);
}

.decisionCard {
  box-shadow: none;
}

.decisionCard h3 {
  margin: 0 0 17px;
  font-size: 1.14rem;
  line-height: 1.3;
}

.decisionCard dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.decisionCard dt {
  margin-top: 9px;
  color: var(--text);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.decisionCard dd {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.statusCard {
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--status-color);
  border-radius: 14px;
  background: var(--panel);
}

.statusCard.pass { --status-color: var(--good); }
.statusCard.warn { --status-color: var(--warn); }
.statusCard.block { --status-color: var(--danger); }
.statusCard.error { --status-color: var(--accent-2); }

.statusCard h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: .02em;
}

.statusCard p {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.5;
}

.humanGate {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--accent-soft);
}

.gateIcon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--accent-bright);
  font-size: 1.25rem;
  font-weight: 900;
}

.humanGate h3,
.humanGate p {
  margin: 0;
}

.humanGate p {
  margin-top: 3px;
  color: var(--muted);
  font-size: .9rem;
}

.tableWrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 15px 17px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  background: var(--panel-strong);
  color: var(--text);
  font-size: .76rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

tbody th {
  color: var(--text);
  font-size: .9rem;
}

tbody td {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

.methodGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.method {
  padding: 17px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel);
}

.method strong,
.method span {
  display: block;
}

.method strong {
  font-size: .92rem;
}

.method span {
  margin-top: 5px;
  color: var(--muted);
  font-size: .82rem;
}

.credibilityNote {
  margin-top: 18px;
  padding: 17px 19px;
  border: 1px solid var(--warn-border);
  border-radius: 13px;
  background: var(--warn-soft);
  color: var(--muted);
  font-size: .9rem;
}

.credibilityNote strong {
  color: var(--warn);
}

.testList,
.limitList {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.testList li,
.limitList li {
  position: relative;
  padding: 14px 16px 14px 46px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--panel);
  color: var(--muted);
  font-size: .91rem;
}

.testList li::before,
.limitList li::before {
  position: absolute;
  left: 16px;
  top: 13px;
  color: var(--good);
  font-weight: 900;
}

.testList li::before {
  content: "✓";
}

.limitList li::before {
  content: "!";
  color: var(--warn);
}

.testList strong,
.limitList strong {
  color: var(--text);
}

.testSplit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.testPath {
  padding: 21px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel);
}

.testPath h3,
.testPath p {
  margin: 0;
}

.testPath p {
  margin-top: 7px;
  color: var(--muted);
  font-size: .9rem;
}

.testPath code {
  color: var(--accent-bright);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .82em;
}

.failureCard {
  box-shadow: none;
}

.failureCard .mitigation {
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: .83rem;
}

.failureCard .mitigation strong {
  color: var(--text);
}

.limitations {
  background: linear-gradient(180deg, var(--warn-glow), transparent);
}

.limitList {
  max-width: 900px;
}

.evidenceCard {
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

.evidenceCard .evidenceLinks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 17px;
}

.evidenceCard a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--control-border);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--accent-bright);
  font-size: .83rem;
  font-weight: 850;
}

.evidenceCard a:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
}

.sourceScope {
  margin-top: 22px;
  color: var(--muted-2);
  font-size: .8rem;
}

footer {
  padding: 34px 0 46px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: .84rem;
}

.footerInner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

footer a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 980px) {
  .heroGrid {
    grid-template-columns: 1fr;
  }

  .heroAside {
    max-width: 680px;
  }

  .proofGrid,
  .statusGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 18px;
  }

  .flowStep:not(:last-child)::after {
    display: none;
  }

  .architectureNotes,
  .methodGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 64px;
  }

  .container {
    width: min(100% - 28px, var(--max));
  }

  section {
    padding: 62px 0;
  }

  .hero {
    padding: 62px 0 58px;
  }

  .headerInner {
    min-height: var(--header-height);
  }

  .headerNav a:not(.backLink) {
    display: none;
  }

  .headerNav .backLink {
    margin-left: 0;
  }

  .challengeGrid,
  .constraintGrid,
  .decisionGrid,
  .failureGrid,
  .lessonGrid,
  .evidenceGrid,
  .testSplit {
    grid-template-columns: 1fr;
  }

  .flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .architecture {
    padding: 18px;
  }

  .flowStep {
    min-height: 155px;
  }

  .footerInner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .brandText {
    display: none;
  }

  h1 {
    font-size: clamp(3rem, 19vw, 4.8rem);
  }

  .actions .btn {
    width: 100%;
  }

  .proofGrid,
  .statusGrid,
  .flow {
    grid-template-columns: 1fr;
  }

  .flowStep {
    min-height: 0;
  }

  .humanGate {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media print {
  :root {
    --text: #111;
    --muted: #333;
    --muted-2: #555;
    --border: #ccc;
  }

  body {
    background: #fff;
    color: #111;
  }

  .header,
  .actions,
  footer {
    display: none;
  }

  section {
    padding: 28px 0;
    break-inside: avoid;
  }

  .card,
  .heroAside {
    box-shadow: none;
    background: #fff;
  }
}

.tableWrap:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
