/* ==========================================================================
   FireThings website — site.css
   One stylesheet for every page. Brand tokens match the app's web theme
   (lib/theme/web_theme.dart): navy #1A1A2E, amber #FFB020, warm off-white.
   Contrast rules: amber is a fill/accent only (navy text on amber, or amber
   on navy) — never amber text on white.
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url('/assets/fonts/outfit-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --navy: #1a1a2e;
  --navy-900: #12121f;
  --navy-700: #2a2a4e;
  --amber: #ffb020;
  --amber-hover: #ffbe47;
  --amber-50: #fff6e5;
  --amber-text: #b45309; /* amber-toned text on light backgrounds (5:1) */
  --red: #dc2626;
  --red-text: #b91c1c;
  --red-50: #fef2f2;
  --red-200: #fecaca;
  --green: #15803d;
  --green-50: #f0fdf4;
  --green-200: #bbf7d0;
  --blue-text: #1d4ed8;
  --blue-50: #eff6ff;
  --blue-200: #bfdbfe;

  --fg: #1f2937;
  --fg-2: #4b5563;
  --fg-3: #6b7280;
  --bg: #ffffff;
  --bg-alt: #fafaf7;
  --bg-sunken: #f3f4f1;
  --border: #e8e5de;
  --border-strong: #d4d1c7;
  --input-border: #7c828d; /* >= 3:1 against white */

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05), 0 1px 3px rgba(17, 24, 39, 0.06);
  --shadow: 0 2px 4px rgba(17, 24, 39, 0.04), 0 8px 20px -6px rgba(17, 24, 39, 0.1);
  --shadow-lg: 0 24px 48px -16px rgba(17, 24, 39, 0.22);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Outfit', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;

  --container: 1160px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 68px;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1 0 auto;
}

/* Components set display:flex/grid, which would otherwise beat the
   browser's own [hidden] rule. */
[hidden] {
  display: none !important;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--navy);
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--navy);
  text-decoration-line: underline;
  text-decoration-color: var(--amber);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--navy);
}

:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}

.on-dark :focus-visible,
.site-footer :focus-visible,
.hero :focus-visible {
  outline-color: var(--amber);
}

::selection {
  background: rgba(255, 176, 32, 0.35);
}

.num {
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--font-mono);
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
  outline-color: var(--amber);
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 28px;
  height: 28px;
}

/* ── Layout ────────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(56px, 8vw, 96px);
}

.section--alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section--tight {
  padding-block: clamp(40px, 6vw, 64px);
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.section-head h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 12px 0 0;
  font-size: 1.125rem;
  color: var(--fg-2);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber-text);
}

.eyebrow--on-dark {
  color: var(--amber);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 600 0.9375rem/1.2 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--amber);
  color: var(--navy);
  box-shadow: 0 8px 20px -10px rgba(255, 176, 32, 0.9);
}

.btn--primary:hover {
  background: var(--amber-hover);
}

.btn--dark {
  background: var(--navy);
  color: #fff;
}

.btn--dark:hover {
  background: var(--navy-700);
}

.btn--ghost {
  background: #fff;
  color: var(--navy);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  border-color: var(--navy);
  background: var(--bg-alt);
}

.btn--ghost-light {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

.btn--ghost-light:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn--sm {
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.875rem;
  border-radius: 9px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Header ────────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: 8px;
}

.brand img {
  width: auto;
  height: 38px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--fg);
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--bg-sunken);
  color: var(--navy);
}

.site-nav a[aria-current='page'] {
  color: var(--navy);
  font-weight: 600;
  background: var(--amber-50);
  box-shadow: inset 0 -2px 0 var(--amber);
}

.site-nav .btn {
  margin-left: 8px;
  padding: 9px 16px;
  min-height: 40px;
  font-weight: 600;
  color: var(--navy);
}

.site-nav .btn:hover {
  background: var(--amber-hover);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded='true'] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded='true'] .icon-close {
  display: block;
}

@media (max-width: 960px) {
  /* Without JS the links simply wrap under the logo. */
  .site-nav {
    margin-left: 0;
    padding-bottom: 10px;
  }

  .js .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    /* Containing block is the header's padding box, i.e. already full-bleed. */
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px var(--gutter) 18px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }

  .js .site-nav.is-open {
    display: flex;
  }

  .js .site-nav a {
    padding: 12px 14px;
    font-size: 1rem;
  }

  .js .site-nav .btn {
    margin: 8px 0 0;
    justify-content: center;
  }

  .js .nav-toggle {
    display: inline-flex;
  }
}

