/* ==========================================================================
   Qvin Platform — styles
   Brand palette is a best-effort match for qvin.com; swap exact hex codes
   in :root below when you have the brand spec.
   ========================================================================== */

/* ==========================================================================
   Web fonts — Berlingske (display) + Inter / Playfair via Google Fonts
   Berlingske is the headline face used on qvin.com. Self-hosted from
   /assets/fonts/. Playfair stays as fallback.
   ========================================================================== */

@font-face {
  font-family: 'Berlingske Serif';
  src: url('/assets/fonts/Berlingske-Serif-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand palette pulled from the official Qvin wordmark:
     charcoal text + red/coral gradient accent (the diagonal through the Q). */
  --qvin-charcoal: #2A2A2A;    /* primary brand text — wordmark color */
  --qvin-red: #D7263D;         /* deep end of the gradient stroke */
  --qvin-red-dark: #B01C2F;    /* hover/active */
  --qvin-coral: #FF8B7B;       /* warm end of the gradient stroke */
  --qvin-blush: #FCD9D2;       /* soft tint accent */
  --qvin-cream: #FBF6F0;       /* page background */
  --qvin-cream-2: #F4ECE0;     /* alt section background */
  --qvin-ink: #1A1F2C;         /* body text */
  --qvin-ink-muted: #5C6275;   /* secondary text */
  --qvin-line: rgba(26, 31, 44, 0.12);
  /* Legacy aliases — keep old wine names mapped to new red so existing rules keep working */
  --qvin-wine: var(--qvin-red);
  --qvin-wine-dark: var(--qvin-red-dark);
  --qvin-rose: var(--qvin-red);

  --maxw: 880px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-card: 0 20px 50px -20px rgba(140, 29, 64, 0.18), 0 8px 20px -10px rgba(26, 31, 44, 0.15);

  --serif: 'Berlingske Serif', 'Playfair Display', 'Times New Roman', Georgia, serif;
  --serif-fallback: 'Playfair Display', 'Times New Roman', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Brand gradient — used for headline word highlights ("…women's <span class='gradient-text'>health</span>"). */
  --qvin-gradient: linear-gradient(135deg, var(--qvin-red) 0%, #E84F47 45%, var(--qvin-coral) 100%);
}

/* ==========================================================================
   Gradient-text utility — wraps a word inside a headline.
   Usage:
     <h1>Diagnostic infrastructure for women's <span class="gradient-text">health</span>.</h1>
   ========================================================================== */

.gradient-text {
  background: var(--qvin-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* Ensure crisp rendering — gradient text can look chalky with anti-aliasing on. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--qvin-cream);
  color: var(--qvin-ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--qvin-wine); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--qvin-wine-dark); }

.hidden { display: none !important; }

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

/* ==========================================================================
   Brand wordmark (typographic — swap with SVG logo when available)
   Drop a file at /assets/img/qvin-logo.svg and replace .brand markup with
   <img src="/assets/img/qvin-logo.svg" alt="Qvin" /> to use the real logo.
   ========================================================================== */

.brand,
.brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.brand-img {
  display: block;
  height: 32px;
  width: auto;
  max-width: 140px;
}

.topbar .brand-img {
  height: 24px;
  max-width: 110px;
}

/* ==========================================================================
   Login overlay
   ========================================================================== */

.login {
  min-height: 100dvh;
  padding: 3rem 1.5rem 1.5rem;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(197, 51, 80, 0.08), transparent 60%),
    radial-gradient(1000px 500px at 0% 110%, rgba(140, 29, 64, 0.06), transparent 60%),
    var(--qvin-cream);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 2rem;
}

/* Two equal columns: request-access on the left, sign-in on the right.
   Both panes are flex-column so we can pin the primary CTA to the bottom of
   each pane — that's how the two CTAs end up horizontally aligned. */
.login-grid {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  align-self: center;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: stretch;
}

/* Both panes center their card horizontally so the two cards line up
   identically across the grid. */
.login-pane {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.request-pane {
  padding-top: 0;
}

.request-headline {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.55rem, 2.4vw, 1.95rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--qvin-ink);
  margin: 0 0 1.1rem;
}

.request-lede {
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--qvin-ink);
  margin: 0 0 1.5rem;
}

.request-lede em {
  font-style: italic;
}

/* Pane CTA row: pinned to the bottom of its card so both cards' CTAs
   line up horizontally (cards are equal height). */
.pane-cta-row {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
}

/* ----- Shared CTA button (base) ----- */

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  padding: 0.95rem 1.4rem;
  min-height: 3.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  transition: background 140ms, border-color 140ms, transform 140ms, box-shadow 140ms;
}

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

.cta-btn:disabled {
  opacity: 0.65;
  cursor: progress;
}

.cta-btn-arrow {
  display: inline-block;
  transition: transform 140ms;
}

.cta-btn:hover .cta-btn-arrow {
  transform: translateX(3px);
}

/* Primary — used for "Request access". */
.cta-btn--primary {
  background: var(--qvin-red);
  box-shadow: 0 8px 22px -8px rgba(215, 38, 61, 0.55);
}

.cta-btn--primary:hover {
  background: var(--qvin-red-dark);
  box-shadow: 0 12px 28px -8px rgba(215, 38, 61, 0.7);
}

