/* ============================================================
   klowpeptidestack.com  |  Design: Dossier (brandhub archetype)
   Locked tokens from DESIGN-SPECS.md section D. Cascade layers
   (tokens, base, layout, components). Flexbox only, no CSS grid.
   Physical properties. Class prefix bh-. Cards and boxes at 14px.
   ============================================================ */
@layer tokens, base, layout, components;

@layer tokens {
  :root {
    color-scheme: light;
    --bh-page: #FCFCFD;
    --bh-ink: #221F26;
    --bh-accent: #5B3FA8;
    --bh-soft: #F4F1FA;
    --bh-rule: #E5E2EC;
    --bh-muted: #5E5869;
    --bh-head: "Avenir Next", "Segoe UI", system-ui, sans-serif;
    --bh-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
    --bh-column: 72ch;
    --bh-wide: 64rem;
    --bh-round: 14px;
    --bh-lift: 0 2px 10px rgba(34, 31, 38, 0.07);
    --bh-gap: 1.25rem;
  }
}

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }

  body {
    margin: 0;
    background-color: var(--bh-page);
    color: var(--bh-ink);
    font-family: var(--bh-body);
    font-size: 1.09rem;
    line-height: 1.66;
  }

  h1, h2, h3, h4 {
    font-family: var(--bh-head);
    line-height: 1.24;
    margin: 0 0 0.7rem 0;
    font-weight: 600;
  }
  h1 { font-size: 1.95rem; letter-spacing: -0.015em; }
  h2 { font-size: 1.34rem; margin-top: 2.4rem; }
  h3 { font-size: 1.06rem; margin-top: 1.5rem; }
  h4 { font-size: 0.98rem; margin-top: 1.2rem; }

  p { margin: 0 0 1rem 0; }
  ul { margin: 0 0 1rem 0; padding-left: 1.15rem; }
  li { margin-bottom: 0.4rem; }

  a {
    color: var(--bh-accent);
    text-decoration: underline;
    text-underline-offset: 0.15em;
    text-decoration-thickness: 1px;
  }
  a:hover { text-decoration-thickness: 2px; }
  a:focus-visible,
  [tabindex]:focus-visible,
  summary:focus-visible {
    outline: 3px solid var(--bh-accent);
    outline-offset: 3px;
    border-radius: 6px;
  }

  strong { font-weight: 600; }
  time { white-space: nowrap; }
  code {
    font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-size: 0.92em;
    background-color: var(--bh-soft);
    padding: 0.05em 0.35em;
    border-radius: 5px;
  }
}

@layer layout {
  .bh-skip {
    position: absolute;
    top: -4rem;
    left: 1rem;
    z-index: 6;
    background-color: var(--bh-soft);
    color: var(--bh-ink);
    border: 1px solid var(--bh-accent);
    border-radius: 10px;
    padding: 0.5rem 0.9rem;
    font-family: var(--bh-head);
    font-size: 0.85rem;
  }
  .bh-skip:focus-visible { top: 0.6rem; }

  .bh-hero {
    background-color: var(--bh-soft);
    border-bottom: 1px solid var(--bh-rule);
    padding: 2rem 1.15rem 2.25rem 1.15rem;
  }
  .bh-hero__inner { max-width: var(--bh-wide); margin: 0 auto; }
  .bh-hero__lede { max-width: var(--bh-column); }

  .bh-band {
    max-width: var(--bh-wide);
    margin: 0 auto;
    padding: 2.25rem 1.15rem 0 1.15rem;
  }

  .bh-column {
    max-width: var(--bh-column);
    margin: 0 auto;
    padding: 0 1.15rem 3rem 1.15rem;
  }

  .bh-footer {
    background-color: var(--bh-soft);
    border-top: 1px solid var(--bh-rule);
    padding: 2rem 1.15rem 2.25rem 1.15rem;
  }
  .bh-footer__inner { max-width: var(--bh-wide); margin: 0 auto; }
  .bh-footer__cols {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
    margin-bottom: 1.5rem;
  }
  .bh-footer__col { flex: 1 1 100%; min-width: 0; }
  .bh-footer h2 {
    margin-top: 0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--bh-muted);
  }
  .bh-footer p { font-size: 0.95rem; }

  @media (min-width: 760px) {
    .bh-hero { padding: 2.75rem 2rem 3rem 2rem; }
    .bh-band { padding: 3rem 2rem 0 2rem; }
    .bh-column { padding: 0 2rem 4rem 2rem; }
    .bh-footer { padding: 2.75rem 2rem 3rem 2rem; }
    .bh-footer__col { flex: 1 1 calc(50% - 0.875rem); }
    h1 { font-size: 2.45rem; }
    h2 { font-size: 1.5rem; }
  }
}

