:root {
  --cream: #faf8f4;
  --surface: #ffffff;
  --navy: #0b1742;
  --royal: #0820a3;
  --mist: #eef1ff;
  --amber: #c97a16;
  --amber-soft: #fdf3df;
  --teal: #0d6e6e;
  --teal-soft: #e6f5f2;
  --coral: #c44d34;
  --coral-soft: #fcece9;
  --ink: #1a2138;
  --muted: #55607a;
  --border: #dde2ee;
  --periwinkle: #5370ff;
  --display: Newsreader, Georgia, serif;
  --body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ui: "Plus Jakarta Sans", var(--body);
  --gutter: clamp(18px, 4.6vw, 78px);
  --panel-padding: clamp(18px, 2.8vw, 38px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 132px; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 1rem/1.65 var(--body);
}

h1, h2, h3, h4 {
  margin: 0 0 0.4em;
  color: var(--navy);
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

h1 { font-size: clamp(2.65rem, 5.1vw, 4.8rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 3rem); }
h3 { font-size: clamp(1.35rem, 2.1vw, 1.85rem); }
h4 { font-size: 1.24rem; }

p { margin: 0.55em 0 1em; }
figure, blockquote { margin: 0; }
img, svg, video { max-width: 100%; }

small, .eyebrow, figcaption {
  font-size: 0.8rem;
  color: var(--muted);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.65em;
  color: var(--royal);
  font: 700 0.77rem/1.45 var(--ui);
  letter-spacing: 0.025em;
}

a { color: var(--royal); text-underline-offset: 0.19em; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
button, a, summary { touch-action: manipulation; }

button, .primary, .secondary {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.68em 0.95em;
  background: var(--surface);
  font: 700 0.875rem/1.45 var(--ui);
  text-align: start;
  overflow-wrap: anywhere;
}

button:hover, .secondary:hover { border-color: var(--periwinkle); }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 3px solid var(--periwinkle); outline-offset: 3px; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select, textarea {
  min-width: 0;
  max-width: 100%;
  border: 1px solid #b8c0d1;
  border-radius: 6px;
  padding: 0.6em 0.75em;
  background: var(--surface);
}

.primary, .secondary, .text-link {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
}

.primary, .secondary { text-decoration: none; }

.primary {
  padding: 0.84em 1.1em;
  background: var(--royal);
  border-color: var(--royal);
  color: var(--surface);
}

.primary:hover {
  background: var(--navy);
  border-color: var(--navy);
}

.secondary { color: var(--royal); }
.secondary:hover { background: var(--mist); }

.text-link {
  border: 0;
  padding: 0.45em 0;
  background: transparent;
  color: var(--royal);
  font: 700 0.875rem/1.45 var(--ui);
  text-decoration: underline;
  text-underline-offset: 0.23em;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-block;
  max-width: 100%;
  border-radius: 999px;
  background: var(--mist);
  padding: 0.22em 0.75em;
  color: var(--royal);
  font: 700 0.78rem/1.45 var(--ui);
  overflow-wrap: anywhere;
}

.feedback {
  border-radius: 7px;
  padding: 0.8em 1em;
  background: var(--mist);
  overflow-wrap: anywhere;
}

.feedback:empty { display: none; }
.feedback.ok { background: var(--teal-soft); color: #0c5353; }
.feedback.bad { background: var(--coral-soft); color: #872f24; }

.visually-hidden, .skip:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip:focus {
  position: fixed;
  z-index: 30;
  top: 6px;
  left: 6px;
  background: var(--surface);
  padding: 0.6em 1em;
}

#top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--cream);
  border-bottom: 1px solid var(--border);
}

.mast, #nav, #main {
  width: min(1440px, 100%);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.mast {
  display: flex;
  align-items: center;
  min-height: 66px;
  gap: 18px;
}

.mast-identity {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  color: var(--navy);
  text-decoration: none;
  font: 600 clamp(1.4rem, 2.05vw, 1.85rem)/1 var(--display);
  letter-spacing: -0.028em;
}

.mast-caption {
  color: var(--muted);
  font: 600 0.76rem/1.45 var(--ui);
  padding-inline-start: 18px;
  border-inline-start: 1px solid var(--border);
}

.tools {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-inline-start: auto;
}

.tools button {
  white-space: nowrap;
  font-size: 0.79rem;
  text-align: center;
}

#focusMode {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border-color: transparent;
  padding-inline: 4px;
}

.toggle {
  display: inline-flex;
  width: 25px;
  height: 15px;
  padding: 3px;
  flex: none;
  border-radius: 999px;
  background: #767f94;
}

.toggle::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
}

.focus .toggle { justify-content: end; background: var(--royal); }

.book-btn {
  color: var(--surface);
  background: var(--navy);
  border-color: var(--navy);
}

.book-btn:hover { background: var(--royal); }

#nav {
  display: flex;
  gap: clamp(14px, 2.1vw, 32px);
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

#nav a {
  display: flex;
  align-items: center;
  flex: none;
  gap: 6px;
  border-bottom: 3px solid transparent;
  padding: 10px 0 12px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font: 700 clamp(0.7rem, 0.9vw, 0.84rem)/1.45 var(--ui);
}

#nav a:hover { color: var(--navy); }
#nav a:focus-visible { outline-offset: -3px; }

#nav a[aria-current="page"] {
  color: var(--royal);
  border-color: var(--royal);
}

