/* =============================================
   SPLENDOR — MOBILE PREMIUM OVERRIDES
   Todo lo que aplica ≤768px para que el sitio se
   sienta táctil, pulido y premium en celular.
   Incluye: base global (font smoothing, tap-highlight),
   active states, safe areas, inputs iOS-friendly,
   scroll-snap carousels, reduce blur pesado, etc.
   ============================================= */

/* ── BASE GLOBAL (aplica a todos los viewports) ─────────── */
html {
  -webkit-text-size-adjust: 100%;            /* no auto-zoom en orientación iOS */
  -webkit-tap-highlight-color: transparent;  /* sin flash azul al tocar */
  text-rendering: optimizeLegibility;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Touch targets mínimos y feedback de tap para botones, links, cards */
button,
a,
[role="button"],
.btn,
.btn-light,
.btn-ghost-light,
.btn-outline,
.btn-primary,
.navbar-icon-btn,
.product-card,
.category-card {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;                 /* elimina 300ms delay en click */
}

/* Active state táctil premium — feedback sutil al tocar */
@media (hover: none) and (pointer: coarse) {
  .btn:active,
  .btn-light:active,
  .btn-ghost-light:active,
  .btn-outline:active,
  .btn-primary:active,
  .navbar-icon-btn:active,
  .product-card:active,
  .category-card:active,
  .account-nav__link:active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform .12s ease, opacity .12s ease;
  }
}

/* Inputs: 16px mínimo para evitar auto-zoom en iOS */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  select,
  textarea {
    font-size: 16px !important;
    /* 16px garantiza no-zoom, el design overriding en desktop sigue */
  }
}

