/* ============================================================================
   Arrange — Public docs skin
   ----------------------------------------------------------------------------
   Deliberately NOT the v10 Apparat system. Apparat is the subject of the
   Design System case study and lives on case-study.html / style-showcase.html.
   These pages instead borrow the main application's language from css/style.css:

     · one base surface — pure white or near-black, never tinted
     · depth from hairline rules, never from fills or cut shadows
     · one muted accent, used only where something is active or current
     · monospace micro-labels, drafting ticks, measured rules

   Theme follows the app: dark by default, light via the shared
   `arrange-theme` localStorage key so a preference carries across.
   ========================================================================= */

:root {
  /* Surface — every level is the same colour. Structure comes from rules. */
  --bg: #060606;
  --bg-sunk: #0b0b0b;
  --ink: #f5f5f5;
  --ink-2: #c9ced6;
  --ink-3: #85898f;

  /* Linework */
  --rule: rgba(255, 255, 255, 0.13);
  --rule-soft: rgba(255, 255, 255, 0.06);
  --rule-strong: rgba(255, 255, 255, 0.26);

  /* Accent — the app's teal. State only, never decoration. */
  --accent: #00b894;
  --accent-faint: rgba(0, 184, 148, 0.12);
  --accent-line: rgba(0, 184, 148, 0.45);

  /* Muted category pops, straight from the app palette */
  --pop-purple: #b39ddb;
  --pop-amber: #f9a825;
  --pop-info: #3498db;
  --pop-error: #e74c3c;
  --pop-error-faint: rgba(231, 76, 60, 0.14);

  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  --r-sm: 4px;
  --r-md: 6px;

  --shell: min(1280px, calc(100% - 48px));
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --quick: 120ms;
}

:root.light-theme,
body.light-theme {
  --bg: #ffffff;
  --bg-sunk: #fafafa;
  --ink: #1f2937;
  --ink-2: #475569;
  --ink-3: #6b7280;

  --rule: rgba(15, 23, 42, 0.14);
  --rule-soft: rgba(15, 23, 42, 0.07);
  --rule-strong: rgba(15, 23, 42, 0.3);

  --accent: #4a9882;
  --accent-faint: rgba(74, 152, 130, 0.1);
  --accent-line: rgba(74, 152, 130, 0.5);

  --pop-purple: #7c6bab;
  --pop-amber: #b0791b;
  --pop-info: #2f7cb8;
  --pop-error: #c0564e;
  --pop-error-faint: rgba(192, 86, 78, 0.1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--s-6);
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  margin: 0;
}

::selection {
  background: var(--accent-faint);
}

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

/* ── Shared primitives ───────────────────────────────────────────────────── */

/* Monospace micro-label with a rule leader running out to the right.
   This is the page's main structural device. */
.doc-label,
.case-eyebrow,
.case-hero__thesis-label,
.toc-label,
.hero__eyebrow,
.doc__tag,
.doc__meta,
.label__letter,
.label__meta {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rule-leader {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.rule-leader::after {
  flex: 1;
  height: 1px;
  background: var(--rule);
  content: "";
}

/* Drafting registration ticks on framed blocks. */
.ticked {
  position: relative;
}

.ticked::before,
.ticked::after {
  position: absolute;
  width: 5px;
  height: 5px;
  border-color: var(--rule-strong);
  border-style: solid;
  content: "";
  pointer-events: none;
}

.ticked::before {
  top: -1px;
  left: -1px;
  border-width: 1px 0 0 1px;
}

.ticked::after {
  right: -1px;
  bottom: -1px;
  border-width: 0 1px 1px 0;
}

/* ── Chrome: header, footer, brand, theme toggle ─────────────────────────── */

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  height: 2px;
  background: transparent;
  border-bottom: 1px solid var(--rule-soft);
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 80ms linear;
}

.case-header,
.case-footer,
.case-hero,
.reader-shell,
.page {
  width: var(--shell);
  margin-inline: auto;
}

.case-header,
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: 56px;
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--rule-strong);
}

.case-brand,
.top__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

/* The wordmark is the logo — scale by height and let the width follow. */
.case-brand .brand-wordmark,
.top__brand .brand-wordmark {
  height: 19px;
  color: var(--ink);
  transition: color var(--quick) var(--ease);
}

.case-brand:hover .brand-wordmark,
.top__brand:hover .brand-wordmark {
  color: var(--accent);
}

.top__sep,
.top__sub {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.case-header__nav,
.top__nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
}

.case-header__nav a,
.top__nav a,
.case-footer > a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 30px;
  padding: 0 var(--s-3);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition:
    border-color var(--quick) var(--ease),
    color var(--quick) var(--ease);
}

