/* Site-specific styles that Bootstrap doesn't cover. Load after theme.css. */

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 1030; background: var(--chrome); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--f-display); font-weight: 400; line-height: 1.12; text-wrap: balance; letter-spacing: -.01em; margin-bottom: 0; }
h2 { font-size: var(--s3); }
h3 { font-size: var(--s2); }
.h-body { font-family: var(--f-body); font-weight: 700; font-size: var(--s1); }
p { margin-bottom: 0; }

.container { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.eyebrow { font-family: var(--f-mono); font-size: var(--s-1); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.lede { font-size: var(--s1); color: var(--muted); max-width: 40rem; }
.small-muted { color: var(--muted); font-size: .95rem; }
.text-plum { color: var(--plum); }
.mono-label { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }

/* Header */
.site-head { top: env(safe-area-inset-top, 0px); background: var(--chrome); }
.site-head .navbar-brand svg { width: 28px; height: 28px; flex: none; }
.site-head .nav-link { font-size: .9rem; font-weight: 500; border-radius: 999px; }
@media (min-width: 1200px) { .site-head .nav-link { padding-inline: .65rem !important; } .site-head .nav-link:hover { background: color-mix(in srgb, var(--chrome-ink) 12%, transparent); } }
.navbar-toggler { color: var(--chrome-ink); }
.navbar-toggler:focus { box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 35%, transparent); }

/* Sections */
section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.band { background: color-mix(in srgb, var(--band) 88%, transparent); }
.sec-head { display: grid; gap: .75rem; margin-bottom: 2.25rem; }
.sub-h { font-size: var(--s2); margin-block: 3rem 1.25rem; }

/* Hero */
.hero { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 6vw, 4.5rem); }
/* Headline stays on one line: it scales down with the column width (8.3% of the column fits the full phrase) */
.hero-copy { container-type: inline-size; }
.hero h1 { font-size: min(var(--s4), 8.3cqi); white-space: nowrap; margin-block: .75rem 1.25rem; }
.hero h1 em { font-style: normal; color: var(--accent); }

.facts { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.fact { border-top: 1px solid var(--line); padding: 1.25rem 1.25rem 1.25rem 0; display: grid; gap: .35rem; align-content: start; font-variant-numeric: tabular-nums; }
.fact b { font-family: var(--f-display); font-weight: 400; font-size: var(--s3); color: var(--plum); line-height: 1; }
.fact span { color: var(--muted); font-size: .95rem; }
.facts-src { font-family: var(--f-mono); font-size: .75rem; color: var(--muted); margin-top: .6rem; }

/* Cards with icons */
.sign-icon { width: 40px; height: 40px; color: var(--accent); }
.card-body { display: grid; gap: .5rem; align-content: start; }

/* Tags */
.tag { font-family: var(--f-mono); font-size: .72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; justify-self: start; }
.tag-fixed { background: var(--band); color: var(--muted); }
.tag-change { background: var(--accent-soft); color: var(--accent); }
.list-group-item b { font-weight: 600; display: block; }

/* Self-exam clock diagram */
.exam-clock { width: min(100%, 230px); margin: .25rem auto 0; }
.exam-clock figcaption { font-family: var(--f-mono); font-size: var(--s-1); color: var(--muted); margin-top: .6rem; }

/* Self-exam steps */
.steps { counter-reset: step; display: grid; gap: 1rem; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.steps li::before { content: counter(step); font-family: var(--f-display); font-size: 1.6rem; width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.steps p { color: var(--muted); }
.nav-pills { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .25rem; display: inline-flex; }
.nav-pills .nav-link { border-radius: 999px; font-weight: 600; }
@media (min-width: 992px) { .exam-aside { position: sticky; top: 6rem; } }

/* Tables */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table { margin-bottom: 0; font-variant-numeric: tabular-nums; min-width: 34rem; }
.table th { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: .9rem 1.1rem; }
.table td { padding: .9rem 1.1rem; }
.table td:first-child { font-weight: 700; white-space: nowrap; color: var(--plum); }
.table tbody tr:last-child td { border-bottom: 0; }
/* Phones: tables fit the screen instead of scrolling sideways */
@media (max-width: 575.98px) {
  .table { min-width: 0; }
  .table-stack thead { display: none; }
  .table-stack tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack td { display: block; border: 0; padding: .35rem 1.1rem; }
  .table-stack td[data-label]::before { content: attr(data-label); display: block; font-family: var(--f-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .15rem; }
}
.stages td:first-child { font-family: var(--f-display); font-weight: 400; font-size: 1.35rem; }
.note { font-size: .9rem; color: var(--muted); margin-top: .9rem; max-width: 46rem; }

/* Ruled items: screening tools, prevention, rights, types */
.ruled { border-top: 1px solid var(--line); padding-top: 1rem; display: grid; gap: .4rem; align-content: start; }
.ruled-accent { border-top: 2px solid var(--accent); }

/* Diagnosis path */
.path { counter-reset: p; }
.path li { counter-increment: p; display: grid; gap: .5rem; align-content: start; }
.path li::before { content: "Step " counter(p); font-family: var(--f-mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); padding-bottom: .75rem; border-bottom: 2px solid var(--accent); margin-bottom: .5rem; }

/* Glossary */
.gloss-search { max-width: 26rem; }
.gloss-count { font-family: var(--f-mono); font-size: var(--s-1); color: var(--muted); }
.gloss dt { font-weight: 700; color: var(--plum); }
.gloss dd { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }
.gloss .col { border-top: 1px solid var(--line); padding-block: 1rem; }

/* Resources */
.res-card { color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
.res-card:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--ink); }
.res-card b { font-size: var(--s1); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }

/* Photo fills: hero, ad cards, and the photo band */
.photo-band { padding-block: 2.5rem; }
/* Ad photo: in the photos' own 3:2 shape so faces aren't cropped, with soft corners and a gentle shadow */
.ad-photo { display: block; flex: 0 0 auto; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; object-position: center 30%; border-radius: 14px; box-shadow: 0 10px 24px -12px rgb(0 0 0 / .45), 0 2px 6px -2px rgb(0 0 0 / .2); }
/* The photo grows into any spare room in the card, so there is no blank gap above the button */
.ad-card .ad-photo { flex: 1 1 auto; aspect-ratio: auto; min-height: 9rem; max-height: 24rem; height: 0; }

/* Stock photo frames and the rotating banner background */
.photo-frame { aspect-ratio: 3 / 2; max-width: 100%; border-radius: var(--radius); overflow: hidden; background: var(--band); }
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; transition: opacity .8s ease; }
.photo-frame img.fading { opacity: 0; }

.hero { position: relative; isolation: isolate; }
/* Page background: photos fixed to the screen behind every section, so they stay put while the
   page scrolls. The overlay keeps text readable; sections with a band color stay slightly see-through. */
.page-bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.page-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; opacity: 0; transition: opacity 1.6s ease; }
.page-bg img.on { opacity: 1; }
.page-bg::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 72%, transparent); }
@media (prefers-reduced-motion: reduce) { .photo-frame img, .page-bg img { transition: none; } }

