:root {
  color-scheme: light;
  --slate: #111827;
  --slate-deep: #0B1220;
  --sky: #0284C7;
  --sky-dark: #075985;
  --sky-pale: #E0F2FE;
  --gold: #CA8A04;
  --gold-dark: #854D0E;
  --paper: #F8FAFC;
  --white: #FFFFFF;
  --line: #DCE5ED;
  --muted: #475569;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--slate);
  font: 1rem/1.58 var(--body);
}
a { color: var(--sky-dark); text-underline-offset: .2em; }
a:hover { color: #0C4A6E; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
button, input, select { font: inherit; }
button, select, summary { cursor: pointer; }
img, svg { max-width: 100%; vertical-align: middle; }
svg { display: block; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, figure { margin: 0; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; font-weight: 700; }
h1, h2 { letter-spacing: -.036em; }
h3 { letter-spacing: -.025em; }
p, li, dd, code { overflow-wrap: anywhere; }
dd { margin: 0; }
.container { width: min(100% - 64px, 1184px); margin-inline: auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 70px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: var(--slate);
  font: 700 1.28rem/1 var(--display);
  letter-spacing: -.055em;
  text-decoration: none;
}
.brand:hover { color: var(--slate); }
.brand strong { color: var(--sky-dark); font-weight: 700; }
.brand-symbol {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--slate);
  color: #7DD3FC;
}
.brand-symbol svg { width: 19px; height: 19px; }
.site-header nav, .site-footer nav { display: flex; align-items: center; flex-wrap: wrap; gap: clamp(14px, 3vw, 36px); }
.site-header nav a, .site-footer nav a { font-size: .9375rem; font-weight: 630; text-decoration: none; color: var(--muted); }
.site-header nav a:hover, .site-footer nav a:hover { text-decoration: underline; color: var(--sky-dark); }
.skip-link { position: absolute; top: 8px; left: 10px; z-index: 2; padding: 8px 12px; background: var(--white); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.site-footer { background: var(--white); border-top: 1px solid var(--line); }
.footer-inner { min-height: 90px; }
.footer-brand { font-size: 1.12rem; }
.footer-brand .brand-symbol { width: 30px; height: 30px; }

.hero {
  color: var(--white);
  background-color: var(--slate);
  background-image: linear-gradient(90deg, #29364B42 1px, transparent 1px), linear-gradient(#29364B42 1px, transparent 1px);
  background-position: center;
  background-size: 30px 30px;
  border-bottom: 3px solid var(--sky);
}
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: center;
  gap: 18px;
  padding-block: clamp(47px, 5.3vw, 77px);
}
.hero-label { color: #7DD3FC; font: 650 .8125rem/1.4 var(--mono); letter-spacing: .14em; }
.hero h1 { margin-top: 14px; font-size: clamp(2.75rem, 4.65vw, 4.125rem); line-height: 1.07; letter-spacing: -.047em; }
.hero-copy > p:not(.hero-label, .local-note) {
  margin-top: 21px;
  max-width: 490px;
  color: #CBD5E1;
  font-size: clamp(1.04rem, 1.8vw, 1.19rem);
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 27px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  padding: 8px 15px;
  background: var(--white);
  color: var(--slate);
  font-weight: 660;
  text-decoration: none;
  line-height: 1.25;
}
.button:hover { background: #F0F9FF; color: var(--sky-dark); border-color: #7DD3FC; }
.button.primary { background: #38BDF8; border-color: #38BDF8; color: var(--slate-deep); }
.button.primary:hover { background: #7DD3FC; border-color: #7DD3FC; }
.hero-secondary { color: #E2E8F0; border-color: #60748A; background: #162235; }
.hero-secondary:hover { color: var(--white); background: #20324A; border-color: #7DD3FC; }
.local-note { display: flex; align-items: center; gap: 8px; color: #BBD3E2; margin-top: 22px; font-size: .875rem; }
.local-note span { width: 7px; height: 7px; border-radius: 50%; background: #38BDF8; }
.hero-figure { margin: 0; min-width: 0; }
.hero-schematic { width: 100%; height: auto; }
.hero-figure figcaption { padding-top: 8px; color: #A7BDD0; text-align: center; font: 550 .75rem/1.4 var(--mono); letter-spacing: .13em; }

.home-section { padding-block: 48px 59px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.section-heading h2 { font-size: clamp(1.9rem, 3.4vw, 2.75rem); }
.section-heading p { color: var(--muted); margin-top: 5px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tool-card {
  display: block;
  min-width: 0;
  padding: 19px;
  border: 1px solid var(--line);
  border-top: 2px solid #A4C8DA;
  border-radius: var(--radius);
  background: var(--white);
  text-decoration: none;
  color: var(--slate);
}
.tool-card:hover { border-color: var(--sky); color: var(--slate); background: #F5FBFF; }
.card-top, .page-category { display: flex; align-items: center; gap: 11px; }
.tool-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid #BAE6FD; border-radius: 9px; color: var(--sky-dark); background: #F0F9FF; }
.tool-icon svg { width: 21px; height: 21px; }
.micro-label { font: 650 .75rem/1.45 var(--mono); letter-spacing: .075em; color: var(--sky-dark); text-transform: uppercase; }
.tool-card h3 { margin-top: 16px; font-size: 1.24rem; }
.tool-card p { margin-top: 6px; color: var(--muted); }
.guide-area { border-top: 1px solid var(--line); background: #EDF4F8; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.guide-group, .faq { border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.guide-group summary, .faq summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
  padding: 13px 15px;
  font-weight: 680;
}
.guide-group summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.guide-group summary::before, .faq summary::before { content: '+'; color: var(--sky-dark); font: 650 1.12rem/1 var(--mono); }
.guide-group[open] summary::before, .faq[open] summary::before { content: '−'; }
.guide-count { color: var(--muted); font: 550 .75rem/1.4 var(--mono); white-space: nowrap; }
.guide-group ul { padding: 0 20px 16px 38px; color: var(--sky-dark); }
.guide-group li + li { margin-top: 7px; }

.calculator-page, .information-page { padding-block: 24px 64px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; padding: 0; list-style: none; gap: 4px 9px; font-size: .875rem; color: var(--muted); }
.breadcrumbs li + li::before { content: '/'; margin-right: 9px; color: #64748B; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.page-intro { margin-block: 27px 27px; }
.page-intro h1, .not-found h1 {
  max-width: 1000px;
  margin-top: 12px;
  font-size: clamp(2.35rem, 4.35vw, 3.65rem);
  line-height: 1.06;
}
.page-intro p { margin-top: 12px; color: var(--muted); max-width: 810px; font-size: 1.1rem; }
.page-intro .example-note { font-size: 1rem; padding-left: 12px; border-left: 3px solid var(--gold); }
.workbench { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); gap: 18px; align-items: start; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 6px #12203309; }
.panel-head { min-height: 61px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.45rem; font-weight: 700; }
.unit-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.unit-switch button { padding: 5px 10px; min-height: 31px; border-radius: 5px; border: 0; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 660; }
.unit-switch button[aria-pressed="true"] { background: var(--slate); color: var(--white); }
.input-groups { display: grid; gap: 15px; padding: 17px 18px; }
.input-group { min-width: 0; padding: 11px 0 0; margin: 0; border: 0; border-top: 1px solid var(--line); }
.input-group legend { padding: 0 9px 0 0; font-weight: 720; font-size: .9375rem; color: var(--sky-dark); }
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 11px; row-gap: 13px; align-items: start; }
.input-field { display: grid; grid-template-rows: auto auto; align-content: start; gap: 4px; min-width: 0; }
.input-field label { display: block; font-size: .875rem; line-height: 1.37; font-weight: 670; }
.number-field { display: flex; align-items: center; min-width: 0; }
.number-field input, .input-field select, .share-box input {
  min-width: 0;
  width: 100%;
  min-height: 39px;
  padding: 5px 8px;
  color: var(--slate);
  background: var(--paper);
  border: 1px solid #AEBCCB;
  border-radius: 6px;
}
.number-field input { font: 640 .9375rem/1.3 var(--mono); }
.number-field input::-webkit-inner-spin-button, .number-field input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.number-field input[type="number"] { appearance: textfield; }
.input-field select { appearance: none; padding-right: 26px; font-size: .9375rem; background-image: linear-gradient(45deg, transparent 50%, #475569 50%), linear-gradient(135deg, #475569 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.input-unit { flex: 0 0 auto; min-width: 0; margin-left: 6px; color: var(--muted); font: 550 .75rem/1.25 var(--mono); }
.input-unit:empty { display: none; }
.help, .field-error { color: var(--muted); font-size: .8125rem; line-height: 1.38; }
.field-error { color: #9F1239; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: #BE123C; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--line); }
.button-compact { min-height: 36px; padding: 6px 11px; font-size: .875rem; }
.button:disabled { cursor: not-allowed; color: #576774; background: #E2E8F0; border-color: #CBD5E1; }
.result-jump { font-size: .875rem; }

[data-result-content] { padding: 15px 17px; }
.headline-readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.reading { min-width: 0; padding: 9px 10px; border: 1px solid #D2E7F1; border-top: 2px solid var(--sky); border-radius: 8px; background: #F0F9FF; }
.reading dt { font-size: .8125rem; color: #24445B; line-height: 1.35; font-weight: 660; min-height: 2.62em; }
.reading dd { display: flex; gap: 2px 5px; flex-wrap: wrap; align-items: baseline; margin-top: 4px; }
.reading-value { font: 760 clamp(1.2rem, 2.2vw, 1.84rem)/1.1 var(--mono); letter-spacing: -.075em; font-variant-numeric: tabular-nums; }
.reading-unit { color: var(--sky-dark); font: 650 .75rem/1.2 var(--mono); }
.notice, .notice-list, .reference-note { font-size: .875rem; line-height: 1.5; background: #FEF9E7; color: #653A08; border: 1px solid #EAD9A0; border-left: 3px solid var(--gold); border-radius: 6px; }
.notice { padding: 9px 11px; margin: 9px 0 16px; }
.output-panel > .notice { margin: 14px 17px; }
.notice-list { margin-top: 11px; padding: 7px 10px 7px 26px; }
.notice-list li + li { margin-top: 4px; }
.reference-note { margin-top: 11px; padding: 8px 10px; }
.diagram { margin-top: 14px; padding: 9px 9px 7px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.diagram h3 { font-size: 1.03rem; margin: 4px 3px 5px; }
.diagram svg { width: 100%; height: auto; }
.diagram figcaption { margin: 3px 3px 2px; color: var(--muted); font-size: .8125rem; line-height: 1.45; }
.detail-readings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 13px; margin-top: 11px; }
.detail-reading { min-width: 0; padding: 7px 0; border-bottom: 1px solid var(--line); }
.detail-reading dt { font-size: .8125rem; line-height: 1.35; color: var(--muted); }
.detail-reading dd { margin-top: 1px; color: var(--slate); font: 670 .875rem/1.4 var(--mono); }
.exports { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 12px 17px; border-top: 1px solid var(--line); }
.exports button:first-child { color: var(--sky-dark); background: #F0F9FF; border-color: #BAE6FD; }
.share-box { padding: 1px 17px 8px; }
.share-box label { display: block; font-size: .875rem; font-weight: 650; margin-bottom: 4px; }
.share-box input { font: 500 .8125rem/1.4 var(--mono); }
.action-status { margin: 0 17px 10px; color: var(--sky-dark); font-size: .875rem; }
.print-inputs { display: none; }

.tool-documentation { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 23px; margin-top: 36px; }
.tool-documentation h2, .faq-section h2, .related-section h2, .print-inputs h2, .prose h2 { font-size: 1.62rem; margin-bottom: 9px; }
.tool-documentation p, .prose p { color: var(--muted); }
.math-steps { list-style: decimal; display: grid; gap: 9px; padding: 0 0 0 26px; margin-top: 11px; }
.math-steps li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); }
.math-steps li::marker { color: var(--sky-dark); font-weight: 650; }
.math-steps strong { font-size: .9375rem; }
.math-steps code { font: 550 .875rem/1.55 var(--mono); }
.method-section > p + p { margin-top: 11px; }
.source-list { margin-top: 16px; }
.source-list h3 { font-size: 1.06rem; margin-bottom: 5px; }
.source-list ul, .related-section ul { padding-left: 20px; }
.faq-section, .related-section { margin-top: 30px; max-width: 820px; }
.faq { margin-top: 8px; }
.faq p { padding: 0 16px 13px 35px; color: var(--muted); }
.related-section p { margin-bottom: 7px; }
.related-section li + li { margin-top: 4px; }

.information-page { max-width: 890px; min-height: 55vh; }
.prose { max-width: 740px; }
.prose p + p { margin-top: 12px; }
.prose h2 { margin-top: 27px; }
.info-link { display: inline-block; margin: 2px 15px 4px 0; }
.not-found { padding-top: 65px; }
.not-found p { margin-top: 12px; }
.not-found .hero-actions { margin-bottom: 17px; }

@media (max-width: 1080px) {
  .hero-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }
  .hero h1 { font-size: clamp(2.6rem, 5.6vw, 4.1rem); }
  .tool-card { padding: 15px; }
  .tool-card p { font-size: .9375rem; }
}
@media (max-width: 860px) {
  .container { width: min(100% - 42px, 1184px); }
  .hero-layout { gap: 6px; }
  .hero h1 br { display: none; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head, .input-groups, .form-actions { padding-inline: 13px; }
  .workbench { gap: 11px; }
  [data-result-content], .exports { padding-inline: 12px; }
  .headline-readings { gap: 5px; }
  .reading { padding-inline: 7px; }
  .input-grid { column-gap: 8px; }
  .detail-readings { column-gap: 9px; }
}
@media (max-width: 660px) {
  .container { width: calc(100% - 32px); }
  .header-inner, .footer-inner { min-height: 0; align-items: flex-start; flex-direction: column; gap: 0; padding-block: 11px; }
  .site-header nav, .site-footer nav { margin-top: 8px; gap: 8px 19px; }
  .site-header nav a, .site-footer nav a { font-size: .875rem; }
  .hero-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-block: 39px 24px; }
  .hero h1 { max-width: 460px; font-size: clamp(2.6rem, 10vw, 3.7rem); }
  .hero-copy > p:not(.hero-label, .local-note) { margin-top: 14px; }
  .hero-actions { margin-top: 19px; gap: 7px; }
  .hero-actions .button { padding-inline: 10px; font-size: .875rem; }
  .local-note { margin-top: 14px; }
  .hero-figure { width: min(100%, 440px); justify-self: center; }
  .hero-figure figcaption { padding-top: 5px; }
  .home-section { padding-block: 35px 39px; }
  .section-heading { margin-bottom: 17px; }
  .tool-grid { gap: 8px; }
  .tool-card { padding: 11px; border-radius: 9px; }
  .tool-card h3 { margin-top: 11px; font-size: 1.07rem; }
  .tool-card p { font-size: .875rem; line-height: 1.45; }
  .tool-card .card-top { gap: 5px; flex-wrap: wrap; }
  .tool-card .micro-label { font-size: .6875rem; }
  .tool-icon { width: 33px; height: 33px; flex-basis: 33px; }
  .guide-grid, .workbench, .tool-documentation { grid-template-columns: minmax(0, 1fr); }
  .guide-grid { gap: 7px; }
  .calculator-page, .information-page { padding-block: 17px 43px; }
  .page-intro { margin-block: 19px 20px; }
  .page-intro p { font-size: 1rem; }
  .panel-head { min-height: 54px; }
  .input-field:has(select[name="mode"]) { grid-column: 1 / -1; }
  .tool-documentation { margin-top: 26px; }
}
@media (max-width: 350px) {
  .container { width: calc(100% - 22px); }
  .input-grid, .tool-grid { grid-template-columns: 1fr; }
  .guide-count { white-space: normal; }
}
@page { size: A4; margin: 13mm; }
@media print {
  body { background: white; color: black; font-size: 9.5pt; }
  .container { width: 100%; margin: 0; }
  .calculator-page { padding: 0; }
  .site-header, .site-footer, .breadcrumbs, .input-panel, .exports, .share-box, .action-status, .faq-section, .related-section { display: none !important; }
  .page-intro { margin: 0 0 5mm; }
  .page-intro h1 { font-size: 20pt; letter-spacing: -.03em; }
  .page-intro p { margin-top: 3mm; font-size: 9.5pt; }
  .page-category .tool-icon { display: none; }
  .workbench, .tool-documentation { display: block; }
  .panel { border: 0; box-shadow: none; }
  .panel-head, [data-result-content] { padding: 0; }
  .panel-head { min-height: 0; padding-block: 0 2mm; margin-bottom: 2mm; }
  .panel-head h2, .tool-documentation h2, .print-inputs h2 { font-size: 13pt; }
  .headline-readings, .diagram, .detail-reading, .math-steps li { break-inside: avoid; }
  .diagram { width: min(100%, 132mm); }
  .diagram svg { max-height: 53mm; }
  .print-inputs { display: block; margin-top: 5mm; }
  .tool-documentation { margin-top: 5mm; }
  .method-section { margin-top: 5mm; }
  .tool-documentation h2, .print-inputs h2 { break-after: avoid; }
  .source-list { font-size: 9pt; }
  .reading, .diagram, .notice-list, .reference-note { print-color-adjust: exact; }
}
