:root {
  color-scheme: light;
  --forest: #143628;
  --green: #15803d;
  --leaf: #a9d99c;
  --soil: #c25e28;
  --paper: #f7f9f5;
  --white: #fff;
  --ink: #18392b;
  --muted: #486154;
  --border: #d8e4d9;
  --wash: #edf4eb;
  --display: "Iowan Old Style", Palatino, "Book Antiqua", Georgia, serif;
  --body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1.5rem; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--body); }
[hidden] { display: none !important; }
a { color: var(--forest); text-underline-offset: .22em; }
a:hover { color: var(--green); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
:focus-visible { outline: 3px solid var(--soil); outline-offset: 3px; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2 { font-family: var(--display); color: var(--forest); font-weight: 600; }
h1 { font-size: clamp(2.4rem, 5.1vw, 4.65rem); line-height: 1; letter-spacing: -.042em; text-wrap: balance; }
h2 { font-size: clamp(1.85rem, 3.2vw, 2.75rem); line-height: 1.1; letter-spacing: -.027em; }
h3 { font-size: 1rem; line-height: 1.35; }
img, svg { display: block; max-width: 100%; }
.shell { max-width: 1320px; width: calc(100% - clamp(2rem, 8vw, 8rem)); margin-inline: auto; }
.skip { position: absolute; inset: .5rem auto auto .5rem; transform: translateY(-180%); background: white; padding: .6rem; z-index: 5; }
.skip:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--border); background: var(--paper); }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.45rem; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; gap: .55rem; font-size: 1.13rem; font-weight: 770; text-decoration: none; letter-spacing: -.035em; }
.brand img { border-radius: .42rem; }
.site-header nav, .site-footer nav { display: flex; align-items: center; gap: clamp(.9rem, 2.8vw, 2.5rem); }
.site-header nav a, .site-footer nav a { text-decoration: none; font-size: .91rem; font-weight: 600; }
.site-header nav a:hover, .site-footer nav a:hover { text-decoration: underline; }
.site-footer { border-top: 1px solid var(--border); }
.site-footer .footer-inner { min-height: 5.5rem; }

