/* ------------------------------------------------------------------
   Building with Law — buildingwithlaw.com
   Design extends the jacket: an architect's drawing sheet.
   One ink, two papers — cyanotype blueprint (dark) and whiteprint (light).
   ------------------------------------------------------------------ */

/* Dark-first: the bare :root carries the blueprint palette, matching the
   jacket. Light overrides follow, guarded so an explicit choice always wins. */
:root {
  --bg:        #0d2338;
  --panel:     #14304d;
  --rule:      #2c4f73;
  --rule-soft: #1b3a5a;
  --mono:      #9cc0e0;
  --body:      #d7e6f4;
  --head:      #eaf2fa;
  --grid:      rgba(156, 192, 224, 0.07);
  --shadow:    rgba(0, 0, 0, 0.35);

  --measure: 64ch;
  --sheet:   72rem;
  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(0.94rem, 0.91rem + 0.14vw, 1.02rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.45rem);
  --step-2:  clamp(1.5rem, 1.34rem + 0.8vw, 2rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.4rem);
  --step-4:  clamp(2.6rem, 1.8rem + 4vw, 5.2rem);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:        #f2f7fb;
    --panel:     #e6eff7;
    --rule:      #a8c3da;
    --rule-soft: #cadcea;
    --mono:      #4a6f94;
    --body:      #274a6b;
    --head:      #0d2338;
    --grid:      rgba(13, 35, 56, 0.06);
    --shadow:    rgba(13, 35, 56, 0.12);
  }
}

:root[data-theme="light"] {
  --bg:        #f2f7fb;
  --panel:     #e6eff7;
  --rule:      #a8c3da;
  --rule-soft: #cadcea;
  --mono:      #4a6f94;
  --body:      #274a6b;
  --head:      #0d2338;
  --grid:      rgba(13, 35, 56, 0.06);
  --shadow:    rgba(13, 35, 56, 0.12);
}

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

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  color: var(--body);
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-size: var(--step-0);
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
}

/* The sheet border — a drawing is always trimmed inside a frame. */
.frame {
  border: 1px solid var(--rule);
  outline: 1px solid var(--rule);
  outline-offset: 6px;
  margin: clamp(0.9rem, 2.5vw, 2rem);
  padding: clamp(1.4rem, 4vw, 4rem) clamp(1.1rem, 4vw, 3.5rem);
}

.wrap { max-width: var(--sheet); margin-inline: auto; }
.measure { max-width: var(--measure); }

h1, h2, h3 {
  color: var(--head);
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0; }
a { color: var(--head); text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--mono); outline-offset: 3px; }

/* Mono labels — the annotation layer of the drawing. */
.label {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mono);
}

.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- shared masthead: identical on every page ---------- */
.topbar {
  display: flex; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; padding-bottom: clamp(1.4rem, 4vw, 2.6rem);
}
.masthead { padding-bottom: clamp(2rem, 5vw, 3.2rem); }
.mast-title {
  flex: 0 1 auto;
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-weight: 700; line-height: 1.05; letter-spacing: -0.02em;
  font-size: clamp(1.9rem, 1.05rem + 2.7vw, 3.2rem);
  color: var(--head); margin: 0.2rem 0 0; text-wrap: nowrap;
}
.mast-title a { color: inherit; text-decoration: none; }
.mast-title a:hover { text-decoration: underline; text-decoration-color: var(--rule); }
.mast-sub { font-size: var(--step-1); color: var(--body); margin-top: 0.25rem; }
.page-title {
  font-size: var(--step-2);
  margin-top: clamp(1.2rem, 3vw, 2rem);
  margin-bottom: 1.1rem;
  padding-top: 1.1rem; border-top: 1px solid var(--rule);
}

/* ---------- hero ---------- */
.hero {
  display: grid; gap: clamp(2rem, 5vw, 4.5rem);
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr);
  align-items: start;
}
@media (max-width: 56rem) {
  .hero { grid-template-columns: 1fr; }
  .hero__cover { max-width: 19rem; order: -1; }
}
.hero__text { display: flex; flex-direction: column; gap: 1.1rem; max-width: 40rem; }
.hero__cover {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule);
  box-shadow: 0 1.5rem 3.5rem -1.8rem var(--shadow);
}

