/* Vertical case study structure from the supplied Figma reference. */
.case-study-page {
  --case-width: 720px;
  min-height: 100dvh;
  background: var(--home-bg);
  font-family: "Suisse Intl", Arial, sans-serif;
}
.case-study-header {
  position: absolute;
  z-index: 5;
  top: 32px;
  left: 50%;
  width: min(calc(100% - 32px), calc(var(--case-width) - 34px));
  transform: translateX(-50%);
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}
.case-close { display: grid; place-items: center; width: 48px; height: 48px; pointer-events: auto; border-radius: 50%; }
.case-close-icon { display: block; width: 48px; height: 48px; background: var(--home-accent); mask: url('../asset/home/case-close.svg') center / contain no-repeat; }
:root[data-theme="light"] .case-close-icon,
.case-close:is(:hover, :focus-visible) .case-close-icon { background: #000; }
.case-close:is(:hover, :focus-visible) { background: var(--home-accent); }
.case-study {
  position: relative;
  width: min(100%, var(--case-width));
  margin-inline: auto;
  padding: 128px 16px 0;
  border-inline: 1px solid var(--home-border);
}
.case-introduction { width: min(100%, 534px); margin: 0 auto; text-align: left; }
.case-introduction h1 {
  margin: 0 0 32px;
  font: 700 48px/1.2 "Beirut Display", Georgia, serif;
  color: var(--home-heading);
  letter-spacing: -.00723em;
  overflow-wrap: anywhere;
}
.case-summary { max-width: 534px; margin: 0; font-size: 20px; line-height: 1.4; text-wrap: balance; }
.case-narrative { width: min(100%, 534px); margin: 0 auto; font-size: 20px; line-height: 1.4; }
.case-narrative p { margin: 0 0 28px; }
.case-narrative p:last-child { margin-bottom: 0; }
.case-narrative h2 { margin: 0 0 24px; font: 700 24px/1.2 "Beirut Display", Georgia, serif; color: var(--home-heading); }
.case-overview { width: 100%; margin-top: 24px; padding: 0; }
.case-details { display: flex; flex-direction: column; gap: 40px; margin: 40px 0 0; font-size: inherit; line-height: inherit; }
.case-details:not(:has(*)) { display: none; }
.case-details dt { margin-bottom: 16px; font: 700 24px/1.2 "Beirut Display", Georgia, serif; color: var(--home-heading); }
.case-details dd { margin: 0; }
/* Visit company pill from Figma (node 1247:7825). */
.case-visit { display: inline-flex; align-items: center; gap: 4px; margin-top: 40px; padding: 8px 8px 8px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.15); color: var(--home-heading); font: 400 16px/20px "Suisse Intl", Arial, sans-serif; text-decoration: none; transition: background-color 180ms ease, color 180ms ease; }
.case-visit-icon { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 4px; background: currentColor; mask: url('../asset/home/visit-arrow.svg') center / 20px 20px no-repeat; }
:root[data-theme="light"] .case-visit:not(:hover, :focus-visible) { background: rgba(0, 0, 0, 0.08); }
.case-visit:is(:hover, :focus-visible) { background: var(--home-accent); color: rgba(0, 0, 0, 0.9); text-decoration: none; }
.case-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 16px; margin: 120px auto 0; }
.case-gallery-item { grid-column: 1 / -1; margin: 0; overflow: hidden; border-radius: 32px; }
.case-gallery-item--half { grid-column: span 1; align-self: center; border-radius: 16px; }
.case-gallery-item img { display: block; width: 100%; height: auto; aspect-ratio: var(--ratio); object-fit: cover; }
.case-gallery-item--contain img { object-fit: contain; }
/* Image rows from the CMS. Pairs are two squares side by side; grids are three across. */
.case-gallery-row { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: inherit; }
.case-gallery-row--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.case-gallery-row > .case-gallery-item--half { align-self: start; }
/* Like the homepage: the column lines run down to the carousel, which is framed by
   full-width lines above and below. Padding (not margin) carries the column lines. */
