/* Layout: containers, sections, grids, header, mobile menu, footer (PRD §4.1, §6.10). */

.container {
  width: min(100% - 2 * var(--gutter), var(--content-max));
  margin-inline: auto;
}
.container.narrow { max-width: 820px; }

.section { padding-block: var(--space-section); }
.section.tight { padding-block: calc(var(--space-section) * 0.6); }
/* Consecutive sections on the same background share one gap. */
.section + .section { padding-top: 0; }
.section.surface { background: var(--surface); }
.section.surface + .section,
.section + .section.surface,
.section-dark + .section,
.section + .section-dark,
.band + .section,
.section + .band { padding-top: var(--space-section); }
.section.surface + .section.surface { padding-top: 0; }

.section-head {
  display: grid;
  gap: 1rem 3rem;
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem);
}
.section-head > * { margin-bottom: 0; }
.section-head .eyebrow { margin-bottom: -0.25rem; }
.section-head.center { justify-items: center; text-align: center; }
.section-head.center .lede { margin-inline: auto; }
@media (min-width: 960px) {
  .section-head.head-split { grid-template-columns: 1.1fr 1fr; align-items: end; }
  .section-head.head-split .eyebrow { grid-column: 1 / -1; }
}

/* Dark anchor sections */
.section-dark {
  --accent: var(--detect-300);
  background: var(--ink-900);
  color: #c9d3dc;
}
.section-dark h1, .section-dark h2, .section-dark h3, .section-dark h4, .section-dark strong { color: #fff; }
.section-dark .eyebrow, .section-dark .lede, .section-dark .muted { color: #a9b6c2; }
.section-dark .text-link { color: var(--detect-300); }
.section-dark :focus-visible { outline-color: var(--detect-300); }
.section-dark.section-forest { background: var(--forest-900); }
.section-forest .card { background: var(--forest-800); }

.grid { display: grid; gap: clamp(1rem, 0.6rem + 1.5vw, 1.75rem); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.split {
  display: grid;
  gap: clamp(2rem, 1rem + 4vw, 5rem);
  align-items: center;
}
@media (min-width: 960px) {
  .split { grid-template-columns: 1fr 1fr; }
  .split.wide-left { grid-template-columns: 1.15fr 0.85fr; }
  .split.wide-right { grid-template-columns: 0.85fr 1.15fr; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 2rem;
}
.actions.center { justify-content: center; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  background: rgb(244 246 247 / 0.88);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-900);
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand img { width: auto; height: 40px; }
.brand span { font-weight: 400; }

.primary-nav { display: none; }
.primary-nav > ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav-link,
.nav-group > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-pill);
  color: var(--ink-700);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.nav-link:hover,
.nav-group > summary:hover,
.nav-group[open] > summary { background: var(--paper-deep); }
.nav-link[aria-current="page"],
.nav-group.is-current > summary { color: var(--ink-900); box-shadow: inset 0 -2px 0 var(--detect-600); border-radius: 0; }

.nav-group { position: relative; }
.nav-group > summary { list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  margin-top: -0.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms var(--ease);
}
.nav-group[open] > summary::after { transform: rotate(-135deg); margin-top: 0.2rem; }

.nav-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  display: grid;
  gap: 0.15rem;
  min-width: 15rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  box-shadow: var(--shadow-float);
  list-style: none;
}
.nav-menu a {
  display: grid;
  gap: 0.1rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-s);
  color: var(--ink-900);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}
.nav-menu a small { color: var(--ink-500); font-size: var(--step--1); font-weight: 400; }
.nav-menu a:hover { background: var(--paper); }
.nav-menu a[aria-current="page"] { background: var(--detect-100); }

.site-header .header-cta { display: none; }

.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  cursor: pointer;
}
.menu-toggle-bars { position: relative; width: 18px; height: 12px; }
.menu-toggle-bars::before,
.menu-toggle-bars::after,
.menu-toggle-bars span {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  border-radius: 2px;
  background: var(--ink-900);
  transition: transform 200ms var(--ease), opacity 200ms var(--ease);
}
.menu-toggle-bars::before { top: 0; }
.menu-toggle-bars span { top: 5.25px; }
.menu-toggle-bars::after { bottom: 0; }
.menu-open .menu-toggle-bars::before { transform: translateY(5.25px) rotate(45deg); }
.menu-open .menu-toggle-bars span { opacity: 0; }
.menu-open .menu-toggle-bars::after { transform: translateY(-5.25px) rotate(-45deg); }

