/* Fish Tank Dimensions: one stylesheet for every page.
   Layout: a big calculator up top, then explainer bands, a tool grid and guides. */
:root {
  --paper: #f3f7f5;       /* cool off-white, aquarium glass in daylight */
  --surface: #ffffff;
  --ink: #14322d;         /* deep planted-tank green */
  --ink-soft: #4a655f;
  --line: #c9d8d3;
  --water: #4f9d92;
  --water-light: #d4eae4;
  --substrate: #a8702f;   /* gravel amber, used sparingly */
  --link: #1b6a5f;
  --focus: #a8702f;
  --shadow: 0 1px 2px rgba(20, 50, 45, .06), 0 8px 24px rgba(20, 50, 45, .08);
  --radius: 10px;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-head: "Familjen Grotesk", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1b19; --surface: #142623; --ink: #e0ede9; --ink-soft: #9db7b0; --line: #2b4741;
    --water: #3f8d83; --water-light: #1b3834; --substrate: #d9a05c; --link: #7fcfc1; --focus: #d9a05c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1b19; --surface: #142623; --ink: #e0ede9; --ink-soft: #9db7b0; --line: #2b4741;
  --water: #3f8d83; --water-light: #1b3834; --substrate: #d9a05c; --link: #7fcfc1; --focus: #d9a05c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.65 var(--font-body); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5vw, 3.3rem); font-weight: 700; margin: 0 0 .6rem; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); font-weight: 650; margin: 0 0 .8rem; }
h3 { font-size: 1.15rem; font-weight: 600; margin: 1.4rem 0 .4rem; }
p, ul, ol { margin: 0 0 1rem; }
a { color: var(--link); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--substrate); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: .5rem 1rem; z-index: 20; }

.wrap { width: 100%; max-width: 1120px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main { padding-block: 0 4rem; }

/* ---------- header ---------- */
.announce { background: var(--ink); color: var(--paper); font-size: .95rem; padding-block: .5rem; text-align: center; }
.announce a { color: inherit; }
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .7rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 40px; height: 28px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font: 700 1.15rem var(--font-head); }
.brand-tag { font-size: .82rem; color: var(--ink-soft); }
.site-nav { display: flex; gap: .25rem; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: .97rem; padding: .45rem .8rem; border-radius: 999px; }
.site-nav a:hover { background: var(--water-light); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.menu-btn { display: none; font: inherit; color: var(--ink); background: none; border: 1px solid var(--line);
  border-radius: 999px; padding: .4rem .9rem; cursor: pointer; }

/* ---------- breadcrumbs ---------- */
.crumbs { padding-top: 1.1rem; font-size: .9rem; color: var(--ink-soft); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; padding: 0; margin: 0; }
.crumbs li + li::before { content: "/"; margin-right: .3rem; color: var(--line); }

/* ---------- hero calculator ---------- */
.hero { padding-top: 2.2rem; }
.hero-sub, .answer-line { font-size: 1.2rem; max-width: 62ch; color: var(--ink-soft); }
.answer-line strong { color: var(--ink); white-space: nowrap; }
.tool { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 2.25rem; align-items: start;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 1.75rem; margin-top: 1.75rem; }
.tool .calc { margin: 0; }
.tool-visual { background: var(--paper); border-radius: var(--radius); padding: 1.25rem; min-width: 0; }
.tank-live { display: block; width: 100%; height: auto; max-height: 260px; margin: 0 auto 1rem; }
.formula { margin: 1.1rem 0 0; padding: .7rem .9rem; border-left: 3px solid var(--water); background: var(--paper);
  font: 600 1rem var(--font-head); border-radius: 0 var(--radius) var(--radius) 0; }

/* segmented controls */
.seg { display: flex; flex-wrap: wrap; gap: .4rem; border: 0; padding: 0; margin: 0 0 1.1rem; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border: 1px solid var(--line);
  border-radius: 999px; font-size: .95rem; cursor: pointer; background: var(--surface); }
.seg svg { width: 22px; height: 15px; fill: var(--water-light); stroke: var(--ink); stroke-width: 1.6; }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:checked + span svg { fill: var(--water); stroke: var(--paper); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg-small { margin: 0; }
.seg-small span { padding: .35rem .8rem; font-size: .9rem; }

/* fields */
.calc-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1rem; }
.calc-fields-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .93rem; font-weight: 700; }
.field-wide { grid-column: 1 / -1; }
input[type="number"], select { font: inherit; font-weight: 400; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; width: 100%; min-height: 46px; }
input[type="number"]:focus, select:focus { border-color: var(--water); outline: 2px solid var(--water-light); }
.calc-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 1.4rem; margin: 1.25rem 0 1.75rem; }
.calc-result { display: block; margin-top: 1.2rem; }
.tool .calc-result { margin-top: 0; }
.hint { color: var(--ink-soft); margin: 0; }
.big { margin: 0 0 .9rem; font-size: 1.1rem; }
.big-num { font: 700 2.9rem/1 var(--font-head); font-variant-numeric: tabular-nums; margin-right: .3rem; letter-spacing: -.02em; }
.res-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; margin: 0 0 .9rem; }
.res-grid div { border-top: 1px solid var(--line); padding-top: .45rem; }
.res-grid dt { font-size: .86rem; color: var(--ink-soft); }
.res-grid dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.near { font-weight: 700; margin: 0; }
.small { font-size: .92rem; color: var(--ink-soft); }

