:root {
  --bg: #e7f9fc;
  --surface: #daecef;
  --border: #bed1d4;
  --text: #031a1d;
  --muted: #556a6d;
  --primary: #137682;
  --secondary: #0d6590;
  --accent: #0f8774;
  --deep: #07444c;
  --ink-blue: #073f5a;
  --pale: #f4fdfe;
  --danger: #07506a;
  --shadow: rgb(3 26 29 / 12%);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image: repeating-linear-gradient(0deg, transparent 0 7px, rgb(19 118 130 / 2.5%) 7px 8px), repeating-linear-gradient(90deg, transparent 0 11px, rgb(13 101 144 / 2%) 11px 12px);
  font-family: var(--sans);
  min-width: 320px;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
button:focus-visible, textarea:focus-visible, [tabindex="0"]:focus-visible { outline: 3px solid var(--secondary); outline-offset: 3px; }
[hidden] { display: none !important; }

.masthead, main, .site-foot { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.masthead { min-height: 80px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none; font: 700 21px/1 var(--serif); }
.brand svg { width: 39px; height: 39px; fill: var(--deep); }
.brand svg circle { fill: var(--bg); }
.brand .seal-link { fill: none; stroke: var(--bg); stroke-width: 1.8; stroke-dasharray: 3 2; }
.edition { color: var(--muted); font-size: .76rem; letter-spacing: .1em; text-transform: uppercase; }

.intro { width: min(760px, 100%); margin: 72px auto 48px; }
.kicker, .eyebrow { margin: 0 0 10px; color: var(--primary); font-size: .73rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1 { margin: 0; max-width: 720px; font: 700 clamp(2.55rem, 7vw, 5.7rem)/.94 var(--serif); letter-spacing: -.045em; }
.intro > p:last-child { max-width: 650px; margin: 25px 0 0; color: var(--muted); font-size: 1.08rem; line-height: 1.65; }

.setup-panel { position: relative; width: min(760px, 100%); margin: 0 auto 72px; padding: 28px; background: rgb(218 236 239 / 88%); border: 1px solid var(--border); box-shadow: 10px 10px 0 rgb(190 209 212 / 45%); clip-path: polygon(0 0, calc(100% - 17px) 0, 100% 17px, 100% 100%, 17px 100%, 0 calc(100% - 17px)); }
.section-heading, .results-head, .section-heading > div, .results-head > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.section-heading h2, .results-head h2, .progress-panel h2, .error-panel h2 { margin: 0; font: 700 1.55rem/1.1 var(--serif); }
.step { display: inline-grid; place-items: center; flex: 0 0 38px; height: 38px; color: var(--pale); background: var(--deep); font: 700 1rem var(--serif); clip-path: polygon(15% 0,85% 0,100% 15%,100% 85%,85% 100%,15% 100%,0 85%,0 15%); }
.text-button { min-height: 44px; padding: 8px 4px; border: 0; border-bottom: 1px solid currentColor; background: transparent; color: var(--primary); font-weight: 750; cursor: pointer; }

.claim-card { margin-top: 20px; padding: 18px; background: rgb(244 253 254 / 54%); border-inline-start: 4px solid var(--primary); }
.claim-card.has-error { border-color: var(--secondary); }
.claim-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.claim-top label { font-size: .78rem; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.remove-claim { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.claim-card textarea { display: block; width: 100%; min-height: 118px; resize: vertical; padding: 14px; color: var(--text); background: var(--pale); border: 1px solid var(--border); line-height: 1.5; }
.claim-card textarea::placeholder { color: #61777a; }
.field-meta { display: flex; justify-content: space-between; gap: 10px; min-height: 20px; margin: 7px 0 0; color: var(--muted); font-size: .72rem; }
.field-error { color: var(--ink-blue); font-weight: 700; }
.claim-actions { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }
.secondary-button { min-height: 44px; padding: 10px 15px; color: var(--deep); border: 1px solid var(--primary); background: transparent; font-weight: 800; cursor: pointer; }
.secondary-button:hover { background: rgb(19 118 130 / 8%); }
.secondary-button:disabled { opacity: .45; cursor: not-allowed; }
.count-label { color: var(--muted); font-size: .8rem; }
.budget-note { margin: 24px 0 14px; padding: 13px 15px; color: var(--muted); border: 1px solid var(--border); border-inline-start: 4px solid var(--accent); font-size: .82rem; line-height: 1.5; }
.form-error { margin: 12px 0; color: var(--ink-blue); font-weight: 700; }
.primary-button { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; color: var(--pale); border: 0; background: var(--deep); font-weight: 850; letter-spacing: .02em; cursor: pointer; }
.primary-button:hover { background: #095964; }
.primary-button:disabled { opacity: .52; cursor: wait; }

.progress-panel, .error-panel { width: min(760px, 100%); margin: 0 auto 70px; padding: 22px; border: 1px solid var(--border); background: var(--surface); }
.progress-panel { display: grid; grid-template-columns: auto 1fr; gap: 16px; }
.progress-copy p, .error-panel > p { margin: 7px 0; color: var(--muted); line-height: 1.5; }
.progress-track { grid-column: 1 / -1; height: 6px; background: var(--border); overflow: hidden; }
.progress-track span { display: block; width: 12%; height: 100%; background: var(--accent); transition: width .22s ease; }
.error-panel { border-inline-start: 5px solid var(--secondary); }
.error-panel .secondary-button { margin-top: 10px; }

.results { margin: 80px auto; }
.results-head { align-items: flex-end; padding-bottom: 22px; border-bottom: 2px solid var(--text); }
.results-head .eyebrow { margin-bottom: 5px; }
.summary { display: flex; margin: 0; gap: 1px; }
.summary div { min-width: 98px; padding: 9px 13px; border-inline-start: 1px solid var(--border); }
.summary dt { color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.summary dd { margin: 2px 0 0; font: 700 1.5rem var(--serif); }
.field-tools { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 18px 0; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters > span { margin-right: 4px; color: var(--muted); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.filters button, .zoom-controls button { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border); background: var(--pale); cursor: pointer; }
.filters button[aria-pressed="true"] { border-color: var(--deep); box-shadow: inset 0 -3px var(--deep); }
.filters button[aria-pressed="false"] { color: var(--muted); background: transparent; }
.filters button b { margin-left: 5px; font-size: .72rem; }
.key { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 5px; font-style: normal; font-weight: 900; border-radius: 50%; }
.key.support { color: var(--pale); background: var(--accent); }
.key.tension { color: var(--pale); background: var(--secondary); }
.key.qualification { color: var(--pale); background: var(--primary); }
.zoom-controls { display: flex; gap: 5px; white-space: nowrap; }

.logical-field { width: 100%; max-width: 1120px; margin-inline: auto; border: 2px solid var(--deep); background: var(--surface); box-shadow: 12px 12px 0 rgb(19 118 130 / 12%); clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); }
.card-head { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 22px; color: var(--pale); background: var(--deep); }
.card-brand { display: flex; align-items: center; gap: 13px; }
.card-brand p { margin: 0 0 2px; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }
.card-brand h3 { margin: 0; font: 700 1.55rem var(--serif); }
.mini-seal { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--bg); clip-path: polygon(15% 0,85% 0,100% 15%,100% 85%,85% 100%,15% 100%,0 85%,0 15%); letter-spacing: 2px; }
.card-head > p { max-width: 45%; margin: 0; text-align: right; color: #d9f5f7; font-size: .82rem; }
.map-frame { position: relative; aspect-ratio: 16 / 9; min-height: 360px; border-bottom: 1px solid var(--border); background-image: linear-gradient(rgb(19 118 130 / 6%) 1px, transparent 1px), linear-gradient(90deg, rgb(19 118 130 / 6%) 1px, transparent 1px); background-size: 40px 40px; overflow: hidden; }
#ontology-map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#ontology-map.dragging { cursor: grabbing; }
.membership { stroke: var(--border); stroke-width: 2; }
.relation { fill: none; stroke-width: 4; opacity: .9; }
.relation.support { stroke: var(--accent); marker-end: url(#arrow-support); }
.relation.tension { stroke: var(--secondary); stroke-width: 5; stroke-dasharray: 14 9; }
.relation.qualification { stroke: var(--primary); stroke-dasharray: 2 8; stroke-linecap: round; marker-end: url(#arrow-qual); }
.edge-marker { font: 800 15px var(--sans); paint-order: stroke; stroke: var(--surface); stroke-width: 5px; }
.edge-marker.support { fill: var(--accent); }.edge-marker.tension { fill: var(--secondary); }.edge-marker.qualification { fill: var(--primary); }
.node { cursor: pointer; transition: opacity .15s ease; }
.node.dimmed, .edge.dimmed { opacity: .13; }
.node .node-shape { stroke: var(--deep); stroke-width: 2.5; fill: var(--pale); }
.node.proposition .node-shape { fill: var(--deep); }
.node.selected .node-shape { stroke: var(--secondary); stroke-width: 7; }
.node text { pointer-events: none; text-anchor: middle; dominant-baseline: middle; font-family: var(--sans); fill: var(--text); }
.node.proposition text { fill: var(--pale); font: 700 24px var(--serif); }
.node.concept text { font-size: 14px; font-weight: 750; }
.node:focus { outline: none; }
.node:focus .node-shape { stroke: var(--secondary); stroke-width: 6; }
.card-lower { display: grid; grid-template-columns: 1.25fr .75fr; min-height: 190px; }
.card-lower h4 { margin: 0 0 14px; color: var(--primary); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; }
.card-ledger, .detail-rail { padding: 20px 22px; }
.card-ledger { border-inline-end: 1px solid var(--border); }
.card-ledger ol { columns: 2; column-gap: 28px; margin: 0; padding: 0; list-style: none; counter-reset: proposition; }
.card-ledger li { counter-increment: proposition; break-inside: avoid; display: grid; grid-template-columns: 30px 1fr; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.card-ledger li::before { content: counter(proposition) "."; color: var(--text); font: 700 .92rem var(--serif); }
.card-ledger li.selected { color: var(--text); font-weight: 750; }
.detail-rail { background: rgb(190 209 212 / 25%); }
.detail-rail p { margin: 0 0 10px; font-size: .78rem; line-height: 1.45; }
.detail-rail .source-quote { display: -webkit-box; overflow: hidden; color: var(--muted); -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.detail-number { font: 700 1.7rem var(--serif) !important; color: var(--deep); }
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-tags span { padding: 4px 7px; border: 1px solid var(--border); background: var(--pale); font-size: .68rem; }
.card-foot { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 22px; border-top: 1px solid var(--border); }
.legend { display: flex; flex-wrap: wrap; gap: 18px; padding: 0; margin: 0; list-style: none; font-size: .72rem; font-weight: 750; }
.line { display: inline-block; width: 26px; margin-right: 6px; border-top: 3px solid; vertical-align: middle; }
.line.support { border-color: var(--accent); }.line.tension { border-color: var(--secondary); border-style: dashed; }.line.qualification { border-color: var(--primary); border-style: dotted; }
.legend li.inactive { display: none; }
.card-foot p { margin: 0; color: var(--muted); font-size: .68rem; text-align: right; }
.accessible-connections { margin: 30px auto 0; padding: 22px; border: 1px solid var(--border); background: rgb(218 236 239 / 55%); }
.accessible-connections h3 { margin: 0; font: 700 1.25rem var(--serif); }
.muted { color: var(--muted); }
.accessible-connections ul { margin: 16px 0 0; padding-left: 20px; }
.accessible-connections li { margin: 8px 0; line-height: 1.45; }
.accessible-connections button { min-height: 44px; padding: 5px 8px; color: var(--deep); border: 0; border-bottom: 1px solid; background: transparent; font-weight: 700; cursor: pointer; }
.site-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 80px; padding: 30px 0 50px; color: var(--muted); border-top: 1px solid var(--border); font-size: .76rem; }
.noscript { padding: 20px; border: 2px solid var(--secondary); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 820px) {
  .edition { display: none; }
  .intro { margin-top: 48px; }
  .results-head, .field-tools { align-items: stretch; flex-direction: column; }
  .summary { width: 100%; }
  .summary div { flex: 1; min-width: 0; }
  .zoom-controls { align-self: flex-end; }
  .map-frame { aspect-ratio: 4 / 3; }
  .card-lower { grid-template-columns: 1fr; }
  .card-ledger { border-inline-end: 0; border-bottom: 1px solid var(--border); }
}

@media (max-width: 540px) {
  .masthead, main, .site-foot { width: min(100% - 20px, 1180px); }
  .masthead { min-height: 68px; }
  .intro { margin-bottom: 34px; }
  h1 { font-size: clamp(2.5rem, 14vw, 4.1rem); }
  .setup-panel { padding: 19px 15px; box-shadow: 6px 6px 0 rgb(190 209 212 / 45%); }
  .section-heading { align-items: flex-start; }
  .section-heading > div { align-items: flex-start; }
  .claim-actions { align-items: flex-start; flex-direction: column; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; }
  .filters > span { display: none; }
  .logical-field { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); }
  .card-head { align-items: flex-start; flex-direction: column; min-height: 118px; padding: 15px; }
  .card-head > p { max-width: 100%; text-align: left; }
  .map-frame { min-height: 390px; aspect-ratio: 4 / 5; }
  .node.concept text { font-size: 24px; }
  .node.proposition text { font-size: 34px; }
  .edge-marker { font-size: 24px; }
  .card-ledger, .detail-rail { padding: 17px 15px; }
  .card-ledger ol { columns: 1; }
  .card-foot { align-items: flex-start; flex-direction: column; padding: 14px 15px; }
  .card-foot p { text-align: left; }
  .site-foot { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

@media (forced-colors: active) {
  body { background-image: none; }
  .logical-field, .setup-panel { clip-path: none; }
  .node .node-shape, .relation, .membership { forced-color-adjust: auto; }
}
