/* Case page template (Figma 64:380 desktop, 83:663 mobile).
   Used by /projects/nobis-bank/, /projects/agroros-bank/, /projects/be-spoken/. */

/* ---------- Sections ---------- */
/* Image corner radius for the whole case page (cover in the hero included): 12px, 8px on mobile */
main { --img-radius: var(--radius-image); }
.case-section {
  padding: 120px 0;
  --label: var(--text-primary);
  --statement: var(--text-heading-grey);
  --text: var(--text-body);
  --title: var(--text-primary);
}
.case-section.section--dark {
  --label: var(--text-on-dark);
  --statement: var(--text-on-dark-display);
  --text: var(--text-on-dark-muted);
  --title: var(--text-on-dark);
}
.case-section > .container { display: flex; flex-direction: column; gap: 48px; }

.case-label { font: 400 16px/normal var(--font); color: var(--label); }          /* Label/16 */
.case-statement { font: 400 40px/1.2 var(--font); color: var(--statement); }    /* Display/40 120% */
.case-statement--wide { max-width: 760px; }
.case-statement--900 { max-width: 900px; }

/* Statement left (560px), text right */
.case-row { display: flex; gap: 80px; align-items: flex-start; }
.case-row > :first-child { flex: 0 0 560px; }
.case-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  font: 400 16px/1.5 var(--font); /* Body/16 */
  color: var(--text);
}
.case-text__strong { font-weight: 500; line-height: normal; color: var(--text-primary); } /* Label/16 Medium */

/* Images: full container width, never cropped */
.case-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--img-radius);
}
.case-img-card {                       /* images on dark sections sit on white cards; */
  border-radius: var(--radius-panel);   /* the white and the 24px padding are inside the file */
  background: var(--surface-white);     /* (so the viewer shows them too) */
  overflow: hidden;
}
.case-img-card .case-img { border-radius: 0; }

/* Looping video in place of an image (Be.Spoken Press, 82:471): same frame size as the Figma layer */
.case-video { aspect-ratio: 1248 / 691; object-fit: cover; background: #111; pointer-events: none; }
/* No Safari play button over the muted looping videos (shown when autoplay is not allowed) */
.case-video::-webkit-media-controls,
.case-video::-webkit-media-controls-start-playback-button { display: none !important; -webkit-appearance: none; }
.case-video--native { aspect-ratio: auto; object-fit: fill; } /* Be.Spoken Overview 2: the video's own 1856×1016 proportions, never cropped */

/* Several images in a row of the page (Be.Spoken 82:454, 82:462, 82:468) */
.case-images { display: flex; flex-direction: column; gap: 24px; }
/* Two images that read as one (Agroros "Website pages" 78:1345): rounded only on the outer corners */
.case-images--joined { gap: 0; }
/* (zoomable images sit in a .zoom-wrap, so match the image or its wrapper) */
.case-images--joined > :first-child, .case-images--joined > :first-child .case-img { border-radius: var(--img-radius) var(--img-radius) 0 0; }
.case-images--joined > :last-child, .case-images--joined > :last-child .case-img { border-radius: 0 0 var(--img-radius) var(--img-radius); }
.case-img--flat { border-radius: 0; }                         /* Agroros "Elements" (72:11696) */
.case-img--soft { border-radius: 8px; }                       /* Agroros "Contacts" (72:11678) */
.case-img-pad { padding-top: 20px; }                          /* Be.Spoken palette (72:11699) */
.case-img-pad .case-img { border-radius: var(--radius-panel); }

/* ---------- Case hero (64:394) ---------- */
.case-hero { padding: 64px 0 96px; }
.case-hero > .container { display: flex; flex-direction: column; gap: 40px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font: 400 16px/normal var(--font);
  color: var(--text-muted);
}
.back-link .icon { width: 1.15em; height: 1.15em; }
.case-title-block { display: flex; flex-direction: column; gap: 24px; }
.case-title { font: 400 80px/1 var(--font); color: var(--text-primary); }      /* Display/80 100% */
.case-lead { max-width: var(--lead-w, 900px); font: 400 32px/1.25 var(--font); color: var(--text-heading-grey); } /* Heading/32 125% */
.case-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.case-chips li {
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
  border-radius: var(--radius-pill);
  font: 400 14px/normal var(--font); /* Caption/14 */
  color: var(--text-body);
}
.case-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  padding-top: 32px;
  border-top: 1px solid color-mix(in srgb, var(--text-primary) 12%, transparent);
}
.case-meta div { display: flex; flex-direction: column; gap: 8px; }
.case-meta dt { font: 400 14px/normal var(--font); color: var(--text-muted); }
.case-meta dd { margin: 0; font: 400 16px/1.5 var(--font); color: var(--text-primary); }