/* ---------- explainer bands ---------- */
.sections { display: flex; flex-direction: column; gap: 3.5rem; margin-top: 3.5rem; }
.band-text { max-width: 70ch; }
.band-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 2rem; align-items: center; }
.steps { padding-left: 1.4rem; }
.steps li { margin-bottom: .6rem; padding-left: .25rem; }
.example { background: var(--water-light); border-radius: var(--radius); padding: .9rem 1.1rem; }
.range-field { max-width: 420px; margin-bottom: 1rem; }
input[type="range"] { width: 100%; accent-color: var(--water); }
.fill-svg { width: 100%; height: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.t-level { stroke: var(--substrate); stroke-width: 2; stroke-dasharray: 5 4; }

.shape-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.shape-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.shape-card svg { width: 80px; height: 50px; }
.shape-card h3 { margin: .5rem 0 .2rem; }
.shape-card .f { font-size: .95rem; color: var(--ink-soft); }
.link-btn { font: inherit; font-weight: 700; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: .18em; }
.link-btn:hover { color: var(--substrate); }

.lineup-scroll { overflow-x: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 1.5rem 1.25rem 1rem; }
.lineup { display: block; min-width: 720px; width: 100%; height: auto; }
.lineup-tank .t-edge { stroke-width: 2.2; }
.lineup-tank:hover .t-water, .lineup-tank:focus .t-water { fill: var(--water); }
.lineup-name { fill: var(--ink); font: 700 15px var(--font-head); }
.lineup-dim { fill: var(--ink-soft); font: 400 13px var(--font-body); }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.tool-card { display: grid; grid-template-columns: 36px 1fr; gap: .1rem .8rem; align-content: start; padding: 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tool-card:hover { border-color: var(--water); color: var(--ink); }
.tool-card .icon { grid-row: span 2; width: 32px; height: 32px; color: var(--water); }
.tool-card-title { font: 650 1.05rem var(--font-head); }
.tool-card-text { font-size: .92rem; color: var(--ink-soft); }
.chips-head { margin-top: 2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }
.chips a { display: inline-block; padding: .4rem .85rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); text-decoration: none; font-size: .95rem; }
.chips a:hover { border-color: var(--water); }

.post-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.post-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.post-card h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.post-card h3 a { color: var(--ink); text-decoration: none; }
.post-card h3 a:hover { color: var(--link); text-decoration: underline; }
.post-card p { color: var(--ink-soft); font-size: .95rem; }
.post-meta { font-size: .88rem; color: var(--ink-soft); margin: 0; }

/* ---------- tank pages, articles ---------- */
.page-narrow { max-width: 820px; padding-top: 2rem; }
.page-tank, .page-post { padding-top: 1.5rem; }
.answer { margin-bottom: 1.5rem; }
.tank-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; align-items: center; margin-bottom: 2rem; }
.tank-hero-fig { margin: 0; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 1.25rem; }
.tank-drawing { display: block; width: 100%; height: auto; }
.metric { color: var(--ink-soft); white-space: nowrap; }
.lead { font-size: 1.1rem; }
.note { border-left: 3px solid var(--water); padding: .2rem 0 .2rem 1rem; color: var(--ink-soft); }
.with-toc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 3rem; align-items: start; }
.toc-col { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 1.25rem; }
.with-toc > .toc { position: sticky; top: 90px; }
.toc ul, .side-box ul { list-style: none; padding: 0; margin: 0; font-size: .93rem; }
.toc li, .side-box li { padding: .25rem 0; }
.toc a, .side-box a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover, .side-box a:hover { color: var(--link); text-decoration: underline; }
.toc-head { font: 650 .95rem var(--font-head); margin-bottom: .4rem; }
.article-body { max-width: 72ch; min-width: 0; }
.article-body > section, .article-body > h2 { margin-top: 2.5rem; }
.article-body > section:first-child { margin-top: 0; }
.article-body h2 { margin-top: 2.5rem; }
.updated { font-size: .9rem; color: var(--ink-soft); margin-top: 2rem; }
.post-head { max-width: 820px; margin-bottom: 1.5rem; }
.related { margin-top: 3.5rem; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.facts > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.facts dt { font-size: .86rem; color: var(--ink-soft); }
.facts dd { margin: .15rem 0 0; font: 700 1.2rem/1.3 var(--font-head); display: flex; flex-direction: column; }
.facts dd span { font: 400 .9rem var(--font-body); color: var(--ink-soft); }

.tank-drawing .t-water, .tank-live .t-water, .t-water { fill: var(--water-light); }
.t-water-top { fill: var(--water); opacity: .45; }
.t-water-side { fill: var(--water); opacity: .25; }
.t-sub { fill: var(--substrate); opacity: .5; }
.t-edge { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.t-dim path { stroke: var(--ink-soft); stroke-width: 1; fill: none; }
.t-dim text { fill: var(--ink-soft); font: 700 13px var(--font-body); }

.table-scroll { overflow-x: auto; margin-bottom: .5rem; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: .97rem; background: var(--surface); }
table.data caption { text-align: left; font-size: .9rem; color: var(--ink-soft); padding-bottom: .5rem; }
table.data th, table.data td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data thead th { background: var(--water-light); font-weight: 700; }
table.data tbody th { font-weight: 700; }

.products { background: var(--water-light); border-radius: var(--radius); padding: 1.1rem 1.3rem; }
.product-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: 0; list-style: none; }
.disclosure { font-size: .85rem; color: var(--ink-soft); }

.faq { margin-top: 3rem; }
.faq-item { border-bottom: 1px solid var(--line); padding: .85rem 0; }
.faq-item summary { cursor: pointer; font-weight: 700; list-style-position: outside; }
.faq-item p { margin: .5rem 0 0; }
.size-links { columns: 2; padding-left: 1.1rem; }
.prose { max-width: 72ch; }
.ad { margin: 2rem 0; min-height: 100px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 2.5rem 1.5rem; font-size: .95rem; color: var(--ink-soft); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { padding: .2rem 0; }
.footer-grid a { color: var(--ink-soft); text-decoration: none; }
.footer-grid a:hover { color: var(--link); text-decoration: underline; }
.footer-brand, .footer-head { font: 700 1rem var(--font-head); color: var(--ink); margin-bottom: .5rem; }
.copy { margin: 2rem 0 0; font-size: .88rem; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .tool, .tank-hero, .band-split { grid-template-columns: 1fr; }
  .with-toc { grid-template-columns: 1fr; gap: 1.5rem; }
  .with-toc > .toc, .toc-col { position: static; }
  .with-toc > .toc { display: none; }
  .calc-fields-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .menu-btn { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem max(16px, env(safe-area-inset-left, 0px)) 1rem; }
  .site-nav.open { display: flex; }
  .site-nav a { border-radius: 8px; padding: .7rem .8rem; }
  .brand-tag { display: none; }
  .tool { padding: 1rem; gap: 1.25rem; border-radius: 14px; }
  .calc-fields { grid-template-columns: 1fr; }
  .calc-fields-4 { grid-template-columns: 1fr 1fr; }
  .size-links { columns: 1; }
  .big-num { font-size: 2.4rem; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.page-narrow h2 { margin-top: 2.5rem; }
.page-narrow .answer + .calc-card, .page-narrow .answer + .table-scroll { margin-top: 0; }

/* ---------- full-width two-column bands ---------- */
.band-even { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: center; gap: 2.5rem; }
.band-split .band-text { max-width: none; }
.band-split > .calc-card { margin: 0; }
.fact-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); padding: 1.4rem 1.5rem; }
.fact-card h3 { margin: 0 0 .8rem; }
.conv-list { margin: 0; display: grid; gap: .55rem; }
.conv-list div { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; padding-bottom: .55rem; border-bottom: 1px solid var(--line); }
.conv-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.conv-list dt { font-weight: 700; }
.conv-list dd { margin: 0; color: var(--ink-soft); }
.calc-line { font-variant-numeric: tabular-nums; margin-bottom: .5rem; }
.worked { border-top: 4px solid var(--water); }

/* ---------- article layouts: contents | body | sidebar ---------- */
.with-toc { grid-template-columns: 200px minmax(0, 1fr) 260px; gap: 2.5rem; }
.article-body { max-width: none; }
.side-col { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 1rem; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.side-box ul { font-size: .95rem; }
.side-box a { color: var(--link); }
.side-facts { margin: 0; display: grid; gap: .5rem; font-size: .93rem; }
.side-facts dt { color: var(--ink-soft); }
.side-facts dd { margin: 0; font-weight: 700; }
.page-wide { padding-top: 2rem; }
.post-body p, .post-body li { max-width: 68ch; }
@media (max-width: 1100px) {
  .with-toc { grid-template-columns: 200px minmax(0, 1fr); }
  .side-col { grid-column: 2; position: static; }
}
@media (max-width: 900px) {
  .with-toc { grid-template-columns: 1fr; }
  .side-col { grid-column: auto; }
  .band-even { grid-template-columns: 1fr; }
}
.page-narrow { max-width: 1120px; }
.page-narrow p, .page-narrow li { max-width: 75ch; }
.site-nav a { white-space: nowrap; }
@media (max-width: 900px) {
  .menu-btn { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem max(16px, env(safe-area-inset-left, 0px)) 1rem; }
  .site-nav.open { display: flex; }
  .site-nav a { border-radius: 8px; padding: .7rem .8rem; }
}

/* ---------- hamburger menu (tablets and phones) ---------- */
.menu-btn { width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); align-items: center; justify-content: center; }
.bars { display: flex; flex-direction: column; gap: 5px; width: 20px; }
.bars span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .2s, opacity .2s; }
.menu-btn[aria-expanded="true"] .bars span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bars span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .bars span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .site-nav { box-shadow: var(--shadow); padding-block: .5rem 1rem; gap: .15rem; }
  .site-nav a { font-size: 1.05rem; padding: .8rem 1rem; }
  .site-nav a[aria-current="page"] { background: var(--water-light); color: var(--ink); font-weight: 700; }
}
@media (prefers-reduced-motion: reduce) { .bars span { transition: none; } }
