:root {
  color-scheme: light;
  --linen: #f8f6f2;
  --paper: #fffdf9;
  --console: #171412;
  --ink: #28221d;
  --muted: #62584f;
  --line: #dfd7ca;
  --soft: #efe9df;
  --emerald: #0f9d76;
  --green-ink: #075e47;
  --amber: #d97724;
  --amber-ink: #9d4c16;
  --display: Baskerville, "Palatino Linotype", Georgia, serif;
  --body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 1.4rem; }
body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font: 1rem/1.55 var(--body);
  overflow-wrap: anywhere;
}
img, svg { max-inline-size: 100%; }
button, input, select { font: inherit; }
a { color: var(--green-ink); text-underline-offset: 0.22em; }
a:hover { color: var(--amber-ink); }
:focus-visible { outline: 2px solid var(--amber-ink); outline-offset: 4px; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.038em;
}
h1 { font-size: clamp(2.5rem, 5vw, 4.8rem); line-height: 0.98; }
h2 { font-size: clamp(1.75rem, 3vw, 2.65rem); line-height: 1.05; }
h3 { font-size: 1.05rem; line-height: 1.25; }
.shell { width: min(1250px, calc(100% - 64px)); margin-inline: auto; }
.skip-link {
  position: absolute;
  inset: 0 auto auto 1rem;
  z-index: 10;
  background: var(--paper);
  padding: 0.6rem 0.85rem;
  transform: translateY(-120%);
}
.skip-link:focus { transform: translateY(0); }
.site-header { border-bottom: 1px solid var(--line); }
.header-row, .footer-row {
  min-height: 75px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--console);
  font-size: 1.08rem;
  font-weight: 760;
  letter-spacing: -0.045em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark img { display: block; flex: 0 0 auto; }
.wordmark > span > span { color: var(--green-ink); }
.header-row nav, .footer-row nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.65rem; }
.header-row nav a, .footer-row nav a { color: var(--muted); text-decoration: none; font-weight: 650; font-size: 0.9rem; }
.header-row nav a:hover, .footer-row nav a:hover { color: var(--green-ink); text-decoration: underline; }
.site-footer { border-top: 1px solid var(--line); background: #f0ebe2; }
.footer-row { min-height: 100px; flex-wrap: wrap; }
.footer-row p { color: var(--muted); font-size: 0.9rem; }

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5.75rem);
  padding-block: clamp(3rem, 7vw, 6.75rem);
}
.hero-copy h1 { font-size: clamp(3.2rem, 6.05vw, 6.25rem); max-width: 9.7em; }
.hero-copy h1 em { color: var(--amber-ink); font-weight: 500; white-space: nowrap; }
.hero-copy p, .page-lead > p, .error-page > p {
  color: var(--muted);
  font-size: clamp(1.05rem, 1.45vw, 1.25rem);
  margin-top: 1.3rem;
  max-width: 42rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.55rem 0.65rem; margin-top: 1.55rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.64rem 0.94rem;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-weight: 680;
  font-size: 0.88rem;
  line-height: 1.25;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--green-ink); color: #fff; }
