/* Case study · an editorial sheet: cover, facts, a numbered story and the next case. */
.dlg {
  width: min(1180px, calc(100vw - 32px)); height: calc(100dvh - 32px); max-height: none;
  margin: 16px auto auto; border-radius: 20px; padding: 0; background: #fbfaf7; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 50px 120px -40px rgba(20,14,10,.6);
}
.dlg::backdrop { background: rgba(24,18,14,.62); backdrop-filter: blur(6px); }
.dlg[open] { animation: case-in .55s cubic-bezier(.22,.7,.2,1); }
@keyframes case-in { from { opacity: 0; transform: translateY(28px) scale(.985); } }
#dlgInner { min-height: 100%; }

/* Cover */
.case-cover { position: relative; min-height: clamp(420px, 62vh, 640px); color: #fff; display: flex; flex-direction: column; justify-content: space-between; isolation: isolate; overflow: hidden; border-radius: 20px 20px 0 0; }
.case-cover__media { position: absolute; inset: 0; z-index: -1; }
.case-cover__media .work-cover { width: 100%; height: 100%; object-fit: cover; transform: scale(1.03); animation: case-cover 14s ease-out forwards; }
@keyframes case-cover { to { transform: scale(1); } }
.case-cover__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,8,7,.55) 0%, rgba(10,8,7,.08) 32%, rgba(10,8,7,.25) 58%, rgba(10,8,7,.86) 100%); }
.case-cover__media .work-print { position: absolute; inset: 0; display: grid; place-items: center; }
.case-cover__bar { display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(18px, 3vw, 32px); }
.case-cover__actions { display: flex; gap: 8px; }
.case-pill {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-radius: 999px;
  color: #fff; font-size: 14px; font-weight: 500; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(12px); transition: background .2s;
}
.case-pill:hover { background: rgba(255,255,255,.28); }
.case-pill--icon { width: 40px; padding: 0; justify-content: center; font: 500 12px var(--mono); }
.case-pill svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.case-cover__title { padding: 0 clamp(22px, 5vw, 64px) clamp(30px, 4.5vw, 56px); max-width: 980px; }
.case-cover__kicker { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font: 500 11.5px/1.3 var(--mono); letter-spacing: .07em; text-transform: uppercase; opacity: .92; margin-bottom: 18px; }
.case-cover__mark { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.94); }
.case-cover__mark .brand-mark { display: block; max-width: none; height: auto; }
.case-cover h2 { font: 500 clamp(36px, 5.2vw, 72px)/1.0 var(--display); letter-spacing: -.035em; text-wrap: balance; max-width: 16ch; }
.case-cover__teaser { margin-top: 18px; max-width: 52ch; font-size: clamp(16px, 1.35vw, 19px); line-height: 1.5; color: rgba(255,255,255,.86); }

/* Facts */
.case-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0 clamp(22px, 5vw, 64px); border-bottom: 1px solid var(--line-2); }
.case-facts div { padding: 22px 20px 22px 0; }
.case-facts div + div { padding-left: 20px; border-left: 1px solid var(--line-2); }
.case-facts dt { font: 500 11px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.case-facts dd { margin-top: 8px; font: 500 17px/1.35 var(--display); letter-spacing: -.01em; color: var(--ink); }

/* Story */
.case-body { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); padding: clamp(40px, 5vw, 72px) clamp(22px, 5vw, 64px) clamp(28px, 4vw, 56px); }
.case-index { position: sticky; top: 28px; align-self: start; display: grid; gap: 2px; }
.case-index a { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); transition: color .2s; }
.case-index a span { font: 500 11px var(--mono); }
.case-index a:hover, .case-index a.is-current { color: var(--ink); }
.case-index a.is-current { border-bottom-color: var(--ink); }
.case-story { display: grid; gap: clamp(40px, 5vw, 64px); max-width: 760px; }
.case-chapter { scroll-margin-top: 24px; }
.case-chapter__n { font: 500 11.5px/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.case-lead { font: 450 clamp(22px, 2.1vw, 30px)/1.32 var(--display); letter-spacing: -.02em; color: var(--ink); text-wrap: pretty; }
.case-text { font-size: 18px; line-height: 1.7; color: #3a332f; }
.case-result blockquote { margin: 0; padding: clamp(24px, 3vw, 40px); border-radius: 18px; font: 450 clamp(21px, 2vw, 28px)/1.35 var(--display); letter-spacing: -.02em; color: var(--ink); background: linear-gradient(135deg, #f3ece0, #ece6db); position: relative; }
.case-result blockquote::before { content: "“"; position: absolute; top: -.18em; left: .3em; font-size: 4em; line-height: 1; color: rgba(31,28,27,.12); font-family: Georgia, serif; }
.case-figure { margin: 0; }
.case-figure img { display: block; width: 100%; border-radius: 14px; border: 1px solid var(--line-2); box-shadow: 0 30px 60px -40px rgba(20,14,10,.45); }
.case-figure figcaption { margin-top: 12px; font-size: 13px; color: var(--muted); }
.case-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.case-tools-grid li { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.case-tools-grid svg { width: 18px; height: 18px; fill: var(--brand); flex: none; }
.case-tool-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); opacity: .35; flex: none; }
.case-cta { display: flex; gap: 10px; flex-wrap: wrap; }

/* Next case */
.case-next {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; isolation: isolate; overflow: hidden;
  margin: 0 clamp(12px, 2vw, 20px) clamp(12px, 2vw, 20px); min-height: 260px; padding: clamp(24px, 4vw, 48px); border-radius: 16px; color: #fff; border: 0;
}
.case-next__media { position: absolute; inset: 0; z-index: -1; background: #2a2320; }
.case-next__media img { width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: transform .9s cubic-bezier(.22,.7,.2,1); }
.case-next__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,8,7,.82), rgba(10,8,7,.25)); }
.case-next:hover .case-next__media img { transform: scale(1.04); }
.case-next__copy { display: grid; gap: 8px; }
.case-next__copy span { font: 500 11px var(--mono); letter-spacing: .07em; text-transform: uppercase; opacity: .8; }
.case-next__copy strong { font: 500 clamp(26px, 3vw, 40px)/1.05 var(--display); letter-spacing: -.03em; }
.case-next__copy em { font-style: normal; font-size: 14px; opacity: .8; }
.case-next__go { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--ink); transition: transform .3s; }
.case-next__go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.case-next:hover .case-next__go { transform: translateX(4px); }