.dot {
  width: 6px;
  height: 6px;
  flex: none;
  border: 1px solid #8993ab;
  border-radius: 50%;
}

.done .dot { border-color: var(--teal); background: var(--teal); }

#main {
  min-height: 70vh;
  padding-block: clamp(26px, 4vw, 58px) 64px;
  outline: none;
}

.section-head { margin: 0 0 clamp(20px, 4vw, 42px); }
.section-head > p { max-width: 66ch; color: var(--muted); }

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--panel-padding);
  background: var(--surface);
}

.two-col, .three-col {
  display: grid;
  gap: clamp(12px, 2.4vw, 28px);
}

.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-col > *, .three-col > * { min-width: 0; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(25px, 4vw, 68px);
  padding-block: clamp(6px, 1.8vw, 24px) clamp(34px, 5vw, 68px);
}

.hero h1 {
  max-width: 15ch;
  margin-bottom: 0.28em;
  font-size: clamp(3rem, 5.7vw, 5.5rem);
  line-height: 0.99;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.hero .lead {
  max-width: 49ch;
  margin: 0 0 1.4em;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
}

.hero-actions, .bridge-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 16px;
}

.plate {
  border: 1px solid #d6d7cc;
  border-radius: 10px;
  overflow: hidden;
  background: var(--amber-soft);
}

.plate > img {
  display: block;
  width: 100%;
  height: auto;
}

.book-banner {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 13px clamp(14px, 1.6vw, 22px);
  background: var(--royal);
  color: var(--surface);
  font-size: 0.8rem;
}

.book-banner img {
  display: block;
  width: clamp(66px, 7.5vw, 105px);
  max-width: 175px;
  max-height: 500px;
  height: auto;
  flex: none;
  transform: rotate(-4deg);
  box-shadow: 2px 3px 0 rgb(0 0 0 / 30%);
}

.book-banner strong {
  display: block;
  font: 500 1.14rem/1.15 var(--display);
}

.book-banner span { display: block; margin-top: 4px; color: #e0e5ff; overflow-wrap: anywhere; }
.book-banner a { display: inline-block; margin-top: 3px; color: inherit; }

.video-intro { margin-block-end: clamp(22px, 4vw, 48px); }
.video-intro > p { max-width: 72ch; }
.video-intro video {
  display: block;
  width: 100%;
  max-height: 66vh;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--navy);
  object-fit: contain;
}

.video-intro .video-heading h2 { margin-bottom: 0.45em; font-size: clamp(1.4rem, 2.2vw, 1.9rem); }
.video-intro .video-unavailable { margin: 0; color: var(--muted); font-size: 0.89rem; }

.video-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
  margin-bottom: 10px;
}

.video-intro .video-heading h2 { margin: 0; }

.pain-section, .test-section, .reading {
  margin-block-end: clamp(28px, 4vw, 52px);
}

.pain-section h2, .test-section > h2, .trilogy > h2 { margin-bottom: 0.65em; }

.pain-grid { gap: clamp(12px, 1.7vw, 22px); }

.pain-grid article {
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2vw, 28px);
}

.pain-grid h3 { font-size: clamp(1.3rem, 1.9vw, 1.65rem); line-height: 1.2; }
.pain-grid p { max-width: 55ch; font-size: 0.94rem; }
.pain-grid .text-link { align-self: flex-start; margin-top: auto; }