/* ---------- Overview (64:428) ---------- */
.case-overview { padding: 24px 0 120px; }
.case-overview > .container { gap: 40px; }

/* ---------- Working process (64:436) ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 16px;
}
.step {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 28px;
  border-radius: var(--radius-panel);
  background: color-mix(in srgb, var(--text-on-dark) 4%, transparent);
}
.step__num { font: 400 14px/normal var(--font); color: color-mix(in srgb, var(--text-on-dark-muted) 60%, transparent); }
.step__title { font: 400 22px/normal var(--font); color: var(--text-on-dark); } /* Heading/22 Regular */

/* ---------- Personas (64:459). Cards keep the type from Figma: IBM Plex Sans Light / Medium, 20/26px. ---------- */
.personas { display: flex; flex-direction: column; gap: 16px; }
.persona {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px;
  border: 1.7px solid #e9e9e9;
  border-radius: 32px;
  background: #f9f9f9;
  font: 300 20px/26px "IBM Plex Sans", var(--font);
  color: #000;
}
.persona__body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 24px; max-width: 654px; }
.persona__intro { display: flex; flex-direction: column; gap: 16px; }
.persona__head { display: flex; align-items: center; gap: 16px; }
.persona__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e9e9e9;
  color: #1c242e;
}
.persona__avatar .icon { width: 24px; height: 24px; }
.persona__name, .persona h4 { font-weight: 500; }
.persona__group { display: flex; flex-direction: column; gap: 8px; }
.persona__illustration {
  position: absolute;
  right: var(--r);
  bottom: var(--b);
  width: var(--w);
  max-width: none;
  height: auto;
}

/* ---------- Process & iteration (64:487) ---------- */
.case-screens > .container { gap: 120px; }
.case-screens__head { display: flex; flex-direction: column; gap: 24px; }
.case-block { display: flex; flex-direction: column; gap: 40px; }
.case-block__title { font: 400 32px/1.2 var(--font); color: var(--title); }      /* Heading/32 120% */
.case-block .case-text { gap: 8px; }
.case-text__label { font: 500 14px/normal var(--font); color: color-mix(in srgb, var(--text-on-dark-muted) 70%, transparent); } /* Caption/14 Medium */

/* ---------- Engagement & growth (64:525) ---------- */
.case-subrow { padding-top: 40px; }
.case-note {
  padding-top: 40px;
  border-top: 1px solid color-mix(in srgb, var(--text-primary) 12%, transparent);
}
.case-note__label { font: 400 14px/normal var(--font); color: var(--text-muted); }
.case-note .case-text { color: var(--text-primary); }
.case-note__small { font-size: 14px; color: var(--text-muted); }

/* Meta value that is a link (Be.Spoken "be-spoken.ru ↗") */
.case-meta a { display: inline-flex; align-items: center; gap: 2px; }
.case-meta a .icon { width: 1.15em; height: 1.15em; }

/* ---------- About this project (Agroros 78:1434) ---------- */
.case-about { padding: 64px 0 96px; }
.case-about .case-row { gap: 80px; font: 400 14px/1.5 var(--font); color: var(--text-muted); }
.case-about .case-row > :first-child { line-height: normal; }

/* ---------- Next project (64:541) ---------- */
.case-next > .container { gap: 24px; }
.next-link {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  align-self: flex-start;
  font: 400 60px/normal var(--font); /* Display/60 */
  color: var(--text-on-dark-display);
}
.next-link .icon { width: 70px; height: 70px; }
.case-next .back-link { color: color-mix(in srgb, var(--text-on-dark-muted) 70%, transparent); }

