/* Responsive — overrides tokens + layout adjustments */

/* --------------------------------------------------------------------------
   Tablet (≤ 900px)
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  :root {
    --pad-section-block: clamp(48px, 10vw, 80px);
    --gap-section-head: clamp(24px, 5vw, 40px);
  }

  .hero {
    min-height: auto;
    padding-bottom: 0;
  }

  .hero-title {
    top: clamp(40px, 6vw, 80px);
    white-space: nowrap;
    line-height: 0.88;
    /* Fit full name on one line; still larger than previous mobile */
    font-size: clamp(40px, 12.2vw, 120px);
    letter-spacing: -0.07em;
  }

  .hero-copy {
    padding-top: clamp(88px, 22vw, 160px);
  }

  .hero-lede {
    max-width: min(36rem, 88vw);
  }

  .hero-float--top,
  .hero-float--left-bottom {
    display: none;
  }

  .hero-float--left-top {
    left: 0;
    top: clamp(8px, 2vh, 24px);
    bottom: auto;
    width: clamp(145px, 39.4vw, 262px);
    transform: translateX(-15%) rotate(9deg);
  }

  .hero.is-ready .hero-float--left-top {
    transform: translateX(-15%) rotate(9deg);
  }

  .hero-float--right-top {
    right: 0;
    top: 12%;
    width: clamp(100px, 26vw, 180px);
    transform: translateX(25%) rotate(6.75deg);
  }

  .hero.is-ready .hero-float--right-top {
    transform: translateX(25%) rotate(6.75deg);
  }

  .hero-float--right-bottom {
    right: 0;
    top: auto;
    bottom: 4%;
    width: clamp(126px, 34.5vw, 230px);
    transform: translateX(15%) rotate(-6deg);
  }

  .hero.is-ready .hero-float--right-bottom {
    transform: translateX(15%) rotate(-6deg);
  }

  .showcase-track {
    height: 240vh;
  }

  .showcase-title {
    top: calc(var(--nav-height) + 10px);
    font-size: clamp(40px, 11vw, 96px);
  }

  .work-stack-track {
    height: 280vh;
  }

  .work-stack-title {
    font-size: clamp(36px, 10vw, 56px);
    max-width: 16ch;
  }

  .work-stack-list {
    height: min(70vh, 560px);
    height: min(70dvh, 560px);
    height: min(70svh, 560px);
    width: 100%;
  }

  .work-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 24px;
  }

  .work-card-gallery-item {
    width: 132px;
  }

  .work-card--v2 {
    --v2-pad-x: 22px;
    --v2-pad-y: 32px;
    --v2-gap-after-title: 20px;
    --v2-gap-body-stats: 28px;
    --v2-gap-stats-gallery: 24px;
  }

  .work-stack-item {
    --stack-peek-pad: 32px;
  }

  .work-card-v2-title {
    max-width: none;
    font-size: clamp(24px, 6.5vw, 34px);
  }

  .work-card-v2-mid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .work-card-v2-body p {
    font-size: clamp(14px, 3.8vw, 16px);
  }

  .work-card-v2-stats {
    gap: 16px 24px;
  }

  .work-card-v2-gallery {
    width: calc(100% + var(--v2-pad-x) + 42%);
    gap: 10px;
  }

  .work-card-v2-shot {
    width: clamp(220px, 56vw, 300px);
    max-height: 170px;
    border-radius: 12px;
  }

  .work-stack.is-static .work-stack-list {
    gap: 16px;
  }

  .vision-bento {
    grid-template-columns: 1fr;
    grid-template-areas:
      "research"
      "agile"
      "workshop"
      "teaching"
      "workflow";
  }

  .vision-tile-head {
    padding: 14px 16px;
    align-items: flex-start;
  }

  .vision-tile-label {
    font-size: clamp(18px, 4.5vw, 24px);
  }

  .vision-tile-media,
  .vision-tile--agile .vision-tile-media,
  .vision-tile--teaching .vision-tile-media,
  .vision-carousel-viewport {
    margin-inline: 0;
  }

  .vision-tile--agile .vision-tile-media,
  .vision-tile--teaching .vision-tile-media,
  .vision-tile--research .vision-tile-media,
  .vision-tile--workflow .vision-tile-media {
    aspect-ratio: 16 / 10;
    min-height: 180px;
  }

  .vision-carousel-slide {
    aspect-ratio: 16 / 10;
    min-height: 180px;
  }

  .media-stage--hero {
    aspect-ratio: 4 / 3;
  }

  .stats-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .stats-bg-text {
    font-size: clamp(52px, 12vw, 110px);
    transform: translate(-50%, -14%);
  }

  .stats-overlap {
    padding-top: clamp(48px, 9vw, 72px);
  }
}

