/* ==========================================================================
   artisanplaybook.dev
   Design tokens and components. Bootstrap 5 supplies grid + utilities only;
   everything visual below is hand-written to match the source designs.
   ========================================================================== */

:root {
  --bg: #100F0E;
  --surface: #191816;
  --surface2: #211F1C;
  --border: #2C2926;
  --text: #EDEAE4;
  --muted: #AFA89D;
  --muted-strong: #C4BEB3;
  --accent: #DFA640;
  --accent-ink: #100F0E;
  --code-bg: #161513;

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;

  --shell-max: 1180px;
  --shell-pad: 32px;
  --nav-h: 62px;
}

:root[data-theme="light"] {
  --bg: #FAF9F7;
  --surface: #FFFFFF;
  --surface2: #F2EFEA;
  --border: #E4E0D8;
  --text: #171614;
  --muted: #635D52;
  --muted-strong: #524C42;
  --accent: #8F5A05;
  --accent-ink: #FFFFFF;
  --code-bg: #161513;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

body { overflow-x: hidden; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: var(--accent-ink); }

input, button, textarea { font-family: inherit; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Shell -------------------------------------------------------------------- */

.ap-shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding-left: var(--shell-pad);
  padding-right: var(--shell-pad);
  width: 100%;
}

.ap-section { padding-top: 88px; }
.ap-section--tight { padding-top: 56px; }
.ap-section--hero { padding-top: 76px; }

/* Typography --------------------------------------------------------------- */

.ap-kicker {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

.ap-kicker--accent { color: var(--accent); }
.ap-kicker--sm { font-size: 10.5px; letter-spacing: 0.14em; }

.ap-mono {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.ap-muted { color: var(--muted); }
.ap-accent { color: var(--accent); }

.ap-h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.ap-h1--hero { font-size: clamp(34px, 6vw, 56px); line-height: 1.04; letter-spacing: -0.035em; }

.ap-h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 24px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.ap-lede {
  margin: 0;
  font-size: clamp(15px, 2vw, 17px);
  line-height: 1.65;
  color: var(--muted-strong);
  text-wrap: pretty;
}

.ap-lede--lg { font-size: clamp(16px, 2.2vw, 19px); line-height: 1.6; }

/* Section header (title + "ALL 6 →" style link) ---------------------------- */

.ap-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.ap-section-head__link {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--muted-strong);
  white-space: nowrap;
}

.ap-section-head__link:hover { color: var(--accent); }

/* Rule-separated inline stats ---------------------------------------------- */

.ap-statline {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--muted-strong);
}

.ap-statline .ap-sep { color: var(--border); }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.ap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border-radius: 3px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: opacity .15s, border-color .15s, color .15s;
}

.ap-btn--primary { background: var(--accent); color: var(--accent-ink); }
.ap-btn--primary:hover { opacity: .88; color: var(--accent-ink); }

.ap-btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}
.ap-btn--ghost:hover { border-color: var(--accent); color: var(--text); }

.ap-btn--surface {
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text);
  height: 42px;
  font-size: 14px;
}
.ap-btn--surface:hover { border-color: var(--accent); color: var(--text); }

.ap-btn--block { width: 100%; }
.ap-btn--lg { height: 48px; font-size: 15px; }
.ap-btn--sm { height: 40px; font-size: 13.5px; }

/* Filter chips -------------------------------------------------------------- */

.ap-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.ap-chip {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 13px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, color .15s;
}

.ap-chip:hover { border-color: var(--accent); color: var(--text); }

.ap-chip--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.ap-chip--on:hover { color: var(--accent-ink); }

/* Tag pills ----------------------------------------------------------------- */

.ap-tags { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

.ap-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.ap-tag:hover { border-color: var(--accent); color: var(--accent); }

/* Inputs -------------------------------------------------------------------- */

.ap-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
}

.ap-input::placeholder { color: var(--muted); }
.ap-input:focus { border-color: var(--accent); }

.ap-input--surface { background: var(--surface); }

