/* Case-study pages. Designed at 1440 wide (Figma "CaseStudy_AVA_1440_v1.01").
   Shared chrome (header, footer, fonts, colours, --edge) is in site.css.

   Type: headings scale down on phones, body copy and captions never change
   with the viewport (same rule as the home page). */

.case {
  /* type */
  --case-h1: clamp(24px, 6.5vw, 32px);
  --case-h2: calc(var(--case-h1) * 0.875);
  --case-title: clamp(44px, 12vw, 62px);

  /* layout */
  --case-text-w: 740px;
  --case-wrap-w: 1600px;
  --case-section-gap: 64px;
  --case-media-radius: 16px;

  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.case-main {
  flex: 1;
  padding-top: clamp(0px, 1vw, 16px);
}

/* A section: wrapper up to 1600, centred, with the shared side padding. */

.case-section {
  max-width: var(--case-wrap-w);
  margin: 0 auto var(--case-section-gap);
  padding: 0 var(--edge);
}

/* Text column: 740 wide, centred. */

.case-text {
  max-width: var(--case-text-w);
  margin: 0 auto;
}

.case-h1,
.case-h2 {
  margin: 0;
  padding: 24px 0;
  font-family: var(--font-expanded);
  font-weight: 700;
}

.case-h1 {
  font-size: var(--case-h1);
  line-height: 1.2;
  letter-spacing: -0.6px;
  text-transform: uppercase;
  text-wrap: balance;
}

.case-h2 {
  font-size: var(--case-h2);
  line-height: 1.43;
  letter-spacing: -0.5571px;
  text-wrap: balance;
}

.case-body p {
  margin: 0 0 32px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.063px;
}

.case-body p:last-child {
  margin-bottom: 0;
}

/* Emphasis inside body copy is Expanded Bold at body size, as drawn in the Figma. */
.case-body strong {
  font-family: var(--font-expanded);
  font-weight: 700;
  letter-spacing: -0.5571px;
}

/* Media: wrapper width set per piece (880, 1080 or 1440 in the Figma). */

.case-media {
  max-width: var(--media-w, 1080px);
  margin: 0 auto;
}

.case-media--880 { --media-w: 880px; }
.case-media--1080 { --media-w: 1080px; }
.case-media--full { --media-w: 1440px; }

/* Rounded corners (16px) on every piece of media. */
.case-media-box,
.case-media > img,
.case-media > video {
  display: block;
  width: 100%;
  border-radius: var(--case-media-radius);
}

.case-media-box {
  background: var(--lightgrey);
}

/* Phone mockup: mobile clips sit in a grey box as wide as the other media and 20% taller (880 x 650.4).
   The phone PNG is centred; the video sits on top of it in the screen area.
   Numbers are from the 232x480 phone: screen 214x464, corners 34. Everything
   scales with the box. */
.case-phone-box {
  position: relative;
  width: 100%;
  max-width: 880px;
  aspect-ratio: 880 / 650.4;
  margin: 0 auto;
  background: var(--lightgrey);
  border-radius: var(--case-media-radius);
  overflow: hidden;
  container-type: inline-size;
}

.case-phone {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 88.56%;
  aspect-ratio: 232 / 480;
  transform: translate(-50%, -50%);
  container-type: inline-size;
}

.case-phone > img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

.case-phone > video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 92.24%;
  height: 96.67%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  border-radius: 14.66cqw;
  overflow: hidden;
}

/* Phones: a taller box (1 : 2.016, which is the old 1 : 1.68 made 20% taller), then 20% shorter
   again (1 : 1.6128) because the phones read too big on a phone. The phone keeps its share of the
   box, so it is 20% shorter too. */
@media (max-width: 599.98px) {
  .case-phone-box {
    aspect-ratio: 1 / 1.6128;
  }
}

@media (max-width: 479.98px) {
  .case-phone-box {
    border-radius: 12px;
  }
}

.case-media-box--880 {
  aspect-ratio: 880 / 542;
}

.case-caption {
  margin: 16px 0 0;
  text-align: center;
  font-family: var(--font-condensed);
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

/* Closing "Home" link (in the Figma, 144px above and below, centred). */

.case-home-section {
  padding: clamp(72px, 10vw, 144px) var(--edge);
  text-align: center;
}

.case-home {
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--case-title);
  line-height: 1.258;
  letter-spacing: -0.003em;
  color: var(--black);
  text-decoration: underline transparent 2px;
  text-underline-offset: 8px;
  transition: color var(--motion-duration-hover), text-decoration-color var(--motion-duration-hover);
}

.case-home:focus-visible {
  color: var(--red);
  text-decoration-color: currentColor;
}

@media (hover: hover) {
  .case-home:hover {
    color: var(--red);
    text-decoration-color: currentColor;
  }
}