/* Secondary — used for "Email me a sign-in link". A traditional dark
   web-button color so it visually steps back from the red primary CTA. */
.cta-btn--secondary {
  background: var(--qvin-charcoal);
  box-shadow: 0 6px 18px -8px rgba(26, 31, 44, 0.35);
}

.cta-btn--secondary:hover {
  background: var(--qvin-ink);
  box-shadow: 0 10px 24px -8px rgba(26, 31, 44, 0.5);
}

/* ----- Card (used by BOTH the request pane and the sign-in pane) -----
   Both panes wrap their content in .login-card so the two boxes look
   visually identical — same width, same padding, same background, same
   shadow, and (via flex:1 + grid stretch) the same height. */
.login-card {
  width: 100%;
  max-width: 480px;
  padding: 2.25rem 2rem 1.85rem;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.login-card .brand {
  margin-bottom: 1.5rem;
}

.login-title {
  font-family: var(--serif);
  font-size: 2.25rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: var(--qvin-ink);
}

.login-sub {
  margin: 0 0 1.5rem;
  color: var(--qvin-ink-muted);
}

.signin-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.signin-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--qvin-ink-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.signin-divider::before,
.signin-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--qvin-line);
}

/* Email magic-link form: input stacks on top, status/error in the middle,
   and the CTA button sits at the bottom of the card so it aligns horizontally
   with the Request-access button on the left pane. */
.email-link-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  flex: 1;
}

.email-link-form input[type="email"] {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--qvin-ink);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.email-link-form input[type="email"]:focus {
  border-color: var(--qvin-red);
  box-shadow: 0 0 0 3px rgba(215, 38, 61, 0.18);
}

.email-link-form .login-status,
.email-link-form .login-error {
  margin: 0;
}

/* Legacy class — kept harmless in case any external code references it. */
.email-link-btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.8rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--qvin-red);
  color: #fff;
  cursor: pointer;
  transition: background 120ms, transform 120ms;
}

.email-link-btn:hover { background: var(--qvin-red-dark); }
.email-link-btn:active { transform: translateY(1px); }
.email-link-btn:disabled { opacity: 0.65; cursor: progress; }

/* ==========================================================================
   Access request form
   ========================================================================== */

.request-intro {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--qvin-ink-muted);
}

.request-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--qvin-ink);
  letter-spacing: 0.01em;
}

.field .req {
  color: var(--qvin-red);
  margin-left: 2px;
}

.field .opt {
  font-weight: 400;
  color: var(--qvin-ink-muted);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="url"],
.field select,
.field textarea {
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--qvin-ink);
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--qvin-red);
  box-shadow: 0 0 0 3px rgba(215, 38, 61, 0.15);
}

.field textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--sans);
}

.field-check .check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--qvin-ink-muted);
  cursor: pointer;
}

.field-check input[type="checkbox"] {
  margin-top: 0.2rem;
  accent-color: var(--qvin-red);
}

.request-submit {
  margin-top: 0.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--qvin-red);
  color: #fff;
  cursor: pointer;
  transition: background 120ms, transform 120ms;
}

.request-submit:hover { background: var(--qvin-red-dark); }
.request-submit:active { transform: translateY(1px); }
.request-submit:disabled { opacity: 0.65; cursor: progress; }

/* ==========================================================================
   Top nav + sub-nav (multi-page chrome)
   ========================================================================== */

.topnav {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 0.25rem;
  margin: 0 1rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }

.topnav a,
.topnav-parent {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--qvin-charcoal);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.topnav a:hover,
.topnav-parent:hover {
  background: rgba(26, 31, 44, 0.05);
  color: var(--qvin-charcoal);
}

.topnav a.is-active,
.topnav-parent.is-active {
  color: var(--qvin-red);
  background: rgba(215, 38, 61, 0.08);
}

.topnav-parent .caret {
  display: inline-block;
  transition: transform 180ms ease;
  color: currentColor;
  opacity: 0.7;
}

.topnav-parent[aria-expanded="true"] .caret {
  transform: rotate(180deg);
  opacity: 1;
}

/* ==========================================================================
   Sub-row fold-out (drops down beneath the topbar when a parent is opened)
   ========================================================================== */

/* The fold-out reads as a tier of the topbar — same white background,
   a thin separator line, and tab-style active state instead of pills.
   `top` is set in JS at runtime so it always tracks the actual topbar
   height (no magic numbers). */

.subnav-fold {
  position: sticky;
  top: 56px;
  z-index: 9;
  background: #ffffff;
  border-top: 1px solid var(--qvin-line);
  border-bottom: 1px solid var(--qvin-line);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 220ms ease, opacity 180ms ease;
}

.subnav-fold[hidden] {
  display: none;
}

.subnav-fold.is-open {
  max-height: 200px;
  opacity: 1;
}

.subnav-fold-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav-fold-inner::-webkit-scrollbar { display: none; }

.subnav-fold-inner a {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--qvin-ink-muted);
  text-decoration: none;
  padding: 0.7rem 0.9rem;
  white-space: nowrap;
  transition: color 120ms, border-color 120ms;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; /* sits flush with the bottom border */
}

.subnav-fold-inner a:hover {
  color: var(--qvin-ink);
}

