:root {
  color-scheme: light;
  --limestone: #f0ede5;
  --sheet: #fffdf7;
  --panel: #f7f4eb;
  --graphite: #25242e;
  --ink: #292832;
  --muted: #55525d;
  --line: #d4cec1;
  --strong-line: #ada596;
  --indigo: #453798;
  --indigo-dark: #322579;
  --indigo-soft: #eee9f9;
  --copper: #8b4e1a;
  --gold: #e5ae65;
  --warning: #803a16;
  --warn-sheet: #f7e8d0;
  --error: #952f27;
  --shadow: 0 15px 45px -32px #3b2c2466;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1.3rem; }
body { margin: 0; background: var(--limestone); color: var(--ink); font: 16px/1.55 var(--font); }
a { color: var(--indigo); text-underline-offset: 0.17em; }
a:hover { color: var(--indigo-dark); }
button, input, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { line-height: 1.14; }
p { overflow-wrap: break-word; }

.shell { width: min(1220px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: fixed; inset: .6rem auto auto .6rem; z-index: 2; transform: translateY(-180%); background: var(--sheet); padding: .6rem .9rem; }
.skip:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { background: var(--graphite); border-bottom: 3px solid #ba844d; color: #fffaf2; }
.head-inner { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fffaf2; font-weight: 780; letter-spacing: -.035em; font-size: 1.24rem; text-decoration: none; white-space: nowrap; }
.brand img { flex: none; }
.brand span span { color: #f1bb75; }
.site-header nav { display: flex; gap: clamp(12px, 2.7vw, 36px); align-items: center; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 44px; color: #e5dfe0; font-size: .91rem; font-weight: 600; text-decoration: none; }
.site-header nav a.current, .site-header a:hover { color: #fff8e8; }
.site-header nav a.current { text-decoration: underline; text-decoration-color: #e5ae65; text-underline-offset: .42em; }
.site-header a:focus-visible { outline-color: var(--gold); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: .55rem .78rem; color: var(--indigo-dark); font-size: .86rem; line-height: 1.15; font-weight: 690; border: 1px solid var(--strong-line); border-radius: 4px; background: var(--sheet); text-decoration: none; white-space: nowrap; }
.button:not(:disabled):hover { border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo-dark); }
.button.primary { color: var(--sheet); background: var(--indigo); border-color: var(--indigo); }
.button.primary:not(:disabled):hover { color: var(--sheet); background: var(--indigo-dark); }
.text-link { font-weight: 680; font-size: .94rem; }

.home-hero {
  background-color: #f7f3e9;
  background-image: linear-gradient(#6358750a 1px, transparent 1px), linear-gradient(90deg, #6358750a 1px, transparent 1px);
  background-size: 32px 32px;
  border-bottom: 1px solid var(--line);
}
.hero-grid { display: grid; grid-template-columns: 1fr minmax(0, 1.02fr); gap: clamp(24px, 4vw, 66px); align-items: center; padding-block: clamp(32px, 4.5vw, 68px); }
.hero-copy, .hero-figure { min-width: 0; }
.eyebrow { color: var(--copper); font: 700 .76rem/1.35 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.hero-copy h1 { margin: .3em 0 .27em; font-weight: 780; font-size: clamp(2.65rem, 5vw, 4.55rem); line-height: 1.015; letter-spacing: -.061em; }
.hero-desc { color: var(--muted); font-size: clamp(1rem, 1.45vw, 1.25rem); max-width: 36ch; line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 13px 22px; margin-top: 24px; }
.hero-actions .button { min-height: 48px; padding-inline: 1rem; }
.hero-figure { border: 1px solid var(--strong-line); border-radius: 6px; overflow: hidden; background: var(--sheet); box-shadow: var(--shadow); }
.hero-figure figcaption { display: flex; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; align-items: center; padding: .83rem 1rem; font-weight: 710; font-size: .86rem; background: var(--graphite); color: #fffaf2; }
.hero-figure figcaption span:last-child { color: #efc692; font: .75rem var(--mono); }
.hero-figure-link { padding: .65rem 1rem .75rem; font-size: .86rem; font-weight: 700; border-top: 1px solid var(--line); }
.anatomy { display: block; width: 100%; max-width: 100%; height: auto; }

.directory { padding-block: 38px 55px; }
.section-lead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 3px 16px; margin-bottom: 17px; }
.section-lead h2 { font-size: clamp(1.75rem, 3vw, 2.35rem); letter-spacing: -.045em; }
.section-lead p { font-size: .85rem; color: var(--muted); }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.tool-card { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; min-width: 0; padding: 18px; background: var(--sheet); border: 1px solid var(--line); border-top: 3px solid var(--indigo); border-radius: 5px; box-shadow: var(--shadow); }
.tool-card:nth-child(4n + 2), .tool-card:nth-child(4n + 4) { border-top-color: #a26b32; }
.icon-box { width: 40px; height: 40px; display: grid; place-items: center; color: var(--indigo); background: var(--indigo-soft); border-radius: 4px; }
.tool-card h3 { font-size: 1.17rem; letter-spacing: -.025em; }
.tool-card h3 a { color: var(--ink); text-decoration: none; }
.tool-card h3 a:hover { color: var(--indigo); text-decoration: underline; }
.tool-card p { flex: 1; color: var(--muted); font-size: .89rem; }
.case-link { display: block; width: 100%; margin-top: 3px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .81rem; font-weight: 680; }

.tool-main, .info-main { padding-block: 20px 48px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 4px 9px; color: var(--muted); font-size: .82rem; }
.tool-lead { padding-block: 14px 24px; }
.tool-lead h1 { font-size: clamp(1.94rem, 4.4vw, 3.48rem); letter-spacing: -.049em; line-height: 1.07; max-width: 27ch; }
.tool-lead p { color: var(--muted); margin-top: 10px; max-width: 76ch; }
.workspace { display: grid; grid-template-columns: minmax(0, 375px) minmax(0, 1fr); grid-template-areas: "controls output"; gap: 18px; align-items: start; }
.surface, .content-panel { border: 1px solid var(--line); background: var(--sheet); border-radius: 6px; box-shadow: var(--shadow); min-width: 0; }
.controls { grid-area: controls; border-top: 3px solid var(--copper); }
.output { grid-area: output; border-top: 3px solid var(--indigo); }
.panel-head { display: flex; justify-content: space-between; gap: 7px 12px; flex-wrap: wrap; align-items: center; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.19rem; letter-spacing: -.028em; }
.panel-head .button { min-height: 40px; }
.anatomy-context { display: flex; align-items: center; gap: 10px; }
.context { color: var(--muted); font: .71rem/1.15 var(--mono); white-space: nowrap; }
.settings-strip { padding: 12px 17px 13px; background: var(--panel); border-bottom: 1px solid var(--line); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; align-items: start; }
fieldset { min-inline-size: 0; border: 0; margin: 0; padding: 9px 17px 16px; }
fieldset + fieldset { border-top: 1px solid var(--line); }
fieldset > legend { float: left; width: 100%; padding: 0 0 .45rem; color: var(--copper); font-size: .75rem; font-weight: 745; letter-spacing: .04em; text-transform: uppercase; }
fieldset > .field-grid { clear: both; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 3px; font-size: .81rem; font-weight: 680; line-height: 1.25; }
.field select, .field input, .share-box input {
  display: block; width: 100%; min-width: 0; min-height: 42px; background: var(--sheet); border: 1px solid var(--strong-line); border-radius: 4px; padding: 6px 9px;
}
.field select { font-size: .88rem; padding-right: 22px; }
.field input { border: 0; background: transparent; font-size: .94rem; font-variant-numeric: tabular-nums; appearance: textfield; }
.field input::-webkit-inner-spin-button, .field input::-webkit-outer-spin-button { appearance: none; }
.field [aria-invalid="true"] { color: var(--error); }
.input-shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid var(--strong-line); border-radius: 4px; }
.input-shell:has(input[aria-invalid="true"]) { border-color: var(--error); }
.input-shell:focus-within { border-color: var(--indigo); outline: 3px solid var(--indigo); }
.input-shell input:focus-visible { outline: 0; }
.input-unit { color: var(--muted); padding-right: 7px; font-size: .72rem; white-space: nowrap; }
.field-help { display: block; margin-top: 4px; color: var(--muted); font-size: .73rem; line-height: 1.35; }
[data-field="neutral"] { grid-column: 1 / -1; }

.anatomy-wrap { background: var(--panel); border-bottom: 1px solid var(--line); }
.calc-notes, .validation { margin: 13px 16px 0; border: 1px solid #ddbe93; border-left: 3px solid var(--copper); border-radius: 4px; color: var(--warning); background: var(--warn-sheet); line-height: 1.4; font-size: .86rem; padding: 8px 12px; }
.calc-notes { padding-left: 29px; }
.calc-notes li + li { margin-top: .32em; }
.validation { border-color: #d9a49d; background: #fbece8; color: var(--error); }
.output-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 7px; }
.output-actions .button { min-width: 45px; }
.action-status { padding-inline: 16px; margin-bottom: 5px; color: var(--indigo-dark); font-size: .82rem; }
.action-status:empty { display: none; }
.share-box { display: block; margin: 5px 16px 8px; color: var(--muted); font-size: .79rem; }
.share-box input { margin-top: 3px; color: var(--ink); }
.edit-jump { display: none; }
.results { padding: 1px 16px 12px; }
.readout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.readout-row { display: flex; justify-content: space-between; align-items: baseline; gap: 9px; min-width: 0; padding: 7px 0; border-top: 1px solid var(--line); font-size: .82rem; }
.readout-row dt { color: var(--muted); line-height: 1.25; }
.readout-row dd { color: var(--ink); font-weight: 735; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: right; }
.spectrum-results { margin-top: 12px; }
.spectrum-results h3 { font-size: .92rem; margin-bottom: 6px; }
.spectrum-results table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .79rem; }
.spectrum-results td, .spectrum-results th { padding: 5px 6px; overflow-wrap: anywhere; text-align: left; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.spectrum-results thead th { background: var(--panel); }

.safety { padding: 14px 17px; margin-block: 18px; background: #f7ead7; border: 1px solid #d8b385; border-left: 4px solid var(--copper); border-radius: 4px; font-size: .88rem; }
.safety h2 { margin-bottom: 4px; font-size: .96rem; color: #663717; }
.safety p { max-width: 115ch; color: #523d2c; }
.reading-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.content-panel { padding: 19px; }
.content-panel h2 { font-size: 1.34rem; letter-spacing: -.028em; margin-bottom: .6rem; }
.content-panel h3 { font-size: 1rem; }
.content-panel p { color: var(--muted); margin-block: .5rem; font-size: .92rem; }
.formula-list article + article { border-top: 1px solid var(--line); margin-top: .85rem; padding-top: .85rem; }
.formula-list .formula { color: var(--indigo-dark); background: var(--indigo-soft); padding: .55rem .65rem; border-radius: 3px; font: .83rem/1.55 var(--mono); overflow-wrap: anywhere; }
.content-panel .assumptions { padding-top: .6rem; margin-block: .25rem .85rem; border-top: 1px solid var(--line); }
.source-list { padding: 0 0 0 1.15rem; margin: .45rem 0 0; font-size: .86rem; }
.source-list li + li { margin-top: .25rem; }
.example-list { padding: 0; margin: 0; list-style: none; }
.example-list li { border-top: 1px solid var(--line); }
.example-list a { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: .55rem; padding: .45rem .2rem; font-size: .9rem; font-weight: 660; text-decoration: none; }
.example-list a:hover { text-decoration: underline; }
.worked-solution { grid-column: 1 / -1; }
.worked-readouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: .8rem; }
.worked-readouts div { background: var(--panel); padding: .65rem .76rem; border: 1px solid var(--line); border-radius: 3px; min-width: 0; }
.worked-readouts dt, .content-panel .preset { color: var(--muted); font-size: .78rem; }
.worked-readouts dd { color: var(--indigo-dark); overflow-wrap: anywhere; font-size: 1.15rem; font-weight: 740; font-variant-numeric: tabular-nums; }

.info-main { max-width: 1000px; }
.info-main > .content-panel + .content-panel { margin-top: 15px; }
.method-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); background: #eae5da; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-start; align-items: center; min-height: 72px; padding-block: 10px; font-size: .84rem; }
.footer-inner > span { font-weight: 740; color: var(--ink); }
#print-report { display: none; }

@media (max-width: 975px) {
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shell { width: calc(100% - 40px); }
  .workspace { grid-template-columns: minmax(0, 345px) minmax(0, 1fr); gap: 12px; }
  .readout-grid { grid-template-columns: minmax(0, 1fr); }
  .desktop-break { display: none; }
}

@media (max-width: 790px) {
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-areas: "output" "controls"; }
  .output .edit-jump { display: inline-flex; }
  .output .anatomy-context { width: 100%; justify-content: space-between; }

  .hero-grid { grid-template-columns: minmax(0, 1fr); max-width: 650px; }
  .hero-copy h1 { font-size: clamp(2.6rem, 8vw, 4.4rem); max-width: 12ch; }
  .reading-grid { grid-template-columns: minmax(0, 1fr); }
  .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .shell { width: calc(100% - 28px); }
  .hero-grid { gap: 20px; padding-block: 26px; }
  .hero-actions { margin-top: 17px; }
  .directory { padding-block: 27px 34px; }
  .tool-grid, .method-index, .readout-grid, .worked-readouts { grid-template-columns: minmax(0, 1fr); }
  .tool-card { padding: 15px; }
  .panel-head, .settings-strip { padding-inline: 11px; }
  fieldset { padding-inline: 11px; }
  .field-grid { column-gap: 8px; }
  .output-actions, .results { padding-inline: 11px; }
  .validation, .calc-notes, .share-box { margin-inline: 11px; }
  .action-status { padding-inline: 11px; }
  .content-panel { padding: 15px; }
  .tool-lead { padding-block: 11px 18px; }
  .tool-lead p { font-size: .9rem; }
  .footer-inner { gap: 5px 14px; }
}

@media (max-width: 430px) {
  .head-inner { flex-direction: column; align-items: flex-start; gap: 0; padding-top: 9px; }
  .site-header nav { gap: 23px; }
  .site-header nav a { font-size: .85rem; }
  .brand { font-size: 1.1rem; }
  .brand img { width: 30px; height: 30px; }
  .hero-figure figcaption { padding: .62rem .7rem; }
}

@media (max-width: 355px) {
  .field-grid { grid-template-columns: minmax(0, 1fr); }
}

@media print {
  @page { margin: 11mm; }
  * { box-shadow: none !important; }
  body { margin: 0; background: #fff; color: #17171c; }
  .page-tool > :not(#print-report) { display: none !important; }
  #print-report { display: block; font: 8.75pt/1.22 var(--font); }
  #print-report > header { border-bottom: 1pt solid #453798; padding-bottom: 3mm; margin-bottom: 3mm; }
  #print-report .print-title { font-size: 19pt; margin: .7mm 0; line-height: 1.04; }
  #print-report h2 { font-size: 11pt; margin-bottom: 1.2mm; }
  .print-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5mm; }
  .print-data dl > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5mm; border-bottom: .3pt solid #d6d3cb; padding: .55mm 0; }
  .print-data dd { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
  .print-diagram { width: 154mm; max-width: 100%; margin: 3mm auto 1.5mm; break-inside: avoid; print-color-adjust: exact; }
  .print-notes { margin: 1.5mm 0; padding-left: 4mm; }
  .print-safety, .print-assumptions { margin-top: 2mm; }
}