.case-home:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .case-home {
    transition: none;
  }
}

/* ---------- Title block (Figma section 1) ---------- */

.case-title-block {
  --case-eyebrow: calc(var(--case-title) / 2.2143);
}

.case-eyebrow {
  margin: 0;
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: var(--case-eyebrow);
  line-height: 1.43;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.case-title {
  margin: calc(var(--case-eyebrow) * 0.571) 0 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--case-title);
  line-height: 1.258;
  letter-spacing: -0.003em;
  text-wrap: balance;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
  font-weight: 300;
}

.case-meta li + li {
  padding-left: 20px;
  border-left: 1px solid #d9d9d9;
}

.case-meta-strong {
  font-weight: 500;
}

.case-meta-org {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.case-meta-org img {
  width: 20px;
  height: 20px;
}

@media (max-width: 599.98px) {
  .case-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .case-meta li + li {
    padding-left: 0;
    border-left: 0;
  }

  /* Stacked: title, then role and dates, then the RingCentral line last */
  .case-meta-org {
    order: 1;
  }
}

/* ---------- Intro: paragraphs left, tiles and highlights right (Figma section 2) ---------- */

.case-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 572px);
  column-gap: 84px;
  row-gap: 48px;
  padding-top: 16px;
}

.case-intro-text p {
  margin: 0 0 32px;
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.063px;
}

.case-intro-text p:last-child {
  margin-bottom: 0;
}

.case-intro-text strong {
  font-family: var(--font-expanded);
  font-weight: 700;
  letter-spacing: -0.5571px;
}

.case-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: 572px;
}

.case-tile {
  padding-top: 16px;
  border-top: 1px solid #d9d9d9;
}

.case-tile-title {
  display: block;
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.5571px;
}

.case-tile-text {
  display: block;
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.case-highlights {
  max-width: 572px;
  margin-top: 48px;
}

.case-highlights-label {
  margin: 0 0 16px;
  font-weight: 500;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.case-highlights ul {
  margin: 0;
  padding: 0 0 0 16px;
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.case-highlights li + li {
  margin-top: 8px;
}

.case-highlights li::marker {
  font-size: 0.8em;
}

@media (max-width: 1099.98px) {
  .case-intro {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-intro-text,
  .case-tiles,
  .case-highlights {
    max-width: var(--case-text-w);
  }
}

@media (max-width: 479.98px) {
  .case-tiles {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Hero video (Figma section 3) ---------- */

.case-hero {
  position: relative;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto var(--case-section-gap);
  aspect-ratio: 16 / 9;
  background: var(--lightgrey);
  overflow: hidden;
}

.case-hero video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 1921px) {
  .case-hero {
    border-radius: var(--case-media-radius);
  }
}

.case-video-toggle {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--black);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--motion-duration-hover), background-color var(--motion-duration-hover), color var(--motion-duration-hover), transform var(--motion-duration-hover);
}

.case-video-toggle:active {
  transform: translateY(1px);
}

.case-video-toggle:focus-visible {
  opacity: 1;
}

@media (hover: hover) {
  .case-hero:hover .case-video-toggle,
  .case-video-box:hover .case-video-toggle,
  .case-phone-box:hover .case-video-toggle {
    opacity: 1;
  }
}

.case-video-toggle:focus-visible {
  background: var(--white);
  color: var(--red);
}

@media (hover: hover) {
  .case-video-toggle:hover {
    background: var(--white);
    color: var(--red);
  }
}

.case-video-toggle:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.case-video-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.case-video-toggle .icon-play { display: none; }
.case-video-toggle[aria-pressed="true"] .icon-play { display: block; }
.case-video-toggle[aria-pressed="true"] .icon-pause { display: none; }

/* Touch screens have no hover: the button is hidden until the video is tapped (js adds
   .is-revealed), stays while the video is paused (.is-paused), and fades out again once it plays. */
@media (hover: none) {
  .case-video-toggle {
    opacity: 0;
    pointer-events: none;
  }

  .is-revealed .case-video-toggle,
  .is-paused .case-video-toggle,
  .case-video-toggle:focus-visible {
    opacity: 0.9;
    pointer-events: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-video-toggle {
    opacity: 1;
    pointer-events: auto;
    transition: none;
  }

  .case-video-toggle:active {
    transform: none;
  }
}

/* ---------- Public passage fading under a gradient, then the unlock panel ---------- */

.case-passage {
  position: relative;
}

.case-locked .case-passage::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--white) 92%);
  pointer-events: none;
}

.case-unlock {
  margin-top: -48px;
  position: relative;
}

/* Unlock panel (Figma "Frame 2121453293": default, active, error, button hover) */

.case-unlock-panel {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 32px;
  background: #f5f5f5;
  border-radius: 16px;
  color: #2d2d2d;
}

.case-unlock-text {
  margin: 0;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.063px;
}

.case-unlock-text a {
  font-family: var(--font-expanded);
  font-weight: 700;
  letter-spacing: -0.5571px;
  line-height: 1;
  color: inherit;
  text-decoration: underline transparent 2px;
  text-underline-offset: 5px;
  transition: color var(--motion-duration-hover), text-decoration-color var(--motion-duration-hover);
}

.case-unlock-text a:focus-visible {
  color: var(--red);
  text-decoration-color: currentColor;
}

@media (hover: hover) {
  .case-unlock-text a:hover {
    color: var(--red);
    text-decoration-color: currentColor;
  }
}

.case-unlock-text a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.case-unlock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.case-unlock-row {
  display: flex;
  align-items: center;
  gap: 32px;
}

.case-unlock-input {
  flex: 1;
  min-width: 0;
  height: 72px;
  padding: 19px 32px;
  border: 1px solid #ddd4d4;
  border-radius: 0;
  background: var(--white);
  color: #635e5e;
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.063px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--motion-duration-hover);
}