/* Mobile sheet menu */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0;
  z-index: 99;
  display: flex;
  flex-direction: column;
  padding: 1rem var(--gutter) 0;
  overflow-y: auto;
  background: var(--paper);
}
.mobile-menu[hidden] { display: none; }
.mobile-menu-group { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.mobile-menu-group p {
  margin: 0 0 0.35rem;
  color: var(--ink-500);
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.mobile-menu-group ul { list-style: none; }
.mobile-menu a:not(.button) {
  display: block;
  padding: 0.55rem 0;
  color: var(--ink-900);
  font-family: var(--font-display);
  font-size: 1.5rem;
  text-decoration: none;
}
.mobile-menu a[aria-current="page"] { color: var(--detect-700); font-style: italic; }
.mobile-menu-cta {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom));
  background: var(--paper);
}
.mobile-menu-cta .button { width: 100%; justify-content: center; }
body.menu-locked { overflow: hidden; }
html:not(.js) .menu-toggle { display: none; }
html:not(.js) .mobile-menu { position: static; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
html:not(.js) .mobile-menu a:not(.button) { font-size: 1.15rem; }

@media (min-width: 1080px) {
  .primary-nav { display: block; }
  .site-header .header-cta { display: inline-flex; }
  .menu-toggle, .mobile-menu { display: none !important; }
}

/* ---------- Footer ---------- */

.site-footer {
  --accent: var(--detect-300);
  padding: clamp(3.5rem, 3rem + 3vw, 6rem) 0 2rem;
  background: var(--ink-900);
  color: #a9b6c2;
  font-size: 0.95rem;
}
.site-footer a { color: #dfe6ec; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.site-footer :focus-visible { outline-color: var(--detect-300); }

.footer-grid {
  display: grid;
  gap: 2.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
@media (min-width: 720px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } .footer-brand-col { grid-column: 1 / -1; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.2fr; } .footer-brand-col { grid-column: auto; } }

.footer-brand-col .brand { color: #fff; }
.footer-brand-col .brand img { height: 44px; }
.footer-tagline {
  margin: 1.25rem 0 0.75rem;
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1.3;
}
.footer-tagline em { color: var(--restore-300); }
.footer-tagline em + em { color: var(--detect-300); }

.site-footer h2 {
  margin-bottom: 1rem;
  color: #fff;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.footer-links { display: grid; gap: 0.6rem; list-style: none; }

.ask-ai {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
  padding: 1.75rem 0;
  border-bottom: 1px solid rgb(255 255 255 / 0.1);
}
.ask-ai p { margin: 0; color: #fff; font-weight: 500; }
.ask-ai ul { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; }
.ask-ai a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: var(--radius-pill);
  font-size: var(--step--1);
}
.ask-ai a:hover { border-color: var(--detect-300); text-decoration: none; }
.ask-ai a::after { content: "↗"; font-size: 0.8em; opacity: 0.7; }

.footer-bottom {
  display: grid;
  gap: 1rem;
  padding-top: 1.75rem;
  font-size: var(--step--1);
}
.footer-disclaimer { max-width: 52rem; margin: 0; }
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}
.footer-legal ul { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; list-style: none; }
.footer-legal p { margin: 0; }
.footer-text-button {
  padding: 0;
  border: 0;
  background: none;
  color: #dfe6ec;
  font-size: inherit;
  cursor: pointer;
}
.footer-text-button:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
