:root {
  color-scheme: light;
  font-family: system-ui, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  color: #183c35;
  background: #eef5f1;
  --green: #153f36;
  --muted: #4d6a62;
  --line: #d6e4dd;
  --paper: #fbfefa;
  --mint: #dbf4a9;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 18rem; }
a { color: inherit; text-underline-offset: .24em; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #548642; outline-offset: 3px; }

.shell { width: min(70rem, calc(100% - 3rem)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 1; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.875rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-size: 1rem; font-weight: 750; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 1.65rem; height: 1.65rem; background: var(--green); color: var(--mint); border-radius: .45rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: .15rem .35rem; }
.site-nav a { display: inline-block; padding: .45rem .6rem; font-size: .875rem; font-weight: 650; text-decoration: none; border-radius: .45rem; }
.site-nav a:hover { background: #e8f2eb; }

h1, h2, h3, p, dl, dd, pre { margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 4.3rem); line-height: 1.03; letter-spacing: -.055em; }
h3 { font-size: 1.2rem; line-height: 1.45; }
code { font-family: var(--mono); }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: clamp(1.5rem, 5vw, 4rem); padding-block: clamp(2rem, 5vw, 4.5rem); }
.hero-copy p { margin-top: .75rem; color: var(--muted); line-height: 1.7; }
.hero-copy .hero-lead { color: var(--green); font-weight: 740; font-size: clamp(1.15rem, 2.3vw, 1.55rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1.35rem; }
.button { display: inline-flex; align-items: center; min-height: 2.75rem; border: 1px solid #a2b9ad; border-radius: .5rem; padding: .45rem .95rem; font-weight: 680; text-decoration: none; background: var(--paper); }
.button:hover { background: #e0eee6; }
.button-primary { border-color: var(--green); color: #f8fff9; background: var(--green); }
.button-primary:hover { background: #24564a; }
.code-block { min-width: 0; overflow-wrap: anywhere; color: #f4fff8; background: #102f2a; border: 1px solid #204d43; border-radius: .75rem; padding: 1rem 1.15rem; font: .875rem/1.6 var(--mono); white-space: pre-wrap; }
.code-comment { color: #bddfca; }

.page-section { padding-block: 1.8rem 2.15rem; border-top: 1px solid var(--line); scroll-margin-top: 4.5rem; }
.section-title { margin-bottom: 1rem; font-size: clamp(1.45rem, 3vw, 1.9rem); line-height: 1.35; }
.section-copy, .section-description { color: var(--muted); line-height: 1.65; }
.section-copy .section-title { color: var(--green); }
.section-copy p + p, .section-copy p + pre { margin-top: .65rem; }
.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 1.2rem clamp(1.5rem, 5vw, 4rem); }
.docs-layout > .code-block { align-self: center; }

.api-list > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: .35rem 1.25rem; padding-block: .8rem; }
.api-list > div + div { border-top: 1px solid var(--line); }
.api-list > div:first-child { padding-top: 0; }
.api-list > div:last-child { padding-bottom: 0; }
.api-list dt { color: var(--green); overflow-wrap: anywhere; }
.api-list dd { color: var(--muted); font-size: .95rem; line-height: 1.55; font-weight: 400; text-align: start; }
.resource-link { margin-top: .9rem; }

.related-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: .85rem; margin: 1rem 0 0; padding: 0; }
.related-card { display: flex; flex-direction: column; gap: .6rem; overflow-wrap: anywhere; }
.related-card p { color: var(--muted); line-height: 1.55; }
.related-links { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-top: auto; padding-top: .2rem; font-weight: 650; font-size: .875rem; }

.amount-panel { display: grid; grid-template-columns: 1.25fr 1fr; background: var(--green); color: #f8fff9; border-radius: 1rem; }
.amount-fields, .parsed { min-width: 0; padding: 1.6rem; }
.amount-fields h3 { margin-bottom: .7rem; }
.amount-fields input { background: #f7fff6; border-color: transparent; font-size: 1.25rem; font-weight: 650; }
.amount-fields :focus-visible { outline-color: var(--mint); }
.examples { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .85rem; }
.examples button { color: #f0faed; background: #285449; border: 1px solid #608578; border-radius: 1.2rem; padding: .35rem .75rem; font-size: .875rem; }
.examples button:hover { background: #376d5e; }
.parsed { display: flex; flex-direction: column; justify-content: center; gap: .45rem; border-left: 1px solid #51736b; }
.parsed-label { color: #d5e9df; font-size: .875rem; font-weight: 650; }
.parsed output { color: var(--mint); font-size: clamp(1.5rem, 4.4vw, 3rem); font-weight: 760; line-height: 1.15; }
.parsed code { font-family: var(--mono); color: #d5e9df; overflow-wrap: anywhere; }

.cards { display: grid; grid-template-columns: 1fr 1.35fr; gap: 1rem; margin-top: 1rem; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 1rem; padding: 1.35rem 1.55rem; }
.card h3 { margin-bottom: .95rem; }
.related-card h3 { margin-bottom: 0; }
.results > div { display: flex; justify-content: space-between; align-items: baseline; gap: .65rem; border-top: 1px solid var(--line); padding: .7rem 0; }
.results > div:last-child { padding-bottom: 0; }
dt, .controls label, .split-heading label { color: var(--muted); font-size: .875rem; font-weight: 650; }
dt { flex-shrink: 0; }
dd, .parsed output, .share-amount { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
dd { min-width: 0; text-align: end; font-weight: 720; }

.controls { display: grid; grid-template-columns: 1fr .9fr 1.1fr; gap: .6rem; margin-bottom: 1rem; }
.controls label { min-width: 0; display: grid; gap: .35rem; }
input, select { min-width: 0; width: 100%; min-height: 2.55rem; padding: .48rem .65rem; color: var(--green); background-color: #fff; border: 1px solid #a2b9ad; border-radius: .45rem; }
select { appearance: none; padding-right: 1.7rem; background-image: linear-gradient(45deg, transparent 50%, #376254 50%), linear-gradient(135deg, #376254 50%, transparent 50%); background-position: right .75rem center, right .45rem center; background-size: .3rem .3rem; background-repeat: no-repeat; }
input[aria-invalid="true"] { border-color: #a33a34; }
.hint, .error { margin-top: .7rem; font-size: .875rem; line-height: 1.5; }
.hint { color: var(--muted); }
.error { color: #90352d; }
.amount-panel .error { color: #ffcfbc; }

.discount, .split { grid-column: 1 / -1; }
.discount .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; }
.split-heading h3 { margin-bottom: 0; }
.split-controls { display: flex; align-items: end; flex-wrap: wrap; gap: .6rem .85rem; }
.split-controls label { display: grid; min-width: 0; gap: .35rem; }
.split-controls input[type="number"] { width: 4.25rem; }
.shares { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .45rem; list-style: none; padding: 0; margin: .85rem 0; }
.shares li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .4rem .7rem; background: #e8f2eb; padding: .62rem .8rem; border-radius: .45rem; }
.share-label { color: var(--muted); font-size: .875rem; }
.share-amount { font-weight: 720; min-width: 0; }
.split-total dd { color: var(--green); }
.site-footer { background: var(--paper); border-top: 1px solid var(--line); }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .65rem 1.1rem; padding-block: 1.25rem; color: var(--muted); font-size: .875rem; line-height: 1.5; }

@media (max-width: 46rem) {
  .cards, .hero, .docs-layout, .api-list > div { grid-template-columns: 1fr; }
  .amount-panel { grid-template-columns: 1fr; }
  .parsed { border-left: 0; border-top: 1px solid #51736b; }
}

@media (max-width: 36rem) {
  .shell { width: calc(100% - 1.5rem); }
  .topbar { align-items: flex-start; flex-direction: column; justify-content: center; gap: .25rem; padding-block: .5rem; }
  .site-nav { gap: .15rem; margin-inline-start: -.38rem; }
  .site-nav a { padding-inline: .38rem; }
  .page-section { scroll-margin-top: 5.7rem; }
}

@media (max-width: 27rem) {
  .card, .parsed, .amount-fields { padding: 1rem; }
  .controls { grid-template-columns: 1fr 1fr; }
  .tax .controls label:last-child { grid-column: 1 / -1; }
}
