/* ==========================================================
   SABASIM — RESPONSIVE
   Firefox-safe drawer: right-position transition (no transform)
   ========================================================== */

/* ---------- Ultra-wide / 4K ---------- */
@media (min-width: 1920px) {
  :root { --container: 1440px; }
  body  { font-size: 1.05rem; }
}

@media (min-width: 2560px) {
  :root { --container: 1640px; }
  body  { font-size: 1.15rem; }
  .hero { min-height: 78vh; }
}

@media (min-width: 3840px) {
  :root { --container: 2000px; }
  body  { font-size: 1.3rem; }
  .hero h1 { font-size: 4.5rem; }
}

/* ==========================================================
   LARGE DESKTOP  ≤ 1440
   ========================================================== */
@media (max-width: 1440px) {
  .hero__inner { gap: 2.5rem; }
}

/* ==========================================================
   DESKTOP  ≤ 1280
   ========================================================== */
@media (max-width: 1280px) {
  :root { --container: 1180px; }
  .hero__inner { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
  .hero__panel { max-width: 340px; }
}

/* ==========================================================
   SMALL DESKTOP  ≤ 1100
   ========================================================== */
@media (max-width: 1100px) {
  .apps__list { gap: 0; }
  .timeline   { grid-template-columns: repeat(3, 1fr); }
  .timeline__step:nth-child(3n) { border-inline-start: 0; }
}

/* ==========================================================
   TABLET LANDSCAPE  ≤ 1024
   ========================================================== */
@media (max-width: 1024px) {
  :root { --gutter: clamp(1rem, 3.5vw, 1.75rem); }

  .hero { min-height: auto; padding-block: 4rem 3rem; }
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-block: 3rem 2rem;
  }
  .hero__panel {
    max-width: 100%;
    justify-self: stretch;
    align-self: auto;
  }
  .hero__content { max-width: 100%; }

  .editorial,
  .apps,
  .quality {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .editorial__media,
  .quality__media { order: 2; }

  .product-block {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .product-block--reverse { direction: rtl; }

  .glass-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

  .footer__grid { grid-template-columns: 1fr 1fr; gap: 2rem; }

  .timeline { grid-template-columns: repeat(3, 1fr); }
  .timeline__step:nth-child(3n) { border-inline-start: 0; }
}

/* ==========================================================
   TABLET PORTRAIT  ≤ 900
   ========================================================== */
@media (max-width: 900px) {
  .catalog__box {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
    text-align: center;
  }
  .catalog__box .btn { width: 100%; }

  .cta-band {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .cta-band .btn { width: 100%; }
}

/* ==========================================================
   MOBILE NAV  ≤ 880
   ----------------------------------------------------------
   The nav is reparented to <body> by JS on mobile, so
   `position: fixed` resolves to the viewport (not the
   sticky header). The drawer is moved off-screen with
   physical `right: -100vw` and slides in with `right: 0`.
   No transform → no Firefox RTL bug.
   ========================================================== */
@media (max-width: 880px) {
  .header__inner { min-height: 68px; }

  .nav {
    position: fixed;
    top: 0;
    right: -100vw;                /* off-screen right */
    left: auto;

    width: min(340px, 88vw);
    max-width: 100vw;
    height: 100dvh;

    background: rgba(14, 16, 19, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);

    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-right: none;

    padding: calc(78px + env(safe-area-inset-top, 0px)) 1.5rem
             calc(2rem + env(safe-area-inset-bottom, 0px));

    /* Animate the physical `right` property — no transform */
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    z-index: 950;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    /* Fallback: never visible when closed */
    visibility: hidden;
  }

  .nav.is-open {
    right: 0;
    visibility: visible;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
  }

  .nav__link {
    display: flex;
    align-items: center;
    padding: 0.95rem 0.75rem;
    font-size: 1rem;
    border-radius: 10px;
    min-height: 48px;
  }

  .nav__link::after { display: none; }

  .nav__link:hover,
  .nav__link.is-active {
    background: rgba(200, 16, 46, 0.12);
    color: #fff;
  }

  .nav__mobile-cta {
    display: block;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav__mobile-cta .btn {
    width: 100%;
    min-height: 52px;
  }

  .header__cta { display: none; }

  .burger {
    display: flex;
    min-width: 44px;
    min-height: 44px;
  }

  body.nav-open { overflow: hidden; }
}

/* ==========================================================
   LARGE PHONES  ≤ 768
   ========================================================== */
@media (max-width: 768px) {
  :root { --gutter: clamp(0.9rem, 4vw, 1.25rem); }

  .section { padding-block: clamp(3rem, 8vw, 5rem); }
  .section--tight { padding-block: clamp(2rem, 5vw, 3rem); }

  .hero h1 {
    font-size: clamp(1.75rem, 1.2rem + 3vw, 2.6rem);
    line-height: 1.25;
  }
  .hero__lead { font-size: 0.98rem; line-height: 1.85; }

  .hero__cta { flex-direction: column; align-items: stretch; }
  .hero__cta .btn { width: 100%; min-height: 52px; }

  .hero__specs li { font-size: 0.82rem; }
  .eyebrow { font-size: 0.75rem; }

  .glass-cards { grid-template-columns: 1fr; gap: 0.75rem; }
  .glass-card { padding: 1rem; }
  .glass-card h3 { font-size: 0.95rem; }

  .product-block__media { aspect-ratio: 4 / 3; }
  .product-block__body  { padding: 1.25rem; }

  .spec-list > div {
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-start;
  }
  .spec-list dd { text-align: right; }

  .app-row { gap: 1rem; padding-block: 1.1rem; }
  .app-row__body h3 { font-size: 1rem; }
  .app-row__body p  { font-size: 0.85rem; }

  .timeline { grid-template-columns: 1fr 1fr; gap: 0; }
  .timeline__step {
    padding: 1.25rem 0.85rem;
    border-inline-start: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .timeline__step:nth-child(2n) { border-inline-start: 0; }
  .timeline__step:nth-child(odd):last-child { border-bottom: 0; }
  .timeline__step h3 { font-size: 0.98rem; }
  .timeline__step p  { font-size: 0.8rem; }

  .catalog { padding-block: 2.5rem; }
  .catalog__box { padding: 1.5rem; }

  .footer__grid { grid-template-columns: 1fr; gap: 2rem; }
  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .footer__line { width: 100%; }

  .section-foot .btn { width: 100%; min-height: 52px; }

  .media--tall { aspect-ratio: 4 / 3; }
  .media--square { aspect-ratio: 4 / 3; }
  .media--wide { aspect-ratio: 16 / 10; }
}

/* ==========================================================
   STANDARD PHONES  ≤ 560
   ========================================================== */
@media (max-width: 560px) {
  .section { padding-block: 3rem; }

  .hero { min-height: auto; padding-block: 3rem 2.5rem; }
  .hero__inner { padding-block: 2rem 1.5rem; gap: 1.5rem; }

  .hero h1 { font-size: 1.7rem; }
  .hero__lead { font-size: 0.92rem; }
  .hero__panel { padding: 1.15rem; }
  .hero__panel-title { font-size: 0.7rem; }

  .timeline { grid-template-columns: 1fr; }
  .timeline__step {
    padding: 1.15rem 0 1.15rem 1.25rem;
    border-inline-start: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    padding-inline-start: 1.5rem;
  }
  .timeline__step::before {
    top: 1.5rem;
    inset-inline-start: 0;
    inset-inline-end: auto;
  }
  .timeline__step:last-child { border-bottom: 0; }

  .h2 { font-size: clamp(1.4rem, 1.1rem + 2vw, 1.9rem); }
  .h3 { font-size: clamp(1.1rem, 1rem + 0.8vw, 1.35rem); }
  .lead { font-size: 0.98rem; }

  .notice { font-size: 0.75rem; }

  .btn { min-height: 48px; padding: 0.75rem 1.25rem; font-size: 0.9rem; }
  .btn--lg { min-height: 52px; }
  .btn--sm { min-height: 40px; padding: 0.5rem 0.9rem; font-size: 0.82rem; }
}

/* ==========================================================
   SMALL PHONES  ≤ 430
   ========================================================== */
@media (max-width: 430px) {
  :root { --gutter: 1rem; }
  .hero h1 { font-size: 1.55rem; }
  .brand__text small { display: none; }
  .brand__text strong { font-size: 1rem; }
  .brand__logo { width: 42px; height: 42px; }
  .product-block__badge { font-size: 0.7rem; padding: 0.35rem 0.7rem; }
  .tag-list li { font-size: 0.72rem; padding: 0.3rem 0.65rem; }
}

/* ==========================================================
   VERY SMALL  ≤ 375
   ========================================================== */
@media (max-width: 375px) {
  .hero h1 { font-size: 1.4rem; line-height: 1.3; }
  .hero__lead { font-size: 0.88rem; }
  .nav { width: min(320px, 92vw); }
  .app-row__num { font-size: 0.72rem; }
  .btn { font-size: 0.85rem; padding: 0.7rem 1.1rem; }
  .btn--lg { font-size: 0.9rem; }
  .eyebrow { font-size: 0.7rem; }
}

/* ==========================================================
   TINY  ≤ 320
   ========================================================== */
@media (max-width: 320px) {
  :root { --gutter: 0.85rem; }
  .hero h1 { font-size: 1.3rem; }
  .hero__lead { font-size: 0.85rem; }
  .brand__logo { width: 38px; height: 38px; }
  .logo-ph { font-size: 0.55rem; }
  .header__inner { min-height: 62px; }
  .nav { width: 96vw; }
}

/* ==========================================================
   LANDSCAPE PHONES
   ========================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .nav { padding-top: 4.5rem; overflow-y: auto; }
  .hero { min-height: auto; padding-block: 2rem; }
  .hero h1 { font-size: 1.5rem; }
}

/* ==========================================================
   IOS NOTCH / SAFE AREAS
   ========================================================== */
@supports (padding: max(0px)) {
  .header__inner {
    padding-inline:
      max(var(--gutter), env(safe-area-inset-left))
      max(var(--gutter), env(safe-area-inset-right));
  }
  .nav {
    padding-top: calc(78px + env(safe-area-inset-top));
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
  }
  .site-footer {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }
}

/* ==========================================================
   TOUCH DEVICES
   ========================================================== */
@media (hover: none) and (pointer: coarse) {
  .nav__link,
  .btn,
  .socials a,
  .link-arrow { min-height: 44px; }
  .nav__link { display: flex; align-items: center; }
  .app-row:hover { padding-inline-start: 0; }
  .app-row:hover .app-row__line { width: 0; }
}

/* ==========================================================
   REDUCED MOTION
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none !important; }
}

/* ==========================================================
   PRINT
   ========================================================== */
@media print {
  .site-header,
  .nav,
  .nav-scrim,
  .burger,
  .strip,
  .hero__scrim,
  .hero__grid,
  .hero__rule,
  .site-footer,
  .catalog,
  .cta-band { display: none !important; }

  body { color: #000; background: #fff; }
  .hero,
  .section { padding-block: 1rem; background: #fff; color: #000; }
  .hero__bg { display: none; }
  a { color: #000; text-decoration: underline; }
  .glass,
  .glass--dark {
    background: #fff !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
  }
}