/* Mastering Cardiology: site styles.
   A night-shift monitor for the top of the page, warm paper below it. */
:root {
  --night: #06101f;
  --night-2: #0b1a2e;
  --night-line: #1c3150;
  --trace: #5eead4;
  --trace-soft: rgba(94, 234, 212, 0.14);
  --paper: #fbf8f3;
  --paper-2: #f3eee6;
  --ink: #101d2e;
  --muted: #55657a;
  --line: #e2dccf;
  --blue: #0b4fb3;
  --blue-deep: #083678;
  --on-night: #e8f0fa;
  --on-night-muted: #9db1c9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --wrap: 1180px;
  /* One spacing, type and corner scale for every page. */
  --gutter: max(20px, calc((100vw - var(--wrap)) / 2));
  --section-y: clamp(64px, 7.4vw, 96px);
  --hero-top: clamp(44px, 5.6vw, 72px);
  --h1: clamp(36px, 4.6vw, 60px);
  --h2: clamp(28px, 3.4vw, 44px);
  --r-lg: 20px;
  --r-md: 16px;
  --r-sm: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); line-height: 1.55; font-size: 17px; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; line-height: 1.1; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 3px solid #f4b740; outline-offset: 3px; border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -60px; background: #fff; color: var(--ink); padding: 10px 14px; border-radius: 12px; z-index: 20; }
.skip:focus { top: 12px; }

/* --- Navigation ---------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 28px;
  padding: 14px var(--gutter); color: var(--on-night);
  background: rgba(6, 16, 31, 0.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--night-line);
}
.brand { display: flex; flex: none; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 20px; letter-spacing: -0.01em; white-space: nowrap; }
.brand b { font-weight: 600; color: var(--trace); }
.nav nav { display: flex; gap: 24px; margin-left: auto; }
.nav nav a { text-decoration: none; font-size: 15px; font-weight: 550; color: var(--on-night-muted); padding: 6px 0; }
.nav nav a:hover { color: #fff; }
.nav nav a.nav-account { color: var(--trace); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; font-weight: 650; font-size: 16px; text-decoration: none; border: 1.5px solid transparent; transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-solid { background: var(--trace); color: #04231f; }
.btn-solid:hover { background: #8df3e2; }
.btn-ghost { border-color: currentColor; }
.nav-cta { min-height: 40px; padding: 0 18px; font-size: 15px; white-space: nowrap; flex: none; }

.nav-toggle { display: none; }

/* Collapsed menu (nav.js adds .nav-enhanced; without it the links stay in a row). */
@media (max-width: 960px) {
  .nav.nav-enhanced { gap: 10px; }
  .nav-enhanced .nav-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 12px; margin-left: 4px;
    border-radius: 999px; border: 1.5px solid var(--night-line); background: transparent; color: var(--on-night);
    font: 600 14.5px var(--sans); cursor: pointer;
  }
  .nav-enhanced .nav-toggle:hover { border-color: var(--on-night-muted); }
  .nav-toggle-bars { display: grid; gap: 3.5px; width: 16px; }
  .nav-toggle-bars i { display: block; height: 2px; border-radius: 2px; background: currentColor; transition: transform 0.2s ease, opacity 0.2s ease; }
  .nav-open .nav-toggle-bars i:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
  .nav-open .nav-toggle-bars i:nth-child(2) { opacity: 0; }
  .nav-open .nav-toggle-bars i:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
  .nav.nav-enhanced .nav-cta { margin-left: auto; }
  .nav.nav-enhanced nav {
    position: absolute; left: 0; right: 0; top: 100%; order: 0; width: auto; margin: 0;
    display: flex; flex-direction: column; gap: 0; overflow: visible;
    padding: 6px var(--gutter) 18px;
    background: var(--night); border-bottom: 1px solid var(--night-line);
    box-shadow: 0 24px 40px -18px rgba(0, 0, 0, 0.6);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  }
  .nav.nav-open nav { visibility: visible; opacity: 1; transform: none; transition: opacity 0.18s ease, transform 0.18s ease; }
  .nav.nav-enhanced nav a { font-size: 18px; padding: 14px 2px; border-bottom: 1px solid rgba(28, 49, 80, 0.7); color: var(--on-night); }
  .nav.nav-enhanced nav a:last-child { border-bottom: 0; }
  .nav.nav-enhanced nav a[aria-current="page"] { color: var(--trace); box-shadow: none; }
}
@media (max-width: 559px) {
  .nav.nav-enhanced .nav-cta { display: none; }
  .nav-enhanced .nav-toggle { margin-left: auto; }
}

