/* =========================================================================
   Ecologic Spray Foam — Building Science cluster supplemental stylesheet
   Loads AFTER /css/main.css. Provides only the components main.css doesn't
   already define (compare-grid, callout, related-grid, team-grid,
   wall-diagram, rvalue-calc, page-grid/toc sidebar, page-hero-eco banner).
   Tokens below alias main.css's design-system variables so colors/fonts
   stay consistent site-wide without redefining them. Header, footer, hero,
   FAQ and byline markup on these pages now reuse main.css's own classes
   directly (site-header, site-footer, page-hero, faq/faq-body, byline) —
   see building-science pages for the canonical markup.
   ========================================================================= */

:root {
  /* Aliases onto main.css's tokens — keeps this file's class names stable
     while inheriting the primary site's actual palette. --font-display,
     --font-body and --muted are intentionally NOT redeclared here so they
     fall through to main.css's :root values (Archivo / IBM Plex Mono). */
  --forest: var(--text);
  --leaf: var(--accent);
  --leaf-light: var(--alt);
  --navy: var(--text);
  --bbb-blue: var(--primary-2);
  --ink: var(--text);
  --line: var(--border);
  --paper: var(--surface);
  --paper-alt: var(--alt);
  --warn-bg: rgba(224, 138, 30, 0.08);
  --warn-border: var(--accent);
  --radius: var(--r-md);
  --max: var(--w-prose);
  --max-wide: var(--w-content);
}

.visually-hidden { position:absolute; width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0); white-space:nowrap; }

/* ---------- Page hero (interior pages, this cluster only) ----------
   Renamed from the old .hero to avoid colliding with main.css's
   homepage-only .hero (which sets a much larger --text-hero size). */
.page-hero-eco { max-width: var(--max-wide); margin: 0 auto; padding: 28px 24px 8px; }
.page-hero-eco__eyebrow {
  display: inline-block; background: var(--leaf-light); color: var(--accent); font-weight: 700;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 100px; margin-bottom: 14px;
}
.page-hero-eco__dek { font-size: 1.2rem; color: var(--text-2); max-width: 68ch; }
.page-hero-eco__meta { font-size: 0.85rem; color: var(--muted); margin-top: 10px; font-family: var(--font-mono); }

/* ---------- Breadcrumb (this cluster's own; main.css's is .breadcrumbs,
   different name, no collision) ---------- */
.breadcrumb { max-width: var(--max-wide); margin: 14px auto 0; padding: 0 24px; font-size: 0.85rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-2); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumb li::after { content: "/"; margin-left: 6px; color: var(--line); }
.breadcrumb li:last-child::after { content: ""; }

/* ---------- Layout: two-column body with sticky "on this page" ---------- */
.page-grid {
  max-width: var(--max-wide); margin: 0 auto; padding: 8px 24px 60px;
  display: grid; grid-template-columns: minmax(0, var(--max)) 260px; gap: 48px;
}
@media (max-width: 900px) { .page-grid { grid-template-columns: 1fr; } .toc { display: none; } }
article.prose { min-width: 0; }
article.prose > *:first-child { margin-top: 0; }

/* ---------- Jump nav / ToC sidebar (main.css's .jump-nav is an inline,
   single-column box; this is the sticky sidebar variant used across the
   building-science cluster) ---------- */
.toc {
  position: sticky; top: 24px; align-self: start; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; background: var(--paper-alt); font-size: 0.9rem;
}
.toc h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; font-family: var(--font-mono); font-weight: 700;}
.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: toc; }
.toc li { margin-bottom: 8px; counter-increment: toc; }
.toc a { text-decoration: none; color: var(--text); }
.toc a:hover { color: var(--primary-2); }
.toc a::before { content: counter(toc) ". "; color: var(--accent); font-weight: 700; }