@media (max-width: 860px) {
  .case-body { grid-template-columns: 1fr; }
  .case-index { display: none; }
}
@media (max-width: 640px) {
  .dlg { width: 100vw; height: 100dvh; margin: 0; border-radius: 0; }
  .case-cover { border-radius: 0; min-height: 78vh; }
  .case-facts { grid-template-columns: 1fr 1fr; }
  .case-facts div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .case-facts div:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .case-text { font-size: 16.5px; }
  .case-next { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .dlg[open], .case-cover__media .work-cover { animation: none; }
}
/* Earlier dialog rules positioned these absolutely; inside the cover bar they sit in the flow. */
.case-cover__actions .case-pill, .case-cover__actions .dlg__close, .case-cover__actions .dlg__lang { position: static; inset: auto; width: 40px; height: 40px; min-width: 0; min-height: 0; border-radius: 999px; }
.case-cover__actions .dlg__close svg { stroke: #fff; }
.case-pill:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.case-next__copy { color: #fff; }
.case-next__copy span, .case-next__copy em { color: rgba(255,255,255,.82); opacity: 1; }
.case-next__copy strong { color: #fff; }
@media (max-width: 640px) {
  dialog.dlg { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .case-facts { margin-inline: 22px; }
}

.case-views { margin-top: 24px; }
.case-views__pick {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 12px; margin: 0 0 16px; padding: 0; min-inline-size: 0; border: 0;
}
.case-views__pick label {
  position: relative; display: flex; align-items: baseline; gap: 8px; padding: 12px 2px; min-height: 44px;
  border-bottom: 1px solid var(--line-2); color: var(--muted); font-size: .91rem; line-height: 1.35; cursor: pointer;
}
.case-views__number { font: 500 .7rem/1.4 var(--mono); }
.case-views__pick label:has(:checked) { color: var(--ink); border-color: var(--ink); box-shadow: 0 1px var(--ink); }
.case-views__pick label:has(:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.case-lesson { overflow: hidden; border: 1px solid var(--line-2); border-radius: 14px; background: #fff; }
.case-lesson__image { display: block; width: 100%; background: #fff; cursor: zoom-in; }
.case-lesson__image img { width: 100%; aspect-ratio: 48/35; object-fit: contain; border: 0; border-radius: 0; box-shadow: none; }
.case-lesson__image:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.case-lesson figcaption {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 18px; padding: 14px 18px; margin: 0; border-top: 1px solid var(--line);
  font-size: .94rem; line-height: 1.5;
}
.case-lesson figcaption div { flex: 1 1 260px; }
.case-lesson figcaption strong { font-weight: 600; color: var(--ink); }
.case-lesson figcaption p { margin: 3px 0 0; }
.case-lesson__zoom, .case-related { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); }
.case-lesson__zoom { font-size: .83rem; font-weight: 550; }
.case-lesson__zoom svg, .case-related svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; }
.case-related { justify-self: start; text-decoration: underline; text-underline-offset: 4px; }

.pcard[data-case="stellecta"] .work-cover { object-position: 50% 30%; }
.dlg[data-open-case="stellecta"] .case-cover {
  display: grid; grid-template-columns: 1fr 1.15fr; grid-template-areas: "bar bar" "title screen";
  align-items: center; gap: 22px clamp(20px, 3vw, 42px); min-height: 0; background: #28243b;
  padding: 0 clamp(22px, 4vw, 52px) clamp(32px, 4.6vw, 60px);
}
.dlg[data-open-case="stellecta"] .case-cover__bar { grid-area: bar; padding: 18px 0; }
.dlg[data-open-case="stellecta"] .case-cover__title { grid-area: title; padding: 0; }
.dlg[data-open-case="stellecta"] .case-cover__title h2 { font-size: clamp(38px, 4.4vw, 62px); }
.dlg[data-open-case="stellecta"] .case-cover__media {
  grid-area: screen; position: static; z-index: 0; min-width: 0; overflow: hidden; border-radius: 9px;
  outline: 1px solid rgb(255 255 255 / 20%); box-shadow: 0 24px 50px -26px #100e1c;
}
.dlg[data-open-case="stellecta"] .case-cover__media .pcard__bg,
.dlg[data-open-case="stellecta"] .case-cover__media::after { display: none; }
.dlg[data-open-case="stellecta"] .case-cover__media .work-cover {
  display: block; width: 100%; height: auto; aspect-ratio: 48/35; object-fit: contain; transform: none; animation: none;
}
@media (max-width: 760px) {
  .dlg[data-open-case="stellecta"] .case-cover { grid-template-columns: minmax(0, 1fr); grid-template-areas: "bar" "title" "screen"; }
  .case-views__pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