/* Ads: fixed side rails on wide screens (Bootstrap xxl, 1400px+), inline banners below that */
:root { --rail-w: clamp(240px, 16vw, 300px); }
.ad-rail { display: none; }
@media (min-width: 1400px) {
  body:has(.ad-rail) :is(main, .site-foot) .container { max-width: min(1320px, calc(100vw - 2 * (var(--rail-w) + 3rem))); }
  /* Both rails: same width, 75% of the visible screen tall, centered in the space below the header */
  .ad-rail { display: block; position: fixed; z-index: 1010; width: var(--rail-w); height: 75vh; height: 75dvh; top: calc(env(safe-area-inset-top, 0px) + 2.125rem + 12.5vh); top: calc(env(safe-area-inset-top, 0px) + 2.125rem + 12.5dvh); }
  .ad-left { left: max(1.25rem, env(safe-area-inset-left, 0px)); }
  .ad-right { right: max(1.25rem, env(safe-area-inset-right, 0px)); }
}
.ad-card, .ad-banner {
  font: inherit; text-align: left; border: 0; cursor: pointer; width: 100%;
  background: var(--plum); color: var(--bg); border-radius: var(--radius);
  transition: transform .15s, box-shadow .15s;
}
.ad-card:hover, .ad-banner:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--plum) 70%, transparent); }
.ad-card { display: flex; flex-direction: column; gap: 1.1rem; height: 100%; padding: 1.25rem 1.25rem 1.5rem; overflow: hidden; }
.ad-card .ad-cta { margin-top: auto; }
/* Card with the photo above the button: needs its own top padding */

