.case-reader {
  max-width: 1250px;
  display: grid;
  grid-template-columns: minmax(200px, 250px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(32px, 6vw, 90px);
  padding: 52px 5% 80px;
}
.case-reader aside {position:sticky; top:100px}
.chapter-menu nav {display:grid;gap:0}
.chapter-menu summary {font-weight:600;cursor:pointer;margin-bottom:10px}
.chapter-menu a {border-left:1px solid var(--rule);text-decoration:none;padding:8px 14px;color:var(--muted)}
.chapter-menu a:hover {color:var(--ink)}
.chapter-menu a[aria-current] {border-left:2px solid var(--site-accent);color:#23483f;font-weight:600}
.profile-control {margin-top:22px}
.profile-evidence a {display:block;width:fit-content;margin:5px 0}
.chapter {scroll-margin-top:100px}
.chapter h1,.chapter h2 {font:400 clamp(33px,3.5vw,50px)/1.12 var(--font-display);margin:0 0 26px;max-width:30ch}
.chapter p {max-width:72ch;line-height:1.7}
.chapter .eyebrow {color:var(--muted);margin-bottom:12px}
.matrix {overflow:auto;margin:24px 0 30px}
.matrix table {width:100%;border-collapse:collapse;font-size:15px}
.matrix th,.matrix td {padding:12px;text-align:left;vertical-align:top;border-bottom:1px solid var(--rule)}
.matrix thead {background:var(--surface-inverse);color:var(--on-dark)}
.matrix tbody th {background:var(--surface-soft);color:var(--site-accent)}
.reader-actions {border-top:1px solid var(--rule);margin-top:30px;padding-top:18px;align-items:baseline;justify-content:space-between;gap:12px}
.reader-actions .next {margin-left:auto;color:var(--site-accent)}
.portfolio-header nav a:hover {text-decoration:underline}
@media(max-width:900px){
 .case-reader {display:block;padding:0 5% 48px}
 .case-reader aside {position:static;margin-bottom:24px}
 .chapter {padding-top:28px;margin-bottom:32px;scroll-margin-top:72px}
 .matrix:has(th:nth-child(4)) table {min-width:640px}
 .profile-control {margin-top:12px}
 .profile-columns {grid-template-columns:minmax(0,1fr)}
}

.role-grid {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:24px 0}
.role-grid p {background:var(--surface-soft);border-top:3px solid var(--site-accent);padding:16px;margin:0}
.role-grid strong {display:block;margin-bottom:8px}
.profile-open {display:inline-flex;align-items:center;gap:8px;text-align:left}
.profile-open svg {width:34px;height:34px;flex:none}
@media(max-width:700px){
  .role-grid {grid-template-columns:1fr}
  .matrix:has(th:nth-child(4)) th:first-child {position:sticky;left:0;max-width:110px}
  .matrix thead th:first-child {background:var(--surface-inverse)}
}
@media (max-width:900px) {
  .case-reader aside {
    position:sticky;top:var(--header-height,70px);z-index:5;
    margin:0 -5.56% 0;padding:0 5%;background:var(--surface);
    border-bottom:0;
  }
  .case-reader aside > .eyebrow,.case-reader aside > .profile-control {display:none}
  .chapter-menu {position:relative}
  .chapter-menu summary {padding:12px 0;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .chapter-menu .current-chapter {font-weight:400;color:var(--muted);padding-left:8px}
  .chapter-menu[open] {max-height:calc(90svh - var(--header-height,70px));overflow-y:auto}
  .mobile-profile {padding:10px 0}
  .chapter {scroll-margin-top:calc(var(--header-height,70px) + 48px)}
}
@media (min-width:901px) {
  .current-chapter,.mobile-profile {display:none}
}
@media(max-width:900px) {
  .case-reader aside {display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
  .case-reader aside > .profile-control {display:block;margin:0}
  .chapter-menu[open] {overflow:visible}
  .chapter-menu[open] nav {position:absolute;left:0;top:100%;width:min(90vw,32rem);max-height:55svh;overflow:auto;background:var(--surface);box-shadow:0 8px 16px #17291f22;border:1px solid var(--rule);z-index:6}
}

@media(max-width:900px){
 .case-reader aside .chapter-menu {position:static}
 .case-reader aside .chapter-menu[open] nav {left:0;right:0;width:auto;max-height:min(52svh,25rem);padding:10px 5% 16px;background:var(--surface);border:0;border-block:1px solid var(--rule);box-shadow:none;overscroll-behavior:contain}
 .chapter-menu summary {display:flex;align-items:center;min-height:48px;gap:8px;list-style:none}
 .chapter-menu summary::-webkit-details-marker {display:none}
 .chapter-menu summary::after {content:"⌄";margin-left:auto;margin-right:8px;color:var(--muted)}
 .chapter-menu[open] summary::after {transform:rotate(180deg)}
 .chapter-menu .current-chapter {padding:0;overflow:hidden;text-overflow:ellipsis}
 .chapter-menu a[aria-current] {background:transparent;font-weight:600}
}

.chapter-menu summary {font:700 .7rem/1.4 var(--font-body);letter-spacing:.095em;text-transform:uppercase;color:var(--blog-muted)}
.chapter-menu a {font:400 .79rem/1.38 var(--font-body);padding:.38rem .1rem .38rem .85rem;color:var(--blog-faint)}
.chapter-menu a[aria-current] {font-weight:600;color:#23483f}
.reading-progress {display:none}
@media(max-width:900px){
 .reading-progress {position:fixed;inset:0 0 auto;display:block;height:3px;z-index:150;pointer-events:none}
 .reading-progress span {display:block;width:100%;height:100%;background:var(--site-accent);transform:scaleX(0);transform-origin:left center}
 .chapter-menu summary {font:650 .78rem/1.4 var(--font-body);color:var(--ink);text-transform:none;letter-spacing:normal}
 .chapter-menu .current-chapter {color:var(--blog-muted)}
 .chapter-menu a {font-size:.88rem;padding-block:.55rem}
}

/* Match the blog article reading measure, weight and optical spacing. */
.chapter > p:not(.eyebrow), .chapter .case-note p {
  color:var(--ink);
  font:400 clamp(1.0625rem,1.1vw,1.16rem)/1.76 var(--font-body);
  letter-spacing:-.006em;
}
.chapter > p strong, .case-note p strong {font-weight:650}
@media(max-width:44rem){
  .chapter > p:not(.eyebrow), .chapter .case-note p {font-size:1.0625rem;line-height:1.72}
}
@media(max-width:900px){
  .case-reader aside::after {content:"";position:absolute;bottom:0;left:5%;right:5%;border-bottom:1px solid var(--rule);pointer-events:none}
  .case-reader aside .chapter-menu[open] nav {border-top:0;border-bottom:0}
  .chapter-menu[open] nav::after {content:"";position:absolute;bottom:0;left:5%;right:5%;border-bottom:1px solid var(--rule)}
}
