/* ==========================================================================
   Arena of Stars — responsive.css
   Адаптивность ТЗ §12. Диапазоны: 360–479, 480–767, 768–1023,
   1024–1279, 1280–1599, 1600+.
   Мобильная шахматка → вертикальный поток (ТЗ §5.2), без CSS order.
   ========================================================================== */

/* ── 1280–1599: умеренное уплотнение ──────────────────────────────── */
@media (max-width: 1599px) {
  :root {
    --section-space: clamp(80px, 12vw, 200px);
  }
}

/* ── 1024–1279: планшет-десктоп ───────────────────────────────────── */
@media (max-width: 1279px) {
  :root {
    --container-width: 100%;
    --page-padding: clamp(20px, 4vw, 48px);
    --section-space: clamp(72px, 10vw, 160px);
  }

  .aos-split,
  .aos-split--reverse {
    grid-template-columns: minmax(0, 1.08fr) minmax(300px, 0.92fr);
    gap: clamp(20px, 3vw, 48px);
  }

  .aos-contact__grid {
    grid-template-columns: 1fr;
    gap: clamp(32px, 4vw, 56px);
  }

  .aos-contact__orb {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    margin-top: clamp(24px, 3vw, 40px);
  }

  .aos-process__track {
    grid-template-columns: repeat(5, 1fr);
    gap: clamp(10px, 1.4vw, 20px);
  }
}

/* ── 768–1023: планшет ────────────────────────────────────────────── */
@media (max-width: 1023px) {
  /* Прячем десктоп-навигацию, показываем кнопку меню */
  .aos-nav__list,
  .aos-nav__phone {
    display: none;
  }

  .aos-menu-toggle {
    display: block;
  }

  /* Шахматка превращается в вертикальный поток: изображение под текстом */
  .aos-split,
  .aos-split--reverse {
    grid-template-columns: 1fr;
    gap: clamp(28px, 4vw, 44px);
  }

  /* HTML-порядок: media идёт после текста в обеих ориентациях */
  .aos-split .aos-text-block {
    order: 0;
  }

  .aos-split .aos-media {
    order: 1;
    aspect-ratio: 4 / 3;
  }

  /* Медиаблок делает шире */
  .aos-media {
    aspect-ratio: 4 / 3;
  }

  .aos-text-block {
    max-width: 60ch;
  }

  /* Production: десктоп-превью скрываем, мобильное показываем */
  .aos-production__preview {
    display: none;
  }

  .aos-production__intro {
    grid-template-columns: 1fr;
  }

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

  .aos-production__item:nth-child(n) .aos-production__tooltip {
    right: auto;
    left: 50%;
    transform-origin: 50% 100%;
  }

  .aos-production__item:nth-child(2n + 1) .aos-production__tooltip {
    left: 18px;
    transform-origin: 16% 100%;
  }

  .aos-production__item:nth-child(2n) .aos-production__tooltip {
    right: 18px;
    left: auto;
    transform-origin: 84% 100%;
  }

  .aos-production__item:nth-child(2n + 1):hover .aos-production__tooltip,
  .aos-production__item:nth-child(2n + 1):focus .aos-production__tooltip,
  .aos-production__item:nth-child(2n):hover .aos-production__tooltip,
  .aos-production__item:nth-child(2n):focus .aos-production__tooltip {
    transform: translate(0, 0) scale(1);
  }

  /* Process: вертикальная линия */
  .aos-process__track {
    display: flex;
    flex-direction: column;
    gap: clamp(32px, 4vw, 48px);
  }

  .aos-process__progress {
    top: 0;
    bottom: 0;
    left: 6px;
    right: auto;
    width: 1px;
    height: auto;
  }

  .aos-process__progress-fill {
    width: 100%;
    height: 100%;
    transform: scaleY(0);
    transform-origin: top;
  }

  .aos-process__step {
    padding-left: clamp(28px, 4vw, 44px);
    padding-top: 0;
  }

  .aos-process__step:nth-child(even) {
    margin-top: 0;
  }

  .aos-process__step-dot {
    position: absolute;
    top: 4px;
    left: 0;
    transform: translateX(-50%);
  }

  .aos-process__step:nth-child(even) .aos-process__step-dot {
    top: 4px;
    bottom: auto;
  }

  /* Footer */
  .aos-footer__top {
    grid-template-columns: 1fr 1fr;
  }

  .aos-footer__brand {
    grid-column: 1 / -1;
  }
}