.case-header__nav a:hover,
.top__nav a:hover,
.case-footer > a:hover,
.theme-toggle:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.theme-toggle {
  min-width: 30px;
  justify-content: center;
  padding: 0 var(--s-2);
  border-color: var(--rule);
  font-size: 13px;
  line-height: 1;
}

.case-footer,
.page > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: 96px;
  margin-top: var(--s-8);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--rule-strong);
}

.case-footer p,
.page > footer span {
  color: var(--ink-3);
  font-size: 12px;
}

/* ── Docs index (docs.html) ──────────────────────────────────────────────── */

.page {
  padding: 0 0 var(--s-8);
}

.hero {
  padding: var(--s-8) 0 var(--s-7);
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0 0 var(--s-5);
}

.hero__eyebrow::before {
  width: 24px;
  height: 1px;
  background: var(--accent);
  content: "";
}

.hero__title {
  max-width: 18ch;
  margin: 0 0 var(--s-4);
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hero__lede {
  max-width: 64ch;
  color: var(--ink-2);
  font-size: 15px;
}

.label {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: var(--s-1);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule-strong);
}

.label__title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.label__meta {
  margin-left: auto;
}

.docs-list {
  display: flex;
  flex-direction: column;
}

/* Each row is a ruled register line, not a card. */
.doc {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 200px;
  gap: var(--s-5);
  align-items: start;
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--rule-soft);
  transition: background var(--quick) var(--ease);
}

.doc:hover {
  background: var(--bg-sunk);
}

.doc__no {
  padding-top: 2px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.doc__body {
  min-width: 0;
}

.doc__tag {
  display: inline-block;
  margin-bottom: var(--s-2);
}

.doc__title {
  margin: 0 0 var(--s-2);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.2;
}

.doc__lede {
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.6;
}

.doc__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.doc__meta span:not(:last-child)::after {
  margin-left: var(--s-2);
  color: var(--rule-strong);
  content: "/";
}

.opens {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  align-items: stretch;
}

.opens__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 34px;
  padding: 0 var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 550;
  transition:
    border-color var(--quick) var(--ease),
    color var(--quick) var(--ease);
}

.opens__btn small {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.opens__btn:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.opens__btn--primary {
  border-color: var(--accent-line);
  color: var(--ink);
}

.opens__btn--primary small {
  color: var(--accent);
}

.opens__btn--primary:hover {
  border-color: var(--accent);
}

/* ── Reader hero (docs-reader.html) ──────────────────────────────────────── */

.case-hero {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: var(--s-5) var(--s-6);
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--rule-strong);
}

.case-hero__meta {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.case-hero__meta span {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.case-hero__meta span::before {
  width: 8px;
  height: 1px;
  background: var(--rule-strong);
  content: "";
  flex: 0 0 auto;
}

.case-hero__body {
  min-width: 0;
}

.case-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}

.case-eyebrow::before {
  width: 18px;
  height: 1px;
  background: var(--accent);
  content: "";
}

/* Deliberately restrained — this is documentation, not a campaign page. */
.case-hero h1 {
  max-width: 24ch;
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.14;
}

.case-deck {
  max-width: 66ch;
  margin: var(--s-4) 0 0;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.6;
}

.case-hero__thesis {
  grid-column: 2;
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
}

.case-hero__thesis-label {
  display: block;
  margin-bottom: var(--s-2);
  color: var(--accent);
}

.case-hero__thesis p {
  max-width: 66ch;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

/* ── Reader shell ───────────────────────────────────────────────────────── */

.reader-shell {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  gap: 0;
  padding: var(--s-6) 0 var(--s-9);
}

/* The column rule is the layout. */
.reader-sidebar {
  position: sticky;
  top: var(--s-4);
  align-self: start;
  max-height: calc(100vh - var(--s-6));
  padding-right: var(--s-4);
  overflow: hidden auto;
  border-right: 1px solid var(--rule);
  scrollbar-width: thin;
}

.case-document {
  min-width: 0;
  max-width: 860px;
  padding: 0 var(--s-6);
  background: none;
}

.toc-toggle {
  display: none;
}

.toc-label {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 0 0 var(--s-2);
}

.toc-label::after {
  flex: 1;
  height: 1px;
  background: var(--rule);
  content: "";
}

.doc-picker {
  margin-bottom: var(--s-5);
}

.doc-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-3) 0 0;
}

.doc-list__group {
  display: flex;
  flex-direction: column;
}

