/* ============================================================
   pdverse — Detailed Design Analysis / Mentor Guide
   Screen stylesheet. No external fonts, no scripts, no network.
   ============================================================ */

:root {
  /* Colour system */
  --navy: #121f2b;
  --body-ink: #2c3e50;
  --teal: #007a78;
  --orange: #c85a17;
  --panel: #f7f9fa;
  --panel-strong: #e8eef2;
  --border: #c5d0d6;
  --white: #ffffff;
  --grey-ref: #8a97a0;

  /* Type */
  --font-ui: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Screen scale (readable browser sizes; hierarchy preserved from print system) */
  --step-eyebrow: 0.875rem;
  --step-body: 1.05rem;
  --step-lead: 1.2rem;
  --step-h2: 1.5rem;
  --step-h1: 2.15rem;
  --step-cover-title: 2.6rem;
  --step-small: 0.875rem;
  --step-code: 0.92rem;

  --content-max: 46rem;
  --wide-max: 64rem;
  --radius: 6px;
}

* { box-sizing: border-box; }





a { color: var(--teal); text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--navy);
  color: var(--white);
  padding: 0.6em 1em;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------- Masthead / running header on screen ---------- */
.masthead {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: var(--step-small);
  color: var(--navy);
  font-weight: 700;
}
.masthead .book-title { color: var(--teal); font-weight: 700; }