.case-more { position: relative; margin-top: 0; padding-top: 332px; padding-bottom: 0; overflow: hidden; }
.case-more::before { content: ""; position: absolute; top: 0; height: 332px; left: 50%; width: min(100%, var(--case-width)); transform: translateX(-50%); border-inline: 1px solid var(--home-border); pointer-events: none; }
.case-study-page:has(.case-resize:is(:hover, :focus-visible)) .case-more::before,
.case-study-page.is-case-resizing .case-more::before { border-color: var(--home-accent); }
.case-more .home-projects { background: transparent; }
.case-more .home-projects-grid { height: calc(var(--wheel-height, 440px) + 2 * var(--card-row-gap)); }
.case-study-page :focus-visible { outline-color: var(--home-accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .case-study-header { top: 20px; }
  .case-study { width: 100%; border: 0; padding: 116px 16px 0; }
  .case-introduction h1 { margin-bottom: 24px; }
  .case-summary { font-size: 20px; }
  .case-narrative { font-size: 16px; }
  .case-overview { margin-top: 24px; }
  .case-gallery { margin-top: 64px; gap: 16px; }
  .case-gallery-item { border-radius: 20px; }
  .case-gallery-item--half { border-radius: 10px; }
  .case-more { margin-top: 0; padding-top: 96px; padding-bottom: 0; }
  .case-more::before { display: none; }
}
@media (max-width: 600px) {
  .case-gallery-item--half { grid-column: 1 / -1; }
  .case-gallery-row > .case-gallery-item--half { grid-column: auto; }
  .case-gallery-row--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: no-preference) {
  .case-introduction { animation: case-arrive 700ms cubic-bezier(.22, 1, .36, 1) backwards; }
  .case-introduction { animation-delay: 100ms; }
  .case-reveal { animation: case-arrive 650ms cubic-bezier(.22, 1, .36, 1) backwards; }
}
@keyframes case-arrive { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.case-background { margin-top: 32px; }
.case-background > summary { display: flex; align-items: center; gap: 8px; width: fit-content; list-style: none; font: 400 20px/24px "Beirut Text", Georgia, serif; cursor: var(--click-cursor, pointer); }
.case-background > summary::-webkit-details-marker { display: none; }
.case-background > summary .case-disclosure-icon { flex: 0 0 20px; width: 20px; height: 20px; transform: translateY(2px); background: currentColor; mask: url('../asset/home/plus.svg') center / 24px no-repeat; }
.case-background[open] > summary .case-disclosure-icon { transform: translateY(2px) rotate(45deg); }
.case-background:not([open]) .case-see-less,
.case-background[open] .case-see-more { display: none; }
.case-background > summary:is(:hover, :focus-visible) { color: var(--home-accent); }
.case-resize { position: fixed; z-index: 6; top: 50%; transform: translateY(-50%); left: calc((100vw - min(100vw, var(--case-width))) / 2 - 10px); width: 20px; height: 64px; display: grid; place-items: center; cursor: ew-resize; touch-action: none; color: var(--home-border); }
.case-resize span { width: 8px; height: 48px; border: 1px solid currentColor; background: var(--home-bg); border-radius: 8px; }
.case-study:has(.case-resize:is(:hover, :focus-visible)) .case-resize, .case-study-page.is-case-resizing .case-resize { color: var(--home-accent); }
.case-study-page.is-case-resizing { user-select: none; cursor: ew-resize; }
@media (max-width: 780px), (pointer: coarse) { .case-resize { display: none; } }

.case-study:has(.case-resize:is(:hover, :focus-visible)),
.case-study-page.is-case-resizing .case-study { border-color: var(--home-accent); }

.case-resize[data-resize-side="right"] { left: auto; right: calc((100vw - min(100vw, var(--case-width))) / 2 - 10px); }

/* Expanded introduction: overlays the artwork on a blurred, tinted panel
   instead of pushing the gallery down. */
.case-background { position: relative; z-index: 4; }
.case-background > summary { position: relative; }
.case-background.has-collapse[open] > summary { visibility: hidden; }
.case-background[open] > .case-overview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  margin-top: 0;
  padding-bottom: 56px;
  isolation: isolate;
}
.case-background[open] > .case-overview::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -32px;
  bottom: -240px;
  left: 50%;
  width: calc(min(100vw, var(--case-width)) - 2px);
  transform: translateX(-50%);
  background: linear-gradient(to bottom, var(--home-bg) 0, color-mix(in srgb, var(--home-bg) 82%, transparent) 40%, color-mix(in srgb, var(--home-bg) 55%, transparent) 100%);
  -webkit-backdrop-filter: blur(28px);
  backdrop-filter: blur(28px);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 240px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 240px), transparent);
  pointer-events: none;
}
.case-overview-section { margin-top: 40px; }
.case-overview-section h2 { margin: 0 0 16px; }
.case-overview-section p { margin: 0 0 20px; }
.case-overview-section p:last-child { margin-bottom: 0; }
.case-collapse { display: flex; align-items: center; gap: 8px; margin-top: 40px; padding: 0; border: 0; background: none; color: inherit; font: 400 20px/24px "Beirut Text", Georgia, serif; cursor: var(--click-cursor, pointer); }
.case-collapse[hidden] { display: none; }
.case-collapse .case-disclosure-icon { flex: 0 0 20px; width: 20px; height: 20px; transform: translateY(2px) rotate(45deg); background: currentColor; mask: url('../asset/home/plus.svg') center / 24px no-repeat; }
.case-collapse:is(:hover, :focus-visible) { color: var(--home-accent); }
@media (prefers-reduced-motion: no-preference) {
  .case-background[open] > .case-overview > * { animation: case-overview-in 360ms cubic-bezier(.22, 1, .36, 1); }
}
@keyframes case-overview-in { from { opacity: 0; } to { opacity: 1; } }
