@layer reset, base, layout, components, print;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
  img, svg { display: block; max-width: 100%; }
  button { font: inherit; cursor: pointer; }
}

@layer base {
  :root {
    color-scheme: light;
    --paper: #f5f2e9;
    --paper-light: #fcfaf4;
    --paper-tint: #e9eddf;
    --ink: #17241f;
    --forest: #233d2c;
    --muted: #566158;
    --line: #c9cfc1;
    --line-strong: #9fa896;
    --lime: #d3ef91;
    --lime-soft: #e6f4c2;
    --cobalt: #314bc0;
    --cobalt-soft: #e6eaf8;
    --warn-soft: #f5ead8;
    --serif: Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  }

  html { scroll-padding-top: 88px; }
  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    text-rendering: optimizeLegibility;
  }
  a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
  :focus-visible { outline: 3px solid var(--cobalt); outline-offset: 4px; }
  ::selection { background: var(--lime); color: var(--ink); }
  h1, h2, h3, h4 { font-weight: 400; line-height: 1.12; color: var(--ink); }
  h1, h2, .serif { font-family: var(--serif); letter-spacing: -0.04em; }
}

@layer layout {
  .mono-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(245, 242, 233, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .mono-topbar-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.05;
    letter-spacing: -0.02em;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    stroke-width: 2.4;
    fill: none;
    flex-shrink: 0;
  }
  .brand-dot { color: var(--cobalt); }
  .topbar-meta {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--ink);
    background: transparent;
    color: var(--ink);
    transition: background 0.15s ease, color 0.15s ease;
  }
  .btn:hover { background: var(--paper-tint); }
  .btn--ink { background: var(--ink); color: var(--paper-light); }
  .btn--ink:hover { background: var(--forest); }
  .btn--lime { background: var(--lime); border-color: var(--ink); color: var(--ink); }

  .mono-shell {
    max-width: 1060px;
    margin: 0 auto;
    padding: 36px 24px 88px;
  }

  .mono-cover {
    background: var(--forest);
    color: var(--paper);
    padding: clamp(32px, 5vw, 64px);
    border: 1px solid var(--ink);
    position: relative;
  }
  .cover-brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(245, 242, 233, 0.22);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(245, 242, 233, 0.78);
  }
  .cover-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--paper);
  }
  .cover-brand-badge svg {
    width: 24px;
    height: 24px;
    stroke: var(--lime);
    stroke-width: 2.5;
    fill: none;
  }
  .cover-eyebrow {
    margin-top: 36px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--lime);
  }
  .cover-eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--lime);
  }
  .cover-title {
    margin-top: 18px;
    color: var(--paper-light);
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.04;
    letter-spacing: -0.045em;
    max-width: 18ch;
  }
  .cover-title em {
    font-style: italic;
    color: var(--lime);
  }
  .cover-subtitle {
    margin-top: 22px;
    max-width: 64ch;
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.55;
    color: rgba(245, 242, 233, 0.88);
  }
  .cover-meta-grid {
    margin-top: 42px;
    padding-top: 24px;
    border-top: 1px solid rgba(245, 242, 233, 0.22);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
  }
  .cover-meta-grid dt {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(245, 242, 233, 0.64);
  }
  .cover-meta-grid dd {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--paper-light);
  }

  .mono-toc {
    margin-top: 28px;
    background: var(--paper-light);
    border: 1px solid var(--line);
    padding: 28px 32px;
  }
  .toc-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
  }
  .toc-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 32px;
  }
  .toc-grid li {
    border-top: 1px solid var(--line);
    padding-top: 10px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    font-size: 14px;
  }
  .toc-num {
    font-family: var(--serif);
    font-size: 15px;
    color: var(--cobalt);
    min-width: 24px;
  }
  .toc-grid a { text-decoration: none; font-weight: 600; }
  .toc-grid a:hover { text-decoration: underline; }

  .mono-section {
    margin-top: 56px;
    padding-top: 40px;
    border-top: 1px solid var(--ink);
  }
  .sec-header {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 32px;
    align-items: end;
    margin-bottom: 30px;
  }
  .sec-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cobalt);
    margin-bottom: 10px;
  }
  .sec-header h2 {
    font-size: clamp(28px, 3.6vw, 42px);
    line-height: 1.07;
  }
  .sec-header h2 em { font-style: italic; }
  .sec-lead {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.58;
  }
}

