/* ==========================================================
   The Piriformis Problem: site styles
   Colours and fonts are tokens here. Change them in one place.
   ========================================================== */

:root {
  color-scheme: light;

  --paper: #F4F6F4;        /* page background, cool off-white */
  --surface: #FFFFFF;      /* cards, book page */
  --alt: #E9EEEC;          /* alternate section band */
  --ink: #17252E;          /* body text */
  --ink-soft: #4B5B63;     /* secondary text */
  --line: #CCD5D3;         /* borders, rules */

  --petrol: #1F4E66;       /* primary: buttons, links */
  --petrol-dark: #163A4C;
  --muscle: #A3364A;       /* illustration only */
  --nerve: #D8A31E;        /* illustration and evidence notes */
  --nerve-pale: #FBF3DC;
  --urgent-line: #B54A2E;
  --urgent-bg: #FBEFEA;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 6px;
  --gutter: 24px;
  --max: 1140px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }

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

:focus-visible { outline: 3px solid var(--nerve); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  color: var(--ink);
}
h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); font-weight: 500; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; margin-bottom: 0.35em; }

p { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* Placeholders: yellow highlight. Remove the class when filled in. */
.placeholder { background: #FFF1A8; color: inherit; border-radius: 2px; padding: 0 2px; }

/* ---------- Buttons and links ---------- */
.btn {
  display: inline-block;
  background: var(--petrol);
  color: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  padding: 15px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--petrol);
  text-decoration: none;
  transition: background-color .15s ease;
}
.btn:hover { background: var(--petrol-dark); border-color: var(--petrol-dark); color: #fff; }
.btn .placeholder { background: rgba(255, 241, 168, .25); }
.btn-small { padding: 9px 16px; font-size: .95rem; }
.btn-block { display: block; text-align: center; width: 100%; }
.btn-outline { background: transparent; color: var(--petrol); }
.btn-outline:hover { background: var(--petrol); color: #fff; }

.text-link { font-weight: 600; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: rgba(244, 246, 244, .94);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 600; font-size: 1.15rem; }
.brand:hover { color: var(--ink); }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a:not(.btn) { color: var(--ink-soft); text-decoration: none; font-size: .95rem; }
.nav a:not(.btn):hover { color: var(--ink); text-decoration: underline; }

/* ---------- Sections ---------- */
.section { padding: 88px 0; }
.section-alt { background: var(--alt); }
.section-tight { padding: 0 0 88px; }

.prose { max-width: 62ch; }
.prose h3 { margin-top: 1.4em; }
.prose h2 + h3 { margin-top: .4em; }

.plain-list { list-style: none; padding: 0; margin: 0 0 1em; }
.plain-list li { position: relative; padding-left: 22px; margin-bottom: .55em; }
.plain-list li::before {
  content: ""; position: absolute; left: 0; top: .68em;
  width: 10px; height: 2px; background: var(--ink-soft);
}

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.lede { font-size: 1.2rem; line-height: 1.55; color: var(--ink-soft); max-width: 36em; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin: 32px 0 40px; }

.facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px;
  margin: 0; padding-top: 22px; border-top: 1px solid var(--line);
}
.facts dt { font-size: .82rem; color: var(--ink-soft); }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: .98rem; }

/* The anatomical plate */
.plate {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 28px 28px 22px;
}
.anatomy { width: 100%; height: auto; }
.anatomy .bone path, .anatomy .bone circle {
  fill: #ECEFEB; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round;
}
.anatomy .foramen { fill: var(--surface); stroke: var(--ink); stroke-width: 1.2; }
.anatomy .foramen-dots circle { fill: var(--surface); stroke: var(--ink); stroke-width: 1.1; }
.anatomy .muscle { fill: var(--muscle); fill-opacity: .88; stroke: #6E1F2F; stroke-width: 1.4; }
.anatomy .fibres path { fill: none; stroke: #F3C9CF; stroke-opacity: .55; stroke-width: 1; }
.anatomy .nerve-outline { fill: none; stroke: #8C6608; stroke-width: 14; stroke-linecap: round; }
.anatomy .nerve { fill: none; stroke: var(--nerve); stroke-width: 10; stroke-linecap: round; }
.anatomy .leader { fill: none; stroke: var(--ink-soft); stroke-width: 1; }
.anatomy .labels text { font-family: var(--sans); font-size: 16px; fill: var(--ink); }
.anatomy .labels text.sub { fill: var(--ink-soft); font-size: 14px; }

/* One moment of motion: the nerve draws in on load */
@media (prefers-reduced-motion: no-preference) {
  .anatomy .nerve, .anatomy .nerve-outline {
    stroke-dasharray: 340; stroke-dashoffset: 340;
    animation: draw 1.6s cubic-bezier(.4, 0, .2, 1) .4s forwards;
  }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.plate figcaption {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
  font-family: var(--serif); font-size: 1rem; line-height: 1.5; color: var(--ink-soft);
}
.fig-no { font-weight: 600; color: var(--ink); margin-right: 6px; }

/* ---------- Familiar / fit ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.two-col .plain-list li { font-size: 1.08rem; }
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; margin-top: 56px; }
.fit-col { border-top: 2px solid var(--ink); padding-top: 18px; }
.fit-col:last-child { border-top-color: var(--line); }

/* ---------- Contents ---------- */
.contents-grid { display: grid; grid-template-columns: 1fr 1.5fr; gap: 64px; align-items: start; }
.contents-intro p { color: var(--ink-soft); max-width: 34ch; }
.toc { list-style: none; margin: 0; padding: 0; font-family: var(--serif); font-size: 1.2rem; }
.toc li {
  display: grid; grid-template-columns: 2.2em 1fr auto; align-items: baseline; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.toc li:first-child { border-top: 1px solid var(--line); }
.toc-no { color: var(--muscle); font-variant-numeric: oldstyle-nums; font-weight: 500; }
.toc-page { color: var(--ink-soft); font-variant-numeric: oldstyle-nums tabular-nums; font-size: 1.05rem; }
.toc-appendix { font-size: 1.05rem; }
.toc-appendix .toc-title { color: var(--ink-soft); }
.toc-appendix:first-of-type { margin-top: 0; }
.toc li.toc-appendix:nth-child(10) { border-top: 1px solid var(--ink-soft); margin-top: 18px; }

/* ---------- Research ---------- */
.research-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.page-sample { margin: 0; }
.page {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 40px 44px 28px;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.65;
  box-shadow: 0 1px 0 var(--line), 0 18px 36px -24px rgba(23, 37, 46, .35);
  transform: rotate(-.6deg);
}
.page-head { font-family: var(--sans); font-size: .8rem; color: var(--ink-soft); margin-bottom: 1.6em; }
.page sup { font-family: var(--sans); font-size: .7em; color: var(--petrol); font-weight: 600; }
.page-note {
  font-family: var(--sans); font-size: .9rem; line-height: 1.5;
  background: var(--nerve-pale); border-left: 3px solid var(--nerve);
  padding: 10px 14px; margin: 1.4em 0;
}
.note-label { display: block; font-weight: 600; }
.page-refs { font-family: var(--sans); font-size: .78rem; line-height: 1.5; color: var(--ink-soft); padding-left: 1.4em; margin: 1.4em 0 0; border-top: 1px solid var(--line); padding-top: 12px; }
.page-folio { text-align: center; font-size: .85rem; color: var(--ink-soft); margin: 18px 0 0; }
.page-sample figcaption { font-size: .9rem; color: var(--ink-soft); margin-top: 18px; text-align: center; }

/* ---------- Author ---------- */
.author-grid { display: grid; grid-template-columns: 320px 1fr; gap: 64px; align-items: start; }
.author-photo img, .photo-placeholder { width: 100%; aspect-ratio: 4 / 5; border-radius: 4px; object-fit: cover; }
.photo-placeholder {
  display: grid; place-items: center;
  background: repeating-linear-gradient(135deg, #DCE3E1 0 10px, #E4EAE8 10px 20px);
  color: var(--ink-soft); font-size: .9rem; border: 1px solid var(--line);
}
.signoff { font-family: var(--serif); font-size: 1.2rem; font-style: italic; margin-top: 1.4em; }
.credentials { list-style: none; padding: 0; margin: 24px 0 0; border-top: 1px solid var(--line); }
.credentials li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .98rem; }

/* ---------- Sample ---------- */
.sample { padding: 56px 0; background: var(--petrol); color: #E7EFF2; }
.sample h2 { color: #fff; margin-bottom: .3em; }
.sample p { margin: 0; max-width: 52ch; }
.sample-inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.sample .btn-outline { color: #fff; border-color: #fff; }
.sample .btn-outline:hover { background: #fff; color: var(--petrol); }

/* ---------- Buy ---------- */
.buy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: center; max-width: 960px; }
.cover { display: flex; justify-content: center; perspective: 1200px; }
.cover-face {
  position: relative;
  width: 280px; aspect-ratio: 2 / 3;
  background: var(--petrol);
  color: #fff;
  border-radius: 2px 6px 6px 2px;
  padding: 34px 28px 28px 36px;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 50px -28px rgba(23, 37, 46, .6), 0 2px 4px rgba(23, 37, 46, .2);
  transform: rotateY(-8deg);
}
.cover-face::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
  background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(255,255,255,.08) 70%, rgba(0,0,0,.1));
  border-radius: 2px 0 0 2px;
}
.cover-motif { width: 100%; height: auto; margin-bottom: auto; }
.cover-nerve { fill: none; stroke: var(--nerve); stroke-width: 7; stroke-linecap: round; }
.cover-muscle { fill: var(--muscle); }
.cover-title { font-family: var(--serif); font-size: 2rem; line-height: 1.05; font-weight: 500; margin: 0 0 12px; }
.cover-sub { font-size: .8rem; line-height: 1.45; color: #CFDDE3; margin: 0 0 22px; }
.cover-author { font-family: var(--serif); font-style: italic; font-size: .95rem; margin: 0; }
.cover-author .placeholder { background: rgba(255, 241, 168, .3); }

.buy-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
}
.buy-card h2 { margin-bottom: .2em; }
.price { font-family: var(--serif); font-size: 3rem; line-height: 1; margin: 12px 0 6px; font-weight: 500; }
.price-note { color: var(--ink-soft); font-size: .95rem; }
.included { list-style: none; padding: 0; margin: 22px 0 28px; }
.included li { position: relative; padding: 0 0 0 28px; margin-bottom: 12px; }
.included li::before {
  content: ""; position: absolute; left: 2px; top: .45em;
  width: 12px; height: 7px;
  border-left: 2px solid var(--petrol); border-bottom: 2px solid var(--petrol);
  transform: rotate(-45deg);
}
.secure { font-size: .88rem; color: var(--ink-soft); margin: 16px 0 0; }

/* ---------- Urgent ---------- */
.urgent {
  max-width: 820px; margin: 0 auto;
  background: var(--urgent-bg);
  border-left: 4px solid var(--urgent-line);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 28px 32px;
}
.urgent h2 { font-size: 1.5rem; }
.urgent ul { margin: 0 0 1em; padding-left: 1.2em; }
.urgent li { margin-bottom: .35em; }
.urgent p:last-child { margin-bottom: 0; }

/* ---------- FAQ ---------- */
.faq-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 64px; align-items: start; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary {
  cursor: pointer; list-style: none;
  padding: 18px 40px 18px 0; position: relative;
  font-weight: 600; font-size: 1.05rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; position: absolute; right: 8px; top: 50%;
  width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg); transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
.faq details p { margin: 0 0 20px; color: var(--ink-soft); max-width: 62ch; }
@media (prefers-reduced-motion: reduce) { .faq summary::after { transition: none; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #C5D0D4; padding: 56px 0 28px; font-size: .95rem; }
.site-footer a { color: #fff; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr; gap: 48px; }
.footer-brand { font-family: var(--serif); font-size: 1.25rem; color: #fff; margin-bottom: .5em; }
.footer-small { font-size: .85rem; color: #9DADB3; max-width: 60ch; }
.footer-links { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.footer-base { margin-top: 36px; padding-top: 20px; border-top: 1px solid #2E404A; font-size: .85rem; color: #9DADB3; }
.footer-base p { margin: 0; }
.site-footer .placeholder { background: rgba(255, 241, 168, .2); }

/* ---------- Simple pages (legal, thank you) ---------- */
.page-wrap { padding: 72px 0 96px; }
.page-wrap .prose { max-width: 68ch; }
.page-wrap h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.page-wrap h2 { font-size: 1.4rem; margin-top: 1.8em; }
.page-wrap .updated { color: var(--ink-soft); font-size: .92rem; }
.thanks-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; margin: 28px 0; }
.thanks-box ol { margin: 0; padding-left: 1.2em; }
.thanks-box li { margin-bottom: .6em; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .two-col, .fit, .contents-grid, .research-grid, .buy-grid, .faq-grid, .footer-inner { grid-template-columns: 1fr; gap: 40px; }
  .author-grid { grid-template-columns: 1fr; gap: 32px; }
  .author-photo { max-width: 260px; }
  .hero { padding-top: 40px; }
  .plate { max-width: 600px; }
  .page { transform: none; }
  .nav a:not(.btn) { display: none; }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .section { padding: 64px 0; }
  .section-tight { padding-bottom: 64px; }
  .brand span { font-size: 1.02rem; }
  .facts { grid-template-columns: 1fr 1fr; }
  .plate { padding: 16px 14px 14px; }
  .page { padding: 26px 22px 20px; font-size: 1rem; }
  .buy-card { padding: 26px 22px; }
  .cover-face { width: 230px; padding: 26px 22px 22px 28px; }
  .cover-title { font-size: 1.65rem; }
  .urgent { padding: 22px 20px; }
  .toc { font-size: 1.08rem; }
  .hero-actions .btn { width: 100%; text-align: center; }
}
