/* STOP-Bang site styles. No framework; mobile first.
   Content classes (for page authors) are documented in README.md. */

:root {
  --red: #c8102e;
  --red-dark: #9e0c24;
  --navy: #12364a;
  --navy-dark: #0b2433;
  --blue: #1f5fa8;
  --ink: #1d2730;
  --muted: #56626e;
  --line: #dce3ea;
  --bg: #ffffff;
  --bg-soft: #f3f5f8;
  --callout: #e7f0fb;
  --callout-line: #9fc0e8;
  --alert: #fdebed;
  --alert-line: #efa5b0;
  --ok: #1e7b45;
  --warn: #a35a00;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 32 48 / 8%), 0 4px 16px rgb(16 32 48 / 8%);
  --container: 72rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

img { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: 0.15em; }
a:hover { color: var(--navy); }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.25; color: var(--navy); margin: 1.6em 0 0.6em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p, ul, ol, dl { margin: 0 0 1em; }
li { margin-bottom: 0.35em; }
sup { line-height: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 1.25rem; }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--navy); color: #fff; padding: 0.5rem 1rem; border-radius: 0 0 6px 6px;
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- Buttons ---------- */

.button {
  display: inline-block;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border: 0;
  border-radius: 999px;
  padding: 0.7em 1.4em;
  line-height: 1.2;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}
