/* Stain Rescue — design tokens & base styles.
   Visual direction from the design canvas; text colors adjusted to meet WCAG AA on the warm off-white background. */

:root {
  --bg: #faf7f2;
  --bg-alt: #f3ecdf;
  --bg-chip: #efe7d8;
  --ink: #221e19;
  --ink-soft: #5c5346;        /* 6.9:1 on --bg */
  --ink-mute: #6e6355;        /* 5.4:1 on --bg */
  --accent: #c07a1e;          /* large elements / fills only */
  --accent-deep: #7a4e0c;     /* link/text amber, 6.3:1 on --bg */
  --accent-hover: #5e3c09;
  --accent-tint: #fdf6ea;
  --green: #2a4b3c;
  --green-tint: #eaf1ec;
  --warn-bg: #f6e3d3;
  --warn-border: #e5c3a4;
  --warn-ink: #4a2f14;
  --warn-label: #8a4508;      /* AA on --warn-bg */
  --border: #e6dccb;
  --border-soft: #eee6d9;
  --border-input: #cfc4b0;
  --radius: 16px;
  --radius-lg: 20px;
  --font-body: 'Public Sans', system-ui, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Public Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --max: 1140px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent-deep); }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: pretty; margin: 0 0 0.5rem; }
h1 { font-weight: 800; font-size: clamp(2.375rem, 5.5vw, 2.9rem); margin-bottom: 16px; }
nav[aria-label="Breadcrumb"] { margin-bottom: 14px; }
.kicker { margin-bottom: 12px; }
h2 { font-weight: 700; font-size: clamp(1.6rem, 3.2vw, 1.875rem); }
h3 { font-weight: 700; font-size: 1.15rem; }
p { margin: 0 0 1rem; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 clamp(20px, 6vw, 24px); }

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.mono-label--accent { color: var(--accent-deep); }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .wrap { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: 6px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; line-height: 1; }
.brand-sub { font-family: var(--font-mono); font-size: 0.56rem; color: var(--ink-mute); letter-spacing: 0.08em; }
.site-nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.site-nav a {
  text-decoration: none; color: var(--ink-soft); font-size: 0.82rem; font-weight: 600;
  padding: 11px 10px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center;
  white-space: nowrap;
}
.site-nav a:hover { background: var(--bg-chip); color: var(--ink); }
.site-nav a[aria-current="page"] { background: #f7ecd6; color: var(--accent-deep); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px; border-radius: 14px; border: none; cursor: pointer;
  font-family: var(--font-body); font-weight: 700; font-size: 1rem; text-decoration: none;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #a96a15; color: #fff; }
.btn--ghost { background: none; color: var(--ink); border: 1.5px solid var(--border-input); font-weight: 600; }
.btn--ghost:hover { border-color: var(--accent); color: var(--ink); }
.btn--small { min-height: 44px; padding: 0 16px; font-size: 0.9rem; border-radius: 999px; }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.card--flat { background: var(--bg-alt); border: none; }

/* Evidence badges */
.badge {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em;
  border-radius: 6px; padding: 3px 8px; white-space: nowrap;
  background: var(--bg-chip); color: #514738; border: 1px solid var(--border);
}
.badge--institutional { background: var(--green-tint); color: var(--green); border-color: #cfe0d5; }
.badge--industry { background: #ece9f4; color: #3f3a63; border-color: #d8d3e8; }
.badge--manufacturer { background: #fbeede; color: #7a4e0c; border-color: #ecd3b2; }
.badge--third-party-test { background: #e8eff5; color: #2c4a63; border-color: #cfdde9; }
.badge--community { background: #f6e9e2; color: #7c4626; border-color: #e8cfc0; }

/* Safety band */
.safety-band { background: var(--green); color: #f2f7f0; }
.safety-band .wrap { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; padding-top: 20px; padding-bottom: 20px; }
.safety-band .mono-label { color: #b7d6c2; }
.safety-band p { margin: 0; max-width: 60rem; font-size: 0.95rem; }
.safety-band a { color: #cfe6d8; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: auto; }
.site-footer .wrap {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 26px; padding-top: 34px; padding-bottom: 40px;
}
.site-footer a { display: block; font-size: 0.85rem; color: var(--ink-soft); text-decoration: none; padding: 4px 0; }
.site-footer a:hover { color: var(--accent-hover); }
.site-footer p { font-size: 0.8rem; color: var(--ink-mute); line-height: 1.55; }

/* Utility */
.grid { display: grid; gap: 14px; }
.grid--cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid--half { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 36px; }
.section { padding-top: clamp(48px, 8vw, 56px); padding-bottom: 32px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-mute); }
.table-scroll { overflow-x: auto; }

/* Prose articles */
.prose { max-width: 46rem; }
.prose h2 { margin-top: 2rem; }
.prose h3 { margin-top: 1.4rem; }
.prose li { margin-bottom: 0.4rem; }

/* Method pages */
.summary { font-size: 1.08rem; color: var(--ink-soft); max-width: 48rem; }
.card.do-now { background: var(--green); color: #f2f7f0; border: none; }
.card.do-now p { margin: 6px 0 0; color: #f2f7f0; }
.card.do-now .mono-label { color: #b7d6c2; }
.card.do-now a { color: #cfe6d8; }
.card.avoid { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-ink); }
.card.avoid p { margin: 6px 0 0; color: var(--warn-ink); }
.card.avoid .mono-label { color: var(--warn-label); }
.needs { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 8px 0 0; }
.needs li { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-size: 0.88rem; }
.method-h { margin-top: 1.8rem; }
.method-steps { padding-left: 0; margin: 0.5rem 0 0; list-style: none; counter-reset: step; max-width: 46rem; }
.method-steps li {
  counter-increment: step; background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 13px 15px 13px 48px; margin-bottom: 8px; position: relative;
}
.method-steps li::before {
  content: counter(step); position: absolute; left: 15px; top: 12px;
  font-family: var(--font-mono); color: var(--accent-deep); font-weight: 500;
}
.checkpoint {
  border: 1.5px dashed #c9a86a; background: #fbf3e2; border-radius: var(--radius);
  padding: 14px 16px; margin-top: 1.2rem; max-width: 46rem;
}
.checkpoint p { margin: 4px 0 0; color: var(--warn-ink); }
.caution { padding-left: 12px; border-left: 3px solid var(--warn-border); color: var(--ink-soft); max-width: 44rem; }
.variant { border-top: 1px solid var(--border); margin-top: 2rem; padding-top: 0.5rem; }
.fineprint { font-size: 0.8rem; color: var(--ink-mute); }
.community-item { margin-bottom: 10px; }
.community-item blockquote { margin: 0 0 6px; padding-left: 12px; border-left: 3px solid var(--border); color: var(--ink-soft); font-style: italic; }
.refs { white-space: nowrap; }

/* Wizard */
.wiz-top { display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.wiz-crumb { margin: 0; }
.wiz-crumb a { font-weight: 600; }
.wiz-top-spacer { flex: 1; }
.wiz-back {
  background: none; border: 1px solid var(--border-input); border-radius: 999px;
  padding: 7px 14px; font-size: 0.82rem; font-weight: 600; cursor: pointer;
  color: var(--ink); font-family: var(--font-body); min-height: 34px;
}
.wiz-back:hover { border-color: var(--accent); }
.wiz-step-label { flex-shrink: 0; }
.wiz-card.wiz-card--check { flex-direction: row; align-items: center; gap: 10px; }
.wiz-checkbox {
  width: 18px; height: 18px; border-radius: 6px; flex-shrink: 0;
  border: 1.5px solid var(--border-input); background: #fff;
}
.wiz-card--on .wiz-checkbox { border-color: var(--accent); background: var(--accent); }
@media (max-width: 560px) {
  .wiz-crumb { flex-basis: 100%; }
}
.wiz-progress { height: 4px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.wiz-progress div { height: 100%; background: var(--accent); border-radius: 99px; }
.wiz-body { max-width: 780px; }
.wiz-group { margin-top: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip {
  border: 1px solid var(--border-input); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font-size: 0.84rem; font-weight: 500;
  cursor: pointer; font-family: var(--font-body); min-height: 38px;
  display: inline-flex; align-items: center;
}
.chip:hover { border-color: var(--accent); color: var(--accent-deep); }
.chip--on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--on:hover { color: #fff; }
.chip--static {
  cursor: default; background: var(--bg-chip); border: none; color: var(--ink-soft);
  font-weight: 600; font-size: 0.78rem; padding: 6px 12px; min-height: 0;
}
.wiz-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-top: 10px; }
.wiz-card {
  text-align: left; border: 1.5px solid var(--border-input); background: #fff; border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
  font-family: var(--font-body); font-size: 0.95rem; color: var(--ink); min-height: 52px;
}
.wiz-card:hover { border-color: var(--accent); }
.wiz-card--on { border-color: var(--accent); background: var(--accent-tint); }
.wiz-unknown {
  margin-top: 16px; width: 100%; border-style: dashed; color: var(--ink-mute); font-weight: 600;
}
#wiz-search {
  width: 100%; min-height: 48px; border: 1.5px solid var(--border-input); border-radius: 14px;
  padding: 0 16px; font-size: 1rem; background: #fff; font-family: var(--font-body); margin-top: 6px;
}
#wiz-search:focus { border-color: var(--accent); outline: none; }
.wiz-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 10px; }
.wiz-sticky { position: sticky; bottom: 12px; margin-top: 20px; }
.caution--mine { border-left-color: var(--accent); background: var(--accent-tint); padding: 10px 12px; border-radius: 0 10px 10px 0; }

/* Header search (design: 150px pill growing to 240px on focus, dropdown panel) */
.header-search { position: relative; }
.header-search input {
  min-height: 42px; border: 1.5px solid var(--border-input); border-radius: 999px;
  padding: 0 16px; font-size: 0.84rem; background: #fff; outline: none;
  font-family: var(--font-body); width: 150px; transition: width 0.15s ease;
}
.header-search input:focus { border-color: var(--accent); width: 240px; }
.search-results--dropdown {
  position: absolute; top: 50px; right: 0; width: 340px; background: #fff;
  border: 1px solid var(--border-input); border-radius: 18px;
  box-shadow: 0 20px 50px -20px rgba(60, 45, 20, 0.35);
  padding: 8px; display: flex; flex-direction: column; gap: 2px; z-index: 30;
}
.search-hit {
  text-decoration: none; border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
}
.search-hit:hover { background: #f7f1e4; }
.search-hit strong { font-size: 0.88rem; color: var(--ink); }
.search-hit span { font-size: 0.75rem; color: var(--ink-mute); }
.search-none p { font-size: 0.84rem; color: var(--ink-soft); line-height: 1.5; margin: 4px 4px 10px; }
.btn--chiplike { min-height: 38px; padding: 0 16px; font-size: 0.82rem; border-radius: 999px; align-self: flex-start; margin: 0 4px 6px; }
.menu-search { display: none; }

/* Responsive header / hamburger (raised to 1180px so tablets get the menu instead of a wrapped nav) */
.menu-toggle { display: none; }
@media (max-width: 1179px) {
  .site-nav, .header-search { display: none; }
  .menu-toggle:not([hidden]) { display: inline-flex; min-height: 42px; }
  .site-header .wrap { flex-wrap: wrap; }
  .site-header .brand { flex: 1; }
  .site-header .header-cta { order: 2; margin-left: auto; }
  .menu-toggle { order: 3; }
  .site-header.menu-open .site-nav {
    display: flex; flex-direction: column; gap: 4px; order: 4;
    flex: 0 0 100%; width: 100%; padding: 14px 0 20px; border-top: 1px solid var(--border); margin-top: 10px;
  }
  .site-header.menu-open .site-nav a {
    font-size: 1rem; padding: 13px 12px; border-radius: 12px; min-height: 44px;
    display: flex; align-items: center;
  }
  .site-header.menu-open .menu-search { display: block; position: relative; margin-bottom: 8px; }
  .menu-search input {
    width: 100%; min-height: 46px; border: 1.5px solid var(--border-input); border-radius: 14px;
    padding: 0 16px; font-size: 0.94rem; background: #fff; outline: none; font-family: var(--font-body);
  }
  .menu-search input:focus { border-color: var(--accent); }
  .menu-search .search-results { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
  .menu-search .search-hit { background: #fff; border: 1px solid var(--border-soft); }
}
@media (max-width: 480px) {
  .brand-sub { display: none; }
  .site-header .header-cta { padding: 0 14px; font-size: 0.85rem; }
}

/* Tool page: keep the safety band visible at the bottom while stepping */
.page-tool .section { padding-top: 20px; }
.page-tool main { padding-bottom: 110px; }
.page-tool .safety-band {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 18;
  box-shadow: 0 -8px 24px -14px rgba(34, 30, 25, 0.5);
}
.page-tool .safety-band .wrap { padding-top: 9px; padding-bottom: 9px; gap: 8px 10px; flex-wrap: nowrap; align-items: baseline; }
.page-tool .safety-band p { font-size: 0.78rem; line-height: 1.4; }
.page-tool .wiz-sticky { bottom: 86px; }
.page-tool .site-footer { padding-bottom: 96px; }
@media (max-width: 480px) {
  .page-tool .safety-band .mono-label { display: none; }
}

/* Source list */
.source-list { font-size: 0.85rem; color: var(--ink-soft); }
.source-list li { margin-bottom: 6px; }
.sup-ref { font-size: 0.7rem; vertical-align: super; text-decoration: none; font-weight: 700; }
.mat-points { max-width: 46rem; padding-left: 0; list-style: none; } .mat-points li { background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 13px 15px; margin-bottom: 8px; }

/* Stain family cards (home) */
.family-grid {
  margin-top: 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px;
}
.family-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; display: flex; flex-direction: column;
  text-decoration: none; color: var(--ink);
}
.family-card:hover { border-color: var(--accent); }
.family-card img, .family-ph {
  display: block; width: 100%; height: 96px; object-fit: cover;
}
.family-ph { background: repeating-linear-gradient(-45deg, #f3ecdf 0 12px, #ece3d2 12px 24px); }
.family-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.family-name { font-weight: 700; font-size: 0.97rem; }
.family-ex { font-size: 0.78rem; color: var(--ink-mute); }

/* Care-label symbol chart (guides) */
.symbol-grid {
  list-style: none; margin: 18px 0 10px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
  max-width: 46rem;
}
.symbol-cell {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 12px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.symbol-cell svg { flex-shrink: 0; color: var(--ink); }
.symbol-label { font-size: 0.78rem; line-height: 1.4; color: var(--ink-soft); }
@media (max-width: 480px) {
  .symbol-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
}

/* Long-URL/word insurance against horizontal overflow */
.source-list li, .community-item, .fineprint, .wiz-body p { overflow-wrap: break-word; }

.search-results[hidden] { display: none !important; }

/* Design rhythm: hero stack (design uses flex column gap 20px) */
.stack-20 { display: flex; flex-direction: column; gap: 20px; }
.stack-20 > * { margin: 0; }