@layer components {
  .prose p + p { margin-top: 16px; }
  .prose { max-width: 74ch; color: var(--ink); }
  .prose strong { font-weight: 650; }
  .muted { color: var(--muted); }

  .subhead {
    font-family: var(--serif);
    font-size: 24px;
    letter-spacing: -0.025em;
    margin: 30px 0 12px;
  }
  .label-caps {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
  }

  .pullquote {
    margin: 24px 0;
    padding: 22px 26px;
    background: var(--paper-light);
    border-left: 4px solid var(--forest);
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .pullquote p {
    font-family: var(--serif);
    font-size: 20px;
    line-height: 1.42;
    letter-spacing: -0.02em;
  }
  .pullquote cite {
    display: block;
    margin-top: 10px;
    font-style: normal;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .callout {
    margin: 24px 0;
    padding: 22px 26px;
    border: 1px solid var(--line);
    background: var(--paper-light);
  }
  .callout--lime {
    background: var(--lime-soft);
    border-color: var(--line-strong);
  }
  .callout--forest {
    background: var(--forest);
    color: var(--paper);
    border-color: var(--ink);
  }
  .callout--forest h3, .callout--forest h4, .callout--forest strong { color: var(--paper-light); }
  .callout--forest p, .callout--forest li { color: rgba(245, 242, 233, 0.88); }
  .callout h3, .callout h4 {
    font-family: var(--serif);
    font-size: 21px;
    margin-bottom: 8px;
  }

  .stat-grid {
    margin: 24px 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
  }
  .stat-card {
    background: var(--paper-light);
    border: 1px solid var(--line);
    padding: 20px 22px;
  }
  .stat-value {
    font-family: var(--serif);
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--forest);
  }
  .stat-label {
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
  }
  .stat-detail {
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.48;
  }
  .source-note {
    display: block;
    margin-top: 10px;
    font-size: 11px;
    color: var(--muted);
  }

  .card-grid-2, .card-grid-3, .card-grid-4 {
    margin: 24px 0;
    display: grid;
    gap: 18px;
  }
  .card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .info-card {
    background: var(--paper-light);
    border: 1px solid var(--line);
    padding: 22px 24px;
  }
  .info-card .card-num {
    font-family: var(--serif);
    font-size: 24px;
    color: var(--cobalt);
    display: block;
    margin-bottom: 10px;
  }
  .info-card h3, .info-card h4 {
    font-family: var(--serif);
    font-size: 22px;
    letter-spacing: -0.025em;
    margin-bottom: 10px;
  }
  .info-card p, .info-card li {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
  }
  .info-card ul, .info-card ol {
    margin: 10px 0 0;
    padding-left: 18px;
  }
  .info-card li + li { margin-top: 6px; }

  .figure-card {
    margin: 26px 0;
    background: var(--paper-light);
    border: 1px solid var(--line);
    padding: 24px 26px;
  }
  .figure-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 14px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--line);
  }
  .figure-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cobalt);
  }
  .figure-title {
    font-family: var(--serif);
    font-size: 21px;
    letter-spacing: -0.02em;
    margin-top: 4px;
  }
  .figure-caption {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .figure-card svg {
    width: 100%;
    height: auto;
  }

  .table-wrap {
    margin: 22px 0;
    overflow-x: auto;
    border: 1px solid var(--line);
    background: var(--paper-light);
  }
  .mono-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    line-height: 1.5;
  }
  .mono-table th, .mono-table td {
    padding: 13px 15px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
  }
  .mono-table thead th {
    background: var(--paper-tint);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    border-bottom: 1px solid var(--ink);
  }
  .mono-table tbody tr:last-child td { border-bottom: 0; }
  .mono-table td strong { color: var(--ink); font-weight: 650; }
  .tag-pill {
    display: inline-block;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--paper-tint);
    border: 1px solid var(--line);
    color: var(--ink);
  }
  .tag-pill--lime { background: var(--lime); border-color: var(--line-strong); }
  .tag-pill--cobalt { background: var(--cobalt-soft); border-color: #b7c3ee; color: var(--cobalt); }

  .matrix-2x2 {
    margin: 24px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .quadrant {
    background: var(--paper-light);
    border: 1px solid var(--line);
    padding: 20px 22px;
  }
  .quadrant--highlight {
    background: var(--lime-soft);
    border-color: var(--ink);
  }
  .quadrant-axis {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cobalt);
  }
  .quadrant h4 {
    font-family: var(--serif);
    font-size: 21px;
    margin: 6px 0 8px;
  }
  .quadrant p, .quadrant li {
    font-size: 13.5px;
    color: var(--muted);
    line-height: 1.5;
  }
  .quadrant ul { margin: 8px 0 0; padding-left: 18px; }

  .case-study {
    margin: 28px 0;
    background: var(--paper-light);
    border: 1px solid var(--ink);
    box-shadow: 6px 6px 0 rgba(23, 36, 31, 0.06);
  }
  .case-header {
    background: var(--paper-tint);
    padding: 18px 24px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
  }
  .case-header h3 {
    font-family: var(--serif);
    font-size: 23px;
    letter-spacing: -0.025em;
  }
  .case-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .case-col {
    padding: 20px 22px;
    border-right: 1px solid var(--line);
  }
  .case-col:last-child {
    border-right: 0;
    background: rgba(211, 239, 145, 0.22);
  }
  .case-col h4 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--forest);
    margin-bottom: 10px;
  }
  .case-col p, .case-col li {
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.55;
  }
  .case-col ul { margin: 0; padding-left: 17px; }
  .case-col li + li { margin-top: 6px; }

  .endorsement-grid {
    margin: 24px 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .endorsement-card {
    background: var(--paper-light);
    border: 1px solid var(--line);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
  }
  .endorsement-card blockquote {
    font-family: var(--serif);
    font-size: 16.5px;
    line-height: 1.48;
  }
  .endorsement-card cite {
    font-style: normal;
    font-size: 12px;
    font-weight: 650;
    color: var(--muted);
  }

  .likert-scale {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .likert-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: var(--paper);
    flex-shrink: 0;
  }

  .mono-colophon {
    margin-top: 64px;
    padding: 32px 36px;
    background: var(--forest);
    color: var(--paper);
    border: 1px solid var(--ink);
  }
  .colophon-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 32px;
    align-items: end;
  }
  .mono-colophon h2,
  .mono-colophon .colophon-title {
    color: var(--paper-light);
    font-size: 30px;
    line-height: 1.12;
    margin-top: 8px;
  }
  .mono-colophon :focus-visible { outline-color: var(--lime); }
  .mono-colophon p {
    margin-top: 12px;
    font-size: 14px;
    color: rgba(245, 242, 233, 0.85);
    line-height: 1.6;
  }
  .colophon-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .framework-nav {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
  }
  .framework-nav a {
    color: var(--paper-light);
    text-decoration: underline;
  }
  .framework-nav .framework-nav-legal {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    opacity: 0.85;
  }
  .skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: 10px 14px;
    background: var(--ink);
    color: var(--paper-light);
    font-weight: 600;
    text-decoration: none;
  }
  .skip-link:focus { top: 12px; }
  .colophon-fine {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(245, 242, 233, 0.2);
    font-size: 12px;
    color: rgba(245, 242, 233, 0.72);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  @media (max-width: 820px) {
    .cover-meta-grid,
    .toc-grid,
    .sec-header,
    .card-grid-2,
    .card-grid-3,
    .card-grid-4,
    .matrix-2x2,
    .case-columns,
    .endorsement-grid,
    .colophon-grid {
      grid-template-columns: 1fr;
    }
    .case-col {
      border-right: 0;
      border-bottom: 1px solid var(--line);
    }
    .case-col:last-child { border-bottom: 0; }
    .mono-shell { padding: 20px 16px 64px; }
    .mono-toc, .figure-card, .mono-colophon { padding: 20px 18px; }
    html { scroll-padding-top: 16px; }
    .mono-topbar { position: static; }
    .topbar-meta { display: none; }
    .topbar-actions [data-print-monograph] { display: none; }
  }

  /* Phone renditions of wide figures: shown instead of the SVG below 820px. */
  .fig-narrow { display: none; }
  .fig-narrow ol { list-style: none; margin: 0; padding: 0; }
  .fig-axis,
  .step-num {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--cobalt);
  }
  .fig-narrow mark,
  .start-week mark {
    background: var(--lime);
    color: var(--ink);
    padding: 0 0.12em;
  }
  .step-name {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }
  .step-sub { font-size: 14px; color: var(--muted); }
  .step-note { font-size: 14px; font-weight: 650; line-height: 1.4; margin-top: 6px; }

  .spectrum-narrow .spectrum-steps {
    position: relative;
    margin: 10px 0 18px 5px;
    border-left: 1px solid var(--ink);
  }
  .spectrum-steps::after {
    content: "";
    position: absolute;
    left: -5px;
    bottom: -9px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 9px solid var(--ink);
  }
  .spectrum-steps li {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 8px;
    align-items: baseline;
    padding: 12px 12px 12px 14px;
    border-bottom: 1px solid var(--line);
  }
  .spectrum-steps li:last-child { border-bottom: 0; }
  .spectrum-steps .step-sub,
  .spectrum-steps .step-note { grid-column: 2; }
  .spectrum-steps .is-lead .step-note { color: var(--forest); }
  .spectrum-steps .is-start { background: var(--cobalt-soft); }
  .spectrum-steps .is-start .step-note { color: var(--cobalt); }

  .loop-narrow .loop-steps {
    position: relative;
    display: grid;
    gap: 10px;
    padding-right: 32px;
  }
  .loop-steps li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border: 1px solid var(--cobalt);
    background: var(--paper-light);
  }
  .loop-steps .is-first { background: var(--forest); border-color: var(--ink); color: var(--paper-light); }
  .loop-steps .is-first .step-num { color: var(--lime); }
  .loop-steps .is-next { border-color: var(--ink); }
  .loop-steps::before {
    content: "";
    position: absolute;
    top: 26px;
    bottom: 26px;
    right: 8px;
    width: 18px;
    border: 1.5px dashed var(--forest);
    border-left: 0;
  }
  .loop-steps::after {
    content: "";
    position: absolute;
    top: 21px;
    right: 24px;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 8px solid var(--forest);
  }
  .loop-back { margin-top: 12px; font-size: 14px; color: var(--muted); }

  .ladder-narrow .ladder-bars { display: grid; gap: 8px; margin-top: 12px; }
  .ladder-bars li {
    display: grid;
    grid-template-columns: 4.4em minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }
  .bar-value {
    font-family: var(--serif);
    font-size: 17px;
    text-align: right;
    font-variant-numeric: lining-nums tabular-nums;
  }
  .bar {
    display: block;
    width: var(--w);
    height: 22px;
    background: var(--paper-tint);
    border: 1px solid var(--ink);
  }
  .bar--forest { background: var(--forest); }
  .bar--lime { background: var(--lime); }

  /* Paper worksheet marks and the section-only print action. */
  .yn-mark {
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--muted);
  }
  .tool-actions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px 14px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--muted);
  }
  .tool-actions .btn { min-height: 44px; font-size: 14px; }

  .start-week { margin-top: 36px; }
  .start-week h3 { font-size: 28px; }
  .start-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: start;
    max-width: 66ch;
  }
  .start-list li {
    counter-increment: start;
    position: relative;
    padding: 10px 0 10px 2.4em;
    border-top: 1px solid var(--line);
  }
  .start-list li::before {
    content: counter(start);
    position: absolute;
    left: 0;
    top: 8px;
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.15;
    color: var(--cobalt);
  }

  .source-fold {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .source-fold > summary {
    cursor: pointer;
    padding: 12px 0;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
  }
  .source-fold > summary::marker { color: var(--cobalt); }
  .source-fold[open] { padding-bottom: 18px; }

  @media screen and (max-width: 820px) {
    .fig-wide { display: none; }
    .fig-narrow { display: block; }

    .habit-table,
    .habit-table tbody,
    .habit-table tr,
    .habit-table th,
    .habit-table td { display: block; }
    .habit-table thead { display: none; }
    .habit-table tr { padding: 16px; border-bottom: 1px solid var(--line); }
    .habit-table tbody tr:last-child { border-bottom: 0; }
    .habit-table th,
    .habit-table td { padding: 0; border: 0; }
    .habit-table th {
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--cobalt);
    }
    .habit-table th::before { content: "Habit "; }
    .habit-table td { margin-top: 8px; font-size: 15px; }
    .habit-table td:nth-of-type(n+2)::before {
      display: block;
      margin-bottom: 2px;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .habit-table td:nth-of-type(2)::before { content: "What it costs"; }
    .habit-table td:nth-of-type(3)::before { content: "Lead, Don't Sell instead"; }

    .niche-sheet,
    .niche-sheet tbody { display: block; }
    .niche-sheet thead { display: none; }
    .niche-sheet tr {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      column-gap: 8px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
    }
    .niche-sheet th,
    .niche-sheet td { display: block; padding: 0; border: 0; }
    .niche-sheet tr > :nth-child(1),
    .niche-sheet tr > :nth-child(2) { grid-column: 1 / -1; }
    .niche-sheet tr > :nth-child(2) { margin: 2px 0 10px; font-size: 15px; }
    .niche-sheet tr > td:first-child:empty { display: none; }
    .niche-sheet tr > :nth-child(n+3)::before {
      display: block;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--cobalt);
    }
    .niche-sheet tr > :nth-child(3)::before { content: "Niche A"; }
    .niche-sheet tr > :nth-child(4)::before { content: "Niche B"; }
    .niche-sheet tr > :nth-child(5)::before { content: "Niche C"; }
  }
}

