/* ============================================================
   FREELAND — Responsive Behavior
   Breakpoints: 1280 / 1024 / 768 / 560 / 380
   ============================================================ */

/* ---------- Small desktop / laptop ---------- */
@media (max-width: 1280px) {
  .mega__inner { grid-template-columns: repeat(3, minmax(140px, 1fr)) minmax(240px, 340px); }
}

/* ---------- Tablet landscape ---------- */
@media (max-width: 1024px) {
  :root { --header-h: 68px; --header-h-compact: 58px; }

  .nav, .mega { display: none; }
  .header__burger { display: flex; }
  .header__inner { grid-template-columns: auto 1fr auto; }
  .header__left { display: flex; align-items: center; gap: 4px; }
  .header__logo img { width: 132px; }
  .header.is-stuck .header__logo img { width: 120px; }
  .header__actions .icon-btn--account,
  .header__actions .icon-btn--wishlist { display: none; }

  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .slider__track { grid-auto-columns: calc((100% - 2 * var(--grid-gap)) / 3); }
  .search-results { grid-template-columns: repeat(3, 1fr); }

  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .footer__main { grid-template-columns: 1fr 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }

  .look { grid-template-columns: 1fr; }
  .look__media { max-width: 640px; }
}

/* ---------- Tablet portrait ---------- */
@media (max-width: 768px) {
  :root { --section-space: clamp(56px, 10vw, 80px); --announce-h: 32px; --container-max: 100%; }
  body { font-size: 14px; }

  .hero { height: min(76vh, 700px); min-height: 480px; }
  .hero__media img { object-position: 62% 25%; }
  .hero__cta .btn { min-width: 142px; padding: 13px 22px; }

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

  .editorial { grid-template-columns: 1fr; }
  .editorial__panel { min-height: 440px; }

  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 22px 12px; }
  .slider__track { grid-auto-columns: calc((100% - var(--grid-gap)) / 2); }
  .search-results { grid-template-columns: repeat(2, 1fr); }

  .trending { grid-template-columns: 1fr; }
  .trend-card { min-height: 300px; }

  .social-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 42vw; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .social-grid::-webkit-scrollbar { display: none; }
  .social-card { scroll-snap-align: start; }

  .footer__main { grid-template-columns: 1fr 1fr; }
  .footer__bottom { justify-content: center; text-align: center; }

  /* Quick add: always accessible on touch, as a quiet text action */
  .quick-add { opacity: 1; transform: none; pointer-events: auto; position: static; margin-top: 0; background: transparent; }
  .quick-add__label {
    border: 1px solid #efefef; margin-top: 9px; padding: 8px 8px; font-size: 9.5px; color: var(--text-secondary);
  }
  .quick-add__sizes { border: 1px solid #efefef; border-top: 0; }
  .quick-add__size { padding: 9px 4px; font-size: 11px; }
  .product-card__media .img-alt { display: none; }
  .product-card:hover .product-card__media .img-main { opacity: 1; }

  .announce { overflow: hidden; justify-content: flex-start; }
  .announce__track { flex-direction: column; gap: 0; width: 100%; }
  .announce__item { height: var(--announce-h); display: none; align-items: center; justify-content: center; width: 100%; text-align: center; font-size: 10px; }
  .announce__item.is-current { display: flex; }
  .announce__sep { display: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  :root { --gutter: 18px; --grid-gap: 10px; }

  .announce { overflow: hidden; justify-content: flex-start; }
  .announce__track { flex-direction: column; gap: 0; width: 100%; }
  .announce__item { height: var(--announce-h); display: none; align-items: center; justify-content: center; width: 100%; text-align: center; font-size: 10px; }
  .announce__item.is-current { display: flex; }
  .announce__sep { display: none; }

  .header__logo img { width: 116px; }
  .header.is-stuck .header__logo img { width: 108px; }

  .hero { height: min(72vh, 620px); min-height: 440px; }
  .hero__title { font-size: clamp(30px, 10vw, 44px); }
  .hero__arrow { display: none; }
  .hero__nav { right: 50%; transform: translateX(50%); bottom: 16px; }
  .hero__dots { gap: 10px; }

  .section-head__row { flex-direction: column; align-items: flex-start; gap: 14px; }

  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .cat-card:first-child, .cat-card:last-child { grid-column: 1 / -1; }
  .cat-card:first-child img, .cat-card:last-child img { aspect-ratio: 16/10; }

  .editorial__panel { min-height: 400px; }
  .editorial__content .btn { min-width: 130px; padding: 12px 20px; }

  .product-card__name { font-size: 12.5px; }
  .product-card__meta { font-size: 11px; }
  .product-card__price { font-size: 12.5px; }
  .badge { font-size: 8.5px; padding: 3px 6px; letter-spacing: .08em; }
  .quick-add__label { letter-spacing: .18em; }

  .tabs { gap: 18px; }

  .red-moment__logo { width: 180px; }

  .search-results { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .search-overlay__inner { padding-top: 84px; }

  .footer__main { grid-template-columns: 1fr 1fr; gap: 28px 18px; }
  .footer__pay { flex-wrap: wrap; justify-content: center; }

  .social-grid { grid-auto-columns: 56vw; }
}

/* ---------- Very small ---------- */
@media (max-width: 380px) {
  .product-grid { grid-template-columns: 1fr; }
  .slider__track { grid-auto-columns: 82%; }
  .footer__main { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   PHASE 2 — RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .pdp { grid-template-columns: 1fr; }
  .pdp__info { position: static; max-width: 640px; }
  body[data-page="home"] .hero { margin-top: calc(-1 * var(--header-h)); }
}

@media (max-width: 768px) {
  /* PDP mobile gallery: swipeable */
  .pdp__gallery { display: none; }
  .pdp__gallery-mobile { display: block; position: relative; margin-inline: calc(-1 * var(--gutter)); }
  .pdp__gallery-mobile .track {
    display: grid; grid-auto-flow: column; grid-auto-columns: 100%;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  }
  .pdp__gallery-mobile .track::-webkit-scrollbar { display: none; }
  .pdp__gallery-mobile .track img { width: 100%; aspect-ratio: 4/5; object-fit: cover; object-position: top; scroll-snap-align: start; }
  .pdp__gallery-mobile .counter {
    position: absolute; right: 14px; bottom: 14px;
    background: rgba(255,255,255,.92); font-size: 11px; letter-spacing: .1em; padding: 5px 10px;
  }

  .checkout { grid-template-columns: 1fr; }
  .order-summary { position: static; }

  /* footer accordion */
  .footer__main nav h4 { display: flex; justify-content: space-between; align-items: center; cursor: pointer; margin-bottom: 0; padding: 14px 0; }
  .footer__main nav h4::after { content: "+"; font-weight: 400; font-size: 15px; transition: transform .3s var(--ease); }
  .footer__main nav.is-open h4::after { transform: rotate(45deg); }
  .footer__main nav ul { display: none; padding-bottom: 14px; }
  .footer__main nav.is-open ul { display: block; }
  .footer__main { grid-template-columns: 1fr; gap: 0; }
  .footer__main nav { border-bottom: 1px solid #232323; }
  .footer__brand { padding-bottom: 26px; }

  .toolbar { top: 0; }
  .filter-drawer { width: 100vw; }
  .sort__menu { right: auto; left: 50%; transform: translate(-50%, -6px); }
  .sort.is-open .sort__menu { transform: translate(-50%, 0); }
}

@media (max-width: 560px) {
  .page-head { padding-top: 22px; }
  .pdp-sizes { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .checkout-steps { flex-wrap: wrap; gap: 12px 18px; }
}
