/* =========================================================
   v47 — CASE STUDY FIT STANDARD
   Keeps each work case study inside its own Work-grid column.
   Uses container queries so complex layouts respond to the
   actual card width, not only the browser viewport.
   Reuse this standard for The Weekender + future case studies.
   ========================================================= */

/* Every case-study card owns its lane. */
.work-case-study {
  min-width: 0;
  max-width: 100%;
  container-type: inline-size;
  container-name: caseStudy;
  overflow: clip;
}

.work-case-study > *,
.nowhere-card > *,
.nowhere-showcase,
.nowhere-showcase > *,
.nowhere-showcase article,
.nowhere-showcase section {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* Prevent long headings/copy from leaking into the Weekender lane. */
.nowhere-card h1,
.nowhere-card h2,
.nowhere-card h3,
.nowhere-card h4,
.nowhere-card h5,
.nowhere-card h6,
.nowhere-card p,
.nowhere-card small,
.nowhere-card strong,
.nowhere-card span {
  overflow-wrap: break-word;
}

.nowhere-card h5,
.nowhere-card h6 {
  text-wrap: balance;
}

.nowhere-card p {
  text-wrap: pretty;
}

/* Large desktop: still slightly tighter so NOW.HERE doesn't visually
   consume the neighboring Weekender column. */
.nowhere-showcase {
  width: 100%;
  padding-inline: clamp(0px, 1.25cqw, 12px);
}

/* Generic two-column case-study layouts should never force overflow. */
.nowhere-showcase [class*="layout"],
.nowhere-showcase [class*="grid"],
.nowhere-showcase [class*="panel"] {
  min-width: 0;
}

/* =========================================================
   CONTAINER-BASED ADAPTATION
   This is the key fix: the NOW.HERE card can be ~half the desktop
   viewport, so viewport media queries alone were too late.
   ========================================================= */

@container caseStudy (max-width: 860px) {
  /* FAQ: media first, copy below. */
  .faq-support-layout {
    grid-template-columns: 1fr !important;
    gap: 30px !important;
    align-items: start !important;
  }

  .faq-phone {
    width: min(100%, 410px) !important;
    justify-self: center;
  }

  .faq-support-copy {
    width: min(100%, 620px);
    max-width: 620px;
    margin-inline: auto;
  }

  .faq-support-copy h6 {
    font-size: clamp(29px, 7cqw, 43px) !important;
    line-height: 1.02;
  }

  .faq-support-copy > p {
    font-size: clamp(13px, 2.4cqw, 16px) !important;
  }

  /* Additional Campaign Work: stop squeezing media + copy side-by-side. */
  .additional-campaign-panel {
    grid-template-columns: 1fr !important;
    min-height: 0 !important;
    gap: 30px !important;
    padding: clamp(18px, 4cqw, 30px) !important;
    align-items: start !important;
  }

  .additional-campaign-media {
    order: 1;
    width: 100%;
  }

  .additional-campaign-copy {
    order: 2;
    width: min(100%, 620px) !important;
    max-width: 620px !important;
    margin-inline: auto;
  }

  .artist-lineup-slider,
  .takeover-slider,
  .clean-loop-video {
    width: min(78cqw, 400px) !important;
  }

  .additional-campaign-copy h6 {
    font-size: clamp(31px, 7.5cqw, 46px) !important;
    line-height: 1 !important;
    max-width: 16ch;
  }

  .additional-campaign-copy > p {
    font-size: clamp(13px, 2.5cqw, 16px) !important;
    line-height: 1.6;
    max-width: 56ch;
  }

  /* Tabs become 2 + 1 instead of three cramped labels. */
  .additional-campaign-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .additional-campaign-tab:last-child {
    grid-column: 1 / -1;
  }

  /* Notion preview also respects the actual card width. */
  .workflow-steps {
    grid-template-columns: repeat(2, minmax(0,1fr)) !important;
  }

  .notion-preview-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .notion-preview-card:last-child {
    grid-column: 1 / -1;
  }

  /* Keep oversized editorial section headings contained. */
  .nowhere-showcase .piece-heading h5,
  .nowhere-showcase .additional-campaign-heading h5,
  .nowhere-showcase .notion-workflow-heading h5,
  .nowhere-showcase .campaign-heading h5 {
    font-size: clamp(34px, 9cqw, 58px) !important;
    line-height: .95 !important;
    max-width: 11ch;
  }
}

@container caseStudy (max-width: 620px) {
  .nowhere-showcase {
    padding-inline: 0;
  }

  .additional-campaign-shell {
    padding: 10px !important;
    border-radius: 18px;
  }

  .additional-campaign-tabs {
    grid-template-columns: 1fr !important;
    gap: 7px !important;
  }

  .additional-campaign-tab:last-child {
    grid-column: auto;
  }

  .additional-campaign-tab {
    padding: 12px 14px !important;
    min-height: 62px;
  }

  .artist-lineup-slider,
  .takeover-slider,
  .clean-loop-video,
  .faq-phone {
    width: min(82cqw, 330px) !important;
  }

  .additional-campaign-copy h6,
  .faq-support-copy h6 {
    max-width: 100%;
    font-size: clamp(28px, 9cqw, 38px) !important;
  }

  .campaign-role-chips,
  .faq-support-role {
    gap: 7px !important;
  }

  .campaign-role-chips span,
  .faq-support-role span {
    font-size: 7px !important;
    padding: 7px 9px !important;
  }

  .workflow-steps,
  .notion-preview-grid {
    grid-template-columns: 1fr !important;
  }

  .notion-preview-card:last-child {
    grid-column: auto;
  }

  .notion-workflow-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  .notion-open-button {
    width: 100%;
    justify-content: space-between;
  }
}

/* =========================================================
   VIEWPORT RESPONSIVE SAFETY NET
   Tablet/iPad and phone layouts get their own comfortable gutters.
   ========================================================= */
@media (max-width: 1100px) {
  .work-grid {
    gap: 54px 22px;
  }
}

@media (max-width: 900px) {
  .work-grid {
    grid-template-columns: 1fr !important;
    gap: 58px;
  }

  .work-case-study {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .nowhere-card,
  .nowhere-showcase {
    width: 100%;
    max-width: 100%;
  }

  .nowhere-showcase {
    padding-inline: 2px;
  }

  .nowhere-showcase p {
    font-size: min(4vw, 15px);
    line-height: 1.62;
  }
}

/* Standard for future case studies: no child is allowed to expand a grid lane. */
.work-case-study img,
.work-case-study video,
.work-case-study svg,
.work-case-study canvas,
.work-case-study iframe {
  max-width: 100%;
}