/* ── Home hero ─────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  color: #d6dae3;
  background:
    radial-gradient(900px 420px at 88% -8%, rgba(255, 176, 32, 0.2), transparent 62%),
    radial-gradient(720px 380px at -6% 112%, rgba(220, 38, 38, 0.16), transparent 60%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-900) 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 25%, transparent 75%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding-block: clamp(56px, 9vw, 112px);
}

.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 6px 12px 6px 8px;
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: 999px;
  background: rgba(255, 176, 32, 0.08);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #ffe2a8;
}

.hero__pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.2);
}

.hero h1 {
  color: #fff;
  font-size: clamp(2.375rem, 5.6vw, 4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.hero h1 .accent {
  color: var(--amber);
}

.hero__lead {
  max-width: 34em;
  margin: 22px 0 30px;
  font-size: clamp(1.0625rem, 1.7vw, 1.25rem);
  line-height: 1.6;
  color: #c7ccd8;
}

.hero__proof {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: #aab1c2;
}

.hero__proof li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero__proof .icon {
  color: var(--amber);
}

/* Decorative stack of mini tool cards */
.hero__visual {
  position: relative;
  min-height: 500px;
}

.mini {
  position: absolute;
  width: min(330px, 92%);
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: #fff;
  color: var(--fg);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.55);
}

.mini__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.mini--battery {
  top: 0;
  right: 0;
  transform: rotate(1.5deg);
}

.mini--detector {
  top: 118px;
  left: 0;
  transform: rotate(-2deg);
}

.mini--dip {
  bottom: 0;
  right: 2%;
  transform: rotate(1deg);
}

.mini__big {
  margin-top: 6px;
  font: 800 2rem/1.1 var(--font-display);
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.mini__sub {
  font-size: 0.8125rem;
  color: var(--fg-2);
}

.mini__bar {
  position: relative;
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--bg-sunken);
  overflow: hidden;
}

.mini__bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 51%;
  border-radius: inherit;
  background: var(--green);
}

.mini__plan {
  margin-top: 10px;
  width: 100%;
  height: 118px;
}

.mini__dips {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--navy);
}

.mini__dips span {
  position: relative;
  height: 34px;
  border-radius: 5px;
  background: #0d0d18;
}

.mini__dips span::after {
  content: '';
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 42%;
  border-radius: 4px;
  background: #e5e7eb;
}

.mini__dips span.on::after {
  bottom: auto;
  top: 3px;
  background: var(--amber);
}

@media (max-width: 960px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero__visual {
    display: none;
  }
}

/* ── Tool cards (home + related) ───────────────────────────────────────── */

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(22px, 3vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.tool-card:focus-within {
  border-color: var(--navy);
}

.tool-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tool-card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--amber-50);
  color: var(--amber-text);
}

.tool-card__icon .icon {
  width: 26px;
  height: 26px;
}

.tool-card__tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-sunken);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-2);
}

.tool-card h3 {
  font-size: 1.375rem;
  font-weight: 700;
}

.tool-card h3 a {
  color: inherit;
  text-decoration: none;
}

/* Whole card is clickable via the heading link */
.tool-card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.tool-card h3 a:focus-visible {
  outline: none;
}

.tool-card p {
  margin: 0;
  color: var(--fg-2);
}

.tool-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  font-weight: 600;
  color: var(--navy);
}

.tool-card:hover .tool-card__cta .icon {
  transform: translateX(3px);
}

.tool-card__cta .icon {
  transition: transform 0.2s;
}

.tool-grid--related {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-grid--related .tool-card {
  gap: 10px;
  padding: 20px;
}

.tool-grid--related .tool-card h3 {
  font-size: 1.0625rem;
}

.tool-grid--related .tool-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}

.tool-grid--related .tool-card__icon .icon {
  width: 20px;
  height: 20px;
}