.standfirst { font-size: var(--step-0); color: var(--body); }
.byline { color: var(--mono); }
.byline strong { color: var(--head); font-weight: 600; }

.pull {
  margin: 0.4rem 0; padding-left: 1.3rem;
  border-left: 1px solid var(--rule);
  font-size: var(--step-1); line-height: 1.4; color: var(--head);
}

/* ---------- contents ---------- */
#contents { padding-top: clamp(3rem, 8vw, 5.5rem); }
#contents > h2 { margin-bottom: 1.4rem; font-weight: 400; }
.toc {
  display: grid; gap: clamp(1.4rem, 3vw, 2.6rem);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  border-top: 1px solid var(--rule); padding-top: 1.6rem;
}
.toc h3 {
  font-size: var(--step-0); font-weight: 600;
  padding-bottom: 0.6rem; margin-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule-soft);
}
.toc ol {
  margin: 0; padding-left: 1.5rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  font-size: var(--step--1); line-height: 1.45;
}
.toc li::marker {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  color: var(--mono); font-size: 0.8em;
}

/* ---------- footer ---------- */
.foot {
  margin-top: clamp(3rem, 8vw, 5rem); padding-top: 1.3rem;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 1.2rem; flex-wrap: wrap;
}
.foot p { max-width: 42rem; }

/* ---------- instructor sheet ---------- */
.stack { display: flex; flex-direction: column; gap: 0.8rem; }
.filelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.filelist li {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.85rem 0; border-top: 1px solid var(--rule-soft);
}
.filelist li:first-child { border-top: 0; }
.filelist .meta {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: var(--step--1); color: var(--mono);
}

/* ---------- prose page ---------- */
.prose {
  display: flex; flex-direction: column; gap: 1.1rem;
  max-width: 42rem; margin-top: 1.6rem;
}

/* ---------- reading page ---------- */
.reading { max-width: 38rem; }
.reading > .page-title { margin-bottom: 1.8rem; }
.reading h3 {
  font-size: var(--step-1); margin: 2.6rem 0 0.9rem;
  padding-top: 1.1rem; border-top: 1px solid var(--rule-soft);
}
.reading p { margin: 0 0 1.05rem; }
.reading blockquote {
  margin: 1.4rem 0; padding-left: 1.3rem;
  border-left: 1px solid var(--rule); color: var(--head);
}
.reading ul, .reading ol { margin: 0 0 1.05rem; padding-left: 1.4rem; }
.reading li { margin-bottom: 0.35rem; }
.reading hr { border: 0; border-top: 1px solid var(--rule-soft); margin: 2rem 0; }
.reading strong { color: var(--head); }

.mast-note { margin-top: 0.8rem; }

/* masthead: title and nav share a baseline */
.mast-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 0.6rem 2rem; flex-wrap: wrap;
}
@media (min-width: 62rem) { .mast-row { flex-wrap: nowrap; } }
.mast-nav {
  display: flex; gap: 1.15rem; flex-wrap: wrap;
  letter-spacing: 0.1em; white-space: nowrap;
}
.about-head { font-size: var(--step-1); margin-bottom: 0.2rem; }

/* about page */
.lede { font-size: var(--step-1); line-height: 1.45; color: var(--head); }
.credentials { margin-top: 0.6rem; }

/* contents page */
.toc--plain { border-top: 0; padding-top: 0; }
.toc-end a { color: var(--head); }
.toc-end { margin-bottom: 1.1rem; }          /* space below "Introduction" */
.toc-end--after { margin: 1.1rem 0 0; }      /* Coda, under the last column */

/* praise */
.praise { padding-top: clamp(3rem, 7vw, 4.5rem); }
.praise__grid {
  display: grid; gap: clamp(1.2rem, 3vw, 2.2rem); margin-top: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}
.praise blockquote {
  margin: 0; padding-left: 1.2rem; border-left: 1px solid var(--rule);
  display: flex; flex-direction: column; gap: 0.7rem;
}
.praise blockquote p { color: var(--head); }
.praise cite { font-style: normal; }