.subnav-fold-inner a.is-active {
  color: var(--qvin-red);
  border-bottom-color: var(--qvin-red);
  font-weight: 600;
}

.subnav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1.5rem;
  background: var(--qvin-cream-2);
  border-bottom: 1px solid var(--qvin-line);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }

.subnav a {
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--qvin-ink-muted);
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 120ms, color 120ms;
}

.subnav a:hover {
  background: rgba(26, 31, 44, 0.05);
  color: var(--qvin-ink);
}

.subnav a.is-active {
  color: var(--qvin-charcoal);
  background: #fff;
  box-shadow: 0 1px 3px rgba(26, 31, 44, 0.06);
}

/* Hamburger toggle — hidden on desktop, shown on small viewports */

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
}

.nav-toggle:hover {
  background: rgba(26, 31, 44, 0.05);
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  margin: 2px 0;
  background: var(--qvin-charcoal);
  border-radius: 2px;
  transition: transform 200ms, opacity 200ms;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile drawer */

.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.mobile-drawer:not([hidden]) {
  pointer-events: auto;
}

.mobile-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 44, 0);
  transition: background 200ms;
}

.mobile-drawer.is-open .mobile-drawer-backdrop {
  background: rgba(26, 31, 44, 0.45);
}

.mobile-drawer-nav {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 86vw);
  height: 100%;
  background: #fff;
  padding: 5rem 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transform: translateX(100%);
  transition: transform 250ms cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: -16px 0 40px rgba(26, 31, 44, 0.15);
  overflow-y: auto;
}

.mobile-drawer.is-open .mobile-drawer-nav {
  transform: translateX(0);
}

.mobile-drawer-nav a {
  display: block;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--qvin-ink);
  text-decoration: none;
  padding: 0.85rem 0.5rem;
  border-radius: 6px;
  min-height: 44px;
}

.mobile-drawer-nav a:hover {
  background: rgba(26, 31, 44, 0.04);
  color: var(--qvin-red);
}

.mobile-drawer-nav a.is-active {
  color: var(--qvin-red);
  background: rgba(215, 38, 61, 0.08);
}

.mobile-drawer-sep {
  border: none;
  border-top: 1px solid var(--qvin-line);
  margin: 0.75rem 0.5rem;
}

.mobile-drawer-nav .link-btn {
  text-align: left;
  padding: 0.85rem 0.5rem;
  font-size: 1rem;
  min-height: 44px;
}

/* Drawer group — <details>/<summary> accordion for nav parents with children. */

.drawer-group {
  border: none;
}

.drawer-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--qvin-ink);
  padding: 0.85rem 0.5rem;
  border-radius: 6px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.drawer-group > summary::-webkit-details-marker { display: none; }
.drawer-group > summary::marker { content: ''; }

.drawer-group > summary:hover {
  background: rgba(26, 31, 44, 0.04);
  color: var(--qvin-red);
}

.drawer-group > summary .caret {
  color: currentColor;
  opacity: 0.6;
  transition: transform 180ms ease;
}

.drawer-group[open] > summary .caret {
  transform: rotate(180deg);
}

.drawer-children {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.25rem 0 0.5rem 1rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--qvin-line);
}

.drawer-children a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--qvin-ink-muted);
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.drawer-children a:hover {
  background: rgba(26, 31, 44, 0.04);
  color: var(--qvin-red);
}

.drawer-children a.is-active {
  color: var(--qvin-red);
  background: rgba(215, 38, 61, 0.08);
}

body.drawer-open {
  overflow: hidden;
}

/* Mobile breakpoint behavior */

@media (max-width: 720px) {
  .topnav { display: none; }
  .subnav-fold { display: none !important; }
  .nav-toggle { display: inline-flex; }
  .topbar { padding: 0.75rem 1rem; }
  .topbar-right { gap: 0.4rem; }
  .user-chip { display: none; }
  .topbar-right > #sign-out { display: none; }
  .subnav { padding: 0.5rem 1rem; }
}

/* ==========================================================================
   Page article wrapper + thesis page-nav cards + moat list
   ========================================================================== */

.page {
  display: block;
}

/* Grid of cards on the Thesis page that link into deep-dive sections. */
.page-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-top: 1.5rem;
}

.page-nav-card {
  display: block;
  padding: 1.1rem 1.2rem;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
  color: var(--qvin-ink);
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}

.page-nav-card:hover {
  border-color: rgba(215, 38, 61, 0.35);
  box-shadow: 0 4px 16px rgba(26, 31, 44, 0.06);
  transform: translateY(-1px);
  color: var(--qvin-ink);
}

.page-nav-card h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
  color: var(--qvin-red);
}

.page-nav-card p {
  font-size: 0.9rem;
  margin: 0;
  color: var(--qvin-ink-muted);
  line-height: 1.5;
}

/* Inside a white module card, switch the nested card to cream so it doesn't
   blend with the parent. */
.block-alt .page-nav-card {
  background: var(--qvin-cream);
  border-color: rgba(26, 31, 44, 0.08);
}

.block-alt .page-nav-card:hover {
  border-color: rgba(215, 38, 61, 0.35);
  background: var(--qvin-cream);
}

/* Moat / "why hard to replicate" bulleted list. */
.moat-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.moat-list li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.4rem;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  line-height: 1.55;
  color: var(--qvin-ink);
}