@media (max-width: 860px) {
  .tool-grid,
  .tool-grid--related {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Feature points ────────────────────────────────────────────────────── */

.points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 36px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.point__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--navy);
  color: var(--amber);
}

.point h3 {
  margin-bottom: 6px;
  font-size: 1.125rem;
}

.point p {
  margin: 0;
  color: var(--fg-2);
}

@media (max-width: 760px) {
  .points {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Get the app ───────────────────────────────────────────────────────── */

.app-cta {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  overflow: hidden;
  padding: clamp(28px, 5vw, 60px);
  border-radius: var(--radius-xl);
  color: #c7ccd8;
  background:
    radial-gradient(600px 300px at 100% 0%, rgba(255, 176, 32, 0.18), transparent 65%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-900) 100%);
}

.app-cta h2 {
  color: #fff;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.app-cta__lead {
  margin: 14px 0 22px;
  font-size: 1.0625rem;
}

.checklist {
  display: grid;
  gap: 10px;
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.checklist .icon {
  margin-top: 3px;
  color: var(--amber);
}

.store-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 18px 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s;
}

.store-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.45);
}

.store-btn .icon {
  width: 26px;
  height: 26px;
  color: var(--amber);
}

.store-btn__small {
  display: block;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #aab1c2;
}

.store-btn__big {
  display: block;
  font: 700 1.0625rem/1.25 var(--font-display);
}

.app-cta__note {
  margin: 14px 0 0;
  font-size: 0.875rem;
  color: #aab1c2;
}

/* Decorative phone showing the app's tool grid */
.phone {
  justify-self: center;
  width: min(270px, 100%);
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 40px;
  background: #0b0b14;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
}

.phone__screen {
  overflow: hidden;
  padding: 26px 16px 22px;
  border-radius: 30px;
  background: #f6f6f2;
  color: var(--fg);
}

.phone__notch {
  width: 84px;
  height: 22px;
  margin: -14px auto 16px;
  border-radius: 999px;
  background: #0b0b14;
}

.phone__title {
  margin-bottom: 12px;
  font: 700 1rem/1.2 var(--font-display);
  color: var(--navy);
}

.phone__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.phone__tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.25;
}

.phone__tile .icon {
  width: 22px;
  height: 22px;
  padding: 4px;
  box-sizing: content-box;
  border-radius: 8px;
  background: var(--amber-50);
  color: var(--amber-text);
}

@media (max-width: 860px) {
  .app-cta {
    grid-template-columns: minmax(0, 1fr);
  }

  .phone {
    display: none;
  }
}

/* ── Page header (tool + legal pages) ──────────────────────────────────── */

.page-hero {
  padding-block: clamp(28px, 4vw, 44px) clamp(24px, 3vw, 36px);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(700px 240px at 100% 0%, rgba(255, 176, 32, 0.1), transparent 70%),
    var(--bg-alt);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--fg-2);
}

.breadcrumb li + li::before {
  content: '\203A';
  margin-right: 6px;
  color: var(--fg-3);
}

.breadcrumb a {
  color: var(--fg-2);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.page-hero h1 {
  font-size: clamp(1.875rem, 4.2vw, 2.875rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.page-hero__lead {
  max-width: 46em;
  margin: 12px 0 0;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  color: var(--fg-2);
}

.standard-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8125rem;
  color: var(--fg-2);
}

.standard-chip .icon {
  color: var(--amber-text);
}

.standard-chip strong {
  color: var(--fg);
  font-weight: 600;
}

/* ── Calculator layout ─────────────────────────────────────────────────── */

.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 32px);
  align-items: start;
  padding-block: clamp(24px, 4vw, 40px);
}

.calc--wide-results {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.panel {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 20px;
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
}

.panel__title {
  font-size: 1.1875rem;
  font-weight: 700;
}

.panel__sub {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--fg-2);
}

.panel__head--sub {
  margin: 28px 0 14px;
}

.panel__title--sm {
  font-size: 1.0625rem;
}

.subhead {
  margin: 22px 0 10px;
  font-size: 1rem;
}

.related-title {
  margin-bottom: 20px;
  font-size: 1.375rem;
  font-weight: 800;
}