/* Honeypot: moved off-screen rather than display:none or hidden, both of which
   many bots detect and skip. Readers never reach it — it is aria-hidden and
   tabindex="-1" in the markup. */
.ap-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Search field with the leading "/" affordance ------------------------------ */

.ap-search { position: relative; width: 320px; max-width: 100%; }
.ap-search .ap-input { height: 44px; padding-left: 38px; font-size: 14px; }

.ap-search__slash {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.ap-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.ap-nav__bar {
  display: flex;
  align-items: center;
  gap: 36px;
  min-height: var(--nav-h);
}

.ap-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  letter-spacing: -0.02em;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}

.ap-wordmark:hover { color: var(--text); }
.ap-wordmark__tld { font-family: var(--mono); font-size: 14px; color: var(--accent); }

.ap-nav__links {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-right: auto;
}

.ap-nav__link {
  font-size: 14px;
  font-weight: 500;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  color: var(--muted-strong);
  transition: color .15s;
  white-space: nowrap;
}

.ap-nav__link:hover { color: var(--text); }
.ap-nav__link--on { color: var(--text); border-bottom-color: var(--accent); }

.ap-nav__tools { display: flex; align-items: center; gap: 10px; }

.ap-nav__search .ap-input {
  width: 140px;
  height: 32px;
  padding: 0 10px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12.5px;
}

.ap-theme-toggle {
  height: 32px;
  padding: 0 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.ap-theme-toggle:hover { color: var(--text); border-color: var(--accent); }

.ap-nav__library {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.ap-nav__library:hover { opacity: .85; color: var(--text); }

.ap-nav__library--on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.ap-nav__library--on:hover { color: var(--accent-ink); }

/* The panel is layout-transparent on desktop so the bar stays one flex row;
   under lg it becomes a real collapsible block. */
.ap-nav__panel { display: contents; }

.ap-nav__compact { display: none; }

.ap-nav__toggle {
  height: 34px;
  width: 38px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
}

.ap-nav__toggle:hover { border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.ap-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  height: 100%;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color .15s, transform .15s;
}

.ap-card:hover { border-color: var(--accent); transform: translateY(-2px); color: var(--text); }

.ap-card__meta {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.ap-card__title {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.ap-card__excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted-strong);
  text-wrap: pretty;
}

.ap-card__date {
  margin-top: auto;
  padding-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

/* News item ----------------------------------------------------------------- */

.ap-news {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  transition: border-color .15s;
}

.ap-news:hover { border-color: var(--accent); color: var(--text); }

.ap-news__meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.ap-news__time { color: var(--muted); margin-left: auto; }

.ap-news__title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.ap-news__excerpt {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted-strong);
  text-wrap: pretty;
}

.ap-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.ap-dot--round { border-radius: 99px; width: 7px; height: 7px; }

/* --------------------------------------------------------------------------
   Ebook cover + card
   -------------------------------------------------------------------------- */

.ap-ebook {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  transition: transform .18s;
}

.ap-ebook:hover { transform: translateY(-3px); color: var(--text); }

.ap-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: #26221E;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ap-cover__kicker {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: #DFA640;
}

.ap-cover__rule { width: 26px; height: 1px; background: #DFA640; opacity: .6; }

.ap-cover__title {
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: #F2EFE9;
  text-wrap: balance;
}

.ap-cover__foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: rgba(242, 239, 233, .45);
}

.ap-cover__price {
  position: absolute;
  top: 0;
  right: 0;
  padding: 7px 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  border-bottom-left-radius: 4px;
}

.ap-ebook__title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.ap-ebook__pitch {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted-strong);
  text-wrap: pretty;
}

/* Cover in the "4/3 featured" and large sidebar variants -------------------- */

.ap-cover--wide { aspect-ratio: 4 / 3; padding: 24px; }
.ap-cover--wide .ap-cover__title { font-size: clamp(22px, 3vw, 29px); line-height: 1.1; letter-spacing: -0.03em; }
.ap-cover--wide .ap-cover__price { padding: 8px 12px; font-size: 13px; }