.moat-list li::before {
  content: '';
  position: absolute;
  left: 1rem;
  top: 1.15rem;
  width: 8px;
  height: 8px;
  background: var(--qvin-red);
  border-radius: 50%;
}

/* "Page in progress" placeholder note for unfinished pages. */
.placeholder-note {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  background: rgba(215, 38, 61, 0.06);
  border-left: 3px solid var(--qvin-red);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.92rem;
  color: var(--qvin-ink);
  line-height: 1.55;
}

/* ==========================================================================
   References list (per-page bibliography)
   ========================================================================== */

.references {
  margin: 1.5rem 0 0;
  padding: 0 0 0 2.25rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--qvin-ink);
  counter-reset: ref;
}

.references li {
  margin: 0 0 1rem;
  padding-left: 0.25rem;
}

.references li::marker {
  color: var(--qvin-ink-muted);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.references li em {
  font-style: italic;
}

.references a {
  word-break: break-word;
}

/* Inline citation links — small, superscript-feeling, restrained. */
.block-body a[href^="#ref-"],
.moat-list a[href^="#ref-"],
.facts a[href^="#ref-"],
.fact-label a[href^="#ref-"] {
  font-size: 0.78em;
  font-weight: 600;
  text-decoration: none;
  vertical-align: super;
  line-height: 0;
  margin-left: 1px;
  color: var(--qvin-red);
}

.block-body a[href^="#ref-"]:hover,
.moat-list a[href^="#ref-"]:hover,
.facts a[href^="#ref-"]:hover,
.fact-label a[href^="#ref-"]:hover {
  color: var(--qvin-red-dark);
  text-decoration: underline;
}

/* Highlight target citation when scrolled to from inline link. */
.references li:target {
  background: rgba(215, 38, 61, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.5rem 0.5rem 0.75rem;
  margin-left: -0.75rem;
}

/* ==========================================================================
   Programs page — condition cards with status pills
   ========================================================================== */

.program {
  padding-bottom: 2.25rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid var(--qvin-line);
}

.program:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.program-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.85rem;
  font-size: 0.85rem;
  color: var(--qvin-ink-muted);
}

.program-meta strong {
  color: var(--qvin-ink);
}

.status {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  vertical-align: middle;
}

.status--active {
  background: #E1F0E2;
  color: #285A2A;
}

.status--funded {
  background: #DCE8F4;
  color: #1B4A77;
}

.status--pending {
  background: #F3EBDA;
  color: #7A5824;
}

.program-detail {
  margin-top: 0.5rem;
  padding: 0.85rem 1rem;
  background: rgba(26, 31, 44, 0.03);
  border-left: 2px solid var(--qvin-line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--qvin-ink);
}

.program-detail strong {
  color: var(--qvin-charcoal);
}

/* ==========================================================================
   Patents page — stat strip, product cards, detail blocks, expandables
   ========================================================================== */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 2rem 0 1rem;
  padding: 1.5rem 1.25rem;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
}

.stat-strip > div {
  text-align: center;
}

.stat-strip .stat-num {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
  color: var(--qvin-red);
  line-height: 1.1;
}

.stat-strip .stat-label {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--qvin-ink-muted);
  line-height: 1.45;
}

@media (max-width: 640px) {
  .stat-strip {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }
  .stat-strip > div { text-align: left; }
}

.patent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin: 1.75rem 0 0;
}

@media (max-width: 920px) {
  .patent-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .patent-grid { grid-template-columns: 1fr; }
}

.patent-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.2rem 1.25rem 1.4rem;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--qvin-ink);
  transition: border-color 120ms, transform 120ms, box-shadow 120ms;
}

.patent-card:hover {
  border-color: rgba(215, 38, 61, 0.35);
  box-shadow: 0 4px 16px rgba(26, 31, 44, 0.06);
  transform: translateY(-1px);
  color: var(--qvin-ink);
}

.patent-card .patent-card-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--qvin-red);
  margin: 0;
}

.patent-card .patent-card-status {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
}

.patent-card p {
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0;
  color: var(--qvin-ink);
}

.patent-card .patent-card-link {
  margin-top: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--qvin-red);
}

.patent-detail {
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--qvin-line);
}

.patent-detail:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.patent-detail .patent-figure-placeholder {
  display: block;
  width: 100%;
  margin: 1rem 0 1.5rem;
  padding: 2.5rem 1rem;
  background: rgba(26, 31, 44, 0.04);
  border: 1px dashed rgba(26, 31, 44, 0.18);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 0.84rem;
  color: var(--qvin-ink-muted);
  font-style: italic;
}

.patent-meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 0;
  padding: 1rem 1.1rem;
  background: rgba(26, 31, 44, 0.03);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.patent-meta-row .label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
  margin-bottom: 0.25rem;
}

.patent-meta-row .value {
  color: var(--qvin-ink);
  line-height: 1.5;
}

.patent-detail details {
  margin-top: 1.25rem;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  background: #fff;
}

.patent-detail summary {
  list-style: none;
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
  user-select: none;
}

.patent-detail summary::-webkit-details-marker { display: none; }

.patent-detail summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 150ms;
  color: var(--qvin-red);
}

.patent-detail details[open] summary::before {
  transform: rotate(90deg);
}