.results {
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.results[aria-busy='true'] {
  opacity: 0.6;
}

@media (max-width: 960px) {
  .calc,
  .calc--wide-results {
    grid-template-columns: minmax(0, 1fr);
  }

  .results {
    position: static;
  }
}

/* ── Form controls ─────────────────────────────────────────────────────── */

.field {
  display: grid;
  align-content: start; /* don't spread extra row height between label and input */
  gap: 6px;
  margin: 0 0 20px;
  border: 0;
  padding: 0;
  min-width: 0;
}

.field:last-child {
  margin-bottom: 0;
}

.field__label,
.field > legend {
  padding: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
}

.field > legend {
  margin-bottom: 8px;
}

.field__hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--fg-2);
}

.field__error {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--red-text);
}

.field__error:empty {
  display: none;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

/* Fields in a row always keep their spacing (they stack on narrow screens). */
.field-row > .field,
.field-row > .field:last-child {
  margin-bottom: 20px;
}

.field-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 560px) {
  .field-row,
  .field-row--3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.input-wrap {
  position: relative;
}

.input {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: 1.5px solid var(--input-border);
  border-radius: 10px;
  background: #fff;
  font: 500 1.0625rem/1.4 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--fg-3);
  font-weight: 400;
}

.input:hover {
  border-color: var(--fg-2);
}

.input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.4);
}

.input[aria-invalid='true'] {
  border-color: var(--red);
}

.input[aria-invalid='true']:focus {
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

.input--unit {
  padding-right: 52px;
}

.input-unit {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-weight: 600;
  color: var(--fg-2);
  pointer-events: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chip {
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  font: 600 0.875rem/1.2 var(--font);
  color: var(--fg);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: var(--navy);
}

.chip[aria-pressed='true'] {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

/* Segmented control built from radio inputs */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-sunken);
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  min-width: 52px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: var(--fg-2);
  cursor: pointer;
}

.segmented input:checked + label {
  background: #fff;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--navy);
  outline-offset: 1px;
}

/* Radio cards */
.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 480px) {
  .choices {
    grid-template-columns: minmax(0, 1fr);
  }
}

.choice {
  position: relative;
  display: block;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice__body {
  display: block;
  height: 100%;
  padding: 14px 16px 14px 44px;
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.choice__body::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 16px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--input-border);
  border-radius: 50%;
  background: #fff;
}

.choice input:checked + .choice__body {
  border-color: var(--navy);
  background: var(--bg-alt);
  box-shadow: inset 0 0 0 1px var(--navy);
}

.choice input:checked + .choice__body::before {
  border-color: var(--navy);
  background: radial-gradient(circle, var(--navy) 0 4px, #fff 5px);
}

.choice input:focus-visible + .choice__body {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
}

.choice__title {
  display: block;
  font-weight: 700;
  color: var(--navy);
}

.choice__meta {
  display: block;
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--fg-2);
}

/* ── Results ───────────────────────────────────────────────────────────── */

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
}

.status__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
}

.status__title {
  display: block;
  font: 800 1.375rem/1.15 var(--font-display);
  letter-spacing: 0.02em;
}

.status__text {
  display: block;
  font-size: 0.9375rem;
}

.status--pass {
  background: var(--green-50);
  border-color: var(--green-200);
  color: var(--green);
}

.status--pass .status__icon {
  background: var(--green);
  color: #fff;
}

.status--fail {
  background: var(--red-50);
  border-color: var(--red-200);
  color: var(--red-text);
}

.status--fail .status__icon {
  background: var(--red);
  color: #fff;
}

.status--idle {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--fg-2);
}

.status--idle .status__icon {
  background: var(--bg-sunken);
  color: var(--fg-3);
}

.stat {
  margin: 22px 0 6px;
}

.stat__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-2);
}

.stat__value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
  font: 800 clamp(2.75rem, 7vw, 3.75rem)/1 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.stat__unit {
  font: 600 1.125rem/1 var(--font);
  letter-spacing: 0;
  color: var(--fg-2);
}

.kv {
  margin: 16px 0 0;
}

.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.kv > div:last-child {
  border-bottom: 0;
}

.kv dt {
  color: var(--fg-2);
}

.kv dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.kv .is-good {
  color: var(--green);
}

.kv .is-bad {
  color: var(--red-text);
}

.meter {
  margin-top: 18px;
}