.doc-list__group-title {
  margin: 0 0 var(--s-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Documents read as a ruled list with a live indent bar, not as pucks. */
.doc-list a {
  display: grid;
  gap: 2px;
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-3);
  border: 0;
  border-left: 1px solid var(--rule);
  color: var(--ink-2);
  transition:
    border-color var(--quick) var(--ease),
    color var(--quick) var(--ease);
}

.doc-list a span {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.doc-list a strong {
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
}

.doc-list a:hover {
  border-left-color: var(--rule-strong);
}

.doc-list a:hover strong {
  color: var(--ink);
}

.doc-list a.is-active {
  border-left-color: var(--accent);
}

.doc-list a.is-active strong {
  color: var(--ink);
}

.doc-list a.is-active span {
  color: var(--accent);
}

.toc {
  display: flex;
  flex-direction: column;
  padding-top: var(--s-2);
}

/* TOC entries hang off one continuous hairline. */
.toc a {
  position: relative;
  display: block;
  padding: 5px var(--s-2) 5px var(--s-4);
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.4;
  transition: color var(--quick) var(--ease);
}

.toc a::before {
  position: absolute;
  top: 11px;
  left: 0;
  width: 7px;
  height: 1px;
  background: var(--rule-strong);
  content: "";
  transition:
    background var(--quick) var(--ease),
    width var(--quick) var(--ease);
}

.toc a[data-level="1"] {
  margin-top: var(--s-3);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.toc a[data-level="2"] {
  padding-left: var(--s-5);
}

.toc a[data-level="2"]::before {
  left: var(--s-3);
}

.toc a[data-level="3"] {
  padding-left: var(--s-6);
  font-size: 11px;
}

.toc a[data-level="3"]::before {
  left: var(--s-5);
  width: 4px;
}

.toc a:hover {
  color: var(--ink);
}

.toc a:hover::before {
  background: var(--ink-3);
}

.toc a.is-active {
  color: var(--ink);
}

.toc a.is-active::before {
  width: 12px;
  background: var(--accent);
}






/* ── Loading / error status ─────────────────────────────────────────────── */

.reader-status {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 180px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reader-status[hidden] {
  display: none;
}

.reader-status__mark {
  width: 11px;
  height: 11px;
  border: 1px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: reader-spin 800ms linear infinite;
}

.reader-status.is-error {
  min-height: auto;
  padding: var(--s-4);
  border: 1px solid var(--pop-error);
  border-radius: var(--r-md);
  background: var(--pop-error-faint);
  color: var(--pop-error);
}

.reader-status.is-error .reader-status__mark {
  border: 0;
  background: var(--pop-error);
  animation: none;
}

@keyframes reader-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Document body ──────────────────────────────────────────────────────── */

.markdown-body {
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.7;
}

.markdown-body > h1:first-child {
  display: none;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--ink);
  scroll-margin-top: var(--s-6);
}

.markdown-body h1 {
  margin: var(--s-9) 0 var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule-strong);
  font-size: 26px;
  letter-spacing: -0.02em;
}

/* A rule that runs the full measure, with the heading sitting on it. */
.markdown-body h2 {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: var(--s-8) 0 var(--s-5);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule);
  font-size: 20px;
  letter-spacing: -0.016em;
}

.markdown-body h2::after {
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
  content: "";
}

/* A tick in the margin instead of a filled dot. */
.markdown-body h3 {
  position: relative;
  margin: var(--s-7) 0 var(--s-3);
  padding-left: var(--s-4);
  font-size: 16px;
}

.markdown-body h3::before {
  position: absolute;
  top: 0.62em;
  left: 0;
  width: 9px;
  height: 1px;
  background: var(--accent);
  content: "";
}

.markdown-body h4 {
  margin: var(--s-5) 0 var(--s-2);
  font-size: 14px;
}

.markdown-body p {
  margin: 0 0 1.2em;
}

.markdown-body strong {
  color: var(--ink);
  font-weight: 620;
}

.markdown-body em {
  color: var(--ink);
}

.markdown-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent-line);
  text-underline-offset: 3px;
  transition: border-color var(--quick) var(--ease);
}

.markdown-body a:hover {
  border-bottom-color: var(--accent);
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 1.2em;
  padding-left: var(--s-5);
}

.markdown-body li {
  margin-bottom: 0.45em;
}

.markdown-body li::marker {
  color: var(--ink-3);
}

.markdown-body ul ul,
.markdown-body ol ol,
.markdown-body ul ol,
.markdown-body ol ul {
  margin: 0.45em 0 0.2em;
}

.markdown-body blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-1) 0 var(--s-1) var(--s-4);
  border-left: 1px solid var(--accent-line);
}