.hero { display: grid; grid-template-columns: minmax(0, .97fr) minmax(0, 1.05fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(2.75rem, 6.3vw, 5.4rem); }
.hero h1 { max-width: 12ch; text-wrap: pretty; }
.hero-copy > p:not(.local-note) { max-width: 36ch; margin-top: 1.35rem; font-size: clamp(1.05rem, 1.5vw, 1.23rem); color: var(--muted); }
.hero-actions, .related-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: 1.55rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem; border: 1px solid transparent; border-radius: .43rem; padding: .53rem .83rem; font-size: .91rem; font-weight: 690; line-height: 1.25; text-align: center; text-decoration: none; }
.button-primary { color: white; background: var(--green); border-color: var(--green); }
.button-primary:hover { color: white; background: #116632; border-color: #116632; }
.button-outline { color: var(--forest); background: var(--paper); border-color: var(--border); }
.button-outline:hover { color: var(--forest); background: var(--wash); border-color: #a9c2ab; }
.local-note { display: flex; gap: .45rem; align-items: center; margin-top: 1.05rem; color: var(--muted); font-size: .875rem; }
.local-note > span { width: .65rem; height: .65rem; border: 1px solid var(--green); background: #c2e4b9; border-radius: 50%; }

.hero-chart { background: var(--forest); color: #e9f7eb; padding: clamp(.7rem, 2vw, 1.35rem); border-radius: .7rem; border: 1px solid #244d38; box-shadow: 0 13px 28px #14362817; min-width: 0; }
.hero-chart-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .4rem 1rem; padding: .19rem .25rem .8rem; border-bottom: 1px solid #456a55; }
.hero-chart-header a { color: #f7fff4; font-size: 1.06rem; font-weight: 670; }
.hero-chart-header p { color: #c1dcc8; font-size: .85rem; }
.hero-chart-header output { color: #dbf3d9; font: 700 clamp(1.3rem, 2.3vw, 2rem)/1.1 var(--mono); }
.hero-chart-header output span { font-size: .85rem; }
.hero-chart-note { color: #c1dcc8; border-top: 1px solid #456a55; font-size: .87rem; padding: .65rem .25rem .12rem; }
.hero-plot { margin-block: .25rem; }
.hero-plot svg, .plot svg { width: 100%; height: auto; }
.heat-cell, .plant-point { cursor: pointer; }
.heat-cell:hover rect, .heat-cell:focus-visible rect { stroke: #143628; stroke-width: 3; }
.hero-plot .heat-cell:hover rect, .hero-plot .heat-cell:focus-visible rect { stroke: #fff; }
.plant-point:hover, .plant-point:focus-visible { stroke: var(--soil); stroke-width: 3; }

.tools { padding: .4rem 0 clamp(3rem, 6vw, 5.5rem); }
.section-heading { border-top: 1px solid var(--border); padding-top: 1.2rem; margin-bottom: 1.35rem; }
.section-heading p { color: var(--muted); margin-top: .35rem; }
.tool-grid { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin: 0; padding: 0; }
.tool-card { color: inherit; min-height: 100%; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--border); border-radius: .55rem; padding: 1.1rem; text-decoration: none; transition: background 130ms ease, border-color 130ms ease; }
.tool-card:hover { color: inherit; background: #f2f8ef; border-color: #8fba95; }
.tool-icon { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; background: #eaf4e9; color: var(--forest); border: 1px solid #dbe9da; border-radius: .45rem; margin-bottom: .85rem; }
.card-category { color: var(--muted); font-size: .85rem; font-weight: 610; }
.tool-card h3 { font: 640 1.25rem/1.12 var(--display); letter-spacing: -.015em; margin: .26rem 0 .38rem; }
.tool-card p { font-size: .88rem; color: var(--muted); }
.example-section { background: var(--wash); padding: clamp(2rem, 4vw, 3.6rem) 0 clamp(3rem, 5vw, 5rem); border-top: 1px solid var(--border); }
.example-section .section-heading { border-top: 0; padding-top: 0; }
.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .55rem .8rem; }
.example-grid details, .faq { background: white; border: 1px solid var(--border); border-radius: .5rem; }
.example-grid summary, .faq summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.example-grid summary { display: flex; align-items: center; gap: .55rem; min-height: 3.15rem; padding: .65rem .85rem; font-weight: 630; }
summary::after { content: "+"; color: #32664a; flex: 0 0 auto; font-size: 1.22rem; line-height: 1; }
details[open] > summary::after { content: "−"; }
.summary-icon { display: grid; place-items: center; color: var(--green); }
.summary-icon svg { width: 1.25rem; height: 1.25rem; }
.example-count { margin-inline-start: auto; color: var(--muted); font-size: .84rem; font-weight: 520; white-space: nowrap; }
.example-grid ul { list-style: none; padding: 0 .85rem .55rem; margin: 0; }
.example-grid li { border-top: 1px solid var(--border); padding: .53rem .16rem; line-height: 1.37; }

.detail-page { margin-bottom: clamp(3rem, 6.5vw, 6.5rem); }
.breadcrumbs { color: var(--muted); margin: 1.2rem 0 1.5rem; font-size: .86rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; list-style: none; gap: .25rem .55rem; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: "/"; color: #708778; margin-inline-end: .55rem; }
.breadcrumbs a { color: var(--muted); }
.page-intro { margin: 0 0 1.65rem; }
.page-intro h1 { font-size: clamp(2.04rem, 4.3vw, 3.78rem); max-width: 26ch; }
.page-intro > p { max-width: 70ch; color: var(--muted); margin-top: .85rem; font-size: 1.05rem; }
.notice { margin: 0 0 1rem; padding: .8rem 1rem; border: 1px solid #edc9b4; border-inline-start: .3rem solid var(--soil); border-radius: .35rem; background: #fbefe7; color: #542f20; }
.notice p { margin-top: .22rem; }
.instrument { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); align-items: start; gap: 1rem; }
.inputs-panel, .results-panel { min-width: 0; background: var(--white); border: 1px solid var(--border); border-radius: .6rem; }
.inputs-panel { padding: clamp(.8rem, 2.2vw, 1.5rem); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .55rem; padding-bottom: 1.1rem; }
.panel-heading h2, .result-top h2 { font: 680 1.2rem/1.15 var(--body); letter-spacing: -.02em; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: .16rem; max-width: 100%; background: var(--wash); border: 1px solid var(--border); border-radius: .42rem; padding: .18rem; }
.segmented button { border: 1px solid transparent; background: transparent; border-radius: .3rem; color: var(--forest); padding: .3rem .48rem; min-height: 2rem; font-size: .87rem; font-weight: 650; }
.segmented button:hover { background: #dfece0; }
.segmented button[aria-pressed="true"] { background: var(--white); border-color: #aac4ad; }
form { display: grid; gap: 1.1rem; }
fieldset { min-width: 0; padding: .5rem 0 0; margin: 0; border: 0; border-top: 1px solid var(--border); }
legend { color: var(--forest); font-size: .89rem; font-weight: 700; padding: 0 .5rem 0 0; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .75rem .65rem; }
.field { min-width: 0; }
.field label { display: block; margin: 0 0 .27rem; font-size: .88rem; font-weight: 600; }
.field input, .field select, .share-fallback input { width: 100%; min-width: 0; min-height: 2.65rem; color: var(--ink); background: #fcfdfa; border: 1px solid #b4c9b7; border-radius: .35rem; }
.field input, .share-fallback input { padding: .4rem .55rem; }
.field select { padding: .4rem 1.47rem .4rem .5rem; appearance: none; background-image: url('/hydrogrowlab/assets/chevron.svg'); background-repeat: no-repeat; background-position: right .5rem center; background-size: .7rem; }
.number-control { display: flex; align-items: stretch; min-width: 0; }
.number-control input { font-family: var(--mono); appearance: textfield; }
.number-control input::-webkit-inner-spin-button, .number-control input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.number-control input:has(+ span:not([hidden])) { border-start-end-radius: 0; border-end-end-radius: 0; }
.field-unit { display: grid; align-items: center; flex: 0 0 auto; white-space: nowrap; padding: .25rem .36rem; background: var(--wash); border: 1px solid #b4c9b7; border-inline-start: 0; border-start-end-radius: .35rem; border-end-end-radius: .35rem; color: var(--muted); font-size: .74rem; }
.field-help { font-size: .815rem; color: var(--muted); margin-top: .27rem; line-height: 1.35; }
.field [aria-invalid="true"] { border-color: #ac3e1d; }
.form-error { border-radius: .35rem; background: #fbefe7; color: #883618; padding: .55rem .68rem; font-size: .92rem; }
.reset-button { justify-self: start; }

.results-panel { overflow: clip; }
.result-top { color: white; background: var(--forest); padding: clamp(.95rem, 2.2vw, 1.48rem); }
.result-top h2 { color: #fff; margin-bottom: 1.05rem; padding-bottom: .72rem; border-bottom: 1px solid #496c56; }
.primary-name { color: #d8ebd9; font-size: .93rem; font-weight: 600; }
.primary-value { display: block; font: 720 clamp(1.9rem, 5vw, 3.4rem)/1.08 var(--mono); letter-spacing: -.055em; margin: .16rem 0 .35rem; overflow-wrap: anywhere; }
.primary-value .quantity-unit { color: #cbebc9; font-size: .36em; letter-spacing: 0; white-space: nowrap; }
.primary-summary { color: #d8ebd9; font-size: .91rem; }
.results-body { padding: clamp(.75rem, 2.2vw, 1.48rem); }
.result-table { margin-bottom: .95rem; }
.result-table > div { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: baseline; gap: .35rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
.result-table dt { color: var(--muted); font-size: .9rem; }
.result-table dd { color: var(--forest); font-family: var(--mono); font-size: .88rem; font-weight: 660; text-align: right; overflow-wrap: anywhere; }
.quantity-unit { font-weight: 550; }
.result-figure figcaption { margin-bottom: .6rem; }
.result-figure figcaption h3 { color: var(--forest); font-size: 1.04rem; }
.result-figure figcaption p, .point-note { color: var(--muted); font-size: .87rem; }
.pattern-buttons { margin-bottom: .5rem; }
.point-note { padding: .35rem .5rem 0; }
.plot { border: 1px solid var(--border); border-radius: .65rem; background: #f5f8f3; }
.tool-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .85rem; }
.tool-actions .button { padding-inline: .64rem; }
.action-status { font-size: .88rem; color: var(--muted); margin-top: .5rem; }
.share-fallback { display: block; font-weight: 600; margin-top: .6rem; }
.share-fallback input { display: block; font-size: .875rem; }
.print-settings { display: none; }

.method-block, .reference-grid, .related, .guide-takeaway { margin-top: clamp(1.7rem, 3.3vw, 3rem); padding-top: 1.2rem; border-top: 1px solid var(--border); }
.method-block h2, .reference-grid h2, .related h2, .guide-takeaway h2 { font-size: clamp(1.55rem, 2.5vw, 2.24rem); }
.calculation-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.9rem; margin: .6rem 0 0; padding-left: 1.35rem; }
.calculation-steps li { padding: .55rem 0; }
.calculation-steps li::marker { color: var(--green); font-family: var(--mono); font-weight: 670; }
.calculation-steps p { color: var(--muted); overflow-wrap: anywhere; }
.empty-message { color: var(--muted); margin-top: .5rem; }
.guide-takeaway { background: var(--wash); border: 1px solid var(--border); border-left: .28rem solid var(--green); border-radius: .4rem; padding: 1.05rem 1.2rem; }
.guide-takeaway p { margin-top: .5rem; max-width: 78ch; }
.reference-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(1.1rem, 4vw, 3rem); }
.method-copy p, .prose p { margin-top: .6rem; color: var(--muted); }
.method-copy h3 { margin-top: .85rem; }
.method-copy ul, .related ul { padding-left: 1.15rem; margin: .48rem 0 0; }
.method-copy li, .related li { margin-bottom: .34rem; }
.faq-section h2 { margin-bottom: .7rem; }
.faq + .faq { margin-top: .45rem; }
.faq summary { display: flex; justify-content: space-between; padding: .7rem .8rem; gap: .8rem; font-weight: 650; line-height: 1.35; }
.faq p { padding: 0 .8rem .8rem; color: var(--muted); line-height: 1.46; }
.related p { margin-top: .9rem; }
.information-page { min-height: 62vh; }
.information-page .page-intro:first-child { margin-top: 3rem; }
.prose { max-width: 71ch; }
.prose section { padding-top: 1.05rem; margin: 0 0 1rem; border-top: 1px solid var(--border); }
.prose > p { margin-top: 1.4rem; }
.prose h2 { font-size: clamp(1.55rem, 2.3vw, 2rem); }

@media (max-width: 1080px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .hero { gap: 1.35rem; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .instrument { gap: .65rem; }
  .field-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .hero, .instrument, .reference-grid { grid-template-columns: 1fr; }
  .hero { gap: 1.35rem; padding-block: 2.3rem; }
  .hero h1 { max-width: 13ch; }
  .hero-copy > p:not(.local-note) { margin-top: .82rem; }
  .hero-actions { margin-top: 1.05rem; }
  .hero-chart { max-width: 550px; }
  .header-inner, .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: .55rem; min-height: auto; padding-block: .7rem; }
  .site-header nav, .site-footer nav { gap: .9rem; flex-wrap: wrap; }
  .example-grid, .calculation-steps { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breadcrumbs { margin: .85rem 0 1rem; }
}
@media (max-width: 455px) {
  .tool-grid { gap: .45rem; }
  .tool-card { padding: .72rem; }
  .tool-card h3 { font-size: 1.12rem; }
  .tool-card p { font-size: .84rem; }
  .field select { font-size: .9rem; }
  .field:has(select:is([name="glazingType"], [name="layout"], [name="mix"], [name="shape"])) { grid-column: 1 / -1; }
  .field-unit { font-size: .68rem; padding-inline: .26rem; }
  .instrument .button { min-height: 2.75rem; }
}
@media (max-width: 350px) {
  .field-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@page { margin: 13mm; }
@media print {
  body { background: white; font-size: 10pt; color: black; }
  .shell { width: 100%; margin: 0; }
  .site-header, .site-footer, .skip, .breadcrumbs, .tool-actions, .action-status, .share-fallback,
  .inputs-panel, .pattern-buttons, .reference-grid, .related, .guide-takeaway { display: none !important; }
  .page-intro { margin: 0 0 8pt; }
  .page-intro h1 { max-width: none; font-size: 23pt; }
  .page-intro p { font-size: 10pt; }
  .notice { font-size: 9pt; break-inside: avoid; }
  .instrument { display: block; }
  .results-panel { overflow: visible; border: 0; }
  .result-top { background: none; color: var(--forest); border: 1pt solid var(--border); padding: 5pt 8pt; }
  .result-top h2 { display: none; }
  .primary-name, .primary-summary, .primary-value .quantity-unit { color: var(--forest); }
  .primary-value { font-size: 22pt; }
  .results-body { padding: 5pt 0; }
  .result-table > div { padding-block: 2.5pt; break-inside: avoid; }
  .result-table dt, .result-table dd { font-size: 9pt; }
  .result-figure, .print-settings .result-table { break-inside: avoid; }
  .result-figure { max-width: 115mm; }
  .print-settings { display: block; margin-top: 6pt; }
  .method-block { margin-top: 6pt; }
  .print-settings h2, .method-block h2 { font-size: 16pt; }
  .calculation-steps { display: block; }
  .calculation-steps li { break-inside: avoid; padding-block: 2pt; }
}