.ap-cover--lg { padding: 26px; border-radius: 5px; }
.ap-cover--lg .ap-cover__title { font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.03em; }

.ap-cover--mini { aspect-ratio: 3 / 4; padding: 12px; border-radius: 3px; }
.ap-cover--mini .ap-cover__kicker { font-size: 6.5px; letter-spacing: 0.16em; }
.ap-cover--mini .ap-cover__title { font-size: 13px; letter-spacing: -0.02em; }

/* --------------------------------------------------------------------------
   Panels
   -------------------------------------------------------------------------- */

.ap-panel {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  padding: 22px;
}

.ap-panel--flat { background: var(--surface2); }
.ap-panel--accent { border-color: var(--accent); }
.ap-panel--pad { padding: clamp(24px, 4vw, 44px); }
.ap-panel--bare { padding: 0; overflow: hidden; }

.ap-divider { height: 1px; background: var(--border); }

/* Sticky sidebars ----------------------------------------------------------- */

.ap-sticky { position: sticky; top: calc(var(--nav-h) + 28px); }

/* --------------------------------------------------------------------------
   Prose (article body, ebook description, about copy)
   -------------------------------------------------------------------------- */

.ap-prose {
  font-size: clamp(15.5px, 2vw, 17px);
  line-height: 1.75;
  color: var(--text);
}

.ap-prose p { text-wrap: pretty; }