.meter__track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--bg-sunken);
  overflow: hidden;
}

.meter__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.3s ease;
}

.meter__fill.is-bad {
  background: var(--red);
}

.meter__mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--navy);
  transition: left 0.3s ease;
}

.meter__legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 0.8125rem;
  color: var(--fg-2);
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 12px;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.callout > .icon {
  margin-top: 2px;
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 6px;
}

.callout strong {
  font-weight: 700;
}

.callout ul {
  margin: 6px 0 0;
  padding-left: 1.1rem;
}

.callout li + li {
  margin-top: 4px;
}

.callout .is-muted {
  opacity: 0.85;
}

.callout--info {
  background: var(--blue-50);
  border-color: var(--blue-200);
  color: #1e3a8a;
}

.callout--warn {
  background: var(--amber-50);
  border-color: #fcd9a0;
  color: #78350f;
}

.callout--danger {
  background: var(--red-50);
  border-color: var(--red-200);
  color: #7f1d1d;
}

.callout--neutral {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--fg-2);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Tables ────────────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.table th,
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: var(--bg-alt);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--fg-2);
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table tfoot td,
.table tfoot th {
  border-top: 2px solid var(--navy);
  border-bottom: 0;
  font-weight: 700;
  color: var(--navy);
}

.table--compact th,
.table--compact td {
  padding: 7px 12px;
}

/* Working/breakdown tables stack on phones: label + result on one line,
   the formula underneath, so nothing has to scroll sideways. */
@media (max-width: 560px) {
  .table--working,
  .table--working tbody,
  .table--working tfoot {
    display: block;
  }

  .table--working tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
  }

  .table--working tbody tr:last-child {
    border-bottom: 0;
  }

  .table--working tfoot tr {
    border-top: 2px solid var(--navy);
    border-bottom: 0;
  }

  .table--working th,
  .table--working td,
  .table--working tfoot th,
  .table--working tfoot td {
    padding: 0;
    border: 0;
  }

  .table--working .formula-cell {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
    color: var(--fg-2);
  }

  .table--working .formula-cell:empty {
    display: none;
  }
}

/* ── Explainer / prose ─────────────────────────────────────────────────── */

.explainer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

@media (max-width: 960px) {
  .explainer {
    grid-template-columns: minmax(0, 1fr);
  }
}

.prose {
  max-width: 46rem;
}

.prose h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 2.6vw, 1.875rem);
  font-weight: 800;
}

.prose h3 {
  margin: 30px 0 10px;
  font-size: 1.1875rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 6px;
}

.formula {
  margin: 0 0 1.2em;
  padding: 14px 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-left: 4px solid var(--amber);
  border-radius: 10px;
  background: var(--bg-alt);
  font: 600 1rem/1.5 var(--font-mono);
  color: var(--navy);
  white-space: nowrap;
}

.aside-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
}

.aside-card + .aside-card {
  margin-top: 16px;
}

.aside-card h3 {
  margin-bottom: 8px;
  font-size: 1.0625rem;
}

.aside-card p {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  color: var(--fg-2);
}

.aside-card p:last-child {
  margin-bottom: 0;
}

.aside-card--dark {
  border-color: transparent;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-900) 100%);
  color: #c7ccd8;
}

.aside-card--dark h3 {
  color: #fff;
}

.aside-card--dark p {
  color: #c7ccd8;
}

/* ── DIP switch ────────────────────────────────────────────────────────── */

.dip {
  --dip-gap: clamp(5px, 1.6vw, 12px);
  position: relative;
  width: 100%;
  max-width: 600px;
  margin-inline: auto;
  padding: 18px clamp(12px, 3vw, 24px) 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #26264a 0%, var(--navy) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 18px 40px -18px rgba(17, 24, 39, 0.6);
  color: #fff;
}

.dip__on {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font: 800 0.8125rem/1 var(--font-display);
  letter-spacing: 0.12em;
  color: var(--amber);
}

.dip__row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--dip-gap);
}

.dip__switch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.dip__weight {
  font: 700 0.8125rem/1 var(--font-mono);
  color: #9aa3b5;
  transition: color 0.15s;
}

