@import url('/assets/fonts.css');

:root {
  color-scheme: light;
  --paper: #f7f8fb;
  --surface: #ffffff;
  --ink: #152339;
  --body: #31435b;
  --muted: #526176;
  --line: #cad1dd;
  --input-line: #7f8da0;
  --accent: #274ab4;
  --accent-hover: #183487;
  --button: #2649b1;
  --button-hover: #19378f;
  --button-ink: #ffffff;
  --band: #223e91;
  --band-ink: #ffffff;
  --active-tab: #f6f8ff;
  --active-ink: #183784;
  --hero: #e8efff;
  --wash: #edf2fc;
  --rust: #9d422e;
  --peach: #fff0e6;
  --purple: #654091;
  --lilac: #f1edfb;
  --focus: #b3471f;
  --sans: 'Inter', system-ui, sans-serif;
  --width: 1360px;
  --gutter: clamp(18px, 4vw, 68px);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #111a2b;
  --surface: #182238;
  --ink: #f4f6fd;
  --body: #d2dced;
  --muted: #b7c4d8;
  --line: #394860;
  --input-line: #72839e;
  --accent: #abc3ff;
  --accent-hover: #d9e4ff;
  --button: #aec7ff;
  --button-hover: #caddff;
  --button-ink: #142544;
  --band: #233862;
  --active-tab: #dce7ff;
  --active-ink: #182b55;
  --hero: #1b2e52;
  --wash: #202f4a;
  --rust: #ffb592;
  --peach: #372a2d;
  --purple: #d9b8ff;
  --lilac: #2e2842;
  --focus: #ffb887;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.56 var(--sans); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; }
button, a, summary, input, textarea { touch-action: manipulation; }
button, summary { cursor: pointer; }
button, .secondary, .primary { border-radius: 6px; }
button { padding: 10px 15px; border: 1px solid var(--input-line); color: var(--ink); background: var(--surface); }
button:disabled { cursor: default; opacity: .72; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.sr, .skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { z-index: 10; width: auto; height: auto; clip-path: none; padding: 12px; background: var(--surface); }

h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--sans); font-weight: 650; line-height: 1.16; letter-spacing: -.035em; text-wrap: pretty; }
h1 { font-size: clamp(34px, 3.7vw, 54px); margin-bottom: 12px; }
h2 { font-size: clamp(24px, 2.1vw, 32px); margin-bottom: 14px; }
h3 { font-size: clamp(19px, 1.5vw, 24px); margin-bottom: 12px; }
h4 { font-size: 1rem; margin-bottom: 6px; }
p { margin-bottom: 16px; }
p:last-child { margin-bottom: 0; }
small, .muted, .form-hint, .source, .section-head > p, .pagehead > p:last-child { color: var(--muted); }
.source, .form-hint { font-size: .84rem; }
.source a { display: inline-block; margin: 3px 6px 0 0; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--accent); font: 700 11px/1.4 var(--sans); text-transform: uppercase; letter-spacing: .14em; }
.rule { width: 28px; height: 2px; background: currentColor; }
.lilac { color: var(--purple); }

