/* ==========================================================================
   Responsive layer — desktop-first overrides.
   ≥1800 large · ≤1199 laptop · ≤1023 tablet · ≤767 phone · ≤479 small phone
   ========================================================================== */

@media (min-width: 1800px) {
  :root { --max: 1680px; }
}

/* ------------------------------------------------------------ ≤ 1199px */
@media (max-width: 1199px) {
  .footer__top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer__brand { grid-column: 1 / -1; }
  .footer__company { grid-column: 1 / -1; }
  .footer__company .legal { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 2rem; }

  .values { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .svc__panel-inner { grid-template-columns: 5rem minmax(0, 1fr) minmax(0, 1fr); }
  .svc .link-arrow { grid-column: 2 / -1; justify-self: start; }
}

/* ------------------------------------------------------------ ≤ 1023px */
@media (max-width: 1023px) {
  :root { --nav-h: 64px; }

  .nav__links, .nav__cta, .nav__lang { display: none; }
  .nav__burger { display: inline-flex; }
  .nav__logo img { height: 26px; }

  .hero__foot { grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }
  .scroll-cue { flex-direction: row; justify-self: start; }
  .scroll-cue__track { width: 56px; height: 1px; }
  .scroll-cue__track i { width: 40%; height: 100%; animation-name: cueX; }

  .section-head--split { grid-template-columns: minmax(0, 1fr); }

  /* services become an accordion */
  .svc:hover .svc__title { transform: none; }
  .svc-list:hover .svc:not(:hover) .svc__title { color: inherit; }
  .svc__head { grid-template-columns: 2.5rem minmax(0, 1fr) auto; align-items: center; padding-block: 1.35rem; }
  .svc__toggle {
    display: inline-grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--line-2);
    transition: background-color 0.3s, border-color 0.3s;
  }
  .svc__toggle::after { content: ""; position: absolute; inset: 0; }
  .svc__plus { position: relative; width: 12px; height: 12px; }
  .svc__plus::before,
  .svc__plus::after { content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: currentColor; transition: transform 0.5s var(--ease); }
  .svc__plus::after { transform: rotate(90deg); }
  .svc.is-open .svc__toggle { background: var(--text); color: var(--bg); border-color: var(--text); }
  .svc.is-open .svc__plus::after { transform: rotate(0deg); }

  .js .svc__panel {
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    transition: grid-template-rows 0.6s var(--ease), visibility 0s linear 0.6s;
  }
  .js .svc.is-open .svc__panel { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows 0.6s var(--ease); }
  .svc__panel-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
    min-height: 0;
    overflow: hidden;
    padding: 0 0 0 3.5rem;
  }
  .svc__panel-inner > :last-child { margin-bottom: 1.75rem; }
  .svc__desc, .svc__tags, .svc .link-arrow { grid-column: auto; }
  .svc__thumb {
    display: block;
    width: 100%;
    max-width: 520px;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border: 1px solid var(--line);
  }
  .svc-preview { display: none !important; }
  .svc__peek { display: none; }

  /* work: two columns, alternating rhythm */
  .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 3.5rem; }
  .work-card--a, .work-card--b, .work-card--c, .work-card--d, .work-card--e { grid-column: auto; margin-top: 0; }
  .work-grid .work-card:nth-child(3n + 1) { grid-column: 1 / -1; }
  .work-grid .work-card:nth-child(3n + 1) .work-card__media { aspect-ratio: 16 / 10; }
  .work-grid .work-card:nth-child(3n + 2) .work-card__media,
  .work-grid .work-card:nth-child(3n) .work-card__media { aspect-ratio: 4 / 5; }
  .work-grid .work-card:nth-child(3n) { margin-top: 3.5rem; }

  .about__grid { grid-template-columns: minmax(0, 1fr); }
  .about__aside { position: relative; top: auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; }
  .about__mark { width: clamp(120px, 28vw, 220px); margin-top: 0; }

  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 3rem; }

  .contact__grid { grid-template-columns: minmax(0, 1fr); }

  .project__body { grid-template-columns: minmax(0, 1fr); }
  .project__stage { height: min(62vh, 75vw); }
}

/* ------------------------------------------------------------ ≤ 767px */
@media (max-width: 767px) {
  .hero__title { max-width: none; }
  .hero__actions .btn { flex: 1 1 auto; }

  .work-grid { grid-template-columns: minmax(0, 1fr); }
  .work-grid .work-card:nth-child(n) { grid-column: auto; margin-top: 0; }
  .work-grid .work-card:nth-child(n) .work-card__media { aspect-ratio: var(--native, 4 / 5); max-height: 78vh; }
  .work-card__view { display: none; }
  .work__more { justify-content: flex-start; }

  .form__row { grid-template-columns: minmax(0, 1fr); }
  .form__foot { flex-direction: column; align-items: stretch; }
  .form__submit { width: 100%; }

  .values { grid-template-columns: minmax(0, 1fr); }
  .value__num { margin-bottom: 0.9rem; }
  .steps { grid-template-columns: minmax(0, 1fr); }

  .channel { grid-template-columns: 5.75rem minmax(0, 1fr) auto; }

  .footer__top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer__company .legal { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .intro__timecode { display: none; }
  .intro__progress { margin-inline: 0 1rem; }

  .project__controls { justify-content: space-between; }
  .lightbox__nav { top: auto; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: none; }
  .lightbox__figure { padding-bottom: 5.5rem; }
}

/* ------------------------------------------------------------ ≤ 479px */
@media (max-width: 479px) {
  .hero__coords { display: none; }
  .hero__actions { flex-direction: column; align-items: stretch; }

  .btn { white-space: normal; text-align: center; line-height: 1.3; padding-block: 0.6rem; }

  .svc__head { grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 0.75rem; }
  .svc__panel-inner { padding-left: 0; }

  .work-card__meta { grid-template-columns: auto minmax(0, 1fr); }
  .work-card__cat { grid-column: 2; text-align: left; }
  .work-card__title { overflow-wrap: anywhere; }

  .filters { gap: 0.4rem; }
  .filter { min-height: 2.5rem; padding: 0.55rem 0.75rem; font-size: 0.68rem; }

  .channel { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.15rem; }
  .channel__label { grid-column: 1 / -1; }

  .choice span { padding-inline: 0.8rem; font-size: 0.82rem; }

  .footer__top { grid-template-columns: minmax(0, 1fr); }
  .footer__company .legal { grid-template-columns: minmax(0, 1fr); }

  .intro__enter { padding-inline: 1.25rem; letter-spacing: 0.22em; text-indent: 0.22em; }
  .intro__enter:hover, .intro__enter:focus-visible { letter-spacing: 0.26em; text-indent: 0.26em; }
  .intro__corner { display: none; }
  .intro__top { justify-content: flex-end; }
}

/* ------------------------------------------------------------ ≤ 374px
   Long single words (e.g. UA "ПЕРЕТВОРЮЄМО") must fit a 280px column. */
@media (max-width: 374px) {
  :root {
    --fs-hero: 1.8rem;
    --fs-h2: 1.45rem;
    --fs-h3: 1.2rem;
  }
  .contact__title { font-size: 1.7rem; }
  .menu__links a { font-size: 1.6rem; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .hero { min-height: auto; }
  .hero__inner { padding-bottom: 3rem; }
  .hero__title { margin-top: 2rem; }
}

@keyframes cueX { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