.dip__slot {
  position: relative;
  width: 100%;
  max-width: 46px;
  aspect-ratio: 1 / 2.15;
  border-radius: 9px;
  background: #0b0b16;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7);
}

.dip__knob {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 4px;
  height: 44%;
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #d9dce3 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
  transition: bottom 0.18s ease, background 0.18s;
}

.dip__num {
  font: 700 0.9375rem/1 var(--font);
  color: #c7ccd8;
}

.dip__switch[aria-checked='true'] .dip__knob {
  bottom: calc(56% - 4px);
  background: linear-gradient(180deg, #ffd27a 0%, var(--amber) 100%);
}

.dip__switch[aria-checked='true'] .dip__weight {
  color: var(--amber);
}

.dip__switch:hover .dip__slot {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7), 0 0 0 2px rgba(255, 176, 32, 0.35);
}

.dip__switch:focus-visible {
  outline: none;
}

.dip__switch:focus-visible .dip__slot {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7), 0 0 0 3px var(--amber);
}

.dip__caption {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.75rem;
  color: #9aa3b5;
}

@media (prefers-reduced-motion: reduce) {
  .dip__knob,
  .meter__fill,
  .meter__mark {
    transition: none;
  }
}

.address-input {
  width: 100%;
  max-width: 220px;
  padding: 6px 12px;
  border: 1.5px solid var(--input-border);
  border-radius: 12px;
  background: #fff;
  font: 800 clamp(2.75rem, 7vw, 3.75rem)/1.1 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
}

.address-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.4);
}

.address-input[aria-invalid='true'] {
  border-color: var(--red);
}

.binary {
  display: inline-flex;
  gap: 2px;
  font: 700 1.25rem/1 var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--navy);
}

.binary span:nth-child(4) {
  margin-right: 8px;
}

.chart-details {
  margin: 0 0 clamp(32px, 5vw, 56px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.chart-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}

.chart-details > summary::-webkit-details-marker {
  display: none;
}

.chart-details > summary .icon {
  transition: transform 0.2s;
}

.chart-details[open] > summary .icon {
  transform: rotate(180deg);
}

.chart-details__body {
  padding: 0 22px 22px;
}

.chart-details .table-wrap {
  max-height: 520px;
  overflow: auto;
}

.chart-details thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.switch-dots {
  display: inline-flex;
  gap: 3px;
}

.switch-dots span {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--input-border);
  border-radius: 3px;
}

.switch-dots span.on {
  border-color: var(--navy);
  background: var(--navy);
}

/* ── Detector plan (SVG) ───────────────────────────────────────────────── */

.plan-wrap {
  position: relative;
  min-height: 120px;
}

.plan {
  width: 100%;
  height: auto;
  overflow: visible;
}

.plan__room {
  fill: var(--bg-alt);
  stroke: var(--navy);
  stroke-width: 2;
}

.plan__band {
  fill: rgba(255, 176, 32, 0.16);
}

.plan__det {
  fill: var(--navy);
}

.plan__det-ring {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2;
}

.plan__dim {
  stroke: var(--fg-2);
  stroke-width: 1;
}

.plan__text {
  font: 600 12px var(--font);
  fill: var(--fg);
  font-variant-numeric: tabular-nums;
}

.plan__text--muted {
  fill: var(--fg-2);
  font-weight: 500;
}

.plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--fg-2);
}

.plan-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.swatch--det {
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--amber);
}

.swatch--band {
  background: rgba(255, 176, 32, 0.3);
  border: 1px solid rgba(180, 83, 9, 0.35);
}

.room-type {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--bg-alt);
  font-size: 0.9375rem;
}

.room-type strong {
  color: var(--navy);
}

.room-type .icon {
  color: var(--amber-text);
}

.notes {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ── BS 5839 reference ─────────────────────────────────────────────────── */

.ref-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 48px);
  align-items: start;
  padding-block: clamp(24px, 4vw, 40px) clamp(48px, 7vw, 80px);
}

.ref-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  padding-right: 4px;
  overscroll-behavior: contain;
}

.search {
  position: relative;
}

.search .icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--fg-3);
  pointer-events: none;
}

.search .input {
  padding-left: 44px;
}

.search__clear {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--fg-2);
  cursor: pointer;
}

.search__clear:hover {
  background: var(--bg-sunken);
}

