#cases {
  --case-ink: #9b4139;
  --case-line: var(--line, #d7dce1);
  --case-muted: var(--soft, #576574);
  color: var(--ink, #2b3540);
  border-top: 1px solid var(--case-line);
  scroll-margin-top: calc(var(--nav-height, 68px) + 10px);
}
#cases:empty {display: none;}
#cases .cs-inner {padding-block: clamp(44px, 5.6vw, 82px);}
#cases .cs-intro {display: grid; grid-template-columns: 1.12fr .88fr; gap: clamp(24px, 7vw, 90px); align-items: end; margin-bottom: 26px;}
#cases .cs-intro h2 {max-width: 16ch; font: 500 clamp(40px, 4.5vw, 68px)/1 var(--serif, Georgia, serif); letter-spacing: -.05em;}
#cases .cs-intro em {color: var(--case-ink); font-weight: inherit;}
#cases .cs-intro p {max-width: 44ch; color: var(--body); font: 400 clamp(15px,1.18vw,18px)/1.6 var(--sans, system-ui, sans-serif);}
#cases .cs-chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 0 clamp(20px, 3.5vw, 58px);
  border-bottom: 1px solid var(--case-line);
}
#cases .cs-chooser button {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 5px 0 8px;
  text-align: left;
  background: transparent;
  color: var(--body);
}
#cases .cs-chooser button span {font: 600 clamp(15px,1.18vw,18px)/1.3 var(--sans);}
#cases .cs-chooser button::after {
  position: absolute;
  content: '';
  inset: auto 0 -1px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease-out;
}
#cases .cs-chooser button[aria-pressed=true] {color: var(--case-ink);}
#cases .cs-chooser button[aria-pressed=true]::after {transform: scaleX(1);}
#cases :is(button, input):focus-visible {outline: 2px solid currentColor; outline-offset: 3px;}
#cases .cs-board {scroll-margin-top: calc(var(--nav-height, 68px) + 10px);}
#cases .cs-bar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 8px 20px; padding: 15px 0 2px;
  font: 500 14px/1.5 var(--sans); color: var(--case-muted);
}
#cases .cs-bar ol {display: flex; list-style: none; margin: 0; padding: 0;}
#cases .cs-bar li {display: flex; align-items: baseline; gap: 5px; white-space: nowrap;}
#cases .cs-bar li + li::before {content: ''; align-self: center; width: clamp(7px,1vw,18px); height: 1px; background: var(--case-line); margin: 0 3px;}
#cases .cs-bar li i {font-style: normal; font-variant-numeric: tabular-nums;}
#cases .cs-bar [aria-current] {font-weight: 700; color: var(--case-ink);}
#cases .cs-bar [data-done="true"] i {color: var(--teal);}
#cases .cs-stage {display: grid; grid-template-columns: minmax(0,1.07fr) minmax(0,.93fr); gap: clamp(20px,3.7vw,64px); align-items: center; padding: clamp(18px,2.5vw,36px) 0 0;}
#cases .cs-visual, #cases .cs-copy, #cases .cs-figure {min-width: 0;}
#cases .cs-figure {margin: 0;}
#cases .cs-photo {display: grid; place-items: center; width: 100%; min-height: 160px; height: clamp(216px,22vw,310px); overflow: hidden;}
#cases .cs-image {display: grid; width: 100%; height: 100%; min-height: 0; place-items: center; overflow: hidden;}
#cases .cs-image img {max-width: 100%; max-height: 100%; min-height: 0; min-width: 0; width: 100%; height: 100%; object-fit: contain;}
#cases .cs-figure figcaption {margin-top: 8px; color: var(--case-muted); font: 500 14px/1.45 var(--sans);}
#cases .cs-pair {display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px;}
#cases .cs-pair .cs-photo {height: auto; min-height: 0; aspect-ratio: 1;}
#cases .cs-photo[data-crop] {padding: 12px;}
#cases .cs-photo[data-crop] .cs-image {position: relative; display: block; height: auto;}
#cases .cs-photo[data-crop] img {position: absolute; max-width: none; max-height: none; height: auto; object-fit: fill;}
/* Both views are crops of the original 844px board. Columns G–L occupy x=432…843. */
#cases .cs-photo[data-crop=row] .cs-image {aspect-ratio: 412/96;}
#cases .cs-photo[data-crop=row] img {width: 204.8544%; left: -104.8544%; top: 0;}
/* The 64px square at (708,28) is the card face at aK. */
#cases .cs-photo[data-crop=tile] .cs-image {width: min(132px,80%); aspect-ratio: 1;}
#cases .cs-photo[data-crop=tile] img {width: 1318.75%; left: -1106.25%; top: -43.75%; image-rendering: pixelated;}
#cases .cs-projection {margin: 0;}
#cases .cs-diagram {display: flex; align-items: center; justify-content: center; gap: clamp(10px,2vw,30px); padding-block: 10px; min-height: 240px;}
#cases .cs-grid {display: grid; grid-template-columns: repeat(10,1fr); grid-template-rows: repeat(20,1fr); height: 242px; aspect-ratio: 1/2; padding: 1px; gap: 1px; background: #d3dde1; border: 1px solid #a1afb8;}
#cases .cs-grid i {background: #fff;}
#cases .cs-grid i.active, #cases .cs-grid-key .active::before {background: #1d5172;}
#cases .cs-grid i.stack, #cases .cs-grid-key .stack::before {background: #81939c;}
#cases .cs-grid i.landing, #cases .cs-grid-key .landing::before {background: #f7c987; box-shadow: inset 0 0 0 1px #995c19;}
#cases .cs-grid-key {display: grid; gap: 9px; color: var(--body); font-size: 14px;}
#cases .cs-grid-key span {display: flex; gap: 6px; align-items: center;}
#cases .cs-grid-key span::before {content: ''; width: 11px; height: 11px; flex-shrink: 0;}
#cases .cs-projection figcaption {display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 9px; margin: 8px 0 0; font-size: 14px; color: var(--case-muted);}
#cases .cs-projection figcaption strong {color: var(--case-ink); font: 650 14px/1.4 var(--sans, system-ui, sans-serif);}
#cases .cs-copy {animation: cs-arrive .36s cubic-bezier(.18,.72,.24,1) both;}
#cases .cs-visual > * {animation: cs-photo-in .45s cubic-bezier(.18,.72,.24,1) both;}
#cases .cs-grid[data-preview="true"] i.landing {animation: cs-drop .42s cubic-bezier(.4,0,.82,1) both;}
#cases .cs-copy h3 {margin: 8px 0 12px; color: var(--ink); letter-spacing: -.035em; font: 500 clamp(27px,2.5vw,39px)/1.02 var(--serif, Georgia, serif);}
#cases .cs-copy h3:focus {outline: none;}
#cases .cs-copy > p {font: 400 14px/1.55 var(--sans, system-ui, sans-serif); color: var(--body);}
#cases .cs-copy .cs-feedback {color: var(--case-ink); font-weight: 650; margin-bottom: 7px;}
#cases .cs-options {display: flex; flex-wrap: wrap; gap: 0 18px; border: 0; padding: 0; margin: 15px 0 0;}
#cases .cs-options legend {font: 600 13px/1.4 var(--sans); color: var(--ink); padding: 0;}
#cases .cs-options label {display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer;}
#cases .cs-options input {accent-color: var(--case-ink); width: 15px; height: 15px; margin: 0;}
#cases .cs-options span {font: 500 13px/1.3 var(--sans);}
#cases .cs-options input:checked + span {color: var(--case-ink); text-decoration: underline; text-underline-offset: 4px;}
#cases .cs-photo-options {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr));
  align-items: start; gap: clamp(7px,1vw,14px); min-width: 0;
}
#cases .cs-photo-options legend {position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);}
#cases .cs-photo-options label {display: grid; gap: 7px; align-items: start; min-width: 0;}
#cases .cs-photo-options img {width: 100%; height: auto; display: block; border-radius: 3px;}
#cases .cs-photo-label {display: flex; align-items: baseline; gap: 5px;}
#cases .cs-photo-label input {flex: 0 0 auto; align-self: start; margin-top: 1px;}
#cases .cs-photo-options label:has(:checked) img,
#cases .cs-photo-options label:has(:focus-visible) img {outline: 2px solid var(--case-ink); outline-offset: 1px;}
#cases .cs-actions {display: flex; align-items: center; gap: 3px 23px; flex-wrap: wrap; margin-top: 13px;}
#cases .cs-actions button {border: 0; border-radius: 0; background: transparent; min-height: 44px; padding: 0; text-align: left;}
#cases .cs-action {display: inline-flex; align-items: center; gap: 9px; color: var(--case-ink); font: 650 15px/1.35 var(--sans); text-decoration: underline; text-underline-offset: 5px;}
#cases .cs-arrow {font-size: 18px; line-height: 1; transition: transform .2s;}
#cases .cs-action:disabled {color: var(--case-muted); opacity: .7; text-decoration: none; cursor: default;}
#cases .cs-action:not(:disabled) .cs-arrow {animation: cs-cue .8s .15s 2;}
#cases .cs-link {color: var(--body); font: 500 13px/1.4 var(--sans); text-decoration: underline; text-underline-offset: 3px;}
@keyframes cs-arrive {from {opacity: 0; transform: translateY(8px);} to {opacity: 1; transform: none;}}
@keyframes cs-photo-in {from {opacity: .25; transform: translateX(-6px);} to {opacity: 1; transform: none;}}
@keyframes cs-cue {50% {transform: translateX(3px);}}
@keyframes cs-drop {from {opacity: .35; transform: translateY(var(--drop-start));} to {opacity: 1; transform: none;}}
@media (hover: hover) {
  #cases .cs-chooser button:hover, #cases .cs-actions button:hover:not(:disabled), #cases .cs-options label:hover {color: var(--case-ink);}
  #cases .cs-chooser button[aria-pressed=false]:hover::after {transform: scaleX(1); height: 1px;}
  #cases .cs-action:hover:not(:disabled) .cs-arrow {transform: translateX(3px);}
}
@media(max-width: 760px) {
  #cases .cs-intro {grid-template-columns: 1fr; gap: 10px; margin-bottom: 18px;}
  #cases .cs-intro h2 {max-width: none;}
  #cases .cs-stage {grid-template-columns: 1fr; gap: 17px;}
  #cases .cs-photo {height: clamp(175px,45vw,230px); min-height: 0;}
  #cases .cs-pair .cs-photo {max-height: 210px;}
  #cases .cs-copy h3 {margin: 6px 0 9px;}
  #cases .cs-diagram {min-height: 0;}
  #cases .cs-grid {height: 195px;}
}
@media(max-width: 620px) {
  #cases .cs-chooser {display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 14px;}
  #cases .cs-chooser button {width: fit-content; max-width: 100%; padding-block: 5px 9px;}
  #cases .cs-bar {padding-top: 13px;}
  #cases .cs-actions {gap: 2px 16px;}
  #cases .cs-photo[data-crop] {padding: 6px;}
  #cases .cs-pair {gap: 6px;}
}
@media(prefers-reduced-motion: reduce) {
  #cases *, #cases *::before, #cases *::after {animation: none !important; transition: none !important;}
}