#test-title:focus { outline: none; }

.test-grid { align-items: start; }

.test-card { border-top: 3px solid var(--amber); }
.test-card + .test-card { border-top-color: var(--teal); }
.test-card h3 { max-width: 27ch; }
.test-card .eyebrow { margin-bottom: 0.5em; }

.test-q {
  min-inline-size: 0;
  margin: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.test-q + .test-q { margin-top: 6px; }
.test-q:last-of-type { border-bottom: 0; }
.test-q legend { max-width: 100%; padding: 0; color: var(--navy); font-weight: 600; overflow-wrap: anywhere; }

.test-yn {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.test-yn label {
  display: inline-flex;
  min-height: 44px;
  min-width: 74px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  font: 700 0.875rem/1.45 var(--ui);
}

.test-yn label:hover { border-color: var(--periwinkle); }
.test-yn label:has(:checked) { border-color: var(--royal); background: var(--mist); color: var(--royal); }
.test-yn input { margin: 0; accent-color: var(--royal); }

.test-verdict {
  margin-top: 10px;
  padding: clamp(13px, 2vw, 24px);
  border-radius: 8px;
  background: var(--mist);
  overflow-wrap: anywhere;
}

.test-verdict > p { margin-block: 0; }
.test-verdict > p + p { margin-top: 0.5em; }
.test-verdict .test-saved { margin-top: 0.75em; color: var(--muted); font-size: 0.81rem; }

.test-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.test-links:empty { display: none; }

.preface {
  max-width: 80ch;
  margin: clamp(26px, 4.3vw, 56px) auto;
  border-inline-start: 2px solid var(--amber);
  padding-inline-start: clamp(16px, 3vw, 36px);
}

.preface blockquote {
  max-width: 38ch;
  color: var(--navy);
  font: 400 italic clamp(1.48rem, 3vw, 2.65rem)/1.22 var(--display);
}

.preface figcaption { margin-top: 0.8em; }

.method-questions {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  background: var(--mist);
}

.question-list { margin: 0; padding-inline-start: 1.25em; color: var(--navy); }
.question-list small { white-space: nowrap; }

.reading {
  padding-top: clamp(20px, 3vw, 40px);
  border-top: 1px solid var(--border);
}

.depth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block: 16px;
}

.depth-tabs button, .depth-tabs a { font-size: 0.82rem; }
.depth-tabs [aria-pressed="true"], .depth-tabs [aria-selected="true"] {
  border-color: var(--royal);
  background: var(--mist);
  color: var(--royal);
}

.path-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.path-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: clamp(13px, 1.7vw, 22px);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.87rem;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.path-card:hover { border-color: var(--periwinkle); background: var(--mist); }
.path-card h3 { margin: 0; font-size: clamp(1.2rem, 1.65vw, 1.52rem); }
.path-card p { margin: 0; }
.path-card small { color: var(--royal); }

.reading-quote {
  margin-block: 0.65em 0;
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--amber);
}

.reading-quote blockquote { color: var(--navy); font: italic 400 1.28rem/1.37 var(--display); }
.reading-quote figcaption { margin-top: 0.35em; }

.trilogy-grid { gap: clamp(12px, 1.8vw, 22px); }

.trilogy-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: clamp(10px, 1.5vw, 20px);
  padding: clamp(13px, 2vw, 25px);
}

.trilogy-card[aria-current="true"] {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.trilogy-card img {
  display: block;
  width: clamp(55px, 6.5vw, 98px);
  height: auto;
  box-shadow: 2px 4px 9px rgb(11 23 66 / 15%);
}

.trilogy-card .eyebrow { margin-bottom: 0.3em; }
.trilogy-card h3 { margin-bottom: 0.32em; }
.trilogy-card .text-link { display: block; width: fit-content; padding-block: 0.25em; }

.book-bridge {
  display: flex;
  align-items: center;
  gap: clamp(13px, 3vw, 36px);
  margin-top: clamp(28px, 4vw, 46px);
}

.book-bridge img {
  width: clamp(60px, 10vw, 112px);
  height: auto;
  flex: none;
  box-shadow: 2px 4px 9px rgb(11 23 66 / 15%);
}

.book-bridge h2 { font-size: clamp(1.55rem, 3vw, 2.6rem); }
.book-bridge p { max-width: 70ch; }

.step-pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.step-pager a { text-align: center; }
.step-pager a:last-child { margin-inline-start: auto; }

#drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 96vw);
  max-width: none;
  height: 100dvh;
  max-height: 100%;
  overflow-y: auto;
  margin: 0;
  padding: clamp(17px, 4.3vw, 26px);
  border: 0;
  border-inline-start: 1px solid var(--border);
  background: var(--cream);
  color: var(--ink);
  overscroll-behavior: contain;
}