.markdown-body blockquote p {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

.markdown-body code {
  padding: 1px 5px;
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  background: var(--bg-sunk);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.86em;
}

.markdown-body pre {
  margin: var(--s-5) 0;
  padding: var(--s-4);
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--bg-sunk);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.6;
}

.markdown-body pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: inherit;
}

.markdown-body .formula {
  margin: var(--s-5) 0;
  padding: var(--s-4) var(--s-4) var(--s-4) var(--s-5);
  border: 0;
  border-left: 1px solid var(--accent-line);
  border-radius: 0;
  background: none;
}

.markdown-body .formula::before {
  display: block;
  margin-bottom: var(--s-2);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  content: "Model expression";
}

.markdown-body .formula code {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
}

.markdown-body hr {
  height: 1px;
  margin: var(--s-7) 0;
  border: 0;
  background: var(--rule);
}

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

/* Figures authored inline in a document. The SVGs carry their own light panel
   so they read the same in either theme; the border seats them on the page. */
.markdown-body figure {
  margin: var(--s-6) 0;
}

.markdown-body figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
}

.markdown-body figcaption {
  margin-top: var(--s-3);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-transform: uppercase;
}

/* Tables: a hairline grid. No fills, zebra by rule weight only. */
.table-scroll {
  max-width: 100%;
  margin: var(--s-5) 0;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
}

.markdown-body table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.5;
}

.markdown-body th,
.markdown-body td {
  padding: 9px var(--s-3);
  border-right: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  border-bottom-color: var(--rule-strong);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.markdown-body td strong {
  font-weight: 620;
}

.markdown-body tr:last-child td {
  border-bottom: 0;
}

.markdown-body th:last-child,
.markdown-body td:last-child {
  border-right: 0;
}

.markdown-body tbody tr:hover {
  background: var(--bg-sunk);
}

/* ── Case Study 03 drawing-board figures ────────────────────────────────── */

.design-process-figure {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin: var(--s-6) 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: none;
}

.design-process-figure img {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #f4f1e9;
}

.design-process-figure figcaption {
  position: sticky;
  left: 0;
  width: fit-content;
  max-width: 900px;
  margin: var(--s-3) 0 0;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-transform: uppercase;
}

.design-process-breakouts {
  display: none;
}

.design-process-breakout {
  min-width: 0;
  margin: 0;
}

.design-process-crop {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: #f4f1e9;
}

.design-process-crop img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: var(--design-process-image-width);
  max-width: none;
  height: auto;
  transform: translate(var(--design-process-translate-x), var(--design-process-translate-y));
  transform-origin: 0 0;
}

.design-process-crop--overview {
  --design-process-image-width: 102.272727%;
  --design-process-translate-x: -1.111111%;
  --design-process-translate-y: -1.388889%;
  aspect-ratio: 1760 / 404;
}

.design-process-crop--overview-start {
  --design-process-image-width: 170%;
  --design-process-translate-x: -1.8%;
  --design-process-translate-y: -2.3%;
  aspect-ratio: 1060 / 404;
}

.design-process-crop--overview-finish {
  --design-process-image-width: 170%;
  --design-process-translate-x: -68%;
  --design-process-translate-y: -2.3%;
  aspect-ratio: 1060 / 404;
}

.design-process-crop--lens-01 {
  --design-process-image-width: 300%;
  --design-process-translate-x: -3%;
  --design-process-translate-y: -6%;
  aspect-ratio: 620 / 404;
}

.design-process-crop--lens-02 {
  --design-process-image-width: 300%;
  --design-process-translate-x: -104%;
  --design-process-translate-y: -6%;
  aspect-ratio: 620 / 404;
}

.design-process-crop--lens-03 {
  --design-process-image-width: 300%;
  --design-process-translate-x: -200%;
  --design-process-translate-y: -6%;
  aspect-ratio: 620 / 404;
}