.patent-detail details > div,
.patent-detail details > table {
  padding: 0 1rem 1rem;
}

.patent-detail table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.patent-detail table th,
.patent-detail table td {
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--qvin-line);
  color: var(--qvin-ink);
}

.patent-detail table th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
  border-bottom: 1px solid var(--qvin-line);
}

.patent-detail table tr:last-child td {
  border-bottom: none;
}

.patent-detail .table-note {
  margin: 0.75rem 1rem 0;
  font-size: 0.82rem;
  color: var(--qvin-ink-muted);
  line-height: 1.5;
  font-style: italic;
}

.countries-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin: 1.5rem 0 0;
}

@media (max-width: 640px) {
  .countries-grid { grid-template-columns: 1fr; }
}

.countries-grid h4 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
  margin: 0 0 0.45rem;
}

.countries-grid p {
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
  color: var(--qvin-ink);
}

.back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--qvin-ink-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--qvin-red);
}

.back-link::before {
  content: '← ';
}

.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.85rem 1.2rem;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--qvin-ink);
  cursor: pointer;
  transition: background 120ms, border-color 120ms, transform 120ms, box-shadow 120ms;
}

.oauth-btn:hover {
  background: #FAFAFA;
  border-color: rgba(26, 31, 44, 0.25);
  box-shadow: 0 2px 8px rgba(26, 31, 44, 0.06);
}

.oauth-btn:active { transform: translateY(1px); }
.oauth-btn:disabled { opacity: 0.65; cursor: progress; }
.oauth-btn.is-loading span::after { content: '…'; }

.oauth-icon { flex: 0 0 auto; }

.login-status,
.login-error {
  margin: 1rem 0 0;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

.login-status {
  background: #F0F7EE;
  color: #2C5C2A;
  border: 1px solid rgba(44, 92, 42, 0.15);
}

.login-error {
  background: #FCEEEF;
  color: var(--qvin-wine-dark);
  border: 1px solid rgba(140, 29, 64, 0.18);
}

.login-foot {
  margin: 1.75rem 0 0;
  font-size: 0.82rem;
  color: var(--qvin-ink-muted);
  line-height: 1.5;
}

/* Page-level footer for the login screen (sits below both columns). */
.login-footer {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1.4rem 1.5rem 0;
  border-top: 1px solid var(--qvin-line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 0.85rem;
  font-size: 0.86rem;
  color: var(--qvin-ink-muted);
  text-align: center;
}

.login-footer .login-footer-item {
  color: var(--qvin-ink-muted);
}

.login-footer a.login-footer-item {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-footer a.login-footer-item:hover {
  color: var(--qvin-wine);
}

.login-footer-sep {
  color: var(--qvin-ink-muted);
  opacity: 0.45;
  user-select: none;
}

/* ==========================================================================
   Main content
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid var(--qvin-line);
}

/* topbar brand-img sized in .brand-img section above */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-chip {
  font-size: 0.82rem;
  color: var(--qvin-ink-muted);
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.link-btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  background: none;
  border: none;
  color: var(--qvin-wine);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.3rem 0.5rem;
}

.link-btn:hover { color: var(--qvin-wine-dark); }

.hero,
.block,
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.hero {
  padding-top: 5rem;
  padding-bottom: 3rem;
}

/* Module-style spacing: a little air between sections so the white cards
   read as distinct modules sitting on the cream page. */
.page > .block + .block,
.page > .hero + .block {
  padding-top: 2.5rem;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--qvin-rose);
  margin: 0 0 0.85rem;
}

.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
  color: var(--qvin-ink);
}

.hero-lede {
  font-size: 1.18rem;
  line-height: 1.55;
  color: var(--qvin-ink-muted);
  max-width: 640px;
  margin: 0;
}

/* ==========================================================================
   Block sections — modular cards on a cream page
   - Plain `.block` sits on the cream background with a hairline divider.
   - `.block-alt` is rendered as a white rounded module card with shadow,
     matching the qvin.com module feel. Text inside stays charcoal/ink.
   ========================================================================== */

.block {
  border-top: 1px solid var(--qvin-line);
}

.block-alt {
  border-top: none;
  background: #ffffff;
  border-radius: calc(var(--radius) + 6px);
  box-shadow:
    0 1px 0 rgba(26, 31, 44, 0.04),
    0 24px 60px -28px rgba(140, 29, 64, 0.18),
    0 10px 24px -12px rgba(26, 31, 44, 0.10);
  /* Pull the card out of the page-flow padding so it reads as a module. */
  margin: 1.5rem 1.25rem;
  padding: 3rem 2rem;
  max-width: calc(var(--maxw) - 2.5rem);
}

@media (min-width: 720px) {
  .block-alt {
    margin: 2rem auto;
    padding: 3.5rem 3rem;
    max-width: var(--maxw);
  }
}

/* No top border for blocks immediately following a card — the visual rhythm
   already separates them. */
.block-alt + .block { border-top: none; }
.block + .block-alt { border-top: none; }

.block-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0 0 1rem;
  color: var(--qvin-ink);
}

.block-body {
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0 0 1rem;
  color: var(--qvin-ink);
  max-width: 720px;
}

.block-body.small {
  font-size: 0.92rem;
  color: var(--qvin-ink-muted);
}