.masthead { background: var(--surface); }
.mast-row, .sections, main { width: min(calc(100% - var(--gutter) * 2), var(--width)); margin-inline: auto; }
.mast-row { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; white-space: nowrap; font: 700 29px/1 var(--sans); letter-spacing: -.035em; }
.brand:hover { color: var(--ink); }
.brandmark { display: inline-flex; align-items: flex-end; justify-content: center; gap: 3px; width: 37px; height: 37px; padding: 8px 6px; background: var(--button); border-radius: 5px; }
.brandmark i { width: 5px; height: 8px; border-radius: 1px 1px 0 0; background: var(--button-ink); }
.brandmark i:nth-child(2) { height: 14px; }
.brandmark i:nth-child(3) { height: 21px; }
.mast-tools { display: flex; align-items: center; gap: 20px; }
.edition { color: var(--muted); font-size: 13px; font-weight: 600; }
.theme-switch { display: inline-flex; align-items: center; gap: 7px; color: var(--body); border: 1px solid var(--line); border-radius: 20px; font-size: 13px; font-weight: 600; padding: 7px 13px; }
.theme-switch:hover, .theme-switch[aria-pressed='true'] { background: var(--wash); border-color: var(--accent); }
.mode-symbol { width: 14px; height: 14px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg,currentColor 50%,transparent 50%); }
.nav-band { background: var(--band); }
.sections { display: flex; align-items: stretch; justify-content: space-between; gap: 2px; padding: 5px 0; }
.sections a { min-height: 40px; padding: 7px clamp(6px,.8vw,14px); color: var(--band-ink); border-radius: 4px; display: flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; font: 600 clamp(12px,.98vw,15px)/1.25 var(--sans); }
.sections a:hover { background: #ffffff20; }
.sections a[aria-current] { color: var(--active-ink); background: var(--active-tab); }
.sections a:focus-visible { outline-color: #ffca88; outline-offset: -2px; }
main { padding-top: clamp(21px,2.3vw,36px); }

.lookup, .profile, .lab, .reading-block, .empty { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: clamp(20px,2.5vw,36px); }
.lookup, .profile, .lab, .reading-block { margin: 22px 0; }
.lookup h2 { font-size: clamp(23px,2vw,30px); margin-bottom: 16px; }
.lookup .eyebrow { margin-bottom: 8px; }
.searchform, .inline-form, .actions, .profile-top, .sectionline { display: flex; align-items: center; gap: 12px; }
.searchform { gap: 10px; }
.searchform input { flex: 1; min-width: 0; }
.searchform input, .searchform button { height: 47px; }
.searchform button { white-space: nowrap; }
.searchform + .form-hint { margin: 10px 0 0; font-size: 13px; }
input:not([type='checkbox']), textarea { border-radius: 6px; background: var(--surface); border: 1px solid var(--input-line); padding: 10px 13px; color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { width: 100%; min-width: 190px; margin: 8px 0; }
.primary, .secondary { display: inline-flex; align-items: center; text-decoration: none; }
.primary { justify-content: center; gap: 13px; border: 1px solid var(--button); background: var(--button); color: var(--button-ink); font-weight: 700; }
.primary:hover { background: var(--button-hover); color: var(--button-ink); }
.secondary { gap: 6px; padding: 8px 12px; background: var(--surface); color: var(--accent); font-size: .87rem; border: 1px solid var(--input-line); }
.secondary:hover, .match:hover { background: var(--wash); color: var(--ink); }
.matches { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(240px,100%),1fr)); gap: 6px; }
.matches:not(:empty) { margin-top: 16px; }
.match { text-align: left; min-width: 0; }
.match small, .table-scroll small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
.match strong { overflow-wrap: anywhere; }
.sectionline, .profile-top { justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.sectionline { margin: 30px 0 15px; }
.sectionline h2, .profile-top h2 { margin: 0; }
.sectionline > a, .feature-link { font-size: 14px; font-weight: 600; }
.feature-grid, .grid, .case-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; align-items: start; }
.feature, .card, .case-card, .lesson, .insight { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.feature { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: var(--ink); background: var(--wash); border-top: 3px solid var(--accent); }
.feature.plum { background: var(--peach); border-top-color: var(--rust); }
.feature.plum .eyebrow, .feature.plum .feature-link { color: var(--rust); }
.feature:hover { border-color: var(--accent); color: var(--ink); }
.feature p { font-size: 15px; color: var(--body); }
.feature-link { margin-top: auto; color: var(--accent); }
.feature h3 { margin-bottom: 8px; }
.card h3, .case-card h3 { font-size: clamp(20px,1.6vw,25px); }
.card, .case-card { overflow-wrap: anywhere; }
.card p, .case-card p, .lesson p, .lab p { color: var(--body); }
.card .eyebrow { color: var(--accent); }
.grid > .card { height: 100%; }
.grid > details.card { height: auto; }
.grid, .case-grid, .lesson-stack { margin: 16px 0 28px; }
.grid a, .reading-block a, details a, .lesson a { overflow-wrap: anywhere; }
.pagehead { padding: 3px 0 25px; border-bottom: 1px solid var(--line); margin-bottom: 27px; }
.pagehead > p:last-child { max-width: 72ch; font-size: 17px; }
.pagehead h1 { margin: 12px 0; }
.section-head { max-width: 82ch; }
.profile .actions { margin: 16px 0 24px; }
.actions, .inline-form { flex-wrap: wrap; }
.profile > div > h3, .reading-block h2:not(:first-child) { margin: 24px 0 12px; }
.table-scroll { width: 100%; overflow-x: auto; margin: 12px 0 14px; }
.table-scroll table { border-collapse: collapse; width: 100%; font-size: 14px; }
.table-scroll th, .table-scroll td { padding: 11px 14px 11px 0; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-scroll th { font-weight: 600; }
.table-scroll thead { color: var(--muted); }
.table-scroll tbody th { min-width: 95px; }
.table-scroll td { min-width: 94px; }
.insight { margin: 15px 0; background: var(--wash); border-left: 3px solid var(--accent); }
.insight p { margin-top: 4px; }
.filings, .lesson { margin: 12px 0; }
.filing-list { list-style: none; padding: 0; margin: 10px 0 15px; max-width: 600px; }
.filing-list li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.filing-list span { color: var(--muted); }
summary { font-weight: 600; overflow-wrap: anywhere; }
summary:hover, details[open] > summary { color: var(--accent); }
details[open] > summary { margin-bottom: 14px; }
details.card + details.card, .card details { margin-top: 9px; }
.grid > details.card + details.card { margin-top: 0; }
.card details { background: var(--wash); }
.lesson-stack { max-width: 1000px; }
.lesson summary { font-size: 17px; }
.lab { background: var(--lilac); }
.fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 12px; }
.fields label, .inline-form label { font-size: 13px; font-weight: 600; }
.fields input, .inline-form input { display: block; margin: 5px 0 12px; width: 100%; }
.lab details { margin-top: 18px; }
.lab #valuation-result { margin-top: 18px; font-size: 18px; color: var(--purple); }
.earnings-grid { grid-template-columns: repeat(auto-fit,minmax(min(230px,100%),1fr)); }
.reading-block .card { background: var(--paper); }
.empty h3 { margin: 0 0 6px; }
.inline-form { align-items: flex-end; }
.inline-form button { margin-bottom: 12px; }
.jumpbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 25px; }
.jumpbar a { background: var(--wash); color: var(--accent); border: 1px solid var(--line); border-radius: 4px; padding: 6px 12px; font-size: 13px; text-decoration: none; }
footer { margin: 40px 0 20px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 12px; }
footer a:first-child { font: 650 17px var(--sans); text-decoration: none; color: var(--ink); }
footer a:last-child { margin-left: auto; }
body[data-page='about'] .reading-block { max-width: 900px; }
body[data-page='about'] h2 { font-size: 30px; }
body[data-page='technology'] h2:not(:first-child) { margin-top: 35px; }

@media (max-width: 1030px) {
  .sections { flex-wrap: wrap; justify-content: center; }
  .sections a { padding-inline: 10px; font-size: 13px; }
}
@media (max-width: 760px) {
  .mast-row { min-height: 64px; }
  .brand { font-size: 25px; }
  .brandmark { width: 32px; height: 32px; padding-bottom: 6px; }
  .lookup, .profile, .lab, .reading-block { padding: 20px; margin: 16px 0; }
  .feature, .card, .case-card, .lesson { padding: 18px; }
  .feature-grid, .grid, .case-grid { gap: 12px; }
  .table-scroll td { min-width: 86px; }
  footer a:last-child { margin: 0; }
}
@media (max-width: 620px) {
  .edition { display: none; }
  .sections { width: calc(100% - 16px); display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 5px 0; gap: 2px 3px; }
  .sections a { min-height: 42px; padding: 5px 4px; font-size: 13px; text-wrap: balance; }
  .feature-grid, .grid, .case-grid { grid-template-columns: 1fr; }
  .searchform { flex-wrap: wrap; }
  .searchform input { flex-basis: 100%; }
  .searchform button { height: 43px; }
  .sectionline { margin-top: 20px; }
  .pagehead h1 { font-size: 34px; }
  .theme-switch { min-height: 40px; }
}

/* Put the first research action in reach on every screen. */
.research-start { background: var(--surface); border: 1px solid var(--line); display: grid; grid-template-columns: 1.6fr 1fr; border-radius: 10px; overflow: hidden; }
.research-copy { min-width: 0; align-self: center; padding: clamp(22px, 3vw, 44px); }
.research-copy > p { color: var(--body); max-width: 57ch; }
.research-start > img { order: 1; width: 100%; height: 100%; max-height: 390px; object-fit: cover; }
.research-copy .searchform { margin-top: 18px; }
.table-scroll, .ai-results, #chain-count { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .research-start { grid-template-columns: 1fr; }
  .research-start > img { display: none; }
}
.ai-mast { padding: clamp(18px, 2.1vw, 30px); border: 1px solid var(--line); border-left: 4px solid var(--purple); border-radius: 9px; background: linear-gradient(100deg,var(--lilac),var(--wash)); }
.ai-mast h1 { margin: 0 0 7px; }
.ai-mast p { margin: 0 0 7px; color: var(--body); max-width: 70ch; }
.ai-mast small, .ai-story > small { color: var(--purple); font-size: .8rem; font-weight: 600; }
.ai-switch, .ai-reader .pills, .tech-sources { display: flex; flex-wrap: wrap; gap: 6px 9px; }
.ai-switch { margin: 15px 0 24px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.ai-switch a { padding: 8px 13px; background: var(--surface); border-radius: 6px; border: 1px solid var(--line); color: var(--body); font-size: .91rem; font-weight: 600; text-decoration: none; }
.ai-switch a[aria-current] { background: var(--button); border-color: var(--button); color: var(--button-ink); }
.ai-switch a:hover { border-color: var(--accent); }
.ai-reader h2 { margin: 0 0 8px; }
.ai-reader h3 { margin: 22px 0 10px; }
.ai-reader h4 { margin: 14px 0 4px; font-weight: 650; }
.ai-intro { max-width: 90ch; color: var(--body); }
.ai-reader .foot, .tech-deck { color: var(--muted); font-size: .89rem; }
.ai-reader .foot { margin: 10px 0; }
.ai-grid, .ai-controls { display: grid; align-items: start; gap: 12px; grid-template-columns: repeat(auto-fit,minmax(min(100%,275px),1fr)); }
.ai-controls { align-items: end; grid-template-columns: repeat(auto-fit,minmax(min(100%,180px),1fr)); border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 14px; }
.ai-reader label { display: block; color: var(--body); font-size: .85rem; font-weight: 600; min-width: 0; }
.ai-reader label > input, .ai-reader label > select { display: block; max-width: 100%; width: 100%; margin: 4px 0 0; padding: 8px 12px; min-height: 42px; font: 400 1rem/1.4 var(--sans); }
.ai-reader select { color: var(--ink); background: var(--surface); border: 1px solid var(--input-line); border-radius: 6px; }
#ai-chain > label { max-width: 42rem; }
.ai-reader .ai-story, .tech-topic, .ai-calculator { min-width: 0; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; }
.ai-story, .ai-calculator { padding: clamp(16px,1.6vw,23px); }
.ai-story h3, .ai-calculator h3 { margin: 3px 0 10px; font-size: 1.24rem; }
.ai-story p, .tech-body p { color: var(--body); margin: 5px 0 10px; }
.ai-story small { display: block; margin-bottom: 4px; }
.tech-topic > summary { position: relative; display: grid; gap: 4px; padding: 14px 42px 14px 17px; list-style: none; }
.tech-topic > summary::-webkit-details-marker { display: none; }
.tech-topic > summary::after { content: '+'; position: absolute; right: 15px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 1.28rem; font-weight: 500; }
.tech-topic[open] > summary::after { content: '−'; }
.tech-topic[open] > summary { margin: 0; border-bottom: 1px solid var(--line); }
.tech-kind { color: var(--purple); font-size: .77rem; font-weight: 600; }
.tech-topic summary strong { font-size: 1.08rem; line-height: 1.25; }
.tech-deck { font-weight: 400; line-height: 1.35; }
.tech-body { padding: 7px 17px 14px; }
.tech-topics { display: grid; gap: 8px; }
.tech-sources { margin: 12px 0; font-size: .85rem; }
.ai-reader .quiet { display: inline-flex; align-items: center; background: var(--wash); color: var(--accent); border: 1px solid var(--line); border-radius: 5px; padding: 6px 9px; text-decoration: none; font-size: .85rem; font-weight: 600; }
.ai-reader .quiet:hover { border-color: var(--accent); }
.ai-reader .pills { margin: 10px 0; }
.ai-glossary, .ai-calculator { margin: 16px 0; }
.ai-calculator { background: var(--lilac); }
.ai-results { margin: 12px 0; padding: 12px 15px; border-left: 3px solid var(--purple); background: var(--surface); font-weight: 600; }
.ai-chain-path { display: flex; align-items: stretch; list-style: none; gap: 24px; padding: 0; margin: 16px 0; }
.ai-chain-path li { position: relative; flex: 1; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.ai-chain-path li + li::before { content: '→'; position: absolute; left: -20px; top: 32%; color: var(--accent); }
.ai-chain-path li span { display: block; margin-top: 5px; font-size: .91rem; color: var(--body); }
@media (max-width: 700px) {
  .ai-chain-path { flex-direction: column; }
  .ai-chain-path li + li::before { content: '↓'; top: -25px; left: 17px; }
  .ai-switch { gap: 5px; }
  .ai-switch a { padding: 8px 10px; font-size: .85rem; }
}