/* Reducir animaciones costosas en mobile */
@media (max-width: 768px) {
  /* backdrop-filter pesa en mobile: bajamos blur */
  .hero__fact,
  .hero__aside-card,
  .navbar-user__menu {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  /* Parallax / transform heavy effects: simplificar */
  .category-card:hover .category-card__img-wrap img {
    transform: none;
  }
}

/* Respeto a reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── MOBILE-ONLY (≤768px) ────────────────────────────────── */
@media (max-width: 768px) {

  /* Container padding más agarrable */
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

  body.menu-open {
    overscroll-behavior: none;
  }

  .navbar-inner {
    padding-left: 1rem;
    padding-right: 1rem;
    gap: 0.75rem;
  }

  .navbar-brand {
    gap: 0.65rem;
    min-width: 0;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .navbar-logo {
    font-size: clamp(0.98rem, 4vw, 1.12rem);
  }

  .navbar-actions {
    margin-left: auto;
    gap: 0.35rem;
  }

  .navbar-actions #search-toggle {
    display: none !important;
  }

  .navbar-notif__panel {
    width: min(75vw, 360px) !important;
    max-width: calc(100vw - 1.5rem) !important;
    max-height: min(68vh, 480px) !important;
    right: 0.75rem !important;
  }

  .navbar-user__menu {
    width: min(75vw, 260px) !important;
    max-width: calc(100vw - 1.5rem) !important;
    min-width: 0 !important;
    right: 0.75rem !important;
  }

  #navbar-user-menu a,
  #navbar-user-menu button,
  #navbar-notif-mark-all {
    min-height: 44px !important;
    display: flex !important;
    align-items: center;
  }

  #navbar-user-menu a,
  #navbar-user-menu button {
    padding: .7rem .75rem !important;
  }

  #navbar-notif-mark-all {
    padding: .4rem 0 !important;
    font-size: .72rem !important;
  }

  /* Section titles no enormes en mobile */
  .section-title {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
    line-height: 1.15;
  }
  .section-header {
    margin-bottom: 1.5rem;
  }

  /* ── HERO HOME ────────────────────────────────────────── */
  .hero {
    min-height: 560px;
    height: auto;
    padding: calc(var(--nav-height, 70px) + 1.5rem) 0 3.5rem;
  }

  .hero__shell {
    display: block;
  }

  .hero__copy {
    max-width: 100%;
  }

  .hero__eyebrow {
    font-size: .72rem;
    letter-spacing: .22em;
  }

  .hero__title {
    font-size: clamp(2rem, 11vw, 3.25rem);
    line-height: 1.05;
  }

  .hero__sub {
    font-size: 1rem;
    line-height: 1.55;
    margin-bottom: 1.5rem;
  }

  /* Botones del hero: ancho completo, stacked */
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    gap: .75rem;
  }
  .hero__actions .btn,
  .hero__actions .btn-light,
  .hero__actions .btn-ghost-light {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem;
    font-size: .85rem;
  }

  .hero__scroll {
    display: none;                    /* en mobile no aporta, libera aire */
  }

  /* Overlay un poco más pronunciado abajo para legibilidad */
  .hero__overlay {
    background: linear-gradient(180deg,
      rgba(10,10,10,0.25) 0%,
      rgba(10,10,10,0.40) 50%,
      rgba(10,10,10,0.75) 100%);
  }

  /* ── CARDS GENÉRICAS ─────────────────────────────────── */
  /* Grid de categorías: 2 columnas mobile */
  .categories-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: .75rem !important;
  }
  .category-card__overlay {
    padding: 1rem .9rem !important;
  }
  .category-card__name {
    font-size: 1.1rem !important;
  }
  .category-card__count {
    font-size: .7rem !important;
  }

  /* Producto cards en swipers — scroll snap + momentum */
  .featured-swiper,
  .novedades-swiper,
  .related-swiper {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .featured-swiper .swiper-slide,
  .novedades-swiper .swiper-slide,
  .related-swiper .swiper-slide {
    scroll-snap-align: start;
  }

  /* ── CARRUSEL FLECHAS EN MOBILE ──────────────────────── */
  /* En mobile es más común swipe — las flechas son decorativas/secundarias */
  .swiper-button-prev,
  .swiper-button-next {
    opacity: 0.92;
  }
  /* Si quieres ocultar totalmente las flechas en mobile, descomentá:
     .swiper-button-prev, .swiper-button-next { display: none !important; } */

  /* ── TRUST BAR / BRAND STRIP ─────────────────────────── */
  .trust-bar__grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
  .brand-strip {
    padding: .75rem 0;
  }
  .brand-strip__inner span {
    font-size: .62rem;
  }

  /* ── FOOTER ──────────────────────────────────────────── */
  .footer-inner {
    padding: 2.5rem 1.25rem 1.5rem;
  }
  .footer-grid,
  [class*="footer-grid"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
  }
  .footer-newsletter form {
    flex-direction: column;
    gap: .5rem;
  }
  .footer-newsletter input,
  .footer-newsletter button {
    width: 100% !important;
  }
  .footer-list a,
  .footer-bottom a,
  .footer-cta {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: .2rem 0;
  }
  .footer-bottom {
    justify-content: flex-start;
    align-items: flex-start;
  }
  .footer-bottom__credit {
    margin-left: 0;
    text-align: left;
  }

  /* ── FORMS (login / registro / contacto) ─────────────── */
  .auth-form,
  .contact-form,
  .form-wrap {
    padding: 1.5rem 1.25rem;
  }
  .input,
  input.input,
  select.input,
  textarea.input {
    padding: .85rem 1rem;
    min-height: 48px;
    border-radius: .5rem;
  }
  .form-row {
    grid-template-columns: 1fr !important;
    gap: .75rem !important;
  }

  /* ── SAFE AREA (iPhone notch) + clearance landscape Android ─── */
  #whatsapp-btn {
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    right: calc(1rem + env(safe-area-inset-right, 0px));
  }

  /* ── MODALES (cuenta, cotización, etc.) ──────────────── */
  .modal,
  .modal-overlay > * {
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* ── MOBILE SMALL (≤480px) ──────────────────────────────── */
@media (max-width: 480px) {
  .hero__title {
    font-size: clamp(1.85rem, 10.5vw, 2.75rem);
  }
  .section-title {
    font-size: clamp(1.55rem, 7.5vw, 2.25rem);
  }
  .categories-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .trust-bar__grid {
    grid-template-columns: 1fr !important;
  }
  .footer-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── MOBILE MENU: pulido premium ─────────────────────── */
@media (max-width: 768px) {
  .mobile-menu {
    inset: calc(var(--nav-height, 70px) - 1px) 0 0 0;
    padding: 0;
    background: rgba(18, 18, 18, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    overscroll-behavior: contain;
    z-index: 95;
  }
  .mobile-menu.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .mobile-menu__panel {
    width: min(28rem, 100%);
    max-width: 28rem;
    margin-left: auto;
    min-height: 100%;
    padding: 1.2rem 1.15rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    background: rgba(250, 249, 247, 0.985);
    box-shadow: -20px 0 48px rgba(0,0,0,.14);
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-menu.open .mobile-menu__panel {
    transform: translateX(0);
  }
  .mobile-menu a {
    font-size: 1.28rem;
    padding: 1rem 0;
    display: flex;
    align-items: center;
  }
  .mobile-menu__eyebrow {
    font-size: .65rem;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
  }
  .mobile-menu__search {
    min-height: 46px;
    padding: 1rem 1.2rem;
    font-size: .8rem;
    margin-bottom: 0.75rem;
  }
  .mobile-menu__footer {
    margin-top: auto;
    padding-top: 1.4rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: .5rem;
  }
  .mobile-menu__footer a,
  .mobile-menu__footer button {
    font-size: .85rem;
    padding: .75rem 0;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: .12em;
    border: none;
  }
  .mobile-menu__support {
    line-height: 1.5;
  }
}

/* Hamburger button: tocable y visible */
@media (max-width: 768px) {
  .navbar-menu-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
  .navbar-menu-btn span {
    width: 20px;
    height: 1.6px;
  }
}

@media (max-width: 480px) {
  .navbar-inner {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .navbar-actions {
    gap: 0.25rem;
  }

  .navbar-logo {
    font-size: 0.98rem;
  }

  .navbar-icon-btn,
  .navbar-menu-btn {
    width: 44px;
    height: 44px;
  }

  .navbar-menu-btn {
    min-width: 44px;
  }

  .navbar-menu-btn span {
    width: 18px;
  }

  .mobile-menu__panel {
    width: 100%;
    max-width: 100%;
    padding: 1rem 1rem calc(1.35rem + env(safe-area-inset-bottom, 0px));
  }

  .mobile-menu__search {
    padding: 0.95rem 1rem;
    font-size: .74rem;
  }

  .mobile-menu__search span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .footer-bottom {
    gap: 0.5rem !important;
  }
}

/* ── CHECKOUT / BOTONES CTA MOBILE ─────────────────────── */
@media (max-width: 768px) {
  .checkout-step .btn {
    width: 100%;
  }
}

/* ── PRODUCTO MOBILE ──────────────────────────────────── */
@media (max-width: 768px) {
  /* Grid de producto en mobile: single column, galería arriba, info debajo */
  .product-detail__grid {
    grid-template-columns: 1fr !important;
    gap: 1.75rem !important;
  }

  /* Galería: thumbs HORIZONTALES debajo de la imagen principal */
  .product-gallery {
    grid-template-columns: 1fr !important;
    position: relative !important;
    top: auto !important;
  }
  .gallery-thumbs {
    flex-direction: row !important;
    gap: .5rem !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 1rem .25rem;
  }
  .gallery-thumbs::-webkit-scrollbar { display: none; }
  .thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
  }
  .thumb img {
    width: 64px !important;
    height: 64px !important;
  }

  /* Info card: padding reducido */
  .product-info {
    padding: 1.25rem !important;
    border-radius: .85rem !important;
  }

  /* Variantes en mobile: grid de 2 columnas en vez de flex list */
  .variant-list {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: .5rem !important;
  }
  .variant-btn {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: .7rem .85rem !important;
  }

  /* Botones del producto: CTA ancho completo, WhatsApp secundario */
  .product-add {
    flex-direction: column !important;
    gap: .65rem !important;
  }
  .product-add .qty-selector {
    align-self: flex-start;
  }
  .product-add__btn {
    width: 100% !important;
    min-width: 0 !important;
    padding: 1rem 1.5rem !important;
  }
  .product-add__wa {
    width: 100% !important;
    justify-content: center;
  }
  .btn-wishlist {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 5;
  }

  /* Tabs de descripción: scroll horizontal si no caben */
  .product-tabs .tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .product-tabs .tabs-nav::-webkit-scrollbar { display: none; }
  .tab-btn {
    flex-shrink: 0;
    font-size: .78rem !important;
  }
}

/* ── CATÁLOGO MOBILE: grid 2 cols ─────────────────────── */
@media (max-width: 768px) {
  .catalog-grid,
  #catalog-grid,
  .products-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: .75rem !important;
  }

  /* Cards más compactas en 2-col */
  .product-card__info {
    padding: .75rem !important;
  }
  .product-card__name {
    font-size: .9rem !important;
    line-height: 1.25 !important;
  }
  .product-card__cat {
    font-size: .62rem !important;
  }
  .product-card__price {
    font-size: .9rem !important;
  }
  .product-card__size-meta {
    font-size: .7rem !important;
  }

  /* Sidebar filtros como drawer (JS usa #catalog-filters.mobile-open) */
  .catalog-layout {
    grid-template-columns: 1fr !important;
  }
  #catalog-filters,
  .catalog-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 340px);
    background: #fff;
    z-index: 200;
    transform: translateX(-105%);
    transition: transform .35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 2px 0 32px rgba(0,0,0,.12);
    padding: 1.25rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #catalog-filters.mobile-open,
  .catalog-sidebar.mobile-open,
  .catalog-sidebar.open {
    transform: translateX(0);
  }
  #drawer-close,
  .catalog-sidebar__close {
    display: block !important;
  }

  /* Botón "Filtros" flotante o en la toolbar del catálogo */
  #mobile-filter-btn,
  #filters-toggle {
    display: inline-flex !important;
  }

  /* Backdrop cuando el drawer está abierto */
  body:has(#catalog-filters.mobile-open)::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 150;
    animation: drawerFadeIn .3s ease;
  }
  @keyframes drawerFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
}

/* ≤480 mobile small: sigue 2 cols compactas, pero card full-width si quieres */
@media (max-width: 400px) {
  .catalog-grid,
  #catalog-grid,
  .products-grid {
    gap: .65rem !important;
  }
}

/* ── CUENTA MOBILE: tabs horizontales scrollables ───── */
@media (max-width: 768px) {
  .account-layout,
  .account-wrap {
    grid-template-columns: 1fr !important;
  }

  .account-sidebar {
    position: static !important;
    margin-bottom: 1.25rem;
  }

  .account-nav {
    display: flex !important;
    flex-direction: row !important;
    gap: .25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--color-border);
  }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-nav__link {
    flex-shrink: 0;
    padding: .7rem 1rem !important;
    font-size: .8rem !important;
    border: 1px solid transparent !important;
    border-radius: 999px !important;
    white-space: nowrap;
  }
  .account-nav__link.is-active {
    background: var(--color-primary) !important;
    color: #fff !important;
  }

  .account-user-header {
    padding: 1rem 0 !important;
  }
}