.button.primary:hover { background: #034533; color: #fff; }
.button.secondary { border-color: #cfc5b6; color: var(--ink); background: var(--paper); }
.button.secondary:hover { background: var(--soft); color: var(--ink); }
.button.minor { color: var(--ink); background: transparent; }
.button.minor:hover { text-decoration: underline; }
.button:disabled { opacity: 0.52; cursor: not-allowed; }
.hero-signal {
  background: var(--console);
  color: #eee4d8;
  border: 1px solid #504437;
  border-radius: 9px;
  box-shadow: 0 14px 40px #41291918, 0 2px 6px #41291915;
  overflow: hidden;
}
.signal-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.95rem 1.15rem;
  font: 0.78rem/1.35 var(--mono);
}
.signal-head div { display: flex; align-items: center; gap: 0.6rem; }
.signal-head > span { color: #cdbdaf; }
.signal-dot { background: #59c7a3; box-shadow: 0 0 0 3px #0f9d7637; width: 8px; height: 8px; border-radius: 50%; }
.hero-signal svg { width: 100%; height: auto; display: block; }
.hero-signal figcaption { padding: 0.92rem 1.15rem 1rem; }
.hero-signal a { color: #b2ead4; font-size: 0.9rem; }
.hero-signal a:hover { color: #ffd5a9; }
.hero-signal a:focus-visible { outline-color: #ffba77; }

.home-section { border-top: 1px solid var(--line); padding-block: 2rem 3.25rem; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 0.35rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-heading p { color: var(--muted); }
.tool-grid, .example-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem; }
.tool-card {
  min-width: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 1.05rem;
  display: flex;
  flex-direction: column;
  text-decoration: none;
}
.tool-card:hover { border-color: #a5917c; color: var(--ink); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; margin-bottom: 1.03rem; }
.tool-icon { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #cddfd4; border-radius: 5px; color: var(--green-ink); background: #e9f2ed; }
.category { font: 0.72rem/1.25 var(--mono); color: var(--muted); }
.tool-card h3 { font-size: 1.14rem; letter-spacing: -0.028em; }
.tool-card p { font-size: 0.92rem; color: var(--muted); margin-block: 0.45rem 1.1rem; }
.card-action { color: var(--green-ink); margin-top: auto; font-size: 0.82rem; font-weight: 720; }
.card-action span { margin-left: 0.22rem; }
.tool-card:hover .card-action { text-decoration: underline; }
.example-grid { gap: 1.6rem 2rem; }
.example-group { border-top: 2px solid #bca992; padding-top: 0.7rem; }
.example-group h3 a { color: var(--ink); text-decoration: none; }
.example-group h3 a:hover { color: var(--green-ink); text-decoration: underline; }
.example-group ul, .related ul { list-style: none; padding: 0; margin-block: 0.65rem 0; }
.example-group li a, .related li a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  border-bottom: 1px solid var(--line);
  padding-block: 0.58rem;
  text-decoration: none;
  font-size: 0.91rem;
  line-height: 1.4;
}
.example-group li a:hover span:first-child, .related li a:hover span:first-child { text-decoration: underline; }

.skill-page, .text-page { padding-block: 2rem 4.2rem; }
.page-lead { padding-bottom: 1.65rem; }
.page-lead h1 { max-width: 1040px; }
.page-lead > p { max-width: 780px; }
.breadcrumbs { margin-bottom: 1.25rem; font-size: 0.82rem; color: var(--muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem 0.55rem; list-style: none; padding: 0; margin: 0; }
.breadcrumbs li a { color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 0.55rem; color: var(--amber-ink); }
.page-lead .guide-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem; font-size: 0.93rem; margin-top: 0.9rem; }

.worksheet {
  display: grid;
  grid-template-columns: minmax(275px, 0.42fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 2.25vw, 2rem);
  padding-bottom: 2rem;
}
.control-panel {
  min-width: 0;
  padding: 1rem;
  background: #f0ebe1;
  border: 1px solid #e0d5c6;
  border-radius: 8px;
}
.control-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; margin-bottom: 0.7rem; }
.control-heading h2 { font-size: 1.7rem; }
.unit-picker { display: inline-flex; align-items: center; padding: 2px; background: var(--paper); border: 1px solid #cabfaf; border-radius: 5px; }
.unit-picker button { border: 0; background: transparent; padding: 0.36rem 0.62rem; color: var(--muted); font: 0.78rem var(--mono); min-height: 35px; cursor: pointer; border-radius: 3px; }
.unit-picker button[aria-pressed="true"] { background: var(--console); color: #fff; }
fieldset { min-inline-size: 0; border: 0; border-top: 1px solid #d9cebf; padding: 0.5rem 0 0.6rem; margin: 0 0 0.55rem; }
legend { color: var(--amber-ink); padding: 0 0.4rem 0 0; font: 700 0.75rem/1.4 var(--mono); }
.field { margin-bottom: 0.65rem; min-width: 0; }
.field label { display: block; color: var(--ink); font-weight: 650; font-size: 0.88rem; margin-bottom: 0.24rem; }
.field input, .field select, .share-box input {
  color: var(--ink);
  width: 100%;
  min-width: 0;
  background: var(--paper);
  border: 1px solid #bbaf9d;
  border-radius: 5px;
  font-size: 1rem;
  min-height: 42px;
}
.field input { font-family: var(--mono); padding: 0.52rem 0.5rem 0.52rem 0.63rem; }
.field select { padding: 0.48rem 0.4rem; }
.number-control { display: flex; align-items: stretch; }
.number-control:has(.number-unit:not(:empty)) input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.number-control input:focus { z-index: 1; }
.number-unit { display: grid; place-items: center; background: #e8e0d2; border: 1px solid #bbaf9d; border-left: 0; border-radius: 0 5px 5px 0; padding: 0 0.5rem; font: 0.75rem/1.2 var(--mono); white-space: nowrap; }
.number-unit:empty { display: none; }
.field [aria-invalid="true"] { border-color: #a13e2d; }
.input-error { font-size: 0.9rem; margin-block: 0.25rem 0.85rem; color: #8d2e24; }
.reset-button { width: 100%; margin-top: 0.2rem; }
.worksheet-results, .results-detail { min-width: 0; }
.worksheet-actions { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.42rem; }
.worksheet-actions .button { min-height: 40px; padding-inline: 0.72rem; font-size: 0.79rem; }
.share-box { margin-top: 0.7rem; padding: 0.65rem; background: #e9f1eb; border: 1px solid #bcd2c7; border-radius: 5px; }
.share-box label { display: block; margin-bottom: 0.23rem; font-size: 0.85rem; font-weight: 680; }
.share-box input { font-family: var(--mono); padding: 0.45rem; }
.interaction-status { color: var(--muted); font-size: 0.83rem; margin-top: 0.44rem; }
.interaction-status:empty { margin-top: 0; }
[data-results] { margin-top: 0.65rem; }
.out-of-date .result-console { opacity: 0.75; }
.result-console {
  color: #fff9ee;
  border: 1px solid #45392d;
  border-radius: 8px;
  overflow: hidden;
  background: var(--console);
}
.result-console h2 { color: #f5e9da; font: 0.8rem/1.4 var(--mono); margin: 0; padding: 0.72rem 0.95rem; border-bottom: 1px solid #42382d; letter-spacing: 0; }
.result-console dl, .results-detail dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.console-reading { padding: 0.9rem; min-width: 0; }
.console-reading + .console-reading { border-left: 1px solid #42382d; }
.console-reading dt { color: #e0d2c1; font-size: 0.78rem; line-height: 1.25; margin-bottom: 0.42rem; min-height: 2.35em; }
.console-reading dd { color: #9ee4c9; font: 650 clamp(1.05rem, 2.3vw, 2rem)/1.15 var(--mono); letter-spacing: -0.055em; }
.console-reading:nth-child(2) dd { color: #fbc08a; }
.console-reading dd small, .detail-reading dd small { display: block; font: 0.69rem/1.3 var(--mono); letter-spacing: 0; margin-top: 0.22rem; }
.console-reading dd small { color: #e0d2c1; }
.results-detail { margin-block: 0.7rem 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.detail-reading { padding: 0.62rem 0.75rem; border-bottom: 1px solid var(--line); min-width: 0; }
.detail-reading dt { color: var(--muted); font-size: 0.76rem; line-height: 1.3; }
.detail-reading dd { font: 650 0.95rem/1.35 var(--mono); margin-top: 0.32rem; }
.detail-reading dd small { display: inline; color: var(--muted); margin-left: 0.36rem; }
.detail-reading:nth-last-child(-n+3) { border-bottom: 0; }
.chart-list, .table-list { display: grid; gap: 0.75rem; }
.chart { margin: 0; background: #fdfbf7; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.chart figcaption { padding: 0.64rem 0.82rem; font-size: 0.93rem; border-bottom: 1px solid var(--line); }
.chart svg { width: 100%; height: auto; display: block; }
.chart-caption { font-size: 0.83rem; color: var(--muted); padding: 0 0.82rem 0.75rem; }
.table-list { margin-top: 0.85rem; }
.result-table { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; min-width: 0; }
.result-table h3 { padding: 0.68rem 0.82rem; font-weight: 680; font-size: 0.93rem; }
.result-table > p { padding: 0.3rem 0.82rem 0.65rem; font-size: 0.84rem; color: var(--muted); }
.table-scroll { overflow: auto; width: 100%; }
.table-scroll:focus-visible { outline-offset: -2px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; text-align: start; }
th, td { text-align: left; vertical-align: top; padding: 0.55rem 0.72rem; border-top: 1px solid var(--line); }
thead th { background: #efe9df; }
thead th span { white-space: nowrap; font-size: 0.82em; font-weight: 550; }
tbody th { font-weight: 580; }
tbody td { font-variant-numeric: tabular-nums; }
.print-inputs { display: none; }

.reading { max-width: 850px; }
.reading-section { border-top: 1px solid var(--line); padding-block: 1.35rem 1.65rem; }
.reading-section h2 { margin-bottom: 0.7rem; }
.reading-section p + p { margin-top: 0.7rem; }
.math-steps { margin: 0; padding: 0; list-style: none; counter-reset: calculation; }
.math-steps li { counter-increment: calculation; padding: 0.74rem 0 0.73rem 2.1rem; position: relative; border-bottom: 1px solid var(--line); }
.math-steps li:last-child { border-bottom: 0; }
.math-steps li::before { content: counter(calculation, decimal-leading-zero); position: absolute; top: 0.82rem; left: 0; color: var(--amber-ink); font: 0.76rem var(--mono); }
.math-steps li p { margin-top: 0.35rem; color: var(--muted); font: 0.87rem/1.6 var(--mono); }
.model-notes, .reference-list { margin: 0; padding-left: 1.25rem; }
.model-notes li + li, .reference-list li + li { margin-top: 0.42rem; }
.faq-list { border-bottom: 1px solid var(--line); }
.faq-list details { border-top: 1px solid var(--line); }
.faq-list summary { padding: 0.75rem 0; cursor: pointer; font-weight: 670; }
.faq-list summary::marker { color: var(--amber-ink); }
.faq-list details p { padding: 0 0 0.8rem 1.04rem; color: var(--muted); }
.related ul { margin-bottom: 1rem; }
.inline-link { font-weight: 660; }
.text-page { min-height: 64vh; }
.error-page { padding-block: 4rem; }

@media (max-width: 1020px) {
  .tool-grid, .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-hero { gap: 1.6rem; }
  .hero-copy h1 { font-size: clamp(3.05rem, 6.4vw, 5.7rem); }
}
@media (max-width: 850px) {
  .shell { width: calc(100% - 40px); }
  .worksheet { grid-template-columns: minmax(0, 1fr); }
  fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 0.8rem; }
  .hero-copy h1 { font-size: clamp(3.25rem, 6.8vw, 4.8rem); }
}
@media (max-width: 700px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); padding-block: 2.9rem 2.25rem; }
  .hero-copy h1 { font-size: clamp(3.15rem, 8.8vw, 4.4rem); }
  .hero-copy p { margin-top: 0.95rem; }
  .page-lead > p { margin-top: 0.85rem; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 32px); }
  .header-row { align-items: flex-start; flex-direction: column; justify-content: center; gap: 0.38rem; padding-block: 0.55rem 0.64rem; }
  .wordmark img { width: 29px; height: 29px; }
  .header-row nav, .footer-row nav { gap: 0.37rem 1.1rem; }
  .header-row nav a { font-size: 0.85rem; }
  .home-hero { padding-top: 2rem; }
  .tool-grid, .example-grid { gap: 0.7rem; }
  .tool-card { padding: 0.75rem; }
  .tool-card p, .example-group li a { font-size: 0.85rem; }
  .tool-card h3 { font-size: 1.03rem; }
  .category { font-size: 0.62rem; }
  .signal-head { padding: 0.7rem 0.8rem; font-size: 0.71rem; }
  .hero-signal figcaption { padding: 0.6rem 0.8rem 0.72rem; }
  .skill-page, .text-page { padding-top: 1.35rem; }
  .page-lead h1 { font-size: clamp(2.25rem, 9.3vw, 3.2rem); }
  .control-panel { padding: 0.8rem; }
  .field label { font-size: 0.81rem; }
  fieldset { grid-template-columns: minmax(0, 1fr); }
  .console-reading { padding: 0.65rem 0.5rem; }
  .console-reading dt { font-size: 0.72rem; }
  .console-reading dd { font-size: 1.08rem; }
  .results-detail dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-reading { padding: 0.54rem; }
  .detail-reading:nth-last-child(3) { border-bottom: 1px solid var(--line); }
  th, td { padding: 0.45rem 0.48rem; }
  .footer-row { padding-block: 0.8rem; }
}
@media (min-width: 370px) and (max-width: 480px) {
  fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field:has(select) { grid-column: 1 / -1; }
}
@media (max-width: 350px) {
  .tool-grid, .example-grid { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  @page { margin: 13mm; }
  body { background: #fff; color: #171412; font-size: 10pt; print-color-adjust: exact; }
  .site-header, .site-footer, .skip-link, .print-hide, .control-panel, .worksheet-actions, .share-box, .interaction-status, .breadcrumbs { display: none !important; }
  .shell { width: 100%; }
  .skill-page, .text-page { padding-block: 0; }
  .page-lead { padding-bottom: 0.55rem; }
  .page-lead h1 { font-size: 27pt; }
  .page-lead p { margin-top: 0.4rem; font-size: 10pt; }
  .worksheet { display: block; padding-bottom: 0.5rem; }
  .print-inputs { display: block; padding: 0.5rem; border: 1px solid var(--line); break-inside: avoid; }
  .print-inputs dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.34rem; margin-top: 0.32rem; }
  .print-inputs dt { font-size: 8pt; color: var(--muted); }
  .print-inputs dd { font: 9pt/1.3 var(--mono); }
  .result-console, .results-detail, .chart { break-inside: avoid; }
  .console-reading dd { font-size: 15pt; }
  .chart svg { max-height: 260px; }
  .chart figcaption { padding-block: 0.38rem; }
  .chart-caption, .table-note { font-size: 8pt; }
  .table-scroll { overflow: visible; }
  tr, .math-steps li { break-inside: avoid; }
  .reading-section { padding-block: 0.65rem; }
  h2, h3, figcaption { break-after: avoid; }
}