/* --------------------------------------------------------------------------
   Small tablet / large phone (≤ 768px) — token overrides
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --nav-height: 56px;
    --gap-nav: 16px;
    --radius-stage: 20px;
    --radius-card: 18px;

    --text-intro: clamp(18px, 4.5vw, 28px);
    --text-hero-title: clamp(52px, 16vw, 96px);
    --text-hero-sub: clamp(15px, 4vw, 22px);
    --text-stat-number: clamp(28px, 8vw, 56px);
    --text-stat-label-size: clamp(16px, 4.5vw, 32px);
    --text-lets-talk: clamp(36px, 14vw, 120px);
  }

  .nav-links a,
  .nav-logo,
  .nav-cta {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .nav-cta {
    padding-inline: 14px;
  }

  .hero {
    padding-top: calc(var(--nav-height) + 28px);
    padding-bottom: 48px;
  }

  .hero-copy {
    padding-top: clamp(72px, 20vw, 140px);
    padding-bottom: 24px;
    justify-content: flex-start;
  }

  .testimonials-title {
    font-size: clamp(40px, 11vw, 64px);
    max-width: 10ch;
  }

  .testimonials-track > li {
    width: min(88vw, 420px);
  }

  .trust-card {
    min-height: 360px;
    padding: 24px;
    gap: 22px;
  }

  .trust-card-quote p {
    font-size: 16px;
  }

  .stat-label {
    line-height: 1.15;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px 20px;
  }
}

/* --------------------------------------------------------------------------
   Phone (≤ 640px)
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  :root {
    --pad-section-block: clamp(40px, 11vw, 64px);
    --gap-section-head: clamp(20px, 5vw, 32px);
    --pad-footer-y: 20px;
  }

  .work-stack-switch {
    width: min(100%, 360px);
  }

  .work-stack-switch-btn {
    flex: 1 1 0;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .work-stack-list {
    height: min(68vh, 520px);
    height: min(68dvh, 520px);
    height: min(68svh, 520px);
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    margin-left: 0;
    order: 0;
  }

  .footer-copy {
    order: 0;
  }

  .nav-end {
    gap: 12px;
  }

  .media-stage--hero,
  .media-stage--showcase {
    aspect-ratio: 3 / 4;
  }

  .showcase-title {
    top: calc(var(--nav-height) + 8px);
    font-size: clamp(36px, 12vw, 72px);
  }
}

/* --------------------------------------------------------------------------
   Small phone (≤ 480px) — token overrides
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  :root {
    --space-side: var(--space-side-sm);
    --text-toolkit-word: clamp(26px, 8vw, 40px);
    --text-sticky-quote: clamp(15px, 4vw, 18px);
  }

  .nav-links {
    display: none;
  }

  .stats-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .stats-bg-text {
    font-size: clamp(48px, 12vw, 96px);
    transform: translate(-50%, -8%);
  }

  .stats-overlap {
    padding-top: clamp(36px, 10vw, 48px);
  }

  .cta-button {
    align-self: stretch;
    justify-content: center;
  }

  .hero-title {
    font-size: clamp(36px, 11.5vw, 72px);
  }
}

/* --------------------------------------------------------------------------
   Notched devices — safe area insets
   -------------------------------------------------------------------------- */

@supports (padding: max(0px)) {
  .layout-inline {
    padding-left: max(var(--space-side), env(safe-area-inset-left));
    padding-right: max(var(--space-side), env(safe-area-inset-right));
  }

  .footer-inner.layout-inline {
    padding-bottom: max(var(--pad-footer-y), env(safe-area-inset-bottom));
  }

  .page-main.layout-inline {
    padding-bottom: max(var(--pad-page-bottom), env(safe-area-inset-bottom));
  }
}