/* ── CHECKOUT MOBILE ─────────────────────────────────── */
@media (max-width: 768px) {
  .checkout-layout {
    grid-template-columns: 1fr !important;
  }

  /* Steps indicator: compacto, solo números + active */
  .steps-indicator {
    padding: .75rem 0 !important;
    gap: .5rem !important;
  }
  .step {
    font-size: .72rem !important;
  }
  .step__number {
    width: 28px !important;
    height: 28px !important;
  }

  /* Summary lateral al top o al bottom (no lateral) */
  .checkout-summary {
    order: -1;
    margin-bottom: 1.5rem;
  }

  /* Payment tabs: 3 en columna si no caben */
  .payment-tabs-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ── CARRITO MOBILE ──────────────────────────────────── */
@media (max-width: 768px) {
  .cart-layout {
    grid-template-columns: 1fr !important;
  }

  .cart-item {
    flex-wrap: wrap !important;
    gap: .85rem !important;
    padding: 1rem 0 !important;
  }
  .cart-item__img {
    width: 72px !important;
    height: 72px !important;
    flex-shrink: 0;
  }
  .cart-item__info {
    flex: 1 1 calc(100% - 100px) !important;
    min-width: 0;
  }
  .cart-item__total {
    width: 100%;
    text-align: right;
    padding-top: .5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .cart-summary {
    padding: 1.25rem !important;
  }
  .cart-checkout-btn {
    width: 100% !important;
    padding: 1rem !important;
  }
}

/* ── AUTH (login/registro) MOBILE ────────────────────── */
@media (max-width: 768px) {
  .auth-split,
  .auth-layout {
    grid-template-columns: 1fr !important;
  }
  .auth-aside,
  .auth-visual {
    display: none !important;            /* ocultar panel decorativo en mobile */
  }
  .auth-form-wrap,
  .auth-form__wrap {
    padding: 2rem 1.25rem !important;
    min-height: auto !important;
  }
  .auth-form {
    max-width: 100% !important;
  }
}

/* ── CONTENIDO (nosotros/contacto/blog/faq/terminos/dev) MOBILE ── */
@media (max-width: 768px) {
  .page-hero {
    min-height: 280px !important;
    padding: 4rem 1rem 2rem !important;
  }
  .page-hero__title {
    font-size: clamp(1.85rem, 8vw, 2.75rem) !important;
  }

  /* Grids editoriales */
  .values-grid,
  .process-grid,
  .stats-grid,
  .blog-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* FAQ: item full-width con toggle grande */
  .faq-item {
    padding: 1.25rem 0 !important;
  }
  .faq-question {
    font-size: 1rem !important;
  }

  /* Lookbook: stack vertical en mobile (no 2 columnas) */
  .lookbook-wrap {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }
  .lookbook-curtain,
  .lookbook-curtain__back {
    min-height: 380px !important;
  }
  .lookbook-curtain__half img {
    min-height: 380px !important;
  }
}