.search__clear[hidden] {
  display: none;
}

.search__status {
  margin: 8px 2px 0;
  font-size: 0.875rem;
  color: var(--fg-2);
}

.ref-nav {
  margin-top: 18px;
}

.ref-nav__title {
  margin: 0 0 8px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.ref-nav ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.9375rem;
  color: var(--fg);
  text-decoration: none;
}

.ref-nav a:hover {
  background: var(--bg-sunken);
}

.ref-nav a.is-active {
  background: var(--amber-50);
  color: var(--navy);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--amber);
}

.ref-nav a.is-empty {
  opacity: 0.45;
}

.ref-nav__count {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-sunken);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--fg-2);
}

.ref-nav__extra {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

@media (max-width: 960px) {
  .ref-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ref-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .ref-nav ul {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }

  .ref-nav a {
    white-space: nowrap;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 7px 12px;
  }

  .ref-nav a.is-active {
    box-shadow: none;
    border-color: var(--navy);
  }

  .ref-nav__extra {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
}

.ref-content > .callout {
  margin: 0 0 28px;
}

.ref-category {
  margin-bottom: clamp(36px, 5vw, 56px);
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.ref-category__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--navy);
}

.ref-category__title {
  font-size: clamp(1.375rem, 2.6vw, 1.75rem);
  font-weight: 800;
}

.ref-category__count {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-2);
  white-space: nowrap;
}

.ref-card {
  margin-bottom: 16px;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.ref-card:target {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.4);
}

.ref-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}

.ref-card__title {
  font-size: 1.25rem;
  font-weight: 700;
}

.ref-card__title a {
  color: inherit;
  text-decoration: none;
}

.ref-card__title a:hover {
  text-decoration: underline;
  text-decoration-color: var(--amber);
}

.ref-card__summary {
  margin: 8px 0 16px;
  color: var(--fg-2);
}

.ref-items {
  display: grid;
  gap: 14px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.ref-item dt {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--navy);
}

.ref-item dd {
  margin: 3px 0 0;
}

.ref-item dd p {
  margin: 0;
}

.ref-item dd ul {
  margin: 2px 0 0;
  padding-left: 1.15rem;
}

.ref-item dd li + li {
  margin-top: 3px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--new {
  background: var(--amber);
  color: var(--navy);
}

.badge--pass {
  background: var(--green-50);
  color: var(--green);
}

.badge--fail {
  background: var(--red-50);
  color: var(--red-text);
}

.ref-empty {
  padding: 40px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--fg-2);
}

.ref-empty[hidden],
.ref-card[hidden],
.ref-category[hidden] {
  display: none;
}

.lookup {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
}

.lookup .field {
  margin: 0;
  flex: 1 1 200px;
  max-width: 260px;
}

.lookup + .table-wrap {
  margin-top: 20px;
}

.ref-subtitle {
  margin: 32px 0 8px;
  font-size: 1.1875rem;
}

.search input[type='search']::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.lookup__result {
  flex: 1 1 240px;
  min-height: 50px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--fg);
}

/* ── Legal pages ───────────────────────────────────────────────────────── */

.legal-page {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(36px, 6vw, 64px) var(--gutter) clamp(48px, 8vw, 88px);
}

.legal-page h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.legal-page .last-updated {
  margin-bottom: 2rem;
  font-size: 0.9375rem;
  color: var(--fg-2);
}

.legal-page h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.4rem;
}

.legal-page h3 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.1rem;
  color: var(--fg);
}

.legal-page p,
.legal-page li {
  color: var(--fg);
}

.legal-page ul {
  margin: 0 0 1rem;
  padding-left: 1.5rem;
}

.legal-page li {
  margin-bottom: 0.5rem;
}

.summary-box {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
}

.summary-box h3 {
  margin-top: 0;
}

/* ── 404 ───────────────────────────────────────────────────────────────── */

.not-found {
  padding-block: clamp(64px, 12vw, 140px);
  text-align: center;
}

.not-found__code {
  font: 800 clamp(4rem, 14vw, 7.5rem)/1 var(--font-display);
  letter-spacing: -0.04em;
  color: var(--navy);
}

.not-found__code span {
  color: var(--amber-text);
}