.button:hover { background: var(--red-dark); color: #fff; }
.button-small { padding: 0.5em 1em; font-size: 0.9rem; }
.button-secondary { background: #fff; color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }
.button-secondary:hover { background: var(--navy); color: #fff; }
.button-ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px #fff; }
.button-ghost:hover { background: #fff; color: var(--navy); }

/* ---------- Header and navigation ---------- */

.site-header { background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 1rem; padding-top: 0.6rem; padding-bottom: 0.6rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand-logo { width: 84px; height: auto; }
.brand-text { font-size: 1.05rem; line-height: 1.2; }
.brand-text strong { color: var(--red); }
.header-cta { display: none; }

.menu-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem;
  border: 2px solid var(--navy); border-radius: 8px; padding: 0.4rem 0.8rem;
  color: var(--navy); font-weight: 600; text-decoration: none;
}
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 18px; height: 2px; background: currentColor; position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }

.site-nav { display: none; background: var(--navy); }
.site-nav:target, .site-nav.is-open { display: block; }
.nav-list { list-style: none; margin: 0 auto; padding-top: 0.5rem; padding-bottom: 0.5rem; }
.nav-item { margin: 0; }
.nav-item > a, .nav-item summary {
  display: block; color: #fff; text-decoration: none; padding: 0.7rem 0.25rem; font-weight: 600;
  cursor: pointer; list-style: none;
}
.nav-item summary::-webkit-details-marker { display: none; }
.nav-item summary::after {
  content: ""; display: inline-block; margin-left: 0.5em; width: 0.45em; height: 0.45em;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-0.2em) rotate(45deg);
}
.nav-item details[open] > summary::after { transform: translateY(0.05em) rotate(225deg); }
.nav-item > a:hover, .nav-item summary:hover { color: #ffd9de; }
.nav-item a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }
.nav-panel { padding: 0 0 0.75rem 1rem; }
.nav-panel ul { list-style: none; margin: 0; padding: 0; }
.nav-panel li { margin: 0; }
.nav-panel a { display: block; color: #e8eef3; text-decoration: none; padding: 0.35rem 0; font-size: 0.95rem; }
.nav-panel a:hover { color: #fff; text-decoration: underline; }
.nav-group-title { color: #fff; font-weight: 700; margin: 0.75rem 0 0.25rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }

@media (min-width: 960px) {
  .menu-toggle { display: none; }
  .header-cta { display: inline-block; }
  .brand-logo { width: 100px; }
  .brand-text { font-size: 1.2rem; }
  .site-nav { display: block; }
  .nav-list { display: flex; flex-wrap: wrap; gap: 0 1.75rem; position: relative; padding-top: 0; padding-bottom: 0; }
  .nav-item { position: relative; }
  .nav-item:has(.nav-panel--wide) { position: static; }
  .nav-item > a, .nav-item summary { padding: 0.85rem 0; }
  .nav-item.is-active > details > summary,
  .nav-item > a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--red); text-decoration: none; }
  .nav-panel {
    position: absolute; top: 100%; left: -1rem; min-width: 18rem; max-width: 26rem;
    background: #fff; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow);
    padding: 0.75rem 1rem 1rem;
  }
  .nav-panel--wide {
    left: 1.25rem; right: 1.25rem; max-width: none;
    display: grid; grid-template-columns: 1fr 1.3fr 0.8fr; gap: 1.5rem;
  }
  .nav-panel a { color: var(--ink); font-size: 0.92rem; padding: 0.3rem 0; line-height: 1.35; }
  .nav-panel a:hover { color: var(--red); }
  .nav-panel a[aria-current="page"] { color: var(--red); }
  .nav-group-title { color: var(--muted); opacity: 1; margin-top: 0.25rem; }
}

/* ---------- Page body ---------- */

main:focus { outline: none; }
.page { padding-top: 1.5rem; padding-bottom: 2.5rem; }
.page-title { margin-top: 0.5rem; }
.content { max-width: 52rem; }
.content > :first-child { margin-top: 0; }
.home .content, .wide .content { max-width: none; }

.section-nav { margin-bottom: 1.5rem; }
.section-nav-details { background: var(--bg-soft); border-radius: var(--radius); padding: 0.75rem 1.1rem; }
.section-nav-details summary { cursor: pointer; font-weight: 700; color: var(--navy); }
.section-nav ul {
  list-style: none; margin: 0.75rem 0 0.25rem; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.15rem 1.5rem;
}
.section-nav li { margin: 0; font-size: 0.92rem; line-height: 1.35; padding: 0.25rem 0; }
.section-nav a { text-decoration: none; }
.section-nav a:hover { text-decoration: underline; }
.section-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.section-nav a[aria-current="page"]::before { content: "\25B8\00a0"; color: var(--red); }

/* Highlighted statistic, replaces the old red <font><b> */
.hl { color: var(--red); font-weight: 700; }
.lead { font-size: 1.2rem; color: var(--navy); }

/* Text with an illustration beside it */
.media { display: grid; gap: 1rem 2rem; margin: 0 0 1.5rem; align-items: start; }
.media-figure { margin: 0; }
.media-figure img { border-radius: 6px; }
@media (min-width: 720px) {
  .media { grid-template-columns: minmax(0, 1fr) minmax(0, 16rem); }
  .media--left { grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); }
  .media--left .media-figure { order: -1; }
  .media--narrow { grid-template-columns: minmax(0, 1fr) minmax(0, 10rem); }
}

/* Term / description rows */
.deflist { margin: 0 0 1.5rem; }
.deflist dt { font-weight: 700; color: var(--navy); }
.deflist dd { margin: 0 0 1rem; }
.deflist dd > :last-child { margin-bottom: 0; }
@media (min-width: 720px) {
  .deflist { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 0 1.5rem; }
  .deflist dd { margin-bottom: 1.1rem; }
}

/* Boxes */
.callout, .callout-alert {
  border-radius: var(--radius); padding: 1rem 1.25rem; margin: 0 0 1.5rem;
  background: var(--callout); border-left: 5px solid var(--callout-line);
}
.callout-alert { background: var(--alert); border-left-color: var(--alert-line); }
.callout > :last-child, .callout-alert > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; color: var(--navy); margin-bottom: 0.4em; }

/* References / citations */
.refs { font-size: 0.92rem; color: var(--muted); padding-left: 1.5rem; }
.refs li { margin-bottom: 0.5em; }
.source { font-size: 0.875rem; color: var(--muted); }

/* Lists of links in columns */
.link-cols { columns: 16rem 3; column-gap: 2rem; padding-left: 1.2rem; }
.link-cols li { break-inside: avoid; }
.plain-list { list-style: none; padding: 0; }

/* Figures */
.figure { margin: 0 0 2rem; }
.figure img { display: block; border-radius: 6px; }
.figure figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

/* Tables (if any content needs one) */
.table { border-collapse: collapse; width: 100%; margin: 0 0 1.5rem; font-size: 0.95rem; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }
.table th { background: var(--bg-soft); color: var(--navy); }
.table-scroll { overflow-x: auto; }

/* People (faculty / team) */
.people { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); margin: 0 0 2rem; }
.person { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; align-items: start;
  background: var(--bg-soft); border-radius: var(--radius); padding: 1rem; }
.person img { width: 6.5rem; height: 6.5rem; object-fit: cover; border-radius: 50%; }
.person-name { font-weight: 700; color: var(--navy); margin: 0 0 0.25rem; }
.person p { font-size: 0.92rem; margin-bottom: 0.4em; line-height: 1.45; }
.person-noimg { grid-template-columns: 1fr; }