/* ---------- Narrower desktop: 768–1279px ---------- */
@media (max-width: 1279.98px) {
  .case-row { gap: 48px; }
  .case-row > :first-child { flex-basis: 45%; }
  /* Persona cards switch to the stacked layout: illustration on top */
  /* Figma 83:748: illustration on top, the whole cut-out shown (contain), never cropped */
  .persona { justify-content: flex-start; gap: 20px; }
  .persona__figure { position: relative; width: 100%; max-width: 300px; margin-inline: auto; aspect-ratio: var(--ratio); }
  .persona__figure picture { display: contents; }
  .persona__illustration { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 0; }
  /* Diego (Figma 83:924): wide source, so the picture fills the box and only the empty sides are cut */
  .persona--cover .persona__illustration { object-fit: cover; object-position: center; }
  /* Name row: 40px icon, 16px gap, "Name," / "Role" on two lines, icon centred on them, 8px extra below */
  .persona__head { padding-bottom: 8px; }
  .persona__role { display: block; }
}
@media (min-width: 1280px) {
  .persona__figure { position: static; }
}

/* ---------- Mobile, below 768px (83:663) ---------- */
@media (max-width: 767.98px) {
  main { --img-radius: 8px; }
  .case-section { padding: 72px 0; }
  .case-section > .container { gap: 32px; }
  .case-label { font-size: 15px; }
  .case-statement { font-size: 26px; }
  .case-row { flex-direction: column; gap: 24px; }
  .case-row > :first-child { flex: none; }
  .case-text { font-size: 15px; }

  .case-hero { padding: 40px 0 56px; }
  .back-link { font-size: 15px; }
  .case-title { font-size: min(40px, 11.6vw); } /* 40px from 345px up; a long word ("Communications") still fits at 320px */
  .case-lead { font-size: 22px; }
  .case-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
  .case-meta dd { font-size: 15px; }

  .case-overview { padding: 24px 0 72px; }
  .case-overview > .container { gap: 40px; }

  .case-process > .container { gap: 12px; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .step { gap: 16px; padding: 20px 28px; }
  .step__title { font-size: 18px; }

  .persona__figure { max-width: none; } /* full content width, as in Figma */

  .case-img-card { padding: 5px; } /* + ~7px inside the file = 12px as in Figma 83:663 */

  .case-screens > .container { gap: 64px; }
  .case-block .case-row { gap: 24px; }
  .case-block__title { font-size: 22px; }

  .case-subrow { padding-top: 40px; }

  .next-link { gap: 10px; font-size: 32px; }
  .next-link .icon { flex: none; }
  /* A long name ("Be.Spoken Communications") wraps, the arrow stays on the right (Figma 86:514) */
  .next-link--long { display: flex; align-self: stretch; }
  .next-link--long .next-link__text { flex: 1 1 0; min-width: 0; }
  .case-images { gap: 12px; }
  .case-img-pad .case-img { border-radius: 8px; }
  .case-about { padding: 40px 0 56px; }
  .case-about .case-row { gap: 24px; }
  .next-link .icon { width: 38px; height: 38px; }
  .case-next .back-link { font-size: 15px; }
}

/* ---------- Image viewer (js/viewer.js) ---------- */
main img.case-img[role="button"] { cursor: zoom-in; }
.zoom-wrap { position: relative; display: block; }
/* "Tap to zoom": mobile only, text only, Caption style, chip radius */
.zoom-hint { display: none; }
@media (max-width: 767.98px) {
  .zoom-hint {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: block;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--bg-dark) 70%, transparent);
    color: var(--text-on-dark);
    font: 400 13px/normal var(--font); /* Caption/13 */
    pointer-events: none;
  }
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(0 0 0 / 0.9); /* SPEC: #000 at 90% */
  opacity: 0;
  transition: opacity 400ms cubic-bezier(0.22, 1, 0.36, 1); /* same character as the page fade */
}
.viewer[hidden] { display: none; }
.viewer.is-open { opacity: 1; }
.viewer__stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 64px 16px;
  overflow: hidden;
  touch-action: none; /* gestures are handled in js/viewer.js */
}
@media (min-width: 768px) { .viewer__stage { padding: 72px 80px; } }
.viewer__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.viewer.is-zoomable .viewer__img { cursor: zoom-in; }
.viewer.is-zoomed .viewer__img { cursor: grab; }
.viewer.is-zoomed .viewer__img:active { cursor: grabbing; }
/* Close: the mobile-menu close icon (59:598), white, 44×44 button */
.viewer__close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--surface-white);
}
.viewer__close svg { width: 24px; height: 24px; }
@media (prefers-reduced-motion: reduce) {
  .viewer { transition: none; }
}