.not-found h1 {
  margin: 14px 0 10px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.not-found p {
  max-width: 34em;
  margin: 0 auto 28px;
  color: var(--fg-2);
}

.not-found .btn-row {
  justify-content: center;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-footer {
  padding-block: clamp(44px, 6vw, 64px) 28px;
  background: var(--navy-900);
  color: #aab1c2;
  font-size: 0.9375rem;
}

.site-footer a {
  color: #e5e7eb;
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: var(--amber);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 800 1.375rem/1 var(--font-display);
  color: #fff;
}

.footer-brand img {
  width: 36px;
  height: 36px;
}

.footer-about {
  max-width: 30em;
  margin: 14px 0 0;
}

.footer-col h2 {
  margin-bottom: 12px;
  font: 700 0.8125rem/1.2 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}

.footer-col ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-legal {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8125rem;
  color: #8f97aa;
}

.footer-legal p {
  margin: 0 0 8px;
  max-width: 62em;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: 14px;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-col--brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── Print ─────────────────────────────────────────────────────────────── */

@media print {
  @page {
    margin: 14mm;
  }

  body {
    font-size: 11pt;
    background: #fff;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .no-print,
  .result-actions,
  .toast,
  .breadcrumb,
  .standard-chip,
  .ref-sidebar,
  .related-section,
  .explainer-section {
    display: none !important;
  }

  .page-hero {
    padding: 0 0 8pt;
    border: 0;
    background: none;
  }

  .calc,
  .ref-layout {
    display: block;
    padding: 0;
  }

  .results {
    position: static;
  }

  .panel,
  .ref-card {
    box-shadow: none;
    border-color: #999;
  }

  .ref-card,
  .kv,
  .plan-wrap,
  .callout,
  .table-wrap {
    break-inside: avoid;
  }

  /* Keep the detector plan to a sensible size on paper. */
  .plan {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 85mm;
  }

  /* The notes box only repeats the wall offsets unless it lists an
     alternative layout (then it's styled --warn and prints). */
  #notes.callout--neutral {
    display: none !important;
  }

  .kv > div {
    padding: 6px 0;
  }

  .stat {
    margin: 10px 0 4px;
  }

  .print-only {
    display: block !important;
  }

  a {
    text-decoration: none;
  }

  /* Keep meaningful fills (switch body, pass/fail, bars) when printing. */
  .dip,
  .dip *,
  .status,
  .status *,
  .meter__fill,
  .meter__mark,
  .badge,
  .swatch,
  .switch-dots span {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* The address chart only prints via its own "Print chart" button. */
  .chart-section,
  noscript {
    display: none !important;
  }

  body.print-chart .page-hero,
  body.print-chart .calc {
    display: none !important;
  }

  body.print-chart .chart-section {
    display: block !important;
    border: 0;
  }

  body.print-chart .chart-details > summary .icon,
  body.print-chart [data-action] {
    display: none !important;
  }

  body.print-chart .chart-details .table-wrap {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  body.print-chart .chart-details thead th {
    position: static;
  }

  /* Three compact columns of rows: the full 0-255 chart on two pages. */
  body.print-chart .chart-details table,
  body.print-chart .chart-details tbody {
    display: block;
  }

  body.print-chart .chart-details table {
    font-size: 9pt;
    line-height: 1.3;
  }

  body.print-chart .chart-details .table-wrap {
    break-inside: auto;
  }

  body.print-chart .chart-details thead,
  body.print-chart .chart-details .hide-sm {
    display: none;
  }

  body.print-chart .chart-details tbody {
    columns: 3;
    column-gap: 8mm;
  }

  body.print-chart .chart-details tr {
    display: flex;
    align-items: center;
    gap: 4mm;
    padding: 1.2pt 0;
    border-bottom: 0.5pt solid #ccc;
    break-inside: avoid;
  }

  body.print-chart .chart-details td {
    padding: 0;
    border: 0;
  }

  body.print-chart .chart-details td:first-child {
    flex: none;
    width: 9mm;
    text-align: right;
    font-weight: 700;
  }

  body.print-chart .switch-dots span {
    width: 8px;
    height: 8px;
  }
}

.print-only {
  display: none;
}

@media (max-width: 560px) {
  .hide-sm {
    display: none;
  }
}