@layer components {

  /* ---- nav: two rows, centred wordmark then centred link row ---- */
  .bh-nav {
    background-color: var(--bh-page);
    border-bottom: 1px solid var(--bh-rule);
    text-align: center;
  }
  .bh-nav__mark {
    display: block;
    padding: 1rem 1rem 0.85rem 1rem;
    font-family: var(--bh-head);
    font-size: 1.02rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bh-ink);
    text-decoration: none;
  }
  .bh-nav__mark:hover { color: var(--bh-accent); }
  .bh-nav__rule {
    border: 0;
    border-top: 1px solid var(--bh-rule);
    margin: 0 auto;
    max-width: var(--bh-wide);
  }
  .bh-nav__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 1.4rem;
    list-style: none;
    margin: 0;
    padding: 0.7rem 1rem;
  }
  .bh-nav__links a {
    font-family: var(--bh-head);
    font-size: 0.86rem;
    color: var(--bh-muted);
    text-decoration: none;
  }
  .bh-nav__links a:hover { color: var(--bh-accent); text-decoration: underline; }
  .bh-nav__links a[aria-current="page"] { color: var(--bh-accent); }

  /* ---- hero furniture ---- */
  .bh-eyebrow {
    font-family: var(--bh-head);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--bh-muted);
    margin: 0 0 0.6rem 0;
  }
  .bh-stamp {
    font-family: var(--bh-head);
    font-size: 0.88rem;
    color: var(--bh-muted);
    margin: 0 0 1.4rem 0;
  }
  .bh-stamp span { display: block; font-size: 0.82rem; margin-top: 0.2rem; }

  /* ---- lookup result set: the two-sentence block above the prose ---- */
  .bh-result {
    background-color: var(--bh-page);
    border: 1px solid var(--bh-rule);
    border-left: 6px solid var(--bh-accent);
    border-radius: var(--bh-round);
    padding: 1.1rem 1.2rem;
    margin: 0 0 1.6rem 0;
    max-width: var(--bh-column);
  }
  .bh-result p { margin-bottom: 0.5rem; font-size: 1.02rem; }
  .bh-result p:last-child { margin-bottom: 0; }

  /* ---- disclosure panel, used at the top and again in the footer ---- */
  .bh-disclosure {
    background-color: var(--bh-page);
    border: 2px solid var(--bh-accent);
    border-radius: var(--bh-round);
    padding: 1.05rem 1.15rem;
    margin: 0 0 1.6rem 0;
    max-width: var(--bh-column);
  }
  .bh-disclosure__label {
    display: block;
    font-family: var(--bh-head);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--bh-accent);
    margin-bottom: 0.4rem;
  }
  .bh-disclosure p { font-size: 0.98rem; }
  .bh-disclosure p:last-child { margin-bottom: 0; }
  .bh-footer .bh-disclosure { max-width: none; margin: 0 0 1.5rem 0; }

  /* ---- summary box, neutral: holds the compound definition slot ---- */
  .bh-summary {
    background-color: var(--bh-page);
    border: 1px solid var(--bh-rule);
    border-left: 6px solid var(--bh-accent);
    border-radius: var(--bh-round);
    padding: 1.2rem 1.25rem;
    max-width: var(--bh-column);
  }
  .bh-summary h2 { margin-top: 0; font-size: 1.1rem; }
  .bh-summary__note { font-size: 0.93rem; color: var(--bh-muted); margin: 0 0 1rem 0; }
  .bh-summary dl { margin: 0; }
  .bh-summary dt {
    font-family: var(--bh-head);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--bh-muted);
    margin-top: 0.9rem;
  }
  .bh-summary dt:first-of-type { margin-top: 0; }
  .bh-summary dd { margin: 0.2rem 0 0 0; }

  /* ---- proof cards, two up on desktop, flexbox only ---- */
  .bh-cards {
    display: flex;
    flex-wrap: wrap;
    gap: var(--bh-gap);
    list-style: none;
    margin: 1.2rem 0 0 0;
    padding: 0;
  }
  .bh-card {
    flex: 1 1 100%;
    background-color: var(--bh-page);
    border: 1px solid var(--bh-rule);
    border-radius: var(--bh-round);
    box-shadow: var(--bh-lift);
    padding: 1.15rem 1.2rem 1.25rem 1.2rem;
  }
  .bh-card h3 { margin-top: 0.55rem; }
  .bh-card p { font-size: 0.99rem; }
  .bh-card p:last-of-type { margin-bottom: 0.4rem; }
  .bh-card__kind {
    display: inline-block;
    background-color: var(--bh-soft);
    color: var(--bh-muted);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-family: var(--bh-head);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
  }
  .bh-card__source {
    margin: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--bh-rule);
    font-size: 0.9rem;
    color: var(--bh-muted);
  }
  @media (min-width: 760px) {
    .bh-card { flex: 1 1 calc(50% - (var(--bh-gap) / 2)); }
  }

  /* ---- resolution and record tables ---- */
  .bh-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
    margin-bottom: 0.9rem;
  }
  .bh-table caption {
    caption-side: top;
    text-align: left;
    font-size: 0.9rem;
    color: var(--bh-muted);
    padding-bottom: 0.7rem;
  }
  .bh-table th, .bh-table td {
    text-align: left;
    vertical-align: top;
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid var(--bh-rule);
  }
  .bh-table thead th {
    font-family: var(--bh-head);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--bh-muted);
    border-bottom: 2px solid var(--bh-accent);
  }
  .bh-table tbody th {
    font-family: var(--bh-body);
    font-weight: 600;
    width: 20%;
  }
  .bh-table tbody tr:last-child th,
  .bh-table tbody tr:last-child td { border-bottom: 0; }
  .bh-empty {
    color: var(--bh-muted);
    font-style: italic;
    min-width: 2rem;
  }
  .bh-tablenote { font-size: 0.92rem; color: var(--bh-muted); }
  .bh-finding {
    border-left: 3px solid var(--bh-accent);
    background-color: var(--bh-soft);
    border-radius: 0 8px 8px 0;
    padding: 0.7rem 1rem;
    margin: 0 0 0.8rem 0;
    font-size: 0.95rem;
  }
  @media (max-width: 759px) {
    .bh-table { font-size: 0.86rem; }
    .bh-table th, .bh-table td { padding: 0.55rem 0.35rem; }
    .bh-table tbody th { width: 24%; }
  }

  /* ---- long form furniture ---- */
  .bh-lead { font-size: 1.14rem; }
  .bh-quiet { color: var(--bh-muted); }
  .bh-rule { border: 0; border-top: 1px solid var(--bh-rule); margin: 2.4rem 0 0 0; }
  .bh-faq h3 { margin-top: 1.8rem; }
  .bh-scope {
    background-color: var(--bh-soft);
    border: 1px solid var(--bh-rule);
    border-radius: var(--bh-round);
    padding: 1.15rem 1.25rem;
  }
  .bh-scope h2 { margin-top: 0; }
  .bh-scope p:last-child { margin-bottom: 0; }
  .bh-supplier {
    background-color: var(--bh-page);
    border: 1px solid var(--bh-rule);
    border-radius: var(--bh-round);
    padding: 1.15rem 1.25rem;
    margin-top: 1.2rem;
  }
  .bh-supplier h2 { margin-top: 0; }
  .bh-supplier h3 { font-size: 1rem; }
  .bh-meta {
    border-top: 1px solid var(--bh-rule);
    padding-top: 0.9rem;
    font-family: var(--bh-head);
    font-size: 0.82rem;
    color: var(--bh-muted);
  }
  .bh-meta a { color: var(--bh-muted); }
}