@layer print {
  @media print {
    @page {
      size: A4;
      margin: 14mm 13mm 16mm 13mm;
    }
    html, body {
      background: #fcfaf4 !important;
      color: #17241f !important;
      font-size: 9.6pt;
      line-height: 1.45;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    .mono-topbar,
    .screen-only {
      display: none !important;
    }
    .mono-shell {
      max-width: none;
      margin: 0;
      padding: 0;
    }
    .mono-cover {
      padding: 28pt 26pt;
      min-height: 225mm;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      break-after: page;
      page-break-after: always;
    }
    .cover-title { font-size: 32pt; }
    .cover-subtitle { font-size: 12pt; }
    .cover-meta-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 14pt;
    }
    .mono-toc {
      margin-top: 0;
      padding: 16pt 18pt;
      break-inside: avoid;
    }
    .toc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mono-section {
      margin-top: 20pt;
      padding-top: 14pt;
    }
    .sec-header {
      grid-template-columns: 1.3fr 1fr;
      gap: 18pt;
      margin-bottom: 14pt;
      break-after: avoid;
      page-break-after: avoid;
    }
    .sec-header h2 { font-size: 20pt; }
    .sec-lead { font-size: 9.5pt; }
    h2, h3, h4, .subhead {
      break-after: avoid;
      page-break-after: avoid;
    }
    .figure-card,
    .case-study,
    .callout,
    .pullquote,
    .quadrant,
    .info-card,
    .stat-card,
    .endorsement-card,
    .mono-colophon,
    .mono-table tr {
      break-inside: avoid;
      page-break-inside: avoid;
    }
    .table-wrap { overflow: visible !important; }
    .mono-table { font-size: 8.6pt; }
    .mono-table th, .mono-table td { padding: 7pt 8pt; }
    .mono-table thead { display: table-header-group; }
    .card-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10pt; }
    .card-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10pt; }
    .card-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10pt; }
    .matrix-2x2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10pt; }
    .case-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .case-study { box-shadow: none; }
    a { text-decoration: none; }
    html[data-print-scope="niche-tool"] .mono-shell > :not(#niche-tool) { display: none !important; }
    html[data-print-scope="niche-tool"] #niche-tool { margin-top: 0; padding-top: 0; border-top: 0; }
    .source-fold > summary { display: none; }
    .source-fold { border: 0; margin-top: 0; }
    .source-fold::details-content { content-visibility: visible; display: block; height: auto; }
    .yn-mark { font-size: 9pt; }
  }
}
