:root {
  color-scheme: light;
  --canvas: #edf4f2;
  --paper: #ffffff;
  --ink: #142e37;
  --muted: #516970;
  --line: #cadbd9;
  --accent: #176572;
  --accent-deep: #114d58;
  --mint: #9ee8d8;
  --plate: #122a34;
  --signal: #f4bf85;
  --alert-ink: #723519;
  --alert-bg: #fff1e4;
  --display: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 1rem/1.6 var(--body); }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; }
h1 { letter-spacing: -.047em; font-weight: 740; }
h2 { font-size: clamp(1.45rem, 2.65vw, 2.15rem); letter-spacing: -.035em; }
h3 { font-size: 1.12rem; letter-spacing: -.018em; }
ul, ol { padding-inline-start: 1.25rem; }
a { color: var(--accent-deep); text-underline-offset: .2em; }
a:hover { color: var(--accent); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 2px solid #2b8395; outline-offset: 3px; }
.shell { width: min(100% - 72px, 1232px); margin-inline: auto; }
.skip-link { position: fixed; left: .8rem; top: .8rem; z-index: 10; transform: translateY(-170%); padding: .5rem 1rem; background: var(--paper); }
.skip-link:focus { transform: none; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.nav-shell, .footer-shell { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-shell { min-height: 75px; }
.wordmark { display: inline-flex; align-items: center; gap: .65rem; color: var(--ink); font: 700 1.1rem/1 var(--display); letter-spacing: -.035em; white-space: nowrap; text-decoration: none; }
.wordmark b { color: var(--accent); font-weight: inherit; }
.wordmark svg { flex: none; }
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; gap: .25rem 1.65rem; align-items: center; }
.site-header nav a, .site-footer nav a { color: var(--muted); font-size: .9rem; font-weight: 600; text-decoration: none; padding-block: .35rem; }
.site-header nav a:hover, .site-footer nav a:hover { color: var(--accent-deep); text-decoration: underline; }
.site-footer { margin-top: clamp(3rem, 8vw, 6rem); padding: 2rem 0; border-top: 1px solid var(--line); background: #e7f0ee; }
.site-footer p { margin-top: .55rem; color: var(--muted); font-size: .84rem; }

.button, .text-button, .inline-link { font-weight: 650; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .65rem; border: 1px solid #bdcfce; border-radius: 7px; background: var(--paper); color: var(--ink); padding: .5rem .85rem; text-decoration: none; font-size: .88rem; line-height: 1.3; text-align: center; }
.button:not(:disabled):hover { border-color: var(--accent); color: var(--accent-deep); background: #eef8f5; }
.button-primary { background: var(--accent-deep); color: var(--paper); border-color: var(--accent-deep); }
.button-primary:not(:disabled):hover { background: #226b74; border-color: #226b74; color: var(--paper); }
.button-small { min-height: 36px; }
.text-button { appearance: none; background: transparent; color: var(--accent-deep); border: 0; padding: .28rem 0; text-align: left; font-size: .87rem; }
.text-button:hover, .inline-link:hover { text-decoration: underline; }
.inline-link { text-decoration: none; font-size: .9rem; }
.eyebrow { color: var(--accent-deep); font: 650 .77rem/1.45 var(--mono); letter-spacing: .07em; text-transform: uppercase; overflow-wrap: anywhere; }
.lede { color: var(--muted); font-size: clamp(1rem, 1.4vw, 1.16rem); line-height: 1.63; }

.home-hero { display: grid; grid-template-columns: 1fr 1.03fr; align-items: center; gap: clamp(1.3rem, 4.6vw, 4.1rem); padding: clamp(2.75rem, 8vw, 7rem) 0 clamp(2.75rem, 7.4vw, 6rem); }
.hero-copy { min-width: 0; }
.hero-copy h1 { max-width: 13ch; margin: .68rem 0 1rem; font-size: clamp(2.8rem, 5.5vw, 5.15rem); line-height: .99; }
.hero-copy h1 span { color: var(--accent); }
.hero-copy .lede { max-width: 36rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.3rem; margin-top: 1.4rem; }
.hero-actions .button { min-height: 48px; padding-inline: 1rem; }
.hero-plate { min-width: 0; background: var(--plate); color: #e9f6f4; padding: 1rem; border-radius: 15px; box-shadow: 0 13px 27px #1b4b5019; }
.hero-plate .diagram { display: block; width: 100%; height: auto; border-block: 1px solid #2e4b54; }
.plate-heading, .hero-plate figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; padding: .3rem .13rem .85rem; font: 500 .77rem/1.5 var(--mono); }
.plate-heading span:first-child { color: var(--mint); text-transform: uppercase; letter-spacing: .075em; }
.hero-plate figcaption { padding: .85rem .13rem .25rem; color: #b7cfd4; }
.hero-plate figcaption i { display: inline-block; background: var(--mint); border-radius: 50%; width: .47rem; height: .47rem; margin-right: .3rem; }
.hero-plate a { color: #f0f9f6; }

.home-section { border-top: 1px solid #b7ccca; padding-top: 1.5rem; }
.home-section + .home-section { margin-top: clamp(2.8rem, 6vw, 5rem); }
.section-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .35rem 1.15rem; margin-bottom: 1.55rem; }
.section-heading p { color: var(--muted); }
.tool-category + .tool-category { margin-top: 1.25rem; }
.tool-category > h3 { margin-bottom: .7rem; color: var(--muted); font: 650 .78rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .055em; }
.tool-grid, .example-family ul, .related-section ul { list-style: none; padding: 0; margin: 0; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.tool-card { display: block; height: 100%; position: relative; padding: 1rem; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); text-decoration: none; color: var(--ink); }
.tool-card:hover { border-color: #6a9b9e; color: var(--ink); box-shadow: 0 5px 16px #1b4b5010; }
.tool-icon { width: 41px; height: 41px; display: inline-grid; place-items: center; background: #e0f2ee; color: var(--accent-deep); border-radius: 7px; }
.card-arrow { position: absolute; right: 1rem; top: 1rem; color: var(--accent-deep); font-size: 1.05rem; }
.tool-card strong { display: block; font-family: var(--display); font-size: 1.12rem; line-height: 1.3; margin: .75rem 0 .28rem; }
.tool-card-description { display: block; color: var(--muted); font-size: .85rem; line-height: 1.52; }
.example-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.2rem 1.7rem; }
.example-family { border-top: 2px solid #91b7b7; padding: .85rem 0; }
.example-family h3 a { text-decoration: none; }
.example-family li, .related-section li { margin-top: .6rem; font-size: .9rem; line-height: 1.45; }
.example-family li a, .related-section li a { color: var(--muted); }
.example-family li a:hover, .related-section li a:hover { color: var(--accent-deep); }

.crumbs { color: var(--muted); font-size: .82rem; padding: 1.3rem 0 1.1rem; }
.crumbs ol { padding: 0; margin: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .2rem .54rem; }
.crumbs li { overflow-wrap: anywhere; }
.crumbs li + li::before { content: "/"; margin-right: .54rem; color: #6b888d; }
.crumbs a { color: inherit; }
.page-heading { display: flex; gap: .9rem; align-items: flex-start; margin: .6rem 0 1.45rem; }
.heading-symbol { flex: 0 0 47px; width: 47px; height: 47px; margin-top: .15rem; }
.page-heading h1, .core-copy h1 { font-size: clamp(2.05rem, 4.4vw, 4rem); max-width: 21ch; margin-top: .24rem; line-height: 1.015; }
.page-heading .lede { max-width: 51rem; margin-top: .7rem; }
.safety-note, .trial { border-left: 3px solid #accbc6; padding: .58rem .78rem; margin: 0 0 1rem; color: #30545b; font-size: .92rem; background: #e3efec; }
.safety-note { border-color: #d6915b; color: var(--alert-ink); background: var(--alert-bg); }
.trial strong { margin-right: .4rem; }

.bench-grid { display: grid; grid-template-columns: minmax(290px, .87fr) minmax(0, 1.43fr); gap: 1rem; align-items: start; }
.panel { min-width: 0; padding: clamp(.85rem, 2.1vw, 1.45rem); background: var(--paper); border: 1px solid var(--line); border-radius: 11px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; margin-bottom: .55rem; }
.panel-heading h2 { font-size: 1.48rem; }
.input-tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; gap: .5rem; }
.jump-link { display: none; }
.unit-switch { display: inline-flex; gap: .15rem; padding: .15rem; background: #eaf1f0; border: 1px solid #dce8e7; border-radius: 7px; }
.unit-switch button { font-size: .8rem; padding: .26rem .48rem; color: var(--accent-deep); border: 1px solid transparent; border-radius: 5px; background: transparent; line-height: 1.35; }
.unit-switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); border-color: #b9cecc; font-weight: 700; }
.preset { display: grid; gap: .3rem; margin-bottom: .95rem; padding: .68rem; border-radius: 6px; background: #eff7f5; }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem .65rem; align-items: start; }
.input-field { min-width: 0; display: grid; gap: .2rem; align-content: start; }
.input-field label, .preset label, .share-box label { font-size: .8rem; font-weight: 700; line-height: 1.25; }
.input-field small { color: var(--muted); font-size: .71rem; line-height: 1.36; overflow-wrap: anywhere; }
.input-field .field-error { color: #91281b; font-weight: 650; }
.input-field input, .input-field select, .preset select, .share-box input { width: 100%; min-width: 0; min-height: 38px; border: 1px solid #a5bdbd; border-radius: 5px; padding: .35rem .45rem; color: var(--ink); background: #fbfdfd; font-size: .9rem; line-height: 1.3; }
.input-field input[type="number"] { padding-right: .25rem; border-radius: 5px 0 0 5px; font-family: var(--mono); font-size: .87rem; }
.input-field input[type="number"]:only-child { border-radius: 5px; }
.input-field [aria-invalid="true"] { border-color: #ac3d2b; background: #fff9f4; }
.number-control { display: flex; min-width: 0; align-items: stretch; }
.input-unit { flex: none; display: grid; align-items: center; padding: .18rem .35rem; color: var(--muted); border: 1px solid #a5bdbd; border-left: 0; border-radius: 0 5px 5px 0; background: #ebf1f0; font: 500 .68rem/1 var(--mono); }
.row-set { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: 1rem; }
.row-set h3 { margin-bottom: .48rem; }
.input-group { position: relative; min-width: 0; border: 1px solid #d8e6e3; border-radius: 7px; padding: .58rem; margin: 0 0 .58rem; }
.input-group legend { padding: 0 .3rem; font: 600 .74rem/1.4 var(--mono); color: var(--muted); }
.input-group:has(.remove-row) .input-grid { padding-top: 1.05rem; }
.remove-row { position: absolute; top: -.1rem; right: .6rem; padding: 0; font-size: .73rem; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; border-block: 1px solid var(--line); padding: .72rem 0; margin: .9rem 0; }
.metrics > div { min-width: 0; }
.metrics dt { color: var(--muted); font-size: .75rem; line-height: 1.3; text-wrap: pretty; }
.metrics dd { margin-top: .2rem; font: 630 clamp(.99rem, 2.2vw, 1.75rem)/1.2 var(--mono); letter-spacing: -.038em; overflow-wrap: anywhere; }
.metrics dd span { color: var(--accent-deep); font-size: .68em; letter-spacing: 0; white-space: nowrap; }
.plot-panel { overflow: hidden; border-radius: 8px; background: var(--plate); color: #e9f6f4; }
.plot-panel h3 { padding: .75rem .75rem .6rem; color: #e9f6f4; font: 600 .85rem/1.3 var(--mono); }
.plot-panel figcaption { padding: .6rem .75rem .72rem; color: #b5ced2; font-size: .78rem; line-height: 1.45; }
.diagram { display: block; width: 100%; height: auto; }
.warnings, .invalid-notice { padding: .55rem .7rem; margin: .7rem 0 0; background: var(--alert-bg); color: var(--alert-ink); border-radius: 5px; font-size: .84rem; }
.warnings { padding-left: 1.65rem; }
.warnings li + li { margin-top: .2rem; }
.report-tools { display: flex; flex-wrap: wrap; gap: .43rem; margin-top: .85rem; }
.share-box { margin-top: .55rem; }
.share-box > div { display: flex; align-items: stretch; gap: .45rem; }
.share-box input { flex: 1; font-family: var(--mono); }
.status { color: var(--muted); font-size: .82rem; margin-top: .45rem; }
.status:empty { display: none; }
.report-tables { display: grid; gap: .8rem; margin-top: .85rem; min-width: 0; }
.table-wrap { overflow-x: auto; min-width: 0; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .78rem; line-height: 1.36; }
caption { text-align: left; color: var(--ink); font: 700 .9rem/1.3 var(--display); padding-bottom: .38rem; }
th, td { font-weight: 400; border-bottom: 1px solid #e1eae8; padding: .41rem .48rem; vertical-align: top; }
thead th { background: #edf4f2; color: #334f57; font-weight: 690; min-width: 4.45rem; }
tbody th { font-weight: 650; }
tbody tr:nth-child(even) { background: #fbfdfc; }
td { font-variant-numeric: tabular-nums; }
.quick-result, .print-only { display: none; }

.reading-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr); gap: clamp(1.2rem, 5vw, 4.25rem); margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid #bbcfcc; }
.reading-grid h2, .faq-section h2 { font-size: clamp(1.35rem, 2.4vw, 1.85rem); margin-bottom: .75rem; }
.method-section section { margin: .75rem 0; }
.method-section h3 { margin-bottom: .28rem; }
.method-section p, .faq-section p, .core-copy p { color: var(--muted); }
.references { margin: 0; font-size: .86rem; overflow-wrap: anywhere; }
.reference-data { border-block: 1px solid var(--line); margin: 1rem 0; padding: .5rem 0; }
.reference-data summary { font-weight: 650; cursor: pointer; }
.reference-data > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; margin-top: .6rem; }
.reference-data .table-wrap { max-height: 16rem; overflow: auto; }
.reference-data thead { position: sticky; top: 0; }
.related-section .inline-link { display: inline-block; margin-top: .95rem; }
.faq-section { margin-top: 1.8rem; padding-top: 1.2rem; border-top: 1px solid #bbcfcc; }
.faq-section details { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; margin-top: .52rem; padding: .65rem .82rem; }
.faq-section summary { font-weight: 650; cursor: pointer; line-height: 1.4; }
.faq-section details p { margin-top: .55rem; }
.core-copy { max-width: 46rem; padding: 1rem 0 2rem; }
.core-copy h1 { margin-bottom: 1rem; }
.core-copy h2 { margin-top: 1.35rem; margin-bottom: .55rem; }
.core-links { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; margin-top: 1rem; }
.missing-page { padding: 4rem 0 3rem; }
.missing-page .button { margin-top: 1rem; }

@media (max-width: 1100px) {
  .tool-grid, .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { width: calc(100% - 42px); }
  .desktop-break { display: none; }
  .hero-copy h1 { font-size: clamp(2.75rem, 5.9vw, 4rem); }
  .bench-grid { grid-template-columns: minmax(0, .95fr) minmax(0, 1.13fr); }
  .input-group .input-grid { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); }
}
@media (max-width: 700px) {
  .shell { width: calc(100% - 32px); }
  .nav-shell { align-items: flex-start; flex-wrap: wrap; gap: .35rem 1rem; padding: .6rem 0; min-height: 0; }
  .nav-shell .wordmark { min-height: 37px; }
  .site-header nav { gap: .25rem .85rem; }
  .site-header nav a { font-size: .8rem; padding-block: .18rem; }
  .footer-shell { flex-wrap: wrap; }
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; padding: 2.1rem 0 2.6rem; }
  .hero-copy h1 { font-size: clamp(2.5rem, 10.4vw, 4rem); }
  .hero-plate { padding: .7rem; }
  .tool-grid, .example-grid { gap: .55rem; }
  .tool-card { padding: .75rem; }
  .tool-card strong { font-size: 1rem; }
  .tool-card-description { font-size: .8rem; }
  .heading-symbol { display: none; }
  .page-heading h1 { font-size: clamp(2rem, 8.25vw, 3.2rem); }
  .crumbs { padding: .92rem 0 .68rem; }
  .bench-grid, .reading-grid, .reference-data > div { grid-template-columns: minmax(0, 1fr); }
  .jump-link { display: inline; }
  .quick-result { display: block; position: sticky; bottom: .5rem; z-index: 2; width: fit-content; max-width: 100%; margin: .55rem 0 0 auto; padding: .52rem .7rem; border: 1px solid #5c8489; border-radius: 5px; background: var(--plate); color: var(--paper); box-shadow: 0 3px 10px #0f28363b; font: 650 .75rem/1.4 var(--mono); text-decoration: none; }
  .quick-result::after { content: " ↗"; color: var(--mint); }
  .quick-result:hover { color: var(--mint); }
  .input-field input, .input-field input[type="number"], .input-field select, .preset select, .share-box input { font-size: 1rem; }
  .metrics dt { font-size: .7rem; }
}
@media (max-width: 375px) {
  .tool-grid, .example-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 460px) {
  .input-field:has(select:is([name="nutMode"], [name="bleed"], [name="topology"], [name="ampType"], [name="readingMode"], [name$=".material"])) {
    grid-column: 1 / -1;
  }
}
@media print {
  @page { margin: 12mm; }
  body { background: white; color: black; font-size: 9pt; }
  .shell { width: 100%; }
  .site-header, .site-footer, .skip-link, .crumbs, .jump-link, .setup-panel, .report-tools,
  .share-box, .status, .quick-result, .hero-actions, .hero-plate a { display: none !important; }
  .bench-grid, .reading-grid, .home-hero { display: block; }
  .hero-plate { max-width: 80%; margin: .75rem auto; }
  .home-hero, .home-section, .missing-page { padding: .4rem 0; }
  .home-section + .home-section, .reading-grid, .faq-section { margin-top: .85rem; }
  .tool-grid, .example-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .page-heading { margin: 0 0 .72rem; }
  .page-heading h1, .hero-copy h1, .core-copy h1 { font-size: 24pt; max-width: none; }
  .heading-symbol { display: none; }
  .lede { font-size: 9pt; }
  .panel { border: 0; padding: 0; }
  .metrics { margin: .4rem 0; break-inside: avoid; }
  .metrics dd { font-size: 13pt; }
  .plot-panel, .hero-plate { print-color-adjust: exact; -webkit-print-color-adjust: exact; break-inside: avoid; }
  .plot-panel .diagram { max-height: 100mm; }
  .table-wrap { overflow: visible; }
  table { width: 100%; font-size: 7.5pt; }
  thead { display: table-header-group; }
  thead th { min-width: 0; overflow-wrap: normal; }
  td, th { padding: .22rem; overflow-wrap: anywhere; }
  tr, .print-list li { break-inside: avoid; }
  .print-only { display: block; margin-top: .9rem; }
  .print-list { list-style: none; margin: .35rem 0; padding: 0; columns: 3; column-gap: .65rem; font-size: 8pt; }
  .tool-card, .example-family, .trial, .safety-note, .warnings { break-inside: avoid; }
}