/* ---------- Callouts (no main.css equivalent) ---------- */
.callout {
  border-left: 4px solid var(--primary); background: var(--alt); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px; margin: 1.6em 0;
}
.callout h3 { margin-top: 0; color: var(--primary); }
.callout--verify { border-left-color: var(--accent); background: var(--warn-bg); }
.callout--verify h3 { color: #8a5a10; }
.callout--data { border-left-color: var(--primary-2); background: #eaf3f9; }
.callout--data h3 { color: var(--primary-2); }

/* ---------- Tables (this cluster's own; main.css's is .spec-table,
   different name, no collision) ---------- */
.data-table-wrap { overflow-x: auto; margin: 1.4em 0; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.data-table caption { text-align: left; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
table.data-table th, table.data-table td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
table.data-table thead th { background: var(--alt); color: var(--text-2); font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
table.data-table tbody tr:nth-child(even) { background: var(--paper-alt); }
table.data-table tbody tr[data-highlight="true"] { outline: 2px solid var(--accent); outline-offset: -2px; }
table.data-table td.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ---------- City selector (progressive enhancement) ---------- */
.city-select-wrap { margin: 1.2em 0; }
.city-select-wrap label { font-weight: 700; display: block; margin-bottom: 6px; }
.city-select-wrap select {
  font-size: 1rem; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface);
  font-family: var(--font-body);
}
.city-select-wrap noscript { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

/* ---------- Comparison grid (open vs closed cell etc.) ---------- */
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 1.6em 0; }
@media (max-width: 640px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-card { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; background: var(--surface); }
.compare-card h3 { margin-top: 0; }
.compare-card--a { border-top: 5px solid var(--primary); }
.compare-card--b { border-top: 5px solid var(--accent); }
.compare-card dl { margin: 0; }
.compare-card dt { font-weight: 700; font-size: 0.85rem; color: var(--muted); margin-top: 12px; }
.compare-card dd { margin: 2px 0 0; }

/* ---------- Wall diagram ---------- */
.wall-diagram { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; background: var(--alt); margin: 1.6em 0; }
.wall-diagram figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 10px; }
.wall-toggle { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.wall-toggle button {
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; padding: 8px 16px;
  border: 1px solid var(--primary); background: var(--surface); color: var(--primary); border-radius: 100px; cursor: pointer;
}
.wall-toggle button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.wall-toggle button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- CTA block (this cluster's own; main.css's is .cta-band,
   a full-width section rather than a card, different name, no collision) */
.cta-block {
  background: var(--primary); color: #fff; border-radius: var(--r-lg); padding: 28px 30px; margin: 2.4em 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
}
.cta-block h2, .cta-block p { color: #fff; margin: 0; }
.cta-block__btn {
  background: #fff; color: var(--primary); font-weight: 700; padding: 12px 24px; border-radius: var(--r-sm);
  text-decoration: none; white-space: nowrap; font-family: var(--font-display);
}
.cta-block__btn:hover { background: var(--alt); }

/* ---------- Author byline for this cluster (renamed from .byline to
   avoid colliding with main.css's own .byline, which expects plain-text
   mono content with no avatar image) ---------- */
.byline-eco { display: flex; align-items: center; gap: 12px; margin: 1.2em 0 2em; padding: 14px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.byline-eco__avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--alt); }
.byline-eco__name { font-weight: 700; color: var(--text); }
.byline-eco__role { font-size: 0.85rem; color: var(--muted); }

/* ---------- Team cards ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; margin: 1.6em 0; }
.team-card { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; text-align: left; background: var(--surface); }
.team-card img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 14px; }
.team-card h3 { margin: 0 0 2px; }
.team-card .role { color: var(--accent); font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; }
.team-card ul { padding-left: 1.2em; font-size: 0.92rem; }
.cert-tag { display: inline-block; background: var(--alt); color: var(--text-2); font-size: 0.72rem; font-weight: 700;
  font-family: var(--font-mono); padding: 3px 10px; border-radius: 100px; margin: 2px 4px 2px 0; }

/* ---------- Related / cluster nav (main.css's .spec-card is similar but
   built for a slightly different card shape; kept separate to avoid
   reworking every page's markup) ---------- */
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 1.6em 0 2.4em; }
.related-card {
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; text-decoration: none; color: var(--text);
  display: block; background: var(--surface);
}
.related-card:hover { border-color: var(--border-strong); }
.related-card .eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); font-weight: 700; font-family: var(--font-mono); }
.related-card h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.related-card p { margin: 0; font-size: 0.88rem; color: var(--muted); }

/* ---------- Verify flag inline note ---------- */
.verify-note { font-size: 0.82rem; color: #8a5a10; background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 6px; padding: 8px 12px; display: inline-block; }

/* ---------- R-value calculator ---------- */
.rvalue-calc { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px; margin: 1.6em 0; background: var(--alt); }
.rvalue-calc__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.rvalue-calc__field label { font-weight: 700; font-size: 0.85rem; display: block; margin-bottom: 6px; color: var(--text-2); }
.rvalue-calc__field select, .rvalue-calc__field input {
  width: 100%; font-size: 1rem; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--surface); font-family: var(--font-mono);
}
.rvalue-calc__results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; border-top: 2px solid var(--border); padding-top: 18px; }
.rvalue-calc__result { text-align: center; }
.rvalue-calc__result-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.rvalue-calc__result-value { font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--primary); }
.rvalue-calc__result-value--loss { color: #c0392b; }
.rvalue-calc__flag { margin-top: 16px; padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; }
.rvalue-calc__flag--pass { background: #eaf6ea; color: #0C7A4C; border: 1px solid #0C7A4C; }
.rvalue-calc__flag--fail { background: var(--warn-bg); color: #8a5a10; border: 1px solid var(--warn-border); }
.rvalue-calc__note { font-size: 0.82rem; color: var(--muted); margin-top: 14px; font-family: var(--font-mono); }

/* ---------- Print ---------- */
@media print { .toc { display: none; } }
