/* =========================================================================
   Law By Design — reading site
   Type + color rebuilt to match the ORIGINAL book: bold Helvetica set in
   bright cyan blocks, crisp white page, raspberry accent from the cover.
   Cyan shades taken straight from the original theme CSS:
   #005C6F teal · #029BBF deep · #23D3FC bright · #B9EFFA light · #D7F6FC pale
   ========================================================================= */

:root {
  --cyan:        #23d3fc;   /* original h3 block */
  --cyan-deep:   #029bbf;   /* original h4 */
  --teal:        #005c6f;   /* original h1 text — deepest */
  --cyan-light:  #b9effa;   /* original h2 block */
  --cyan-pale:   #d7f6fc;   /* original h1 block */
  --raspberry:   #c8114f;
  --raspberry-deep: #9c0d3d;
  --ink:         #111315;
  --muted:       #5b6b70;
  --paper:       #ffffff;
  --panel:       #f3fbfd;   /* faint cyan-tinted sidebar, not cream */
  --line:        #e2edf0;
  --line-soft:   #eef5f7;

  --sidebar-w:  312px;
  --measure:    min(720px, 100%);
  --anchor-pad: 92px;

  /* Real Helvetica on Apple devices; Arial (its near-twin) elsewhere.
     No web font load — nothing to date it, nothing to slow it down. */
  --sans: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--anchor-pad);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.075rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* reading progress */
#progress {
  position: fixed; top: 0; left: 0;
  height: 3px; width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--raspberry));
  z-index: 60;
  transition: width .12s linear;
}

/* ============================ shell / layout ============================ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  align-items: start;
}

/* ============================== sidebar ================================= */
.sidebar {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px 22px 40px;
}
.sidebar::-webkit-scrollbar { width: 9px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; }

.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
  margin-bottom: 28px;
}
.brand img { width: 44px; height: 44px; flex: none; }
.brand .wordmark { display: flex; flex-direction: column; line-height: 1.02; }
.brand .wordmark b {
  font-weight: 700; font-size: 1.24rem; letter-spacing: -.02em;
}
.brand .wordmark span {
  font-size: .64rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--cyan-deep); margin-top: 4px;
}

.toc-label {
  font-size: .64rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted);
  margin: 0 0 12px 2px;
}

.chapters { list-style: none; margin: 0; padding: 0; }
.chapters > li { margin: 0; }

.chap-link {
  display: grid; grid-template-columns: 24px 1fr; gap: 10px;
  align-items: baseline;
  padding: 8px 8px 8px 6px; border-radius: 7px;
  text-decoration: none; color: var(--ink);
  font-size: .95rem; font-weight: 500; line-height: 1.28;
  transition: background .13s ease, color .13s ease;
}
.chap-link .num { font-weight: 700; font-size: .95rem; color: var(--cyan-deep); text-align: center; }
.chap-link:hover { background: var(--cyan-pale); }
.chap-link.current { color: var(--raspberry-deep); font-weight: 700; }
.chap-link.current .num { color: var(--raspberry); }
.chap-link.current .title-txt {
  border-bottom: 2.5px solid var(--raspberry);
  padding-bottom: 2px;
}

.outline {
  list-style: none;
  margin: 4px 0 8px 16px; padding: 4px 0 4px 18px;
  border-left: 2px solid var(--line);
}
.outline li { margin: 0; }
.outline a {
  display: block; position: relative;
  padding: 5px 8px 5px 12px; margin-left: -20px;
  border-left: 2px solid transparent;
  text-decoration: none;
  font-size: .84rem; line-height: 1.33; color: var(--muted);
  transition: color .13s ease, border-color .13s ease;
}
.outline a.lvl-3 { padding-left: 24px; font-size: .81rem; }
.outline a:hover { color: var(--ink); }
.outline a.active {
  color: var(--cyan-deep); font-weight: 700;
  border-left-color: var(--cyan);
}

.side-foot {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.side-foot a { font-size: .82rem; font-weight: 500; color: var(--muted); text-decoration: none; }
.side-foot a:hover { color: var(--raspberry); }

/* ============================== content ================================ */
.main { min-width: 0; }
.reading { max-width: var(--measure); margin: 0 auto; padding: 60px 44px 120px; }

.eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--cyan-deep);
  margin: 0 0 14px;
}

h1.doc-title {
  font-weight: 700;
  font-size: clamp(2.2rem, 1.4rem + 3.2vw, 3.4rem);
  line-height: 1.0; letter-spacing: -.03em;
  margin: 0 0 14px;
}
.title-rule {
  width: 72px; height: 6px; border: none; margin: 0 0 40px;
  background: var(--raspberry); border-radius: 6px;
}

/* body typography */
.prose p { margin: 0 0 1.3em; }
.prose > p:first-of-type,
.prose .lead {
  font-size: 1.22rem; line-height: 1.55; color: #2c3033;
}
.prose .big  { font-weight: 700; font-size: 1.4rem; line-height: 1.3; letter-spacing: -.01em; }
.prose .big2 { font-weight: 700; font-size: 1.18rem; }

/* headings — the signature: bold Helvetica in cyan blocks (from the original) */
.prose h1, .prose h2 {
  font-weight: 700; font-size: 1.42rem; line-height: 1.22; letter-spacing: -.01em;
  color: #fff; background: var(--cyan);
  padding: .5em .68em; border-radius: 6px;
  margin: 2.5em 0 .9em;
  scroll-margin-top: var(--anchor-pad);
}
.prose h3 {
  font-weight: 700; font-size: 1.18rem; line-height: 1.28; color: var(--teal);
  border-left: 6px solid var(--cyan); padding: .05em 0 .05em .6em;
  margin: 2em 0 .55em;
  scroll-margin-top: var(--anchor-pad);
}
.prose h4 {
  font-weight: 700; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cyan-deep); margin: 1.9em 0 .45em;
  scroll-margin-top: var(--anchor-pad);
}