.case-unlock-input::placeholder {
  color: #635e5e;
  opacity: 1;
}

/* Active: the border darkens (and stays dark while there is something typed). */
.case-unlock-input:focus,
.case-unlock-input:not(:placeholder-shown) {
  border-color: #635e5e;
  outline: none;
}

.case-unlock-button {
  flex: none;
  width: 124px;
  height: 72px;
  padding: 8px 24px;
  border: 0;
  border-radius: 0;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.5571px;
  cursor: pointer;
  transition: background-color var(--motion-duration-hover), transform var(--motion-duration-hover);
}

.case-unlock-button:active {
  transform: translateY(1px);
}

.case-unlock-button:focus-visible {
  background: var(--red);
}

@media (hover: hover) {
  .case-unlock-button:hover {
    background: var(--red);
  }
}

.case-unlock-button:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 3px;
}

.case-unlock-error {
  margin: 0;
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

/* Hidden label: the placeholder is the visible label, screen readers still get "Password". */
.case-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 599.98px) {
  .case-unlock-panel {
    padding: 24px;
    gap: 24px;
  }

  .case-unlock-row {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .case-unlock-input {
    flex: none;
    width: 100%;
  }

  .case-unlock-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-unlock-input,
  .case-unlock-button,
  .case-unlock-text a {
    transition: none;
  }

  .case-unlock-button:active {
    transform: none;
  }
}

/* ---------- Gated content ---------- */

/* Figma "Section header" paragraph-level headings */
.case-h3 {
  margin: 0;
  padding: 24px 0 16px;
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: calc(var(--case-h1) * 0.65625);
  line-height: 1.62;
  letter-spacing: -0.5571px;
}

.case-body .case-pull {
  margin: 32px 0;
  padding: 0 0 0 24px;
  border-left: 6px solid #f0f0f0;
  font-family: var(--font-expanded);
  font-weight: 700;
  font-size: var(--case-h2);
  line-height: 1.43;
  letter-spacing: -0.5571px;
}

.case-body .case-pull p {
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
}

/* Four cards (Figma section 24) */
.case-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.case-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: #f5f5f5;
  border-radius: 16px;
  text-align: center;
  font-weight: 300;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.case-card strong {
  font-weight: 500;
}

@media (max-width: 599.98px) {
  .case-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .case-card {
    padding: 32px 24px;
  }
}

/* Video in the shared 880 x 542 grey box (desktop clips fill it) */
.case-video-box {
  position: relative;
  width: 100%;
  max-width: 880px;
  aspect-ratio: 880 / 542;
  margin: 0 auto;
  background: var(--lightgrey);
  border-radius: var(--case-media-radius);
  overflow: hidden;
}

.case-video-box video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 479.98px) {
  .case-video-box {
    border-radius: 12px;
  }
}

/* Quotes (Figma section 45) */
.case-quotes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  max-width: 1248px;
  margin: 0 auto;
}

.case-quote {
  flex: 0 1 608px;
  min-width: 0;
  margin: 0;
  padding: 48px 60px;
  background: #f5f5f5;
  border-radius: 16px;
}

.case-quote blockquote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  line-height: 34px;
  letter-spacing: -0.063px;
}

.case-quote blockquote strong {
  font-family: var(--font-expanded);
  font-weight: 700;
  letter-spacing: -0.5571px;
}

.case-quote figcaption {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 48px;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.3429px;
}

.case-quote figcaption img {
  flex: none;
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.case-quote-name {
  display: block;
  font-weight: 500;
}

.case-quote-role {
  display: block;
  font-weight: 300;
}

@media (max-width: 799.98px) {
  .case-quote {
    flex-basis: 100%;
    padding: 32px 24px;
  }
}