/* Publications */
.pubs { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.pub { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1rem; padding: 1rem; margin: 0;
  border: 1px solid var(--line); border-radius: var(--radius); }
.pub-noimg { grid-template-columns: 1fr; }
.pub img { width: 4.5rem; height: auto; border-radius: 3px; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); }
.pub-title { font-weight: 700; margin: 0 0 0.3rem; line-height: 1.35; }
.pub p { margin: 0 0 0.25rem; font-size: 0.92rem; }
.pub-links { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.9rem; margin-top: 0.4rem; }

/* ---------- Pager ---------- */

.pager {
  display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-top: 3rem;
  padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.pager a { text-decoration: none; }
.pager-prev, .pager-next { display: block; padding: 0.75rem 1rem; border-radius: var(--radius); }
a.pager-prev, a.pager-next { background: var(--bg-soft); }
a.pager-prev:hover, a.pager-next:hover { background: var(--callout); }
.pager span { display: block; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.pager-prev span::before { content: "\2190\00a0"; }
.pager-next span::after { content: "\00a0\2192"; }
.pager-top { align-self: center; text-align: center; font-size: 0.9rem; }
@media (min-width: 720px) {
  .pager { grid-template-columns: 1fr auto 1fr; }
  .pager-next { text-align: right; }
}

/* ---------- CTA band and footer ---------- */

.cta-band { background: var(--bg-soft); border-top: 1px solid var(--line); }
.cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; padding-bottom: 1.5rem; }
.cta-inner p { margin: 0; }
.home .cta-band { display: none; }

.site-footer { background: var(--navy-dark); color: #d6dee5; font-size: 0.95rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; padding-top: 2rem; padding-bottom: 2rem; }
.site-footer a { color: #fff; }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }

/* ---------- Home page ---------- */

.home .page { padding-top: 1.5rem; }
.hero {
  position: relative; color: #fff; border-radius: 0 0 var(--radius) var(--radius);
  margin: 0 -1.25rem 2.5rem; padding: 3.5rem 1.5rem;
  background: linear-gradient(90deg, rgb(11 36 51 / 92%) 0%, rgb(11 36 51 / 75%) 55%, rgb(11 36 51 / 35%) 100%),
              url("../../image/mainpro4.jpg") center / cover no-repeat;
}
@media (min-width: 720px) { .hero { margin: 0 0 2.5rem; padding: 4.5rem 3rem; border-radius: var(--radius); } }
.hero h1 { color: #fff; margin: 0 0 0.5rem; max-width: 20em; }
.hero h1 strong { color: #ff6b7f; }
.hero p { font-size: 1.15rem; max-width: 34em; color: #e9eff4; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

.quick { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); margin-bottom: 3rem; }
.quick-card { background: var(--bg-soft); border-radius: var(--radius); padding: 1.25rem 1.5rem; border-top: 4px solid var(--red); }
.quick-card h2 { margin-top: 0; font-size: 1.2rem; }
.quick-card ul { padding-left: 1.2rem; }
.quick-card > :last-child { margin-bottom: 0; }

.cards { list-style: none; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); margin: 0 0 3rem; }
.card { margin: 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.card-body { padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.card h3 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.card h3 a { text-decoration: none; color: var(--navy); }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card:hover h3 a { color: var(--red); }
.card p { font-size: 0.95rem; color: var(--muted); margin: 0; }

.chips { list-style: none; padding: 0; margin: -1.5rem 0 3rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.chips li { margin: 0; }
.chips a { display: inline-block; padding: 0.45rem 1rem; border-radius: 999px; background: var(--bg-soft); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.chips a:hover { background: var(--callout); }

.news { list-style: none; padding: 0; margin: 0 0 2rem; }
.news li { padding: 0.9rem 0 0.9rem 1.5rem; border-bottom: 1px solid var(--line); position: relative; margin: 0; }
.news li::before { content: ""; position: absolute; left: 0.2rem; top: 1.45rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--red); }
.news p { margin: 0 0 0.6em; }
.news p:last-child { margin-bottom: 0; }

/* ---------- STOP-Bang questionnaire ---------- */

.sb-intro { display: grid; gap: 1rem 2rem; align-items: center; margin-bottom: 1.5rem; }
@media (min-width: 720px) { .sb-intro { grid-template-columns: minmax(0, 1fr) auto; } }
.sb-intro img { width: 150px; }
.sb-title { font-size: 1.6rem; font-weight: 800; color: var(--navy); margin: 0 0 0.5rem; }
.sb-title span { color: var(--red); }

.sb-form { margin: 0 0 2rem; }
.sb-q {
  border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 0.85rem; padding: 1rem 1.1rem;
  display: grid; gap: 0.75rem 1.25rem; grid-template-columns: 3rem minmax(0, 1fr);
}
.sb-letter {
  grid-row: span 2; width: 3rem; height: 3rem; border-radius: 50%; background: var(--navy); color: #fff;
  font-size: 1.5rem; font-weight: 800; display: grid; place-items: center;
}
.sb-q.is-stop .sb-letter { background: var(--red); }
.sb-text { margin: 0; }
.sb-text strong { color: var(--navy); }
.sb-text .sb-word { font-size: 1.1rem; }
.sb-answers { display: flex; gap: 0.5rem; grid-column: 2; }
.sb-answers label {
  display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
  border: 2px solid var(--line); border-radius: 999px; padding: 0.35rem 1.1rem; font-weight: 600;
}
.sb-answers input { accent-color: var(--red); width: 1.1rem; height: 1.1rem; margin: 0; }
.sb-answers label:has(input:checked) { border-color: var(--navy); background: var(--callout); }
.sb-q.is-missing { border-color: var(--red); background: var(--alert); }

.bmi { grid-column: 1 / -1; background: var(--bg-soft); border-radius: 8px; padding: 0.85rem 1rem; margin-top: 0.25rem; }
@media (min-width: 720px) { .bmi { grid-column: 2; } }
.bmi-title { font-weight: 700; margin: 0 0 0.5rem; font-size: 0.95rem; }
.bmi-row { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: end; }
.bmi-row label { display: flex; flex-direction: column; font-size: 0.85rem; font-weight: 600; gap: 0.2rem; }
.bmi-units { display: flex; gap: 1rem; margin-bottom: 0.6rem; font-size: 0.92rem; }
.bmi-units label { display: inline-flex; gap: 0.35rem; align-items: center; }
.bmi input[type="text"], .bmi input[inputmode] {
  width: 7rem; font: inherit; padding: 0.35rem 0.5rem; border: 1px solid #b7c2cd; border-radius: 6px;
}
.bmi-out { margin: 0.6rem 0 0; font-weight: 600; min-height: 1.5em; }
.bmi-out.is-error { color: var(--red); }

.sb-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; margin-top: 1.25rem; }
.sb-error { color: var(--red); font-weight: 600; margin: 0.75rem 0 0; }
.sb-privacy { font-size: 0.9rem; color: var(--muted); margin-top: 0.75rem; }

.sb-result { border-radius: var(--radius); padding: 1.25rem 1.5rem; margin: 0 0 1.5rem; border: 2px solid var(--navy); }
.sb-result:focus { outline: 3px solid #f2b705; }
.sb-score { font-size: 1.6rem; font-weight: 800; margin: 0 0 0.25rem; color: var(--navy); }
.sb-risk { font-size: 1.2rem; margin: 0 0 0.5rem; }
.sb-result[data-risk="high"] { border-color: var(--red); background: var(--alert); }
.sb-result[data-risk="high"] .sb-risk strong { color: var(--red); }
.sb-result[data-risk="intermediate"] { border-color: var(--warn); background: #fff4e5; }
.sb-result[data-risk="intermediate"] .sb-risk strong { color: var(--warn); }
.sb-result[data-risk="low"] { border-color: var(--ok); background: #e9f6ee; }
.sb-result[data-risk="low"] .sb-risk strong { color: var(--ok); }
.sb-reasons { margin: 0.25rem 0 0.5rem; padding-left: 1.2rem; }

.odds { display: grid; gap: 1rem 1.5rem; align-items: start; }
@media (min-width: 720px) { .odds { grid-template-columns: 350px minmax(0, 1fr); } }

/* ---------- Contact form (only shown when a form endpoint is configured) ---------- */

.form-grid { display: grid; gap: 1rem; max-width: 36rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.form-grid input, .form-grid textarea {
  font: inherit; padding: 0.55rem 0.7rem; border: 1px solid #b7c2cd; border-radius: 6px; font-weight: 400;
}
.form-grid .hp { position: absolute; left: -9999px; }

/* ---------- Print ---------- */

@media print {
  .site-nav, .menu-toggle, .header-cta, .cta-band, .section-nav, .pager, .skip-link, .sb-actions { display: none !important; }
  body { font-size: 11pt; }
  a { color: inherit; }
  .sb-q { break-inside: avoid; }
}

.media-figure img + img { margin-top: 1rem; }
.figure-center img { margin: 0 auto; }
.person-photo { text-align: center; font-size: 0.85rem; }
.person-photo p { margin: 0.4rem 0 0; }
/* Beside a picture there isn't room for two columns of term/description. */
.media .deflist { display: block; }
.media .deflist dd { margin-bottom: 1rem; }