/* --- Hero ---------------------------------------------------------------- */
.hero {
  background:
    radial-gradient(900px 500px at 82% 10%, rgba(94, 234, 212, 0.12), transparent 60%),
    radial-gradient(700px 480px at 0% 100%, rgba(11, 79, 179, 0.28), transparent 65%),
    var(--night);
  color: var(--on-night);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 56px; align-items: center;
  padding: 84px var(--gutter) 96px;
}
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); margin-bottom: 16px; }
.hero .eyebrow { color: var(--trace); }
.hero h1 { font-size: clamp(42px, 5.6vw, 76px); }
.hero h1 em { font-style: italic; color: var(--trace); }
.lede { font-size: clamp(18px, 1.6vw, 21px); color: var(--on-night-muted); margin-top: 22px; max-width: 34em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 26px; padding: 0; margin: 40px 0 0; color: var(--on-night-muted); font-size: 15px; }
.hero-facts b { font-family: var(--mono); color: #fff; font-size: 17px; margin-right: 4px; }

.monitor { margin: 0; border: 1px solid var(--night-line); border-radius: 20px; background: linear-gradient(180deg, #0c1d33, #081425); box-shadow: 0 40px 80px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(94, 234, 212, 0.05); overflow: hidden; }
.monitor-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; font-size: 14px; color: var(--on-night-muted); border-bottom: 1px solid var(--night-line); }
.monitor-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--trace); box-shadow: 0 0 0 4px var(--trace-soft); }
.monitor-lead { font-family: var(--mono); font-weight: 700; color: #fff; }
.monitor-name { flex: 1; font-weight: 600; color: var(--on-night); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.monitor-rate { font-family: var(--mono); white-space: nowrap; }
.monitor-rate b { color: var(--trace); font-size: 22px; }
.monitor canvas { display: block; width: 100%; height: 300px; }
.monitor figcaption { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 18px; font-size: 13.5px; color: var(--on-night-muted); border-top: 1px solid var(--night-line); }
.link { background: none; border: 0; padding: 8px 0; font: inherit; font-weight: 650; color: var(--trace); cursor: pointer; white-space: nowrap; }
.link:hover { text-decoration: underline; }

/* --- Pillars ------------------------------------------------------------- */
.pillars { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 0 var(--gutter); margin-top: -44px; position: relative; }
.pillar { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; text-decoration: none; box-shadow: 0 14px 34px rgba(16, 29, 46, 0.08); transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.pillar:hover { transform: translateY(-4px); box-shadow: 0 22px 44px rgba(16, 29, 46, 0.14); border-color: var(--blue); }
.pillar h2 { font-size: 25px; }
.pillar p { color: var(--muted); font-size: 15.5px; flex: 1; }
.pillar-tag { align-self: flex-start; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--paper-2); color: var(--muted); }
.pillar-tag.live { background: #dff6f1; color: #0a6b5e; }
.pillar-go { font-weight: 650; color: var(--blue); font-size: 15.5px; }
.pillar-go::after { content: " \2192"; }

/* --- Showcase ------------------------------------------------------------ */
.showcase { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 56px; align-items: center; padding: var(--section-y) var(--gutter); }
.showcase h2, .band h2, .atlas-teaser h2 { font-size: var(--h2); }
.showcase-copy > p:not(.eyebrow) { color: var(--muted); margin-top: 16px; font-size: 18px; }
.ticks { list-style: none; padding: 0; margin: 26px 0 30px; display: grid; gap: 14px; }
.ticks li { padding-left: 30px; position: relative; color: var(--muted); font-size: 16px; }
.ticks li b { color: var(--ink); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 16px; height: 9px; border-left: 2.5px solid #0f9d8a; border-bottom: 2.5px solid #0f9d8a; transform: rotate(-45deg) translateY(-4px); }
.showcase .btn-solid { background: var(--blue); color: #fff; }
.showcase .btn-solid:hover { background: var(--blue-deep); }
.showcase-art img { border-radius: 16px; border: 1px solid var(--night-line); box-shadow: 0 30px 70px rgba(16, 29, 46, 0.28); }

/* --- Bands --------------------------------------------------------------- */
.band { padding: var(--section-y) var(--gutter); background: var(--paper-2); border-top: 1px solid var(--line); }
.band-alt { background: var(--paper); }
.band-head { max-width: 46em; }
.band-head > p:not(.eyebrow) { color: var(--muted); margin-top: 16px; font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.card h3 { font-size: 22px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15.5px; }

.atlas-teaser { background: var(--night); color: var(--on-night); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: var(--section-y) var(--gutter); }
.atlas-teaser .eyebrow { color: var(--trace); }
.atlas-teaser p:not(.eyebrow) { color: var(--on-night-muted); margin: 16px 0 28px; font-size: 18px; }
.atlas-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.atlas-chips a { display: inline-block; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--night-line); background: var(--night-2); text-decoration: none; font-size: 15px; font-weight: 550; }
.atlas-chips a:hover { border-color: var(--trace); color: var(--trace); }

/* --- Footer -------------------------------------------------------------- */
.foot { background: #040b16; color: var(--on-night-muted); padding: 44px var(--gutter); display: grid; grid-template-columns: auto 1fr; gap: 18px 40px; align-items: center; font-size: 15px; }
.foot-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 18px; color: #fff; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: flex-end; }
.foot nav a { text-decoration: none; }
.foot nav a:hover { color: #fff; }
.foot-note { grid-column: 1 / -1; font-size: 13.5px; max-width: 70em; border-top: 1px solid var(--night-line); padding-top: 18px; }

/* Home: live course cards and the workbook feature */
.home-courses { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.home-course { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 24px; background: #fff; border: 1px solid var(--line); border-top: 4px solid #14b8a6; border-radius: 16px; text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.home-course:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(16, 29, 46, 0.1); }
.home-course small { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.home-course h3 { font-size: 24px; }
.home-course p { color: var(--muted); font-size: 15.5px; flex: 1; }
.home-course-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }
.home-course-foot b { font-family: var(--serif); font-size: 22px; }
.home-course-foot span { color: var(--blue); font-weight: 650; font-size: 15px; }

.home-book { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 64px; align-items: center; }
.home-book-cover { display: grid; perspective: 1200px; padding: 0 12% 0 0; }
.home-book-cover img { grid-area: 1 / 1; width: 100%; border-radius: 2px 6px 6px 2px; box-shadow: 26px 34px 50px -22px rgba(16, 29, 46, 0.55), 0 0 0 1px rgba(16, 29, 46, 0.08); transition: transform 0.5s cubic-bezier(.2, .7, .2, 1); }
.home-book-back { transform: translate(24%, -9%) rotateY(-20deg) scale(0.92); filter: brightness(0.97); }
.home-book-front { transform: rotateY(-14deg); }
.home-book-cover:hover .home-book-front { transform: translateX(-4%) rotateY(-6deg); }
.home-book-cover:hover .home-book-back { transform: translate(30%, -9%) rotateY(-10deg) scale(0.92); }
.home-books { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; max-width: 640px; }
.home-books li { display: flex; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.home-books li > div:first-child { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.home-books small { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.home-books b { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.25; }
.home-books-links { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.home-books-links a { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; font-size: 14.5px; font-weight: 650; color: var(--blue); text-decoration: none; white-space: nowrap; }
.home-books-links a:hover { text-decoration: underline; }
.home-books-links svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.home-save { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.home-save li { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 15px; font-weight: 550; }
.home-save b { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: linear-gradient(160deg, #14b8a6, #0b4fb3); font-size: 14px; }
.home-book-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--blue-deep); }
.home-book .btn-ghost { color: var(--ink); }

/* --- Smaller screens ----------------------------------------------------- */
@media (max-width: 980px) {
  .hero, .showcase, .atlas-teaser { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .hero { padding-top: 56px; padding-bottom: 84px; }
  .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .home-book { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .home-book-cover { width: min(240px, 64vw); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { gap: 12px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 8px; }
  .nav nav { order: 3; width: 100%; margin: 0; gap: 18px; overflow-x: auto; }
  .nav nav a { white-space: nowrap; font-size: 14.5px; padding: 8px 0; }
  .nav-cta { margin-left: auto; }
  .nav.nav-enhanced { flex-wrap: nowrap; padding-top: 12px; padding-bottom: 12px; }
  .brand { font-size: 18px; }
  .pillars { grid-template-columns: minmax(0, 1fr); margin-top: -36px; }
  .monitor canvas { height: 220px; }
  .monitor figcaption { flex-direction: column; align-items: flex-start; gap: 2px; }
  .foot { grid-template-columns: minmax(0, 1fr); }
  .foot nav { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .pillar, .home-course, .home-book-cover img { transition: none; }
}

.missing { grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - 70px); }

/* --- Motion shared by every page ------------------------------------------ */
/* Pages cross-fade into each other; the navigation bar stays put. */
@view-transition { navigation: auto; }
header.nav { view-transition-name: site-nav; }
::view-transition-old(root) { animation: vt-out 0.18s ease both; }
::view-transition-new(root) { animation: vt-in 0.32s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

.has-motion [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.7s cubic-bezier(.2, .8, .2, 1); }
.has-motion [data-reveal].is-in { opacity: 1; transform: none; }

.btn:active { transform: translateY(0) scale(0.97); transition-duration: 0.06s; }
a, button, summary { -webkit-tap-highlight-color: transparent; }

/* --- Three-dot menu ---------------------------------------------------------- */
.more { position: relative; display: inline-block; }
.more > summary { list-style: none; display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 999px; border: 1.5px solid currentColor; cursor: pointer; transition: background 0.15s ease, transform 0.15s ease; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary:hover { background: rgba(255, 255, 255, 0.08); }
.more > summary svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 3.2; stroke-linecap: round; }
.more[open] > summary { background: var(--trace); color: #04231f; border-color: var(--trace); }
.more-menu { position: absolute; left: 0; top: calc(100% + 8px); z-index: 12; min-width: 290px; padding: 6px; display: grid; gap: 2px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 24px 50px rgba(6, 16, 31, 0.28); transform-origin: 0 0; }
.more[open] > .more-menu { animation: more-in 0.18s cubic-bezier(.2, .8, .2, 1); }
@keyframes more-in { from { opacity: 0; transform: translateY(-6px) scale(0.96); } }
.more-menu button, .more-menu a { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; font: 600 15.5px var(--sans); text-align: left; text-decoration: none; cursor: pointer; }
.more-menu button:hover, .more-menu a:hover, .more-menu button:focus-visible, .more-menu a:focus-visible { background: var(--paper-2); }
.more-menu svg { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); }
@media (max-width: 640px) { .more-menu { position: fixed; left: 12px; right: 12px; top: auto; bottom: max(12px, env(safe-area-inset-bottom)); border-radius: var(--r-lg); padding: 8px; transform-origin: 50% 100%; } .more[open] > .more-menu { animation-name: sheet-in; } .more-menu button, .more-menu a { min-height: 50px; font-size: 16.5px; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .more[open] > .more-menu { animation: none; }
}

/* --- No layout shift while scripts start ----------------------------------------
   When scripting is on, lay the page out as the scripts will leave it, so nothing
   visible moves when they run. Without scripting these rules never apply. */
@media (scripting: enabled) and (max-width: 960px) {
  /* The phone header collapses into the Menu button nav.js adds. */
  .nav:not(.nav-enhanced) nav { position: absolute; visibility: hidden; }
  .nav:not(.nav-enhanced)::after { content: ""; flex: none; width: 0; height: 40px; }
  .nav:not(.nav-enhanced) .nav-cta { margin-left: auto; margin-right: 104px; }
}
@media (scripting: enabled) and (max-width: 640px) {
  .nav:not(.nav-enhanced) { flex-wrap: nowrap; padding-top: 12px; padding-bottom: 12px; }
}
@media (scripting: enabled) and (max-width: 559px) {
  .nav:not(.nav-enhanced) .nav-cta { display: none; }
}

/* --- Search ------------------------------------------------------------------------
   The header link (a button once nav.js runs) and the search dialog (search.js). */
.nav-search {
  display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 40px; padding: 0 8px 0 12px;
  border-radius: 999px; border: 1.5px solid var(--night-line); background: rgba(255, 255, 255, 0.03);
  color: var(--on-night-muted); font: 600 14.5px var(--sans); text-decoration: none; cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.nav-search:hover { color: #fff; border-color: var(--on-night-muted); background: rgba(255, 255, 255, 0.06); }
.nav-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.nav-search kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 1px solid var(--night-line); border-radius: 6px; font: 650 12px var(--mono); color: var(--on-night-muted); }
.nav-search + .nav-cta { margin-left: -12px; }
@media (max-width: 1240px) {
  .nav-search { width: 40px; padding: 0; justify-content: center; background: transparent; }
  .nav-search-label, .nav-search kbd { display: none; }
  .nav-search + .nav-cta { margin-left: -16px; }
}
@media (max-width: 960px) {
  .nav.nav-enhanced .nav-search { margin-left: auto; }
  .nav.nav-enhanced .nav-search + .nav-cta { margin-left: 0; }
}
@media (max-width: 559px) {
  .nav.nav-enhanced .nav-toggle { margin-left: 4px; }
}
/* Between the collapsed menu and wide screens, tighten the row so it fits on one line. */
@media (min-width: 961px) and (max-width: 1120px) {
  .nav { gap: 18px; }
  .nav nav { gap: 18px; }
  .nav nav a { font-size: 14.5px; white-space: nowrap; }
  .nav-cta { padding: 0 16px; }
  .nav .nav-search + .nav-cta { margin-left: -6px; }
}
/* Small phones: the Menu button keeps its name for screen readers but shows only its icon. */
@media (max-width: 420px) {
  .nav-enhanced .nav-toggle { width: 40px; padding: 0; justify-content: center; flex: none; }
  .nav.nav-enhanced .nav-toggle { margin-left: 0; }
  .nav-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 360px) {
  .nav.nav-enhanced { gap: 8px; }
  .brand { font-size: 16.5px; gap: 8px; }
  .brand img { width: 28px; height: 28px; }
}
/* Before nav.js runs, hold the same places it will leave (see "No layout shift"
   above): the search button and the lab button sit where they will be once the
   Menu button arrives. */
@media (scripting: enabled) and (max-width: 960px) {
  .nav:not(.nav-enhanced) .nav-search { margin-left: auto; margin-right: -18px; }
  .nav:not(.nav-enhanced) .nav-search + .nav-cta { margin-left: 0; margin-right: 78px; }
  .nav:not(.nav-enhanced) .nav-search:last-child { margin-right: 78px; }
}
@media (scripting: enabled) and (max-width: 640px) {
  .nav:not(.nav-enhanced) .nav-search { margin-right: -2px; }
  .nav:not(.nav-enhanced) .nav-search + .nav-cta { margin-right: 94px; }
  .nav:not(.nav-enhanced) .nav-search:last-child { margin-right: 94px; }
}
@media (scripting: enabled) and (max-width: 559px) {
  .nav:not(.nav-enhanced) .nav-search { margin-right: 94px; }
}
@media (scripting: enabled) and (max-width: 420px) {
  .nav:not(.nav-enhanced) .nav-search, .nav:not(.nav-enhanced) .nav-search:last-child { margin-right: 38px; }
}
@media (scripting: enabled) and (max-width: 360px) {
  .nav:not(.nav-enhanced) { gap: 8px; }
  .nav:not(.nav-enhanced) .nav-search, .nav:not(.nav-enhanced) .nav-search:last-child { margin-right: 40px; }
}

html.sx-lock { overflow: hidden; scrollbar-gutter: stable; }
.sx {
  width: min(680px, calc(100% - 32px)); max-width: none; max-height: min(620px, calc(100dvh - 120px));
  margin: max(56px, 12vh) auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: #fff; color: var(--ink); color-scheme: light; box-shadow: 0 40px 90px -20px rgba(6, 16, 31, 0.55), 0 0 0 1px rgba(6, 16, 31, 0.04);
  overflow: hidden;
}
.sx[open] { display: flex; flex-direction: column; animation: sx-in 0.2s cubic-bezier(.2, .8, .2, 1); }
.sx::backdrop { background: rgba(6, 16, 31, 0.58); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes sx-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
.sx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sx-field { display: flex; align-items: center; gap: 12px; flex: none; padding: 0 12px 0 20px; border-bottom: 1px solid var(--line); box-shadow: inset 0 -2px 0 transparent; transition: box-shadow 0.15s ease; }
.sx-field:focus-within { box-shadow: inset 0 -2px 0 var(--blue); }
.sx-icon { width: 21px; height: 21px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; }
.sx-field input { flex: 1; min-width: 0; min-height: 64px; padding: 0; border: 0; background: transparent; color: var(--ink); font: 500 18px var(--sans); outline: none; }
.sx-field input::placeholder { color: #8391a3; }
.sx-close { flex: none; display: inline-grid; place-items: center; min-height: 32px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--muted); font: 650 12.5px var(--mono); cursor: pointer; }
.sx-close:hover { color: var(--ink); border-color: #c9c1b1; }
.sx-close-word { display: none; }
.sx-body:focus-visible { outline: 3px solid #f4b740; outline-offset: -3px; border-radius: 0; }
.sx-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 8px 10px; }
.sx-caption { padding: 10px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sx-opt { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 60px; padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; scroll-margin: 8px; }
.sx-opt[aria-selected="true"] { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--blue); }
.sx-badge { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #e8f0fb; color: var(--blue); }
.sx-badge svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sx-badge.sx-rhythm { background: #dff6f1; color: #0a6b5e; }
.sx-badge.sx-cond { background: #efe9fb; color: #5b3aa8; }
.sx-badge.sx-path { background: #fde9ec; color: #a61b3a; }
.sx-badge.sx-tool { background: #fdf1dc; color: #8a5a05; }
.sx-text { display: grid; gap: 2px; min-width: 0; }
.sx-title { font-weight: 650; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.sx-detail { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-also { color: #7a8798; }
.sx mark { background: #c9f3ea; color: inherit; border-radius: 3px; padding: 0 1px; box-shadow: inset 0 -1.5px 0 #14b8a6; }
.sx-sec { font-size: 12px; font-weight: 650; color: var(--muted); padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; background: #fff; }
.sx-empty { display: grid; justify-items: center; gap: 8px; padding: 40px 20px 36px; text-align: center; }
.sx-empty h3 { font-size: 22px; max-width: 100%; overflow-wrap: anywhere; }
.sx-empty p { color: var(--muted); font-size: 15px; max-width: 30em; }
.sx-btn { min-height: 40px; padding: 0 16px; font-size: 14.5px; margin-top: 8px; }
.sx-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; flex: none; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--paper); font-size: 13px; color: var(--muted); }
.sx-foot span { display: inline-flex; align-items: center; gap: 4px; }
.sx-foot kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: #fff; font: 650 11.5px var(--mono); color: var(--ink); }
@media (hover: none), (max-width: 640px) { .sx-foot { display: none; } }
@media (max-width: 640px) {
  .sx { width: 100%; max-height: none; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .sx[open] { animation-name: sx-up; }
  .sx-field { padding: env(safe-area-inset-top) 8px 0 16px; }
  .sx-field input { min-height: 60px; font-size: 17px; }
  .sx-close { border: 0; background: none; min-height: 44px; padding: 0 10px; font: 650 15.5px var(--sans); color: var(--blue); }
  .sx-close-key { display: none; }
  .sx-close-word { display: inline; }
  .sx-body { padding: 6px 6px max(16px, env(safe-area-inset-bottom)); }
  .sx-opt { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 9px 10px; }
  .sx-badge { width: 36px; height: 36px; }
  .sx-sec { display: none; }
}
@keyframes sx-up { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) { .sx[open] { animation: none; } }

/* --- Book format and price badges (scripts/build-owner-content.mjs) --- */
.book-badges { list-style: none; padding: 0; margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.book-badges li { display: inline-flex; align-items: center; min-height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: 12.5px; font-weight: 650; color: var(--ink); }
.book-badges li.is-price { border-color: #bfe9df; background: #effaf7; color: #0a6b5e; }

/* --- Testimonials (rendered by scripts/build-owner-content.mjs only when real entries exist) --- */
.tm { padding: var(--section-y) var(--gutter); background: var(--paper); border-top: 1px solid var(--line); }
.tm h2 { font-size: var(--h2); }
.tm-list { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.tm-card { margin: 0; height: 100%; display: grid; gap: 16px; align-content: space-between; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.tm-card blockquote { margin: 0; font-family: var(--serif); font-size: 19px; line-height: 1.45; color: var(--ink); }
.tm-card blockquote p::before { content: "\201C"; }
.tm-card blockquote p::after { content: "\201D"; }
.tm-card figcaption { display: grid; gap: 2px; font-size: 14.5px; color: var(--muted); }
.tm-card figcaption b { color: var(--ink); }
.tm-card figcaption a { color: var(--blue); }
.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; }
/* --- Draft content awaiting the clinical owner's review --------------------- */
.draft-badge { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 10px; padding: 4px 12px; border-radius: 999px; font: 700 13px/1.4 var(--sans); letter-spacing: 0.01em; color: #5c3b00; background: #fde7b0; border: 1px solid #e8b94a; }
.draft-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b7791f; }
.draft-badge.is-small { margin: 2px 0 0; padding: 1px 8px; font-size: 12px; align-self: flex-start; }
@media print { .draft-badge { color: #000; background: none; border-color: #000; } .draft-badge::before { background: #000; } }