.prose a {
  color: var(--teal); text-decoration: underline;
  text-decoration-color: var(--cyan);
  text-decoration-thickness: 2px; text-underline-offset: 2px;
}
.prose a:hover { color: var(--raspberry); text-decoration-color: var(--raspberry); }

.prose ul, .prose ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.prose li { margin: .32em 0; }
.prose li::marker { color: var(--cyan-deep); }
.prose strong { font-weight: 700; color: var(--ink); }

.prose blockquote {
  margin: 1.6em 0; padding: .8em 1em;
  border-left: 5px solid var(--cyan);
  background: var(--cyan-pale); border-radius: 0 6px 6px 0;
  color: #23383d;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* images — clean, ink-framed, cyan-tinted shadow */
.prose figure { margin: 2em 0; text-align: center; }
.prose img, .prose figure img {
  max-width: 100%; height: auto; border-radius: 6px;
  background: #fff; border: 1.5px solid var(--ink);
  box-shadow: 5px 6px 0 rgba(2,155,191,.12);
}
.prose figcaption, .prose .wp-caption-text {
  font-size: .82rem; color: var(--muted); margin-top: .7em; line-height: 1.4;
}
.prose .wp-caption { max-width: 100% !important; margin: 2em auto; }
.prose img.alignleft, .prose img.alignright, .prose img.aligncenter {
  float: none; display: block; margin: 2em auto;
}
.prose a:has(> img) { text-decoration: none; }

/* prev / next */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line);
}
.pager a {
  display: block; text-decoration: none; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; padding: 16px 18px;
  transition: border-color .13s ease, background .13s ease;
}
.pager a:hover { border-color: var(--cyan); background: var(--cyan-pale); }
.pager a.next { text-align: right; }
.pager .dir { font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pager .tt { font-weight: 700; font-size: 1.05rem; margin-top: 4px; letter-spacing: -.01em; }
.pager .empty { visibility: hidden; }

/* ============================ landing page ============================= */
.hero {
  max-width: 960px; margin: 0 auto; padding: 80px 44px 40px;
  display: grid; grid-template-columns: 1fr 260px; gap: 48px; align-items: center;
}
.hero-cover { text-align: center; }
.hero-cover img { width: 100%; max-width: 240px; filter: drop-shadow(4px 8px 0 rgba(2,155,191,.14)); }
.hero h1 {
  font-weight: 700; font-size: clamp(2.8rem, 1.6rem + 4.4vw, 4.4rem);
  line-height: .95; letter-spacing: -.04em; margin: 0 0 10px;
}
.hero .kicker {
  font-size: .74rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--cyan-deep); margin: 0 0 16px;
}
.hero .byline { font-size: .95rem; font-weight: 500; color: var(--muted); margin-top: 6px; }
.hero .blurb { font-size: 1.2rem; line-height: 1.55; margin: 18px 0 0; max-width: 46ch; }

.toc-grid { max-width: 960px; margin: 12px auto 0; padding: 24px 44px 110px; }
.toc-grid h2 {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin: 0 0 20px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.chap-card {
  text-decoration: none; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 22px 20px; background: #fff;
  transition: transform .13s ease, border-color .13s ease, box-shadow .13s ease;
}
.chap-card:hover {
  border-color: var(--cyan); transform: translateY(-2px);
  box-shadow: 5px 7px 0 rgba(35,211,252,.18);
}
.chap-card .cnum { font-weight: 700; font-size: 1.9rem; color: var(--cyan-deep); line-height: 1; letter-spacing: -.02em; }
.chap-card .ctitle { font-weight: 700; font-size: 1.18rem; margin-top: 10px; line-height: 1.14; letter-spacing: -.01em; }

/* ============================== topbar (mobile) ======================== */
.topbar {
  display: none; position: sticky; top: 0; z-index: 50;
  align-items: center; gap: 12px; padding: 10px 16px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar img { width: 30px; height: 30px; }
.topbar b { font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; }
.menu-btn {
  margin-left: auto; font-family: var(--sans);
  font-size: .8rem; font-weight: 700; color: #fff;
  background: var(--cyan-deep); border: none; border-radius: 999px;
  padding: 8px 16px; cursor: pointer;
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(17,19,21,.34); z-index: 55; }

/* ============================ responsive =============================== */
@media (max-width: 960px) {
  body { font-size: 1.02rem; }
  .shell { grid-template-columns: 1fr; }
  .topbar { display: flex; }
  .scrim.open { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: min(86vw, 340px); z-index: 56;
    transform: translateX(-102%); transition: transform .24s ease;
    box-shadow: 8px 0 30px rgba(0,0,0,.12);
  }
  .sidebar.open { transform: translateX(0); }
  .reading { padding: 40px 22px 90px; }
  .hero { grid-template-columns: 1fr; padding: 44px 22px 20px; text-align: center; }
  .hero-cover { order: -1; }
  .hero-cover img { max-width: 170px; }
  .hero .blurb { margin-left: auto; margin-right: auto; }
  .toc-grid { padding: 8px 22px 80px; }
  .pager { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

a:focus-visible, button:focus-visible {
  outline: 3px solid var(--cyan-deep); outline-offset: 2px; border-radius: 4px;
}