.block-body.muted { color: var(--qvin-ink-muted); }

.block-foot {
  margin: 1.25rem 0 0;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--qvin-ink-muted);
}

.block-subtitle {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  margin: 1.75rem 0 0.5rem;
  color: var(--qvin-charcoal);
}

/* Facts row */

.facts {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

/* Inside a white .block-alt card, the fact tiles need to differentiate — switch
   them to a soft cream background to keep visual hierarchy. */
.block-alt .facts li {
  background: var(--qvin-cream);
  border-color: rgba(26, 31, 44, 0.08);
}

.facts li {
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  padding: 1.1rem 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.fact-num {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--qvin-wine);
  letter-spacing: -0.01em;
}

.fact-label {
  font-size: 0.86rem;
  color: var(--qvin-ink-muted);
  line-height: 1.4;
}

/* Conditions */

.conditions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.conditions article {
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  padding: 1.4rem;
}

.conditions h3 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
  color: var(--qvin-wine);
}

.conditions p {
  font-size: 0.95rem;
  margin: 0;
  color: var(--qvin-ink);
  line-height: 1.55;
}

/* Press */

.press {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.press li a {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--qvin-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 120ms, border-color 120ms;
}

.press li a:hover {
  color: var(--qvin-wine);
  border-bottom-color: var(--qvin-wine);
}

/* Press list — featured coverage with outlet label + headline link */

.press-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.press-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--qvin-line);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.press-list li:first-child {
  padding-top: 0;
}

.press-list li:last-child {
  border-bottom: none;
}

.press-outlet {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
}

.press-list li a {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--qvin-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 120ms, border-color 120ms;
  align-self: flex-start;
}

.press-list li a:hover {
  color: var(--qvin-wine);
  border-bottom-color: var(--qvin-wine);
}

/* Team member block on /team */

.team-member {
  padding: 1.25rem 0 1.5rem;
  border-bottom: 1px solid var(--qvin-line);
}

.team-member:last-of-type {
  border-bottom: none;
}

.team-member .block-subtitle {
  margin-top: 0;
}

/* Team member with photo — photo on the left, bio on the right (stacks on mobile). */
.team-member-with-photo {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 640px) {
  .team-member-with-photo {
    grid-template-columns: 200px 1fr;
    gap: 2rem;
  }
}

.team-photo {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--qvin-line);
  background: var(--qvin-cream);
}

.team-bio {
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Image figure components — sized conservatively so they support the prose
   rather than dominate it. Hard height caps prevent vertical illustrations
   from towering, and `object-fit: contain` preserves illustration aspect.
   ========================================================================== */

.hero-figure {
  margin: 2rem 0 0;
  padding: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--qvin-line);
  max-width: 480px;
}

.hero-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

.block-figure {
  margin: 1.5rem 0;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--qvin-cream);
  border: 1px solid var(--qvin-line);
  max-width: 460px;
}

.block-alt .block-figure {
  background: var(--qvin-cream);
}

.block-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.block-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--qvin-ink-muted);
  font-style: italic;
  line-height: 1.45;
}

/* Condition hero — illustrated banner at the top of a condition section.
   Sized to be a supporting visual, not full-bleed. */

.condition-hero {
  margin: 1.25rem 0 1.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--qvin-line);
  background: var(--qvin-cream);
  max-width: 440px;
}

.block-alt .condition-hero {
  background: var(--qvin-cream);
}

.condition-hero img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: contain;
}

.condition-hero-narrow {
  max-width: 280px;
  margin-left: 0;
  margin-right: auto;
}

/* Compare grid — side-by-side "today vs Qvin" cards */

.compare-grid {
  margin: 1.5rem 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  max-width: 560px;
}

@media (min-width: 600px) {
  .compare-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.compare-card {
  margin: 0;
  padding: 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--qvin-line);
  background: var(--qvin-cream);
  display: flex;
  flex-direction: column;
}

.block-alt .compare-card {
  background: var(--qvin-cream);
}

.compare-card-qvin {
  background: rgba(215, 38, 61, 0.04);
  border-color: rgba(215, 38, 61, 0.18);
}

.block-alt .compare-card-qvin {
  background: rgba(215, 38, 61, 0.04);
}

.compare-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--qvin-ink-muted);
  margin: 0 0 0.5rem;
}

.compare-card-qvin .compare-label {
  color: var(--qvin-red);
}

.compare-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  margin: 0 0 0.65rem;
  background: #fff;
}

.compare-card figcaption {
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--qvin-ink-muted);
  margin: 0;
}

/* Block-figure-inline — small floated figure that lets prose wrap */

.block-figure-inline {
  max-width: 240px;
  float: right;
  margin: 0.25rem 0 1rem 1.25rem;
  padding: 0.6rem;
}

.block-figure-inline img {
  max-height: 180px;
}

.block-figure-inline figcaption {
  font-size: 0.78rem;
  margin-top: 0.5rem;
}

@media (max-width: 720px) {
  .block-figure-inline {
    float: none;
    margin: 1rem 0;
    max-width: 100%;
    padding: 0.85rem;
  }
  .block-figure-inline img {
    max-height: 220px;
  }
}

/* ==========================================================================
   Condition cards — grid on /conditions overview + mini cards on detail pages
   ========================================================================== */