@media (min-width: 1121px) {
  .reader-shell:has(.design-process-figure) {
    width: min(1680px, calc(100% - 48px));
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .reader-shell:has(.design-process-figure) .case-document {
    min-width: 0;
    padding-inline: var(--s-5);
  }

}

/* ── Reader comments ────────────────────────────────────────────────────── */

.markdown-body .is-commentable {
  position: relative;
}

.case-comment-highlight {
  border-bottom: 1px solid var(--accent-line);
  background: var(--accent-faint);
  cursor: pointer;
  transition: background var(--quick) var(--ease);
}

.case-comment-highlight.is-density-2 {
  border-bottom-color: var(--accent);
}

.case-comment-highlight.is-density-3,
.case-comment-highlight.is-density-4 {
  border-bottom-width: 2px;
  border-bottom-color: var(--accent);
}

.case-comment-highlight:hover {
  background: var(--accent-faint);
  border-bottom-color: var(--ink);
}

.case-comment-pin {
  position: absolute;
  top: 0.2em;
  left: calc(var(--s-5) * -1);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 16px;
  padding: 0 5px;
  border: 1px solid var(--accent-line);
  border-radius: 99px;
  background: var(--bg);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  cursor: pointer;
}

.case-comment-pin::before {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.case-comment-pin.is-density-2,
.case-comment-pin.is-density-3,
.case-comment-pin.is-density-4 {
  border-color: var(--accent);
}

.case-comment-action,
.case-comments-toggle,
.case-comments-icon,
.case-comment-popover button {
  font-family: var(--font);
  cursor: pointer;
}

.case-comment-action {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 28px;
  padding: 0 var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink-2);
  font-size: 11px;
}

.case-comment-action:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.case-comments-toggle {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  z-index: 45;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 36px;
  padding: 0 var(--s-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 550;
}

.case-comments-toggle b {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--accent-line);
  border-radius: 99px;
  background: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
}

.case-comments-toggle:hover,
.case-comments-toggle.is-active {
  border-color: var(--accent);
}

.case-comments-panel {
  position: fixed;
  top: var(--s-5);
  right: var(--s-5);
  z-index: 60;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  width: min(360px, calc(100vw - var(--s-6)));
  max-height: calc(100vh - var(--s-7));
  padding: var(--s-4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity var(--quick) var(--ease),
    transform var(--quick) var(--ease);
}

.case-comments-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.case-comments-panel__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule);
}

.case-comments-panel__head strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

.case-comments-kicker,
.case-comments-count {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.case-comments-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
}

.case-comments-icon:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.case-comments-panel__note {
  padding: var(--s-3) 0;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.5;
}

.case-comments-count {
  padding-bottom: var(--s-2);
}

.case-comments-empty {
  padding: var(--s-5) 0;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}

.case-comments-list,
.case-comment-thread {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-comments-list {
  overflow-y: auto;
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule-soft);
}

.case-comment-card {
  padding: var(--s-3) 0 var(--s-3) var(--s-3);
  border-left: 1px solid var(--rule);
}

.case-comment-card blockquote {
  margin: 0 0 var(--s-2);
  padding: 0 0 0 var(--s-3);
  border-left: 1px solid var(--accent-line);
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.5;
}

.case-comment-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.case-comment-card footer {
  margin-top: var(--s-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-comment-popover {
  position: absolute;
  z-index: 70;
  width: min(320px, calc(100vw - var(--s-6)));
  padding: var(--s-4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.case-comment-popover label {
  display: block;
}

.case-comment-popover label span {
  display: block;
  margin-bottom: var(--s-2);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.case-comment-popover textarea {
  width: 100%;
  min-height: 84px;
  padding: var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--bg-sunk);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.case-comment-popover textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.case-comment-popover__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.case-comment-popover button {
  min-height: 30px;
  padding: 0 var(--s-3);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 550;
}

.case-comment-popover button:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}

.case-comment-popover button[type="submit"],
.case-comment-popover button[data-comment-all] {
  border-color: var(--accent-line);
  color: var(--ink);
}

.case-comment-popover button[type="submit"]:hover,
.case-comment-popover button[data-comment-all]:hover {
  border-color: var(--accent);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .reader-shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }


  .case-document {
    padding-right: 0;
  }
}

@media (max-width: 900px) {
  :root {
    --shell: calc(100% - 32px);
  }

  .case-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-4);
  }

  .case-hero__meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--s-3);
  }

  .case-hero__thesis {
    grid-column: 1;
  }

  .reader-shell {
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--s-4);
  }

  .reader-sidebar {
    position: static;
    max-height: none;
    padding-right: 0;
    padding-bottom: var(--s-4);
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }

  .case-document {
    padding: var(--s-5) 0 0;
  }

  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 40px;
    padding: 0 var(--s-3);
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: none;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .toc-panel {
    display: none;
    padding-top: var(--s-4);
  }

  /* markdown-reader.js toggles `is-open` on the sidebar; aria-expanded is a
     belt-and-braces fallback if that ever changes. */
  .reader-sidebar.is-open .toc-panel,
  .toc-toggle[aria-expanded="true"] + .toc-panel {
    display: block;
  }

  .doc,
  .top,
  .case-header,
  .case-footer,
  .page > footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .doc {
    gap: var(--s-3);
  }

  .opens {
    width: 100%;
  }

  .opens__btn {
    min-height: 42px;
  }

  .markdown-body h2 {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