/* Never squeeze a section: long text pushes the checklist down instead of running into it */
.ad-card > :not(.ad-photo) { flex-shrink: 0; }
/* Short screens: drop the alignment spacing so the button stays inside the ad */
/* Shorter screens: keep the photo and button; drop the checklist, then the body text */
@media (max-height: 940px) {
  .ad-card { gap: .7rem; }
  .ad-card .ad-title, .ad-card .ad-body { min-height: 0; }
  .ad-card .ad-list { display: none; }
}
@media (max-height: 780px) {
  .ad-card .ad-body { display: none; }
}
.ad-card .ad-kicker, .ad-card .ad-title, .ad-card .ad-body { text-align: center; }
/* Same slot heights in every side ad so headlines, text, checklists, and buttons line up across both */
.ad-card .ad-title { display: flex; flex-direction: column; justify-content: center; }
.ad-card .ad-body { text-align: justify; text-align-last: center; hyphens: auto; -webkit-hyphens: auto; }
.ad-banner .ad-title { text-align: center; }
.ad-title { display: block; }
.ad-line { display: block; white-space: nowrap; line-height: 1.2; }
.ad-card > *, .ad-banner > * { transition: opacity .3s ease; }
.ad-swapping > * { opacity: 0; }
.ad-kicker { font-family: var(--f-mono); font-size: .88rem; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.ad-title { font-family: var(--f-display); font-size: clamp(1.6rem, 1.9vw, 2.2rem); line-height: 1.1; text-wrap: balance; }
.ad-body { font-size: 1rem; opacity: .85; }
.ad-list { display: grid; gap: .5rem; font-size: 1rem; }
.ad-list span::before { content: "\2713"; color: var(--ad-accent); margin-right: .5rem; font-weight: 700; }
.ad-cta { justify-self: stretch; text-align: center; background: var(--ad-accent); color: var(--ad-accent-ink); border-radius: 999px; padding: .8rem .75rem; font-weight: 700; font-size: 1rem; white-space: nowrap; }

.ad-inline { padding-block: 1.5rem; }

/* Quote form */
#leadModal .form-check-label { font-size: .82rem; line-height: 1.45; }
#leadModal .form-label { margin-bottom: .3rem; font-weight: 500; }
.choice .btn-check:checked + .btn { --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent); --bs-btn-active-color: var(--accent-ink); }
.was-validated .choice .btn-check:invalid + .btn { border-color: var(--bs-form-invalid-border-color); }
.ad-banner { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "kicker cta" "title cta"; align-items: center; gap: .3rem 1.5rem; padding: 1.25rem 1.5rem; }
.ad-banner .ad-kicker { grid-area: kicker; }
.ad-banner .ad-title { grid-area: title; font-size: 1.35rem; }
.ad-banner .ad-cta { grid-area: cta; justify-self: start; }
@media (max-width: 575.98px) {
  .ad-banner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "kicker" "title" "cta"; gap: .6rem; text-align: center; }
  .ad-banner .ad-cta { justify-self: center; }
}

/* Footer: one row (copyright left, links right); wraps under the copyright on small screens */
.site-foot { background: var(--chrome); color: var(--chrome-ink); padding-block: 1.25rem; font-size: .875rem; }
.site-foot a { color: inherit; }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.5rem; }
.foot-copy { white-space: nowrap; opacity: .85; }
.foot-nav { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.foot-nav a { text-decoration: underline; text-underline-offset: 3px; opacity: .85; white-space: nowrap; }
.foot-nav a:hover { opacity: 1; }
.foot-credit { flex-basis: 100%; font-size: .8rem; opacity: .7; }
.foot-credit a { text-decoration: underline; text-underline-offset: 3px; }

/* Legal page */
.legal { max-width: 48rem; }
.legal-title { font-size: var(--s4); }
.legal-toc { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2.5rem; }
.legal-toc a { padding: .4rem 1rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600; }
.legal-toc a:hover { border-color: var(--accent); }
.legal h2 { margin-top: 3rem; padding-top: 1.5rem; border-top: 2px solid var(--accent); }
.legal h2:first-of-type { margin-top: 0; }
.legal h3 { font-family: var(--f-body); font-weight: 700; font-size: var(--s1); margin-top: 1.75rem; margin-bottom: .5rem; }
.legal p, .legal li { color: var(--muted); }
.legal p + p, .legal ul + p, .legal p + ul { margin-top: .75rem; }
.legal ul { display: grid; gap: .4rem; padding-left: 1.25rem; margin-bottom: 0; }

/* Older iPhones (iOS 15 and early iOS 16) lack color-mix() and container queries.
   These fallbacks keep the overlay, section colors, menu text and headline working there. */
@supports not (color: color-mix(in srgb, red, blue)) {
  .band { background: var(--band); }
  .page-bg::after { background: var(--bg); opacity: .72; }
  .navbar { --bs-navbar-color: var(--chrome-ink); --bs-navbar-toggler-border-color: var(--chrome-ink); }
  .site-head .nav-link:hover { background: transparent; }
  .alert-danger { --bs-alert-bg: var(--surface); }
}
@supports not (container-type: inline-size) {
  .hero h1 { font-size: clamp(1.75rem, 7vw, 4.25rem); white-space: normal; }
}
/* Safety net: nothing may make the page scroll sideways on phones */
body { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
/* Touch screens: finger drags may only scroll up and down (pinch-zoom still works), so the page can't be dragged sideways */
html, body { touch-action: pan-y pinch-zoom; }
/* iPhone: don't let Safari enlarge text on its own, and let long words or web addresses wrap instead of running off the edge */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-wrap: break-word; }

/* Phones and tablets: stronger overlay and full-strength text so words stay readable over the photos */
@media (max-width: 991.98px) {
  .page-bg::after { background: color-mix(in srgb, var(--bg) 86%, transparent); }
  body { font-weight: 500; }
  .lede, .small-muted, .note, .facts-src, .fact span, .steps p, .gloss dd,
  .list-group-item span, .legal p, .legal li { color: var(--ink); }
  .text-body-secondary { color: var(--ink) !important; }
}
@supports not (color: color-mix(in srgb, red, blue)) {
  @media (max-width: 991.98px) { .page-bg::after { opacity: .86; } }
}

/* Menu: larger, full-strength links when it opens from the menu button */
@media (max-width: 1199.98px) {
  .navbar { --bs-navbar-color: var(--chrome-ink); }
  .site-head .nav-link { font-size: 1.15rem; font-weight: 600; padding-block: .65rem; }
}