/* ── 480–767: большой мобильный ───────────────────────────────────── */
@media (max-width: 767px) {
  :root {
    --page-padding: clamp(18px, 5vw, 28px);
    --section-space: clamp(64px, 16vw, 110px);
    --section-space-tight: clamp(48px, 12vw, 80px);
    --font-display-xl: clamp(2.3rem, 10.5vw, 3.35rem);
    --font-display-lg: clamp(2.4rem, 11vw, 4rem);
    --font-display-md: clamp(2.1rem, 10vw, 3.4rem);
    --font-heading: clamp(1.9rem, 8vw, 3rem);
    --font-subheading: clamp(1.25rem, 5vw, 1.8rem);
  }

  body {
    font-size: 1rem;
  }

  /* Hero: текст прижат к верху, чтобы заголовок был виден сразу */
  .aos-hero {
    align-items: flex-start;
  }

  .aos-hero__content {
    padding-top: clamp(76px, 11vh, 104px);
    padding-bottom: clamp(100px, 12vh, 140px);
  }

  /* Hero: убираем нижнюю панель в компактный вид */
  .aos-hero__bar-inner {
    gap: 12px;
  }

  .aos-hero__title {
    font-size: clamp(2.15rem, 9vw, 3rem);
    letter-spacing: -0.045em;
    max-width: 100%;
    hyphens: manual;
  }

  .aos-hero__scroll-line {
    width: 40px;
  }

  /* Контакты вертикально */
  .aos-contact__messengers {
    flex-direction: column;
    align-items: stretch;
  }

  .aos-contact__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .aos-contact__actions .aos-pill {
    width: 100%;
  }

  .aos-contact__messengers .aos-socials {
    justify-content: center;
    margin-top: 6px;
  }

  .aos-contact__row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .aos-contact__value[href^="mailto:"] {
    font-size: clamp(1.1rem, 5vw, 1.35rem);
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow-wrap: normal;
  }

  .aos-pill {
    justify-content: center;
  }

  /* Footer */
  .aos-footer__top {
    grid-template-columns: 1fr;
    gap: clamp(28px, 5vw, 40px);
  }

  .aos-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .aos-emotional__content {
    max-width: 100%;
  }

  .aos-emotional__title {
    line-height: 1.075;
  }

  /* Marquee меньше */
  .aos-marquee__item {
    font-size: clamp(1.5rem, 8vw, 2.4rem);
  }

  /* Production items меньше */
  .aos-production__item-name {
    font-size: clamp(1.15rem, 5vw, 1.6rem);
  }
}

/* ── 360–479: малый мобильный ─────────────────────────────────────── */
@media (max-width: 479px) {
  :root {
    --page-padding: 18px;
    --font-display-xl: clamp(2.4rem, 14vw, 3.4rem);
  }

  .aos-hero__title {
    max-width: 100%;
    font-size: clamp(1.85rem, 8.4vw, 2.7rem);
    line-height: 1.05;
  }

  .aos-hero__sub {
    margin-top: clamp(16px, 2.5vh, 24px);
  }

  .aos-hero__actions {
    flex-direction: column;
    align-items: stretch;
    margin-top: clamp(16px, 2.5vh, 24px);
  }

  .aos-btn {
    justify-content: center;
    width: 100%;
  }

  .aos-hero__bar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .aos-pull-quote {
    font-size: clamp(1.2rem, 6vw, 1.6rem);
  }

  .aos-contact__value {
    font-size: clamp(1.25rem, 7vw, 1.8rem);
  }

  .aos-production__list {
    grid-template-columns: 1fr;
  }

  .aos-production__item {
    overflow: hidden;
  }

  .aos-production__item:nth-child(n) .aos-production__tooltip {
    position: relative;
    inset: auto;
    width: 100%;
    max-height: 0;
    padding: 0 18px;
    margin-top: -20px;
    border-radius: 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.98);
    transform-origin: 50% 0;
    transition:
      max-height 500ms var(--ease-out-expo),
      margin 500ms var(--ease-out-expo),
      padding 500ms var(--ease-out-expo),
      opacity 240ms ease,
      visibility 240ms ease,
      transform 500ms var(--ease-out-expo);
  }

  .aos-production__tooltip::after {
    display: none;
  }

  .aos-production__item.is-tooltip-open .aos-production__tooltip {
    max-height: 360px;
    padding: 20px 18px;
    margin-top: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  /* safe area для iOS */
  .aos-hero__bar,
  .aos-footer {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .aos-to-top {
    bottom: 18px;
    right: 18px;
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .aos-header__inner {
    padding-top: env(safe-area-inset-top, 0);
  }
}

/* ── Большие экраны 1600+: добавляем воздуха ──────────────────────── */
@media (min-width: 1600px) {
  :root {
    --page-padding: clamp(40px, 4vw, 80px);
    --section-space: clamp(120px, 14vw, 260px);
  }
}

/* ── Очень большие экраны 1920+ ───────────────────────────────────── */
@media (min-width: 1920px) {
  :root {
    --container-width: 1840px;
    --font-display-xl: clamp(8rem, 9vw, 12rem);
  }
}

/* ── Тонкая подстройка под landscape телефоны ─────────────────────── */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  .aos-hero {
    min-height: 100vh;
  }

  .aos-hero__content {
    padding-top: clamp(90px, 22vh, 120px);
    padding-bottom: clamp(80px, 18vh, 110px);
  }

  .aos-emotional {
    min-height: 100vh;
  }
}

/* ── Курсор только для точных указателей (ТЗ §11) ─────────────────── */
@media (hover: none), (pointer: coarse) {
  .aos-cursor,
  .aos-cursor__dot,
  .aos-cursor__label {
    display: none !important;
  }
}

@media (pointer: fine) and (hover: hover) {
  /* Скрываем системный курсор только когда есть замена и JS активен */
  .js.aos-has-cursor,
  .js.aos-has-cursor a,
  .js.aos-has-cursor button {
    cursor: none;
  }
}

/* ── Печать ───────────────────────────────────────────────────────── */
@media print {
  .aos-preloader,
  .aos-cursor,
  .aos-cursor__dot,
  .aos-cursor__label,
  .aos-grain,
  .aos-header,
  .aos-menu,
  .aos-hero__video-wrap,
  .aos-scroll-progress {
    display: none !important;
  }

  .aos-hero {
    min-height: auto;
  }

  body {
    overflow: visible;
  }
}

/* ── Высокая контрастность Windows ────────────────────────────────── */
@media (forced-colors: active) {
  .aos-btn,
  .aos-pill {
    border: 1px solid CanvasText;
  }

  .aos-cursor,
  .aos-cursor__dot,
  .aos-grain {
    display: none;
  }
}