#drawer::backdrop { background: rgb(11 23 66 / 39%); }
body:has(#drawer[open]) { overflow: hidden; }

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.drawer-head h2 { margin: 0; font-size: clamp(1.9rem, 4.2vw, 2.4rem); }
.drawer-head .close { padding: 0.2em 0.4em; font: 400 1.5rem/1 var(--body); }
#drawer .method-questions { margin-top: 16px; }
#drawer h3 { font-size: 1.25rem; }
#drawer .question-list { font-size: 0.84rem; line-height: 1.5; }
#drawer .question-list li + li { margin-top: 7px; }

.carnet-notes { margin: 20px 0; }
.carnet-notes h3 { margin-bottom: 0.35em; }
.carnet-empty { margin: 0; color: var(--muted); font-size: 0.84rem; }

.entry {
  padding-block: 12px;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.entry h4 { margin-bottom: 0.2em; }
.entry p {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.875rem;
}

.drawer-book {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  padding-top: 12px;
  font-size: 0.82rem;
}

.drawer-book a { width: fit-content; color: var(--muted); }
.drawer-book a:hover { color: var(--royal); }

#carnet-print { display: none; }

body.focus #main { max-width: 960px; }
body.focus .aux, body.focus .mast-caption { display: none; }
body.focus .hero,
body.focus .two-col,
body.focus .three-col { grid-template-columns: minmax(0, 1fr); }
body.focus .path-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (min-width: 1024px) {
  #nav { justify-content: space-between; }
}

@media (max-width: 900px) {
  .mast, .mast-identity { gap: 10px; }
  .mast-caption { padding-inline-start: 10px; }
  .hero { gap: 20px; }
  .hero h1 { font-size: clamp(2.8rem, 6.2vw, 4rem); }
  .path-cards, .trilogy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
  html { scroll-padding-top: 148px; }
  .mast { min-height: 59px; gap: 7px; padding-block: 7px; }
  .mast-identity { display: grid; min-width: 0; gap: 4px; overflow-wrap: anywhere; }
  .brand { font-size: 1.13rem; }
  .mast-caption { border: 0; padding: 0; font-size: 0.65rem; }
  .tools { flex: none; gap: 5px; }
  .tools button { min-height: 44px; font-size: 0.7rem; padding-inline: 0.7em; }
  #focusMode { gap: 5px; }
  .toggle { width: 22px; }
  #nav { gap: 17px; }
  #nav a { font-size: 0.75rem; }
  .hero, .two-col, .three-col { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2.65rem, 10.8vw, 4rem); }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 5px; }
  .path-cards, body.focus .path-cards { grid-template-columns: minmax(0, 1fr); }
  .book-bridge { align-items: flex-start; }
  .step-pager a { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  @page { margin: 15mm; }

  html, body { background: white; color: black; }
  #top, .skip, .step-pager, #drawer { display: none !important; }
  body:has(#drawer[open]) { overflow: visible; }
  body:has(#drawer[open]) #main { display: none !important; }
  body:has(#drawer[open]) #carnet-print { display: block; }

  #carnet-print {
    font-size: 10.5pt;
    line-height: 1.4;
  }

  #carnet-print h1, #carnet-print h2, #carnet-print h4 { color: black; break-after: avoid; }
  #carnet-print h1 { font-size: 27pt; }
  #carnet-print h2 { font-size: 16pt; margin-top: 0.9em; }
  #carnet-print h4 { font-size: 12pt; }
  #carnet-print header > p { margin: 0 0 0.3em; }
  #carnet-print .method-questions { background: none; border: 0; padding: 0; }
  #carnet-print .question-list { color: black; }
  #carnet-print .question-list li { margin-bottom: 0.35em; }
  #carnet-print .question-list li, #carnet-print .entry { break-inside: avoid; }
  #carnet-print .entry { padding-block: 8pt; }
  #carnet-print .entry p { orphans: 3; widows: 3; }
}