/* ---------- Cover ---------- */
.cover {
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
}
.cover .eyebrow {
  color: var(--teal);
  font-size: var(--step-eyebrow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 0 0 1.5rem;
}
.cover h1 {
  font-size: var(--step-cover-title);
  color: var(--navy);
  line-height: 1.15;
  margin: 0 0 1rem;
  max-width: 26ch;
}
.cover .cover-sub {
  color: var(--body-ink);
  font-size: var(--step-lead);
  max-width: 46ch;
  margin: 0 0 2rem;
}
.cover .cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: var(--step-small);
  color: var(--grey-ref);
}
.cover .cover-meta span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25em 0.9em;
}
.cover-grid {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.cover-text { flex: 1 1 260px; min-width: 200px; }
.cover-art { flex: 0 1 220px; max-width: 220px; margin: 0 auto; }
.cover-art img { width: 100%; height: auto; display: block; }
@media screen and (min-width: 560px) {
  .cover-grid { gap: 2.5rem; }
  .cover-text { flex-basis: 320px; min-width: 280px; }
  .cover-art { flex-basis: 300px; max-width: 300px; }
}

/* ---------- Layout shell ---------- */
main { display: block; }
article.chapter { padding-bottom: 4rem; }

.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.wrap-wide {
  max-width: var(--wide-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

section {
  padding: 2.25rem 0;
  border-top: 1px solid var(--border);
}
section:first-of-type { border-top: none; }
section > .wrap, section > .wrap-wide { }

/* ---------- Headings ---------- */
h1, h2, h3, h4 { color: var(--navy); font-weight: 700; line-height: 1.25; }
h1 { font-size: var(--step-h1); margin: 0 0 0.75rem; }
h2 {
  font-size: var(--step-h2);
  margin: 0 0 1.1rem;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(90deg, var(--panel-strong) 0%, rgba(232, 238, 242, 0) 100%);
  border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
}
h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.6rem;
  padding: 0.3rem 0 0.3rem 0.7rem;
  background: linear-gradient(90deg, rgba(18, 31, 43, 0.05) 0%, rgba(18, 31, 43, 0) 85%);
  border-left: 3px solid var(--navy);
}
h4 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }

.kicker {
  display: block;
  color: var(--teal);
  font-size: var(--step-eyebrow);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.lead { font-size: var(--step-lead); color: var(--navy); }

p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.4rem; }
li { margin-bottom: 0.4rem; }

/* ---------- Contents / nav ---------- */
nav.contents {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
nav.contents ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 1;
  gap: 0.5rem 2rem;
}
@media (min-width: 640px) {
  nav.contents ol { columns: 2; }
}
nav.contents li { break-inside: avoid; margin-bottom: 0.5rem; }
nav.contents a {
  display: flex;
  gap: 0.6em;
  text-decoration: none;
  color: var(--body-ink);
}
nav.contents .num { color: var(--teal); font-weight: 700; font-variant-numeric: tabular-nums; }
nav.contents a:hover .title { text-decoration: underline; }

/* ---------- Sidebars ---------- */
.sidebar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--white);
}
.sidebar .sidebar-label {
  display: inline-block;
  font-size: var(--step-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.sidebar > :last-child { margin-bottom: 0; }

.sidebar-why { border-left: 4px solid var(--teal); }
.sidebar-why .sidebar-label { color: var(--teal); }

.sidebar-whatif { border-left: 4px solid var(--grey-ref); background: var(--panel); }
.sidebar-whatif .sidebar-label { color: var(--teal); }

.sidebar-practice { border-left: 4px solid var(--navy); }
.sidebar-practice .sidebar-label { color: var(--navy); }

.sidebar-trap { border-left: 4px solid var(--orange); background: #fdf4ee; }
.sidebar-trap .sidebar-label { color: var(--orange); }

.sidebar-takeaway { border-left: 4px solid var(--teal); background: #eef8f7; }
.sidebar-takeaway .sidebar-label { color: var(--teal); }

.sidebar-aside { border-left: 4px solid var(--navy); background: var(--panel); }
.sidebar-aside .sidebar-label { color: var(--navy); }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; margin: 1.25rem 0; }
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}
caption {
  text-align: left;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}
thead th {
  background: var(--navy);
  color: var(--white);
  text-align: left;
  padding: 0.55em 0.8em;
  font-weight: 700;
  position: sticky;
  top: 0;
}
tbody th { text-align: left; background: var(--panel-strong); }
td, tbody th { padding: 0.55em 0.8em; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) { background: var(--panel); }

/* ---------- Code ---------- */
code {
  font-family: var(--font-mono);
  /* 0.875em scales with the surrounding text, but inside a small-text
     context (e.g. 0.875rem labels/captions at 14px) that multiplies down
     to 12.25px, under the 14px screen floor. max() keeps inline code at
     0.875rem (14px at the default root size) as a hard floor, while still
     growing past it in a larger-than-root context. Screen CSS only --
     print.css sets its own code sizing and is not touched by this rule. */
  font-size: max(0.875em, 0.875rem);
  background: var(--panel-strong);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  overflow-wrap: break-word;
  word-break: break-word;
}
pre {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  font-size: var(--step-code);
  line-height: 1.55;
  margin: 1.1rem 0;
}
pre code { background: none; padding: 0; font-size: 1em; }
.prompt { color: var(--teal); font-weight: 700; }
.tcl-comment { color: var(--teal); font-style: italic; }
.report-label {
  display: inline-block;
  font-size: var(--step-eyebrow);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--grey-ref);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

/* ---------- Figures ---------- */
figure {
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--white);
}
figure.wide { max-width: var(--wide-max); }
.fig-kicker {
  display: block;
  color: var(--teal);
  font-size: var(--step-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
figure svg { display: block; width: 100%; height: auto; }
figcaption { margin-top: 0.75rem; font-size: 0.92rem; }
figcaption .read-it { color: var(--navy); font-weight: 700; }
.fig-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--body-ink);
}
.fig-legend span { display: inline-flex; align-items: center; gap: 0.4em; }
.swatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

/* ---------- Command cards ---------- */
.card-group-label {
  display: block;
  color: var(--teal);
  font-size: var(--step-eyebrow);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin: 2rem 0 1rem;
}
.command-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem 1rem;
  margin: 0.85rem 0;
  break-inside: avoid;
}
.command-card h3 {
  margin: 0 0 0.15rem;
  padding: 0;
  background: none;
  border-left: none;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--navy);
}
.command-card .command-tagline { color: var(--grey-ref); font-size: 0.875rem; margin-bottom: 0.6rem; }
.command-card ol.scaffold {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem 1.1rem;
  min-width: 0;
}
.command-card ol.scaffold > li { padding-left: 0; min-width: 0; font-size: 0.92rem; }
.command-card ol.scaffold > li:nth-child(4) { grid-column: 1 / -1; }
.command-card ol.scaffold > li:nth-child(4) pre { margin: 0.2rem 0 0; }
.command-card .scaffold-label {
  display: block;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.1rem;
}
.command-card .scaffold-trap .scaffold-label { color: var(--orange); }

/* ---------- Advanced placement/legalization control cards ---------- */
.advctrl-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem 1.05rem;
  margin: 1rem 0;
  break-inside: avoid;
}
/* print override for .advctrl-card break-inside lives in print.css (task-1
   fill/orphan fix, correction pass v2) -- see that file's comment for why. */
.advctrl-kicker {
  display: inline-block;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 0.2rem;
}
.advctrl-card h3 { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--navy); }
.advctrl-fields { display: grid; grid-template-columns: minmax(0,1fr); gap: 0; margin: 0; }
.advctrl-fields dt {
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}
.advctrl-fields dt:first-child { margin-top: 0; }
.advctrl-fields dd { margin: 0.15rem 0 0; font-size: 1rem; }
.advctrl-fields dd ul, .advctrl-fields dd ol { margin: 0.15rem 0 0; padding-left: 1.3rem; }
.advctrl-fields dd li { margin: 0.15rem 0; }
.advctrl-fields .table-scroll { margin-top: 0.2rem; }
.advctrl-fields .table-scroll table { font-size: 0.9rem; }
.advctrl-cite { font-style: italic; color: var(--grey-ref); }