.ap-prose h2 {
  margin: 44px 0 14px;
  font-size: clamp(21px, 3vw, 26px);
  font-weight: 600;
  letter-spacing: -0.025em;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

.ap-prose h3 {
  margin: 32px 0 10px;
  font-size: clamp(17px, 2.2vw, 19px);
  font-weight: 600;
  letter-spacing: -0.015em;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}

.ap-prose ul,
.ap-prose ol { padding-left: 22px; color: var(--muted); }
.ap-prose li { margin-bottom: 9px; }
.ap-prose li strong { color: var(--text); font-weight: 400; }

/* Fenced code blocks from Markdown. The inner `code` must drop the inline
   pill styling above, or every block gets a border inside a border. */
.ap-prose pre {
  margin: 22px 0;
  padding: 16px 18px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
}

.ap-prose pre code {
  padding: 0;
  background: none;
  border: 0;
  font-size: .85em;
  line-height: 1.6;
  overflow-wrap: normal;
}

.ap-prose blockquote {
  margin: 22px 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.ap-prose blockquote p:last-child { margin-bottom: 0; }

.ap-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.ap-prose hr {
  margin: 34px 0;
  border: 0;
  border-top: 1px solid var(--border);
  opacity: 1;
}

/* Wide tables scroll inside their own wrapper rather than the page. */
.ap-prose .ap-table-scroll,
.ap-prose table { display: block; max-width: 100%; overflow-x: auto; }

.ap-prose table {
  margin: 22px 0;
  border-collapse: collapse;
  font-size: .93em;
}

.ap-prose th,
.ap-prose td {
  padding: 8px 14px 8px 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ap-prose th { font-weight: 600; }
.ap-prose td { color: var(--muted); }

/* Hero image above an article body. */
.ap-figure { margin: 0; }

.ap-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.ap-prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.ap-prose code {
  font-family: var(--mono);
  font-size: .87em;
  color: inherit; /* Bootstrap defaults `code` to pink. */
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

/* Promo box inside prose ---------------------------------------------------- */

.ap-promo {
  margin: 26px 0;
  padding: 20px 22px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ap-promo p { margin: 0; font-size: 15.5px; line-height: 1.6; }

/* --------------------------------------------------------------------------
   Code blocks
   -------------------------------------------------------------------------- */

.ap-code {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--code-bg);
}

.ap-code__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .02);
  flex-wrap: wrap;
}

.ap-code__lang {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: #DFA640;
}

.ap-code__file {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: #9A9488;
  overflow-wrap: anywhere;
}

.ap-code__copy {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #9A9488;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 4px 2px;
}

.ap-code__copy:hover { color: #EDEAE4; }

.ap-code__body {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.75;
  color: #DAD5CB;
  tab-size: 4;
}

.tok-comment { color: #6B655C; }
.tok-key     { color: #7FB6D9; }
.tok-flag    { color: #DFA640; }
.tok-val     { color: #A9C77E; }
.tok-kw      { color: #C99AE0; }
.tok-fn      { color: #DFA640; }
.tok-type    { color: #7FB6D9; }
.tok-var     { color: #E08C7A; }

/* --------------------------------------------------------------------------
   Article page furniture
   -------------------------------------------------------------------------- */

.ap-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.ap-breadcrumb a { color: var(--muted); }
.ap-breadcrumb a:hover { color: var(--accent); }
.ap-breadcrumb .ap-sep { color: var(--border); }

.ap-byline {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 0;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted-strong);
}

.ap-byline .ap-sep { color: var(--border); }

.ap-copy-link {
  margin-left: auto;
  height: 32px;
  padding: 0 11px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.ap-copy-link:hover { color: var(--text); border-color: var(--accent); }

/* Table of contents --------------------------------------------------------- */

.ap-toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--border);
}

.ap-toc__link {
  font-size: 13px;
  line-height: 1.4;
  padding: 7px 0 7px 14px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  color: var(--muted-strong);
}

.ap-toc__link:hover { color: var(--text); }
.ap-toc__link.is-active { color: var(--text); border-left-color: var(--accent); }

.ap-toc-disclosure { display: none; }
.ap-toc-disclosure > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.ap-toc-disclosure > summary::-webkit-details-marker { display: none; }
.ap-toc-disclosure > summary::after { content: ' ▾'; }
.ap-toc-disclosure[open] > summary::after { content: ' ▴'; }

/* --------------------------------------------------------------------------
   Ebook detail
   -------------------------------------------------------------------------- */

.ap-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.ap-specs__cell {
  background: var(--surface);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ap-specs__label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.ap-specs__value { font-size: 15px; font-weight: 600; }

.ap-toc-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 22px;
  border-bottom: 1px solid var(--border);
}

.ap-toc-row__num { font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--accent); }
.ap-toc-row__title { font-size: 15px; line-height: 1.4; }
.ap-toc-row__pages { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--muted); white-space: nowrap; }

.ap-price {
  font-family: var(--mono);
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.ap-price--was {
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  text-decoration: line-through;
}

.ap-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.ap-badge--quiet {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 500;
}

.ap-include {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
}

.ap-include__tick { color: var(--accent); font-family: var(--mono); font-size: 12px; }

/* --------------------------------------------------------------------------
   News sources sidebar
   -------------------------------------------------------------------------- */

.ap-sources {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}

.ap-source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
  color: var(--muted-strong);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.ap-source:last-child { border-bottom: none; }
.ap-source:hover { color: var(--text); }

.ap-source--on {
  background: var(--surface2);
  border-left-color: var(--accent);
  color: var(--text);
}

.ap-source__name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ap-source__count { color: var(--muted); }

.ap-daygroup {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
  padding-top: 8px;
}

/* --------------------------------------------------------------------------
   Library
   -------------------------------------------------------------------------- */

.ap-library-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  gap: 26px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
}

.ap-library-row__actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 184px;
}

.ap-library-row__title { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }

.ap-ghost-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}

.ap-ghost-link:hover { border-color: var(--accent); color: var(--text); }

/* --------------------------------------------------------------------------
   About facts table
   -------------------------------------------------------------------------- */

.ap-facts {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  overflow: hidden;
}

.ap-fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.ap-fact:last-child { border-bottom: none; }
.ap-fact__label { font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; color: var(--muted); }
.ap-fact__value { font-size: 14.5px; font-weight: 600; text-align: right; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.ap-footer {
  border-top: 1px solid var(--border);
  margin-top: 96px;
  background: var(--bg);
}

.ap-footer__cols {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-top: 52px;
  padding-bottom: 40px;
}

.ap-footer__col { display: flex; flex-direction: column; gap: 12px; }

.ap-footer__col a {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--muted-strong);
  transition: color .15s;
}

.ap-footer__col a:hover { color: var(--text); }

.ap-footer .ap-kicker--sm {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted-strong);
}

.ap-footer__blurb {
  margin: 0;
  max-width: 290px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted-strong);
  text-wrap: pretty;
}

.ap-footer__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 22px;
  padding-bottom: 34px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted-strong);
}

.ap-footer__credit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ap-footer__credit .bi-heart-fill {
  color: #e25555;
  font-size: 11px;
}

.ap-footer__credit a {
  color: var(--muted-strong);
  font-weight: 600;
  text-decoration: none;
}

.ap-footer__credit a:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */

.ap-flash {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Responsive
   The source designs carry no media queries; every rule below is ours.
   -------------------------------------------------------------------------- */

@media (max-width: 991.98px) {
  :root { --shell-pad: 20px; }

  /* A row's negative gutter margins must never exceed the shell padding, or
     the page overflows sideways. Cap them here so a `g-5` on any row is safe. */
  .ap-shell .row { --bs-gutter-x: 1.5rem; }

  .ap-section { padding-top: 56px; }
  .ap-section--hero { padding-top: 40px; }
  .ap-section--tight { padding-top: 36px; }

  /* Nav collapses behind a toggle. */
  .ap-nav__bar { flex-wrap: wrap; gap: 12px; padding-top: 12px; padding-bottom: 12px; }

  .ap-nav__compact { display: flex; align-items: center; gap: 10px; margin-left: auto; }
  .ap-nav__toggle { display: inline-flex; }

  .ap-nav__panel {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 16px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .ap-nav__panel.is-open { display: flex; }

  /* The bar already carries a toggle at this width. */
  .ap-nav__panel .ap-theme-toggle { display: none; }

  .ap-nav__links {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-right: 0;
  }

  .ap-nav__link {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    border-left: 2px solid transparent;
    padding-left: 10px;
  }

  .ap-nav__link--on { border-bottom-color: var(--border); border-left-color: var(--accent); }

  .ap-nav__tools { flex-direction: column; align-items: stretch; gap: 12px; }
  .ap-nav__search .ap-input { width: 100%; height: 42px; font-size: 14px; }
  .ap-nav__library { height: 42px; justify-content: center; }

  /* Sidebars stop sticking and stack. */
  .ap-sticky { position: static; }

  /* Article TOC becomes a disclosure. */
  .ap-toc-disclosure { display: block; }
  .ap-toc-aside { display: none; }

  .ap-specs { grid-template-columns: repeat(2, 1fr); }

  .ap-footer { margin-top: 64px; }
  .ap-footer__cols { grid-template-columns: 1fr 1fr; gap: 28px; padding-top: 40px; }
}

@media (max-width: 767.98px) {
  .ap-library-row {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .ap-library-row__actions {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }

  .ap-toc-row { grid-template-columns: 32px minmax(0, 1fr); row-gap: 4px; padding: 13px 18px; }
  .ap-toc-row__pages { grid-column: 2; }

  .ap-search { width: 100%; }

  .ap-byline { gap: 10px; }
  .ap-copy-link { margin-left: 0; }

  .ap-panel--pad { padding: 24px; }
  .ap-code__body { font-size: 12.5px; padding: 14px; }
}

@media (max-width: 575.98px) {
  :root { --shell-pad: 16px; }

  .ap-shell .row { --bs-gutter-x: 1rem; }

  .ap-statline { gap: 12px; }
  .ap-statline .ap-sep { display: none; }

  .ap-footer__cols { grid-template-columns: 1fr; }
  .ap-footer__bar { flex-direction: column; align-items: center; text-align: center; }

  .ap-btn { width: 100%; }
  .ap-btn--auto { width: auto; }

  .ap-library-row { grid-template-columns: 1fr; }
  .ap-library-row .ap-cover--mini { max-width: 104px; }
}
