/* The original article markup and mobile flow stay intact. Enhancement is
   enabled only on desktop; without JavaScript the existing layout still works. */
.cases-gallery { display: contents; }

@media (min-width: 768px) {
  .case-cinema .cases-opening {
    width: min(1120px, calc(100% - 64px));
    padding-block: 88px 40px;
  }

  .case-cinema .cases-gallery.is-carousel {
    display: block;
    width: min(1120px, calc(100% - 64px));
    margin: 0 auto 64px;
  }

  .cases-gallery.is-carousel .case-story {
    width: 100%;
    min-width: 0;
    margin: 0;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
  }

  .cases-gallery.is-carousel .case-intro {
    width: 100%;
    padding: 28px;
  }

  .cases-gallery.is-carousel .case-intro h3 {
    font-size: 25px;
    line-height: 1.22;
    letter-spacing: -.035em;
    text-wrap: pretty;
  }

  .cases-gallery.is-carousel .case-category {
    margin: 0 0 12px;
    font-size: 11px;
    line-height: 1.55;
    color: var(--muted);
  }

  .cases-gallery.is-carousel .case-intro-copy { margin-top: 18px; }
  .cases-gallery.is-carousel .case-intro-copy p {
    font-size: 15px;
    line-height: 1.7;
  }
  .cases-gallery.is-carousel .case-intro-copy p + p { margin-top: 12px; }
  .cases-gallery.is-carousel .case-intro-copy .case-lead {
    font-size: 19px;
    line-height: 1.4;
  }
  .cases-gallery.is-carousel .case-event-list {
    font-size: 12px;
    gap: 12px;
  }

  .cases-gallery.is-carousel .case-reel { order: -1; margin: 0; }
  .cases-gallery.is-carousel .case-stage {
    width: 100%;
    margin: 0;
    aspect-ratio: var(--film-ratio);
  }
  .cases-gallery.is-carousel .case-frame { border-radius: 0; }
  .cases-gallery.is-carousel .case-frame video { object-fit: contain; }
  .cases-gallery.is-carousel .case-frame::after,
  .cases-gallery.is-carousel .case-film-caption { display: none; }
  .cases-gallery.is-carousel .case-video-error {
    left: 12px;
    right: 12px;
    bottom: 66px;
    font-size: 12px;
  }

  /* The landscape film leads the portfolio, in its own native proportion. */
  .case-feature { margin-bottom: 52px; }
  .cases-gallery.is-carousel .case-feature .case-story {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
    align-items: center;
  }
  .cases-gallery.is-carousel .case-feature .case-intro { padding: 32px; }
  .cases-gallery.is-carousel .case-feature .case-intro::before {
    content: 'EM DESTAQUE';
    display: block;
    margin-bottom: 22px;
    color: var(--yellow);
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .16em;
  }
  .cases-gallery.is-carousel .case-feature h3 {
    font-size: clamp(25px, 2.5vw, 34px);
    line-height: 1.2;
  }
  .case-feature .case-category { display: none; }

  /* One continuous rail, with visible manual navigation. */
  .case-carousel-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
  }
  .case-carousel-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .14em;
    margin-bottom: 10px;
  }
  .case-carousel-eyebrow::before {
    content: '';
    width: 22px;
    height: 2px;
    background: var(--yellow);
  }
  .case-carousel-heading {
    font-size: clamp(25px, 2.6vw, 34px);
    font-weight: 500;
    letter-spacing: -.035em;
    line-height: 1.2;
  }
  .case-carousel-controls { display: flex; align-items: center; gap: 10px; flex: none; }
  .case-carousel-count {
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    margin-right: 12px;
    min-width: 84px;
    text-align: right;
  }
  .case-carousel-button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    transition: color .2s, background .2s, border-color .2s;
  }
  .case-carousel-button[data-direction='next'] {
    background: var(--yellow);
    color: var(--deep);
    border-color: var(--yellow);
  }
  .case-carousel-button:hover:not([aria-disabled='true']) {
    background: var(--text);
    border-color: var(--text);
    color: var(--deep);
  }
  .case-carousel-button[aria-disabled='true'] { opacity: .3; cursor: default; }
  .case-carousel-button:focus-visible { outline-offset: 4px; }
  .case-carousel-button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .case-carousel-track {
    --cards-visible: 2;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--cards-visible) - 1) * 24px) / var(--cards-visible));
    gap: 24px;
    align-items: start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding-bottom: 8px;
  }
  .case-carousel-track::-webkit-scrollbar { display: none; }
  .case-carousel-track:focus-visible { outline: 2px solid var(--yellow); outline-offset: 6px; }
  .cases-gallery.is-carousel .case-carousel-track .case-story {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    scroll-snap-align: start;
  }
  .case-carousel-track .case-text-scene { width: 100%; }
  .cases-gallery.is-carousel .case-carousel-track .case-intro { padding: 22px 24px 18px; }
  .cases-gallery.is-carousel .case-carousel-track .case-intro h3 {
    min-height: 3.66em;
    font-size: 24px;
  }
  .cases-gallery.is-carousel .case-carousel-track .case-category { min-height: 1.55em; }
  .case-project-details { margin-top: 16px; border-top: 1px solid var(--line); }
  .case-project-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 0;
    font-size: 12px;
    color: var(--muted);
    list-style: none;
    cursor: pointer;
  }
  .case-project-details summary::-webkit-details-marker { display: none; }
  .case-project-details summary::after { content: '+'; color: var(--yellow); font-size: 21px; line-height: 1; }
  .case-project-details[open] summary { color: var(--text); }
  .case-project-details[open] summary::after { content: '−'; }
  .case-project-details .case-intro-copy { padding-bottom: 6px; }

  @media (max-width: 1099px) {
    .cases-gallery.is-carousel .case-feature .case-story { grid-template-columns: 1.25fr 1fr; }
    .cases-gallery.is-carousel .case-feature .case-intro { padding: 24px; }
    .cases-gallery.is-carousel .case-feature .case-intro::before { margin-bottom: 14px; }
    .cases-gallery.is-carousel .case-feature h3 { font-size: 25px; }
    .cases-gallery.is-carousel .case-feature .case-intro-copy p { font-size: 14px; }
    .case-carousel-heading { font-size: 27px; }
  }
  @media (min-width: 1100px) {
    .case-carousel-track { --cards-visible: 3; }
  }
  @media (prefers-reduced-motion: reduce) {
    .case-carousel-button { transition: none; }
  }
}