.condition-card-grid {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.condition-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--qvin-ink);
  transition: border-color 140ms, transform 140ms, box-shadow 140ms;
  height: 100%;
}

.block-alt .condition-card {
  background: var(--qvin-cream);
}

.condition-card:hover {
  border-color: rgba(215, 38, 61, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -16px rgba(140, 29, 64, 0.18);
  color: var(--qvin-ink);
}

.condition-card img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: contain;
  background: var(--qvin-cream);
  padding: 0.75rem;
  border-bottom: 1px solid var(--qvin-line);
}

.block-alt .condition-card img {
  background: #fff;
}

.condition-card-body {
  padding: 1rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.condition-card h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  color: var(--qvin-red);
}

.condition-card p {
  font-size: 0.88rem;
  line-height: 1.5;
  margin: 0;
  color: var(--qvin-ink-muted);
}

/* Mini variant — small text-only card used in "other conditions" footer row */
.condition-card-mini {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  text-decoration: none;
  color: var(--qvin-ink);
  transition: border-color 140ms, transform 140ms;
  height: 100%;
}

.block-alt .condition-card-mini { background: var(--qvin-cream); }

.condition-card-mini:hover {
  border-color: rgba(215, 38, 61, 0.4);
  transform: translateY(-1px);
  color: var(--qvin-red);
}

.condition-card-mini h3 {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: inherit;
}

/* ==========================================================================
   Award list — large recognition cards on /media
   ========================================================================== */

.award-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 720px) {
  .award-list {
    grid-template-columns: 1fr 1fr;
  }
}

.award-card {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 1.25rem;
  background: var(--qvin-cream);
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
}

.award-badge {
  width: 96px;
  height: auto;
  flex-shrink: 0;
}

.award-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--qvin-red);
  margin: 0 0 0.4rem;
}

.award-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 0.5rem;
  color: var(--qvin-ink);
}

.award-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--qvin-red);
  text-decoration: none;
}

.award-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Story card grid — featured press cards with hero image
   ========================================================================== */

.story-card-grid {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.story-card {
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 140ms, transform 140ms, box-shadow 140ms;
}

.story-card:hover {
  border-color: rgba(215, 38, 61, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -16px rgba(140, 29, 64, 0.18);
}

.story-card a {
  display: block;
  text-decoration: none;
  color: var(--qvin-ink);
}

.story-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--qvin-cream);
}

.story-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--qvin-ink-muted);
  padding: 0.85rem 1rem 0;
  letter-spacing: 0.04em;
}

.story-outlet {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--qvin-red);
}

.story-headline {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 700;
  margin: 0.45rem 1rem 1rem;
  color: var(--qvin-ink);
}

/* ==========================================================================
   Outlet logo grid — "as seen in" wall
   ========================================================================== */

.outlet-grid {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  align-items: center;
}

.outlet-grid li {
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 80px;
  transition: border-color 140ms, transform 140ms;
}

.outlet-grid li:hover {
  border-color: rgba(215, 38, 61, 0.35);
  transform: translateY(-1px);
}

.outlet-grid a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.outlet-grid img {
  max-width: 100%;
  max-height: 40px;
  object-fit: contain;
  filter: grayscale(1) opacity(0.75);
  transition: filter 140ms;
}

.outlet-grid li:hover img {
  filter: grayscale(0) opacity(1);
}

/* Tighter variant for in-page press strip on home */
.outlet-grid-tight li {
  height: 64px;
  padding: 0.75rem;
}

.outlet-grid-tight img {
  max-height: 28px;
}

/* ==========================================================================
   Partner logos (research collaborator row)
   ========================================================================== */

.partner-logos {
  list-style: none;
  margin: 1.25rem 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: center;
}

.partner-logos li {
  display: flex;
  align-items: center;
  height: 48px;
}

.partner-logos img {
  max-height: 36px;
  width: auto;
  filter: grayscale(1) opacity(0.7);
  transition: filter 140ms;
}

.partner-logos li:hover img {
  filter: grayscale(0) opacity(1);
}

/* CTA */

.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.3rem;
  border-radius: var(--radius-sm);
  background: var(--qvin-wine);
  color: #fff;
  text-decoration: none;
  transition: background 120ms;
}

.btn:hover { background: var(--qvin-wine-dark); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--qvin-wine);
  border: 1px solid var(--qvin-wine);
}

.btn-ghost:hover {
  background: var(--qvin-wine);
  color: #fff;
}

/* Footer */

.footer {
  padding-top: 3rem;
  padding-bottom: 4rem;
  border-top: 1px solid var(--qvin-line);
  margin-top: 1rem;
  color: var(--qvin-ink-muted);
  font-size: 0.88rem;
}

.footer a { color: var(--qvin-ink-muted); }
.footer a:hover { color: var(--qvin-wine); }

/* ==========================================================================
   Rich footer — Press / Security / Follow + meta + bottom row
   ========================================================================== */

.footer-rich {
  border-top: 1px solid var(--qvin-line);
  margin-top: 4rem;
  padding: 3rem 1.5rem 2rem;
  background: var(--qvin-cream);
  color: var(--qvin-ink);
  font-size: 0.92rem;
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--qvin-line);
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-brand .brand-img {
  height: 28px;
}

