:root {
  --site-bg: #e5ebea;
  --site-surface: #ffffff;
  --site-surface-2: #f0f4f3;
  --site-text: #262626;
  --site-muted: #6b7280;
  --site-border: rgba(38, 38, 38, 0.1);
  --site-accent: #fb4d3d;
  --site-accent-hover: #ff6b6b;
  --site-accent-glow: rgba(251, 77, 61, 0.25);
  --site-success: #2f855a;
  --site-warning: #a15c00;
  --site-error: #b42318;
  --site-radius-card: 12px;
  --site-space-section: 80px;
  --site-body-leading: 1.5;
  --site-shadow: 0 18px 42px rgba(38, 38, 38, 0.12);
  --site-font-display: 'Bebas Neue', sans-serif;
  --site-font-cond: 'Barlow Condensed', sans-serif;
  --site-font-body: 'Barlow', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --site-header-height: 76px;
}

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

html {
  scroll-padding-top: calc(var(--site-header-height) + 16px);
  /* Keep the viewport's content width stable when a page introduces a
     vertical scrollbar, preventing the fixed header/logo from shifting. */
  scrollbar-gutter: stable;
}

body.site-shell {
  min-height: 100vh;
  padding-top: var(--site-header-height);
  background:
    radial-gradient(circle at 85% 4%, rgba(251, 77, 61, 0.12), transparent 30rem),
    radial-gradient(circle at 4% 24%, rgba(255, 255, 255, 0.9), transparent 24rem),
    linear-gradient(180deg, #eef3f2 0%, var(--site-bg) 44%, #e9e1de 100%);
  color: var(--site-text);
  font-family: var(--site-font-body);
  overflow-x: hidden;
}

body.site-shell.feature-page {
  background:
    radial-gradient(circle at 78% 0%, rgba(251, 77, 61, 0.18), transparent 28rem),
    linear-gradient(180deg, #111412 0%, #050505 44%, #0d0d10 100%);
  color: var(--text, #f5efe6);
}

body.site-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image:
    linear-gradient(rgba(251, 77, 61, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(251, 77, 61, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
}

body.site-shell.feature-page::before {
  opacity: 0.28;
}

body.site-shell.tool-page .lede,
body.site-shell.tool-page .screen-title p,
body.site-shell.tool-page .section-head p {
  color: var(--site-muted);
}

.site-shell .container {
  width: min(1160px, calc(100vw - 40px));
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 0;
}

.site-shell .site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  min-height: var(--site-header-height);
  padding: 0;
  border-bottom: 1px solid var(--site-border);
  background: rgba(229, 235, 234, 0.9);
  backdrop-filter: blur(16px);
}

.site-shell .header-inner {
  position: relative;
  min-height: var(--site-header-height);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
}

.site-shell .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.site-shell .brand .logo,
.site-shell .logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: none;
  border-radius: 0;
  box-shadow: none;
}

.site-shell .brand-name {
  color: var(--site-accent);
  font-family: var(--site-font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.site-shell .site-nav {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 14px;
  margin-left: 48px;
}

/* Reserve one stable auth slot so resolving Firebase auth cannot move the
   navigation or download action horizontally. Both auth buttons remain
   hidden until the shared auth listener chooses exactly one to show. */
.site-shell .site-auth {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 108px;
  width: 108px;
  min-width: 108px;
  min-height: 42px;
}

.site-shell .site-auth .btn {
  width: 100%;
  min-height: 40px;
  border-color: var(--border-default, #c3ccc6);
  background: var(--surface-card, #ffffff);
  color: var(--text-primary, #202321);
  border-radius: 6px;
}

.site-shell .site-auth .btn:hover {
  background: var(--surface-card, #ffffff);
  border-color: var(--border-strong-light, #7b8780);
  color: var(--text-primary, #202321);
}

.site-shell .site-auth .btn:focus-visible {
  outline: 3px solid var(--focus-ring, #a9362b);
  outline-offset: 3px;
}

.site-shell .nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-right: auto;
  list-style: none;
}

.site-shell .nav-links > li,
.site-shell .nav-help {
  flex: 0 0 auto;
}

.site-shell .site-nav > .site-auth + .site-download {
  margin-left: 14px;
}

.site-shell .site-nav > .site-download {
  margin-left: auto;
}

.site-shell .nav-link,
.site-shell .nav-links a {
  position: relative;
  color: var(--site-muted);
  font: 500 clamp(13px, 1.1vw, 15px) var(--site-font-cond);
  font-synthesis: none;
  letter-spacing: 1.25px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  transition: color 0.18s ease;
}

/* Active/hover/focus states must never change text metrics or shift neighbors. */
.site-shell .nav-link:hover,
.site-shell .nav-link:focus,
.site-shell .nav-link:focus-visible,
.site-shell .nav-link.is-active,
.site-shell .nav-link[aria-current='page'],
.site-shell .nav-links a:hover,
.site-shell .nav-links a:focus,
.site-shell .nav-links a:focus-visible,
.site-shell .nav-links a[aria-current='page'] {
  font-family: var(--site-font-cond);
  font-size: clamp(13px, 1.1vw, 15px);
  font-weight: 500;
  letter-spacing: 1.25px;
  font-synthesis: none;
}

.site-shell .nav-label,
.site-shell .field-label,
.site-shell .control-label,
.site-shell .step-label {
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}

.site-shell .nav-link::after,
.site-shell .nav-links a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  background: var(--site-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.site-shell .nav-link:hover,
.site-shell .nav-link.is-active,
.site-shell .nav-link[aria-current='page'],
.site-shell .nav-links a:hover,
.site-shell .nav-links a[aria-current='page'] {
  color: var(--site-text);
}

.site-shell .nav-link:hover::after,
.site-shell .nav-link.is-active::after,
.site-shell .nav-link[aria-current='page']::after,
.site-shell .nav-links a:hover::after,
.site-shell .nav-links a[aria-current='page']::after {
  transform: scaleX(1);
}

.site-shell .nav-help {
  position: relative;
}

.site-shell .nav-help-toggle {
  display: inline-flex;
  align-items: center;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.site-shell .help-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 12px);
  left: 50%;
  width: min(240px, calc(100vw - 32px));
  padding: 5px;
  transform: translateX(-50%);
  border: 1px solid var(--site-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 38px rgba(38, 38, 38, .16);
}

.site-shell .help-menu[hidden] {
  display: none;
}

.site-shell .help-menu__link {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--site-text);
  text-decoration: none;
  white-space: normal;
}

.site-shell .help-menu__link:hover,
.site-shell .help-menu__link:focus-visible,
.site-shell .help-menu__link[aria-current='page'] {
  background: var(--site-surface-2);
}

.site-shell .help-menu__link::after {
  display: none;
}

.site-shell .help-menu__link strong {
  color: var(--site-text);
  font: 700 15px/1.1 var(--site-font-cond);
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.site-shell .help-menu__link[aria-current='page'] strong { color: var(--site-accent); }

.site-shell .nav-toggle {
  position: static;
  display: none;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--site-border);
  border-radius: 999px;
  background: var(--site-surface);
  color: var(--site-text);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}

.site-shell .nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.site-shell .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: 700 13px var(--site-font-cond);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

/* Keep auth controls truly hidden while Firebase resolves the session. */
.site-shell .site-auth .btn[hidden] {
  display: none !important;
}

.site-shell .btn:hover {
  transform: translateY(-2px);
}

.site-shell .btn-primary {
  background: var(--site-accent);
  color: #fff;
  box-shadow: 0 12px 28px var(--site-accent-glow);
}

.site-shell .btn-primary:hover {
  background: var(--site-accent-hover);
}

.site-shell .btn-secondary {
  border-color: var(--site-border);
  background: rgba(255, 255, 255, 0.58);
  color: var(--site-text);
}

.site-shell .site-footer {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 100%;
  border-top: 1px solid var(--site-border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--site-muted);
  padding: 32px 0 40px;
}

.site-shell .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.site-shell .footer-brand {
  display: grid;
  gap: 6px;
}

.site-shell .footer-title {
  color: var(--site-text);
  font: 400 26px var(--site-font-display);
  letter-spacing: 2px;
}

.site-shell .footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-weight: 600;
}

.site-shell .footer-links a {
  color: inherit;
  text-decoration: none;
}

.site-shell .footer-links a:hover {
  color: var(--site-accent);
}

.site-shell .disclaimer {
  max-width: 780px;
  margin-top: 8px;
  color: var(--site-muted);
  font-size: 0.9rem;
}

.site-section {
  padding-block: var(--site-space-section);
}

.site-card {
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: var(--site-radius-card);
  box-shadow: var(--site-shadow);
}

@media (max-width: 1120px) {
  .site-shell .site-nav {
    gap: 12px;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .site-shell .nav-toggle {
    display: inline-flex;
    flex: 0 0 auto;
  }

  /* The compact header keeps Download inside the menu to prevent CTA clipping. */
  .site-shell .site-download {
    display: none;
  }

  .site-shell .nav-download-link {
    display: inline-flex;
  }

  .site-shell .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--site-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 32px rgba(38, 38, 38, 0.12);
  }

  .site-shell .nav-help {
    width: 100%;
  }

  .site-shell .nav-help-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 4px 0;
  }

  .site-shell .help-menu {
    position: static;
    width: 100%;
    margin-top: 4px;
    padding: 3px;
    transform: none;
    box-shadow: none;
    background: var(--site-surface-2);
  }

  .site-shell .nav-links.open {
    display: flex;
  }
}

@media (max-width: 720px) {
  :root {
    --site-header-height: 70px;
  }

  .site-shell .header-inner {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .site-shell .site-nav {
    justify-content: flex-end;
  }

  .site-shell .site-auth {
    flex-basis: 88px;
    width: 88px;
    min-width: 88px;
  }

  .site-shell .brand-name {
    font-size: 24px;
  }

  .site-shell .site-download {
    display: none;
  }

  .site-shell .nav-download-link {
    display: inline-flex;
  }

  .site-shell .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 420px) {
  .site-shell .container {
    width: min(100vw - 28px, 1160px);
  }

  .site-shell .header-inner,
  .site-shell .site-nav {
    gap: 8px;
  }

  .site-shell .brand {
    gap: 7px;
  }

  .site-shell .brand .logo,
  .site-shell .logo {
    width: 28px;
    height: 28px;
  }

  .site-shell .brand-name {
    font-size: 22px;
    letter-spacing: 1.5px;
  }

  .site-shell .site-auth .btn {
    padding-inline: 8px;
    font-size: 0.72rem;
    letter-spacing: 1px;
  }

  .site-shell .site-auth {
    flex-basis: 82px;
    width: 82px;
    min-width: 82px;
  }

  .site-shell .site-download {
    min-height: 38px;
    padding-inline: 10px;
    font-size: 12px;
    letter-spacing: 1px;
  }
}

/* FAQ pages share the Weight Class Explorer page surface and a single-column accordion. */
.site-shell.faq-page {
  background:
    radial-gradient(circle at 85% 4%, rgba(251, 77, 61, 0.12), transparent 30rem),
    radial-gradient(circle at 4% 24%, rgba(255, 255, 255, 0.9), transparent 24rem),
    linear-gradient(180deg, #eef3f2 0%, var(--site-bg) 44%, #e9e1de 100%);
  color: var(--site-text);
}
.site-shell.faq-page .policy { background: transparent; }
.site-shell.faq-page .policy-hero { padding: 64px 0 28px; }
.site-shell.faq-page .policy-hero > .container,
.site-shell.faq-page .policy-body > .container { width: min(920px, calc(100% - 40px)); margin-inline: auto; }
.site-shell.faq-page .faq-eyebrow { margin: 0 0 8px; color: var(--site-accent); font: 700 clamp(14px, 1.2vw, 18px)/1.2 var(--site-font-body); letter-spacing: .055em; text-transform: uppercase; }
.site-shell.faq-page .policy-hero h1 { margin: 0; color: var(--site-text); font: 400 clamp(46px, 6vw, 80px)/.95 var(--site-font-display); letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.site-shell.faq-page .policy-hero .subtext { display: none; }
.site-shell.faq-page .policy-body { padding: 0 0 72px; }
.site-shell.faq-page .faq-accordion { display: grid; grid-template-columns: 1fr; gap: 14px; }
.site-shell.faq-page .faq-accordion__item { overflow: hidden; border: 1px solid rgba(38, 38, 38, .22); border-radius: 12px; background: rgba(255, 255, 255, .2); box-shadow: none; }
.site-shell.faq-page .faq-accordion__heading { margin: 0; }
.site-shell.faq-page .faq-accordion__trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 68px; padding: 18px 22px; border: 0; background: transparent; color: var(--site-text); font: 700 21px/1.15 var(--site-font-cond); letter-spacing: .02em; text-align: left; cursor: pointer; }
.site-shell.faq-page .faq-accordion__trigger:hover,
.site-shell.faq-page .faq-accordion__trigger:focus-visible { background: rgba(38,38,38,.06); }
.site-shell.faq-page .faq-accordion__trigger:focus-visible { outline: 2px solid var(--site-accent); outline-offset: -2px; }
.site-shell.faq-page .faq-accordion__icon { flex: 0 0 auto; margin-left: 18px; color: #ffb36b; font: 400 30px/1 var(--site-font-body); }
.site-shell.faq-page .faq-accordion__answer { max-height: 0; overflow: hidden; padding: 0 22px; opacity: 0; transition: max-height .24s ease, opacity .2s ease, padding-bottom .24s ease; }
.site-shell.faq-page .faq-accordion__answer[aria-hidden="false"] { padding-bottom: 20px; opacity: 1; }
.site-shell.faq-page .faq-accordion__answer p { margin: 0; color: var(--site-muted); font: 400 1.05rem/1.6 var(--site-font-body); }
.site-shell.faq-page .faq-accordion__answer a, .site-shell.faq-page .faq-cross-link a { color: #ffb36b; text-decoration: underline; text-underline-offset: 3px; }
.site-shell.faq-page .faq-cross-link { margin: 24px 0 0; color: rgba(247,243,237,.75); font: 400 1rem/1.5 var(--site-font-body); }
.site-shell.faq-page .app-faq-group { margin: 0 0 20px; }
.site-shell.faq-page .app-faq-group-title { margin: 0 0 10px; color: var(--site-accent) !important; font: 700 14px/1.2 var(--site-font-body) !important; letter-spacing: .055em; text-transform: uppercase; }
.site-shell.faq-page .app-faq-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (max-width: 700px) {
  .site-shell.faq-page .policy-hero { padding-top: 44px; }
  .site-shell.faq-page .policy-hero > .container, .site-shell.faq-page .policy-body > .container { width: min(100% - 28px, 920px); }
  .site-shell.faq-page .policy-hero h1 { font-size: clamp(42px, 13vw, 58px); }
  .site-shell.faq-page .faq-accordion__trigger { min-height: 62px; padding: 16px 17px; font-size: 19px; }
  .site-shell.faq-page .faq-accordion__answer { padding-inline: 17px; }
  .site-shell.faq-page .faq-accordion__answer p { font-size: 1rem; }
}
