/* HabitatCalculator — deep teal, leaf green and warm sand. */
:root {
  --ink: #17282a; --muted: #55686a; --teal: #12393b; --teal2: #1d5558; --leaf: #3f8f4f; --leaf2: #e3f1e2;
  --sand: #f6f1e7; --sand2: #ece3d0; --line: #d9d0bd; --card: #fffdf8; --warm: #c8682b; --link: #1b6a6e;
  --r: 12px; --shadow: 0 1px 2px rgba(18, 57, 59, .08), 0 4px 14px rgba(18, 57, 59, .06);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--sand); color: var(--ink); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-wrap: break-word; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--teal); }
h1, h2, h3 { line-height: 1.25; color: var(--teal); font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.35rem); margin: .4rem 0 .5rem; }
h2 { font-size: 1.35rem; margin: 0 0 .7rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: var(--teal); color: #fff; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-size: 1.15rem; letter-spacing: .2px; }
.brand b { color: #a9dba0; font-weight: 700; }
.brand img { border-radius: 7px; }
.top nav { display: flex; flex-wrap: wrap; gap: 2px 4px; font-size: .9rem; }
.top nav a { color: #d7ecea; text-decoration: none; padding: 4px 8px; border-radius: 6px; }
.top nav a:hover, .top nav a[aria-current] { background: var(--teal2); color: #fff; }

main.wrap { padding-bottom: 32px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-top: 14px; }
.crumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--line); }
.lede { font-size: 1.07rem; color: #2e4446; max-width: 760px; margin: 0 0 18px; }

/* panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0 0 18px; box-shadow: var(--shadow); min-width: 0; }
.calc-panel { border-top: 5px solid var(--leaf); }
.note { font-size: .88rem; color: var(--muted); }
.big { font-size: 1.1rem; font-weight: 500; }
.big b { color: var(--teal); }
.by { display: block; font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; font-size: .7rem; line-height: 1.3; padding: 1px 6px; margin-left: 4px; border-radius: 99px; background: var(--sand2); color: #6b5530; vertical-align: 1px; white-space: nowrap; }

/* calculator form */
.calc .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.dyn { display: contents; }
.calc label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--teal); min-width: 0; }
.calc label[hidden], .calc [hidden] { display: none; }
.calc input, .calc select { font: inherit; font-weight: 400; color: var(--ink); width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid #b9b09b; border-radius: 8px; background: #fff; }
.calc input:focus, .calc select:focus { outline: 3px solid rgba(63, 143, 79, .35); border-color: var(--leaf); }
.fixed { display: none !important; }

/* results */
.results { min-width: 0; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 12px; }
.totals > div { background: var(--leaf2); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.totals > div.main { background: var(--teal); color: #fff; }
.totals span { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; opacity: .85; }
.totals b { display: block; font-size: 1.35rem; line-height: 1.3; margin: 2px 0 4px; }
.totals small { display: block; font-size: .8rem; line-height: 1.4; }
.totals .main a { color: #bfe6b8; }
.envgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.envgrid > div { border: 1px solid var(--line); border-left: 4px solid var(--warm); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
.envgrid span { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.envgrid b { display: block; font-size: 1.02rem; color: var(--ink); }
.envgrid small { display: block; font-size: .76rem; color: var(--muted); line-height: 1.4; }
.calcline { font-size: .9rem; color: var(--muted); margin: 6px 0; }
.dl { list-style: none; padding: 0; margin: 0 0 12px; }
.dl li { display: grid; grid-template-columns: minmax(90px, 150px) 1fr; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--sand2); }
.dl li b { color: var(--teal); }
.dl li span { min-width: 0; }
.who { margin: 8px 0; }
.who summary, .faq summary { cursor: pointer; font-weight: 600; color: var(--teal); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.tools button, .share { font: inherit; font-size: .88rem; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--teal2); background: #fff; color: var(--teal); cursor: pointer; text-decoration: none; }
.tools button:hover, .share:hover { background: var(--leaf2); }

/* tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 12px; max-width: 100%; }
table.ref { border-collapse: collapse; width: 100%; font-size: .88rem; }
table.ref th, table.ref td { text-align: left; vertical-align: top; padding: 7px 9px; border-bottom: 1px solid var(--sand2); }
table.ref thead th { background: var(--teal); color: #fff; font-weight: 600; white-space: nowrap; }
table.ref tbody th { font-weight: 600; color: var(--teal); }
table.ref tbody tr:nth-child(even) { background: #faf6ec; }
table.chart td, table.chart th { min-width: 110px; }

/* lists, faq, sources */
.plain { padding-left: 1.2rem; margin: .3rem 0 .8rem; }
.plain li { margin: .3rem 0; }
.faq details { border-top: 1px solid var(--sand2); padding: 10px 0; }
.faq details p { margin: .5rem 0 0; }
.srcs { padding-left: 1.2rem; font-size: .88rem; }
.srcs li { margin: .35rem 0; }
.links { list-style: none; padding: 0; margin: .3rem 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.prose p, .prose li { max-width: 760px; }

/* species picker */
.picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.pick { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 16px; }
.pick h3 { margin-top: 0; }
.pick ul { list-style: none; padding: 0; margin: 0; }
.pick li { padding: 3px 0; }
.pick .links { flex-direction: column; gap: 0; }

/* shop cards */
.shop { border-top: 5px solid var(--warm); }
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 10px 0; }
.pcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink); transition: box-shadow .15s, transform .15s; min-width: 0; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
.pimg { display: flex; justify-content: center; padding: 10px; background: var(--sand); }
.pimg img { width: 96px; height: 96px; }
.pbody { padding: 8px 10px 10px; font-size: .85rem; line-height: 1.4; }
.pbody b { display: block; color: var(--teal); font-size: .92rem; margin-bottom: 2px; }
.pbody span { color: var(--muted); }
.pbody em { display: block; margin-top: 6px; font-style: normal; font-weight: 600; color: var(--warm); }

/* footer */
footer { background: var(--teal); color: #cfe3e1; font-size: .88rem; padding: 26px 0 18px; }
footer a { color: #e9f6f4; }
footer b { color: #fff; display: block; margin-bottom: 4px; }
.fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 12px; }
footer .links { flex-direction: column; gap: 3px; }

@media (max-width: 560px) {
  .panel { padding: 14px 12px; }
  .wrap { padding: 0 12px; }
  .dl li { grid-template-columns: 1fr; }
  .totals, .envgrid { grid-template-columns: 1fr; }
  .pcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pimg img { width: 72px; height: 72px; }
  .top nav { font-size: .82rem; }
}
@media print {
  .top nav, .shop, footer, .tools { display: none; }
  body { background: #fff; }
  .panel { box-shadow: none; border-color: #bbb; }
}