.footer-tagline {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.4;
  color: var(--qvin-ink-muted);
  margin: 0;
  max-width: 220px;
}

.footer-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--qvin-red);
  margin: 0 0 0.25rem;
}

.footer-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-list a {
  color: var(--qvin-ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms;
}

.footer-list a:hover {
  border-bottom-color: var(--qvin-red);
  color: var(--qvin-red);
}

.footer-list li {
  color: var(--qvin-ink-muted);
}

.footer-social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.5rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--qvin-line);
  border-radius: 999px;
  color: var(--qvin-charcoal);
  background: #fff;
  transition: border-color 120ms, color 120ms, transform 120ms;
}

.footer-social a:hover {
  border-color: var(--qvin-red);
  color: var(--qvin-red);
  transform: translateY(-1px);
}

.footer-meta {
  max-width: var(--maxw);
  margin: 1.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-size: 0.82rem;
  color: var(--qvin-ink-muted);
}

.footer-meta strong {
  color: var(--qvin-ink);
  font-weight: 600;
  margin-right: 0.4rem;
}

.footer-meta a {
  color: var(--qvin-ink-muted);
  text-decoration: none;
}

.footer-meta a:hover {
  color: var(--qvin-red);
}

.footer-bottom {
  max-width: var(--maxw);
  margin: 1.5rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  font-size: 0.82rem;
  color: var(--qvin-ink-muted);
  align-items: center;
}

.footer-bottom a {
  color: var(--qvin-ink-muted);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--qvin-red);
}

.footer-bottom-sep {
  opacity: 0.5;
}

/* ==========================================================================
   Legal page (terms.html)
   ========================================================================== */

body.legal-body {
  background: var(--qvin-cream);
  color: var(--qvin-ink);
}

.legal-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  background: rgba(251, 246, 240, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--qvin-line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.legal-topbar .brand-img {
  height: 24px;
  max-width: 110px;
}

.legal-back {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--qvin-ink-muted);
  text-decoration: none;
}

.legal-back:hover {
  color: var(--qvin-wine);
}

.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
}

.legal h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  color: var(--qvin-ink);
}

.legal .legal-effective {
  font-size: 0.92rem;
  color: var(--qvin-ink-muted);
  margin: 0 0 2.25rem;
  letter-spacing: 0.01em;
}

.legal h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.85rem;
  color: var(--qvin-ink);
}

.legal h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.005em;
  margin: 1.75rem 0 0.55rem;
  color: var(--qvin-ink);
}

.legal p {
  font-size: 1rem;
  line-height: 1.7;
  margin: 0 0 1rem;
  color: var(--qvin-ink);
}

.legal ul {
  margin: 0.25rem 0 1.25rem;
  padding-left: 1.4rem;
}

.legal li {
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 0.45rem;
  color: var(--qvin-ink);
}

.legal .legal-contact {
  white-space: pre-line;
  line-height: 1.55;
}

.legal-footer {
  max-width: 760px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 640px) {
  .legal { padding: 2.5rem 1.25rem 4rem; }
  .legal-topbar { padding: 0.75rem 1rem; }
}

/* ==========================================================================
   Modal / Lightbox (request-access form)
   ========================================================================== */

body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 44, 0.55);
  backdrop-filter: saturate(140%) blur(4px);
  -webkit-backdrop-filter: saturate(140%) blur(4px);
  cursor: pointer;
  animation: modalFade 160ms ease-out;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: calc(100dvh - 4rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--qvin-line);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px -20px rgba(26, 31, 44, 0.55);
  padding: 2rem 2rem 1.75rem;
  animation: modalIn 200ms cubic-bezier(0.2, 0.7, 0.3, 1);
}

@keyframes modalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 2.1rem;
  height: 2.1rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--qvin-ink-muted);
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms, color 120ms;
}

.modal-close:hover {
  background: rgba(26, 31, 44, 0.06);
  color: var(--qvin-ink);
}

.modal-close:focus-visible {
  outline: 2px solid var(--qvin-red);
  outline-offset: 2px;
}

.modal-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  color: var(--qvin-ink);
  padding-right: 2rem; /* leave room for the close button */
}

@media (max-width: 540px) {
  .modal {
    padding: 1rem 0.75rem;
  }
  .modal-card {
    padding: 1.6rem 1.25rem 1.25rem;
  }
}

/* Tweaks for narrower screens */

/* At <960px the two equal columns stack: request side on top (the pitch),
   sign-in card below. */
@media (max-width: 960px) {
  .login {
    padding: 2rem 1.25rem 1.25rem;
    gap: 1.5rem;
  }
  .login-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 560px;
  }
  .signin-pane .login-card {
    max-width: 100%;
    flex: 0 0 auto; /* don't stretch when stacked */
  }
  .request-pane {
    padding-top: 0;
  }
  .request-headline {
    font-size: clamp(1.7rem, 6vw, 2.15rem);
  }
  .pane-cta-row {
    margin-top: 1rem; /* no need to push to bottom on mobile */
  }
  .login-footer {
    padding-top: 1.25rem;
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  .topbar { padding: 0.75rem 1rem; }
  .user-chip { display: none; }
  .login-card { padding: 2rem 1.5rem; }
  .hero { padding-top: 3.5rem; }
}