/* ---------- Checklists ---------- */
.checklist { list-style: none; margin: 0 0 1rem; padding: 0; }
.checklist li {
  padding: 0.5em 0 0.5em 1.9em;
  position: relative;
  border-bottom: 1px dashed var(--border);
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before {
  content: "\2610";
  position: absolute;
  left: 0;
  color: var(--teal);
  font-size: 1.05em;
}
.checklist .evidence { display: block; color: var(--grey-ref); font-size: 0.875rem; margin-top: 0.2em; }

/* ---------- Q&A ---------- */
.qa {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1.1rem 0;
  break-inside: avoid;
}
.qa-lead {
  color: var(--navy);
  font-weight: 600;
  margin: 0.3rem 0 0.8rem;
  padding-left: 0.7rem;
  border-left: 3px solid var(--teal);
}
.chip {
  display: inline-block;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.chip-beginner { background: #eef8f7; color: var(--teal); }
.chip-intermediate { background: var(--panel-strong); color: var(--navy); }
.chip-scenario { background: #fdf4ee; color: var(--orange); }
.chip-advanced { background: #fdf4ee; color: var(--orange); }
.chip-expert { background: var(--navy); color: var(--white); }
.qa h3 { font-size: 1rem; margin: 0.2rem 0 0.6rem; }
.qa dl { margin: 0; }
.qa dt { font-weight: 700; color: var(--navy); margin-top: 0.6rem; font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.04em; }
.qa dd { margin: 0.2rem 0 0; }
.qa-tier {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 1.6rem 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--teal);
}
.qa-tier:first-of-type { margin-top: 0.6rem; }

/* ---------- Flashcards ---------- */
.flashcards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .flashcards { grid-template-columns: 1fr 1fr; } }
.flashcard { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.flashcard .front { background: var(--navy); color: var(--white); padding: 0.9rem 1.1rem; font-weight: 700; }
.flashcard .back { padding: 0.9rem 1.1rem; }

/* ---------- Glossary ---------- */
.glossary dt { font-weight: 700; color: var(--navy); font-family: var(--font-mono); font-size: 0.95rem; margin-top: 0.9rem; }
.glossary dd { margin: 0.2rem 0 0; }

/* ---------- Sidebar legend table already covered by table styles ---------- */

/* ---------- Sign-off / summary ---------- */
.summary-table td:first-child { font-weight: 700; color: var(--navy); white-space: nowrap; }

/* ---------- Footer ---------- */
.page-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 1.25rem 3rem;
  display: flex;
  align-items: center;
  font-size: var(--step-small);
  color: var(--grey-ref);
}
.page-footer svg { width: 34px; height: 34px; flex-shrink: 0; }
.page-footer a { color: var(--teal); font-weight: 700; }
.page-footer .footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--grey-ref);
  text-decoration: none;
}
.page-footer .footer-link span { color: var(--teal); font-weight: 700; }
.page-footer .footer-link:hover span { text-decoration: underline; }
.page-footer .footer-link img { border-radius: 3px; }

/* ---------- Bridge / nav buttons ---------- */
.bridge {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.bridge .kicker { margin-bottom: 0.4rem; }

/* Utility */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0; padding: 0;
}

/* Website-package-only additions: chapter cross-navigation, not present in the
   shared book stylesheet this file was forked from. */
.chapter-nav {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; justify-content: space-between;
  max-width: 60rem; margin: 0 auto; padding: 0.6rem 1.25rem;
  font-size: 0.875rem; border-bottom: 1px solid var(--border, #c5d0d6);
}
.chapter-nav a { color: var(--teal, #007a78); text-decoration: none; }
.chapter-nav a:hover, .chapter-nav a:focus { text-decoration: underline; }
.chapter-nav em { color: var(--grey-ref, #8a97a0); font-style: italic; }
.chapter-nav-disabled {
  color: var(--grey-ref, #8a97a0);
  cursor: default;
  user-select: none;
}
.chapter-nav-disabled em { color: var(--grey-ref, #8a97a0); }
.back-to-contents { display: block; margin: 0.75rem 0 0; font-size: 0.875rem; }
.back-to-contents a { color: var(--teal, #007a78); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--orange, #c85a17); outline-offset: 2px; }
