:root {
  color-scheme: light;
  --canvas: #f8fafc;
  --white: #fff;
  --ink: #0f172a;
  --text: #334155;
  --muted: #516078;
  --line: #d7e1ee;
  --blue: #0284c7;
  --blue-text: #075985;
  --green: #059669;
  --display: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 1rem/1.55 var(--body); }
main { min-width: 0; }
svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--display); line-height: 1.12; margin: 0; }
p { margin: 0; }
a { color: var(--blue-text); text-underline-offset: 0.2em; }
a:hover { color: #07426b; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
::selection { background: #c0e9fd; color: var(--ink); }
.shell { width: min(1190px, calc(100% - clamp(32px, 7vw, 88px))); margin-inline: auto; }
.skip-link { position: absolute; left: 1rem; top: -6rem; z-index: 10; padding: .75rem; background: white; }
.skip-link:focus { top: .65rem; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.masthead, .footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.masthead { min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); font: 700 1.36rem/1 var(--display); letter-spacing: -.055em; text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 37px; height: 37px; }
.brand-kit { color: var(--blue-text); }
.masthead nav, .footer-inner nav { display: flex; flex-wrap: wrap; gap: clamp(.85rem, 3vw, 2.3rem); }
.masthead nav a, .footer-inner nav a { color: var(--text); font-size: .88rem; font-weight: 630; text-decoration: none; padding: .45rem 0; }
.masthead nav a:hover, .footer-inner nav a:hover { color: var(--blue-text); text-decoration: underline; }
.site-footer { border-top: 1px solid var(--line); background: var(--white); padding: 2.1rem 0 2.5rem; }
.footer-inner { flex-wrap: wrap; align-items: flex-start; }
.footer-inner p { color: var(--muted); font-size: .84rem; margin-top: .7rem; }

.home-hero {
  background: #f0f6fb;
  background-image: linear-gradient(90deg, #f0f6fb 36%, transparent 100%),
    linear-gradient(#dce7f3 1px, transparent 1px), linear-gradient(90deg, #dce7f3 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  border-bottom: 1px solid var(--line);
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(2.5rem, 6vw, 5.5rem);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); align-items: center; gap: clamp(1.8rem, 4vw, 4.5rem); }
.hero-copy h1 { font-size: clamp(2.3rem, 4.15vw, 3.85rem); letter-spacing: -.056em; font-weight: 650; }
.hero-copy h1 span { color: var(--blue-text); }
.hero-copy p { max-width: 42ch; margin-top: 1.1rem; color: var(--text); font-size: clamp(1.02rem, 1.75vw, 1.23rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem 1.1rem; align-items: center; margin-top: 1.5rem; }
.button { display: inline-flex; gap: .55rem; justify-content: center; align-items: center; min-height: 42px; padding: .65rem .9rem; text-decoration: none; border: 1px solid transparent; border-radius: 6px; line-height: 1.2; font-size: .87rem; font-weight: 680; }
.button-primary { background: var(--ink); color: var(--white); }
.button-primary:hover { background: #183455; color: var(--white); }
.button-secondary { background: var(--white); border-color: var(--line); color: var(--blue-text); }
.button-secondary:hover:not(:disabled) { border-color: #7ab9dd; background: #eef8ff; }
.secondary-link { display: inline-flex; align-items: baseline; gap: .45rem; font-size: .89rem; font-weight: 700; text-decoration: none; }
.secondary-link:hover { text-decoration: underline; }
.link-arrow { font-family: var(--mono); font-weight: 650; color: var(--blue-text); }
.button-primary .link-arrow { color: #86dcff; }
.hero-instrument { min-width: 0; border: 1px solid #34445d; background: var(--ink); border-radius: 14px; box-shadow: 0 18px 42px #152b4a27; }
.hero-readings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 1px solid #34445d; color: #f8fafc; }
.hero-readings > div { padding: .78rem 1.1rem .95rem; min-width: 0; }
.hero-readings > div + div { border-left: 1px solid #34445d; }
.hero-readings dt { color: #bcc9dd; font-size: .76rem; line-height: 1.35; }
.hero-readings dd { font: 650 clamp(1rem, 2vw, 1.4rem)/1.2 var(--mono); margin: .35rem 0 0; }
.hero-readings > div:last-child dd { color: #6ee7b7; }

.tool-index { padding-block: clamp(2.7rem, 5vw, 4.4rem); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .7rem 1.4rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.section-heading h2 { font-size: clamp(1.75rem, 3vw, 2.65rem); letter-spacing: -.052em; }
.section-heading p { color: var(--muted); font-size: .94rem; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.tool-card { display: block; min-width: 0; padding: 1rem; background: var(--white); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); text-decoration: none; transition: background-color .15s, border-color .15s; }
.tool-card:hover { color: var(--ink); border-color: #83bddd; background: #f4faff; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.card-top svg { width: 38px; height: 38px; padding: 7px; color: #075985; border-radius: 6px; background: #e0f2fe; }
.card-top span { color: var(--muted); font-size: .78rem; }
.tool-card h3 { display: flex; gap: .4rem; align-items: baseline; justify-content: space-between; font-size: 1.05rem; font-weight: 680; }
.tool-card p { margin-top: .55rem; color: var(--muted); font-size: .86rem; }
.examples-index { background: #edf3f9; border-top: 1px solid var(--line); padding-block: clamp(2.5rem, 5vw, 4rem); }
.example-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.7rem 1.3rem; }
.example-grid h3 { padding-bottom: .56rem; border-bottom: 2px solid #93bed9; font-size: 1.04rem; }
.guide-links { padding: 0; list-style: none; margin: 0; }
.guide-links li { border-bottom: 1px solid var(--line); }
.guide-links a { display: flex; align-items: baseline; justify-content: space-between; gap: .45rem; padding: .57rem 0; font-size: .86rem; line-height: 1.37; text-decoration: none; }
.guide-links a:hover { text-decoration: underline; }

.tool-page, .info-page { padding-block: 1.45rem clamp(2.5rem, 6vw, 5rem); }
.info-page { min-height: 63vh; }
.breadcrumb ol { display: flex; align-items: baseline; flex-wrap: wrap; gap: .22rem .5rem; padding: 0; list-style: none; margin: 0 0 1.3rem; color: var(--muted); font-size: .81rem; }
.breadcrumb li + li::before { content: "/"; color: #76899e; margin-right: .5rem; }
.page-lead { margin-bottom: 1.55rem; }
.page-lead h1 { max-width: 24ch; font-size: clamp(2rem, 4.15vw, 3.6rem); font-weight: 650; letter-spacing: -.045em; overflow-wrap: anywhere; }
.page-lead p { color: var(--muted); margin-top: .65rem; max-width: 75ch; font-size: clamp(.97rem, 1.5vw, 1.12rem); }
.page-lead .secondary-link { margin-top: .75rem; }
.page-lead .http-code { font: 700 clamp(2.1rem, 8vw, 4rem)/1 var(--mono); color: var(--blue-text); margin: 0 0 .7rem; }
.missing-page { padding-top: clamp(3rem, 8vw, 7rem); }
.worked-steps { margin-bottom: 1.25rem; padding: 1rem 1.15rem; background: #ecf7fe; border: 1px solid #c4e2f3; border-left: 4px solid var(--blue); border-radius: 7px; }
.worked-steps h2 { font-size: 1.14rem; }
.worked-steps ol { color: var(--text); font-size: .9rem; padding-left: 1.35rem; margin: .45rem 0 0; }
.worked-steps li { padding-left: .18rem; }
.worked-steps li + li { margin-top: .35rem; }
.worked-steps li::marker { font: 650 .84rem var(--mono); color: var(--blue-text); }

.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1rem; align-items: start; }
.inputs-panel, .results-panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: 11px; padding: clamp(.85rem, 2vw, 1.35rem); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .85rem; }
#results-heading { scroll-margin-block-start: 12px; }
.panel-heading h2 { font-size: 1.3rem; font-weight: 680; letter-spacing: -.035em; }
.input-actions { display: flex; align-items: center; gap: .55rem; }
.mobile-jump { display: none; }
.text-button { border: 0; background: transparent; border-radius: 3px; color: var(--blue-text); padding: .25rem .35rem; font-weight: 690; font-size: .85rem; }
.text-button:hover:not(:disabled) { background: #edf8ff; }
.field, .paired-fields, .cron-pieces { margin: 0 0 .85rem; min-width: 0; }
.field label, .share-box label { display: block; font-size: .81rem; font-weight: 670; margin-bottom: .3rem; }
.field input, .field select, .field textarea, .share-box input, .cron-pieces input {
  display: block; width: 100%; min-width: 0; color: var(--ink); background: #f8fafc; border: 1px solid #bccbdf; border-radius: 5px;
  padding: .57rem .62rem; font: 500 .86rem/1.33 var(--mono);
}
.field select { font-family: var(--body); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .share-box input:focus, .cron-pieces input:focus { border-color: var(--blue); }
.field small, .share-box small { display: block; margin-top: .35rem; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.field-pair .field { margin-bottom: 0; }
.paired-fields, .cron-pieces { border: 0; padding: 0; }
.paired-fields legend, .cron-pieces legend { color: var(--muted); font-weight: 680; font-size: .77rem; margin: 0 0 .37rem; padding: 0; }
.field-pair > .field:only-of-type, .field-pair:has(> .field[hidden]) > .field:not([hidden]) { grid-column: 1 / -1; }
.cron-piece-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.cron-pieces label { font-size: .75rem; color: var(--text); font-weight: 630; }
.cron-pieces input { margin-top: .2rem; }
.helper-action { margin-top: .15rem; }
.local-note { display: flex; gap: .45rem; align-items: center; color: var(--muted); margin-top: 1rem; font-size: .78rem; }
.local-note span { display: block; width: .47rem; height: .47rem; border-radius: 100%; background: var(--green); }
.share-box { padding: .65rem; margin: 0 0 .7rem; border-radius: 7px; background: #eff7fd; }
.status { font-size: .83rem; color: #065f46; margin: 0 0 .65rem; }
.status:empty { display: none; }
.status.error, .notice { color: #7f2d12; border: 1px solid #fdcc9a; background: #fff7ed; padding: .7rem .8rem; border-radius: 6px; }
.notice { font-size: .86rem; margin: 0 0 .75rem; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; margin: 0 0 .8rem; }
.metric { background: #edf5fb; border: 1px solid #d6e6f3; padding: .67rem .72rem; border-radius: 7px; min-width: 0; }
.metric:first-child { background: #eaf7f2; border-color: #cde9df; }
.metric dt { color: var(--muted); font-size: .76rem; font-weight: 650; line-height: 1.3; }
.metric dd { margin: .29rem 0 0; }
.metric-value { font: 650 clamp(.88rem, 1.45vw, 1.25rem)/1.27 var(--mono); overflow-wrap: anywhere; }
.metric-detail { color: var(--muted); font-size: .77rem; font-family: var(--mono); }

.plot { margin: 0 0 .85rem; overflow: hidden; min-width: 0; background: var(--ink); border-radius: 9px; color: #f8fafc; }
.plot-top { display: flex; align-items: center; gap: .55rem; padding: .82rem .9rem 0; }
.plot-top h2, .plot-top h3 { color: #e3edf9; font: 620 .82rem/1.25 var(--mono); }
.plot-glyph { width: .62rem; height: .62rem; border: 1px solid #7dd3fc; border-radius: 2px; transform: rotate(45deg); flex: none; }
.plot > svg { width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: .35rem .85rem; margin: 0; padding: 0 .9rem .58rem; list-style: none; }
.legend li { min-width: 0; display: flex; align-items: baseline; gap: .4rem; font: 500 .73rem/1.42 var(--mono); color: #d6e2f1; overflow-wrap: anywhere; }
.dot { width: .56rem; height: .56rem; display: inline-block; flex: 0 0 .56rem; border-radius: 2px; background: #455571; }
.dot-cyan { background: #38bdf8; }
.dot-emerald { background: #34d399; }
.dot-purple { background: #a5b4fc; }
.dot-amber { background: #fbbf24; }
.dot-rose { background: #f9a8d4; }
.dot-teal { background: #5eead4; }
.plot figcaption { border-top: 1px solid #34445d; color: #bcc9dd; padding: .53rem .9rem .7rem; font-size: .76rem; line-height: 1.46; }
.hero-plot { margin: 0; border-radius: 14px 14px 0 0; }
.hero-plot .plot-top { padding: 1.05rem 1.1rem .15rem; }
.hero-plot .legend { padding-inline: 1.1rem; padding-bottom: .85rem; }
.hero-plot figcaption { display: none; }
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: .6rem; align-items: baseline; padding: .42rem .05rem; border-bottom: 1px solid #e4ebf3; }
.facts dt { font-weight: 650; color: var(--muted); font-size: .81rem; }
.facts dd { margin: 0; font: 500 .81rem/1.4 var(--mono); overflow-wrap: anywhere; }
table { width: 100%; margin-top: 1.1rem; border-collapse: collapse; table-layout: fixed; text-align: left; font-size: .79rem; }
caption { caption-side: top; text-align: left; color: var(--ink); padding: 0 0 .42rem; font: 730 1rem/1.2 var(--display); }
th { background: #eff5fb; color: var(--text); font-weight: 690; }
th, td { border-bottom: 1px solid #e0e8f2; padding: .43rem .37rem; vertical-align: top; overflow-wrap: anywhere; }
td { font-family: var(--mono); }
tbody tr:nth-child(even) { background: #fafcff; }
.export-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .95rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.export-bar .button { padding: .5rem .68rem; font-size: .77rem; min-height: 37px; }

.reading-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(1.2rem, 4vw, 3.4rem); padding-top: 1.8rem; }
.doc-section + .doc-section { margin-top: 1.55rem; }
.doc-section h2, .related h2 { font-size: 1.24rem; letter-spacing: -.03em; margin-bottom: .6rem; }
.doc-section h3 { color: var(--text); font-size: .98rem; margin-top: .8rem; }
.doc-section p { color: var(--text); margin-top: .35rem; font-size: .91rem; line-height: 1.62; }
.faq-section details { border-bottom: 1px solid var(--line); padding: .53rem 0; }
.faq-section summary { cursor: pointer; font-weight: 650; font-size: .91rem; }
.faq-section details p { margin-left: 1rem; font-size: .86rem; }
.sources ul { padding: 0; margin: 0; list-style: none; }
.sources li { margin: .15rem 0; font-size: .85rem; }
.related { min-width: 0; padding: .85rem 1rem; align-self: start; background: #edf4fb; border: 1px solid var(--line); border-radius: 8px; }
.related .secondary-link { margin-top: .7rem; }
.info-content { max-width: 72ch; }
.info-content .button { margin-top: 1.35rem; }

@media (max-width: 980px) {
  .hero-grid { gap: 1.5rem; }
  .tool-grid, .example-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .hero-grid, .workbench, .reading-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-instrument { max-width: 620px; }
  .mobile-jump { display: inline; color: var(--blue-text); font-size: .82rem; font-weight: 650; }
  .home-hero { background-image: linear-gradient(#dce7f3 1px, transparent 1px), linear-gradient(90deg, #dce7f3 1px, transparent 1px); background-size: 28px 28px; }
  .tool-page, .info-page { padding-top: 1.1rem; }
  .shell { width: calc(100% - 32px); }
}

@media (max-width: 500px) {
  .masthead { min-height: 0; display: grid; gap: .3rem; padding-block: .67rem .42rem; }
  .masthead nav { gap: .95rem; }
  .masthead nav a { font-size: .79rem; }
  .brand { font-size: 1.27rem; }
  .brand-mark { width: 33px; height: 33px; }
  .hero-copy h1 { font-size: clamp(1.85rem, 9.9vw, 2.85rem); }
  .hero-actions { margin-top: 1.08rem; }
  .hero-readings > div { padding: .65rem .6rem; }
  .hero-readings dt { font-size: .69rem; }
  .tool-card { padding: .8rem; }
  .tool-card h3 { font-size: .94rem; }
  .tool-card p, .guide-links a { font-size: .78rem; }
  .example-grid { gap: 1.25rem .85rem; }
  .example-grid h3 { font-size: .91rem; }
  .metric { padding: .56rem .43rem; }
  .metrics { gap: .36rem; }
  .metric dt { font-size: .68rem; }
  .metric-value { font-size: .83rem; }
  .plot-top { padding-inline: .69rem; }
  .legend, .plot figcaption { padding-inline: .69rem; }
  .legend li { font-size: .68rem; }
  .facts div { gap: .42rem; }
  .facts dt, .facts dd { font-size: .75rem; }
  table, caption, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .4rem .46rem; border: 1px solid var(--line); border-radius: 5px; margin-bottom: .35rem; gap: .25rem .45rem; }
  td { border: 0; padding: 0; }
  td::before { content: attr(data-label); display: block; color: var(--muted); font: 650 .69rem/1.3 var(--body); margin-bottom: .14rem; }
  td:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@page { margin: 12mm; }
@media print {
  body { color: #000; background: #fff; font-size: 10pt; }
  .site-header, .site-footer, .breadcrumb, .skip-link, .inputs-panel, .export-bar, .text-button, .share-box, .status,
  .reading-grid, .page-lead .secondary-link, .hero-actions, .mobile-jump { display: none !important; }
  .shell { width: 100%; }
  .tool-page, .info-page { padding-block: 0; }
  .page-lead { margin-bottom: .8rem; }
  .page-lead h1 { font-size: 24pt; max-width: none; }
  .page-lead p { font-size: 10pt; }
  .workbench, .results-panel { display: block; padding: 0; border: 0; }
  .plot { break-inside: avoid; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .plot > svg { max-height: 172px; }
  .metrics, .worked-steps, .facts div { break-inside: avoid; }
  .worked-steps { margin: .4rem 0 .8rem; padding: .55rem; }
  caption { break-after: avoid; }
  tr { break-inside: avoid; }
}
