/* KTO mobile.css — phone-specific overrides + global late-cascade refinements
   Loaded after each page's inline <style> so these rules win in the cascade.
   Targets phones ≤480px (Android narrow at 360px; iPhone 14 at 390px).
   The "Buttons — global refinements" block below applies at all viewport sizes. */

/* iOS Safari: prevent zoom-in on focus when input font-size <16px */
@supports (-webkit-touch-callout: none) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="search"],
  input[type="number"],
  input[type="password"],
  select,
  textarea {
    font-size: 16px;
  }
}

/* ============================================================
   BUTTONS — global refinements (a11y + polish, all viewports)
   ============================================================ */

/* Smoother easing on primary/outline CTAs — additive to existing
   per-page `:hover { background: ... }` rules (different properties). */
.btn-primary,
.btn-outline {
  transition: transform 0.18s cubic-bezier(.4,0,.2,1),
              background 0.25s cubic-bezier(.4,0,.2,1),
              color 0.25s cubic-bezier(.4,0,.2,1),
              box-shadow 0.25s cubic-bezier(.4,0,.2,1),
              border-color 0.25s cubic-bezier(.4,0,.2,1);
}

/* Subtle lift on hover — feels premium without being flashy. */
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.14);
}
.btn-outline:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

/* Tactile press feedback. */
.btn-primary:active,
.btn-outline:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,0,0,0.10);
  transition-duration: 0.08s;
}

/* Header icon buttons — search, wishlist, cart. */
.icon-btn {
  transition: background 0.2s ease, transform 0.15s ease;
}
.icon-btn:active {
  transform: scale(0.92);
  transition-duration: 0.08s;
}

/* Best-sellers carousel arrows — keep the translateY(-50%) centering. */
.bs-arrow {
  transition: background 0.2s ease, transform 0.18s cubic-bezier(.4,0,.2,1), box-shadow 0.2s ease;
}
.bs-arrow:hover {
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.bs-arrow:active {
  transform: translateY(-50%) scale(0.94);
  transition-duration: 0.08s;
}

/* Hero carousel dots. */
.hero-dot {
  transition: width 0.25s cubic-bezier(.4,0,.2,1),
              background 0.25s ease,
              transform 0.15s ease;
}
.hero-dot:hover { background: var(--black); }
.hero-dot:active { opacity: 0.7; }

/* Hamburger (mobile drawer) — tactile press. */
.hamburger { transition: opacity 0.15s ease, transform 0.15s ease; }
.hamburger:active { transform: scale(0.92); opacity: 0.85; }

/* Keyboard focus rings — visible only when navigating by keyboard.
   `:focus-visible` does not trigger on mouse click, so this won't add
   visual noise for pointer users. */
.btn-primary:focus-visible,
.btn-outline:focus-visible,
.icon-btn:focus-visible,
.bs-arrow:focus-visible,
.hero-dot:focus-visible,
.hamburger:focus-visible,
.nav-link:focus-visible,
.view-all:focus-visible {
  outline: 2px solid var(--kto-blue);
  outline-offset: 3px;
}

/* Disabled state. */
button:disabled,
.btn-primary:disabled,
.btn-outline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Respect prefers-reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  .btn-primary, .btn-outline,
  .icon-btn, .bs-arrow,
  .hero-dot, .hamburger {
    transition: none;
  }
  .btn-primary:hover, .btn-outline:hover,
  .bs-arrow:hover { transform: none; box-shadow: none; }
  .bs-arrow:hover { transform: translateY(-50%); }
}

/* ============================================================
   CARDS — global refinements (a11y + polish, all viewports)
   ============================================================ */

/* Smoother card transitions site-wide (some pages have hover bg/shadow
   but no easing on transform — we add the timing). */
.blog-card, .product-card, .bs-card, .lw-card, .cat-card {
  transition: transform 0.28s cubic-bezier(.4,0,.2,1),
              box-shadow 0.28s cubic-bezier(.4,0,.2,1),
              border-color 0.2s ease;
}

/* Blog cards (homepage + blog page) — gain subtle lift + image zoom. */
.blog-card:hover { transform: translateY(-3px); }
.blog-card .blog-img { overflow: hidden; }
.blog-card .blog-img > img,
.blog-card .blog-img > picture > img {
  transition: transform 0.5s cubic-bezier(.4,0,.2,1);
}
.blog-card:hover .blog-img > img,
.blog-card:hover .blog-img > picture > img {
  transform: scale(1.04);
}

/* Product cards — add lift to the existing shadow change. */
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.10);
}

/* Lentilles-wizard cards — subtle elevation. */
.lw-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
}

/* Best-sellers cards already have translateY(-4px); add soft shadow. */
.bs-card:hover {
  box-shadow: 0 14px 36px rgba(0,0,0,0.10);
}

/* Category cards already zoom the image; add subtle elevation. */
.cat-card { will-change: transform; }
.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.10);
}

/* ============================================================
   TYPOGRAPHY — global smoothing (no layout changes)
   ============================================================ */

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection {
  background: var(--kto-blue);
  color: var(--white);
}
::-moz-selection {
  background: var(--kto-blue);
  color: var(--white);
}

/* Headings — slightly tighter, more editorial feel. No size changes. */
h1, h2, h3, .section-title, .hero-title {
  text-wrap: balance;
}

/* Body paragraph readability — long-line opt-out for narrow column flows. */
p {
  text-wrap: pretty;
}

/* ============================================================
   FORMS — focus polish, smooth transitions
   ============================================================ */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="number"],
input[type="password"],
input[type="url"],
input[type="date"],
textarea,
select {
  transition: border-color 0.2s ease,
              box-shadow 0.2s ease,
              background 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43, 143, 212, 0.20);
  border-color: var(--kto-blue);
}

/* Newsletter forms often strip outline — keep the ring as the focus
   indicator without breaking the inline-look pill. */
.newsletter-form input:focus {
  box-shadow: 0 0 0 3px rgba(43, 143, 212, 0.20);
}

/* ============================================================
   LOADING STATE — utility class for buttons / forms during async ops
   Usage: <button class="btn-primary is-loading">…</button>
   ============================================================ */

.is-loading {
  pointer-events: none;
  cursor: wait;
  animation: kto-pulse 1.4s ease-in-out infinite;
}
@keyframes kto-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

/* Reduced motion: skip the pulse, just dim. */
@media (prefers-reduced-motion: reduce) {
  .is-loading { animation: none; opacity: 0.7; }
  .blog-card, .product-card, .bs-card, .lw-card, .cat-card { transition: none; }
  .blog-card:hover, .product-card:hover,
  .bs-card:hover, .lw-card:hover, .cat-card:hover { transform: none; box-shadow: none; }
  .blog-card:hover .blog-img > img,
  .blog-card:hover .blog-img > picture > img { transform: none; }
}

@media (max-width: 480px) {
  body { -webkit-tap-highlight-color: transparent; }

  /* ===== HEADER ===== */
  header { padding: 8px 16px !important; }
  .header-icons { right: 12px !important; gap: 2px !important; }
  .icon-btn { width: 40px !important; height: 40px !important; }
  .header-logo-space { height: 44px !important; }
  .header-logo-space img,
  .footer-logo-img { height: auto !important; max-height: 38px !important; }
  .hamburger { padding: 10px !important; }
  .hamburger span { width: 24px !important; }

  /* Mobile slide-in nav */
  .mobile-nav { padding: 80px 24px 32px !important; }
  .mobile-nav-link { font-size: 22px !important; padding: 14px 0 !important; }
  .mobile-nav-close { top: 18px !important; right: 18px !important; padding: 10px !important; }

  /* ===== SECTIONS / TYPOGRAPHY ===== */
  section { padding: 40px 16px !important; }
  .section-title { font-size: clamp(24px, 7vw, 32px) !important; }
  .section-subtitle { font-size: 14px !important; }
  .section-header { padding: 0 !important; }

  /* ===== HERO (homepage) ===== */
  .hero { min-height: auto !important; height: auto !important; padding: 24px 0 32px !important; }
  .hero-content { padding: 0 16px !important; }
  .hero-title { font-size: clamp(36px, 11vw, 56px) !important; line-height: 1.05 !important; }
  .hero-ctas { flex-direction: column !important; gap: 10px !important; width: 100% !important; }
  .hero-ctas .btn-primary,
  .hero-ctas .btn-outline { width: 100% !important; text-align: center !important; padding: 14px 20px !important; }
  .hero-controls { left: 16px !important; bottom: 20px !important; }
  .hero-counter { right: 16px !important; bottom: 20px !important; }

  /* ===== MARQUEE ===== */
  .marquee-bar { padding: 10px 0 !important; }
  .marquee-track { gap: 32px !important; }
  .marquee-item { font-size: 10px !important; letter-spacing: 1.5px !important; gap: 8px !important; }

  /* ===== HOMEPAGE GRIDS ===== */
  .categories-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .cat-card:first-child { grid-row: auto !important; aspect-ratio: 16 / 11 !important; }
  .cat-card { aspect-ratio: 16 / 11 !important; }
  .cat-name { font-size: 22px !important; }
  .cat-info { padding: 18px !important; }

  .why-grid { grid-template-columns: 1fr !important; }
  .blog-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .products-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }

  /* ===== BEST-SELLERS CAROUSEL (homepage) ===== */
  .bs-section { padding: 48px 0 32px !important; }
  .bs-header { padding: 0 16px !important; margin-bottom: 24px !important; }
  .bs-filters-wrap { margin: 18px 16px 24px !important; }
  .bs-carousel-track {
    padding: 0 16px !important;
    gap: 12px !important;
    scroll-padding-left: 16px !important;
  }
  .bs-card {
    flex: 0 0 72vw !important;
    width: 72vw !important;
    max-width: 72vw !important;
  }
  .bs-arrow { display: none !important; }

  /* ===== TESTIMONIALS ===== */
  #kto-testimonials { padding: 48px 16px !important; }
  #kto-testimonials .head h2 { font-size: 26px !important; }
  #kto-testimonials .grid { grid-template-columns: 1fr !important; gap: 14px !important; }
  #kto-testimonials .card { padding: 22px 18px !important; }
  #kto-testimonials .card p { font-size: 14px !important; }

  /* ===== NEWSLETTER ===== */
  .newsletter { padding: 48px 16px !important; }
  .newsletter-form { flex-direction: column !important; max-width: 100% !important; gap: 10px !important; margin-top: 24px !important; }
  .newsletter-form input { width: 100% !important; padding: 14px 16px !important; border-right: 1.5px solid var(--gray-200) !important; }
  .newsletter-form button { width: 100% !important; padding: 14px 20px !important; }

  /* ===== FOOTER ===== */
  footer { padding: 32px 16px 16px !important; }
  .footer-top { grid-template-columns: 1fr !important; gap: 24px !important; padding-bottom: 20px !important; margin-bottom: 14px !important; }
  .footer-map { max-width: 100% !important; }
  .footer-bottom { flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; font-size: 11px !important; }

  /* ===== LISTING PAGES (lunettes-vue, solaires, lentilles, accessoires, promotions) ===== */
  .page-hero { padding: 96px 16px 32px !important; }
  .page-hero h1 { font-size: clamp(28px, 8vw, 38px) !important; }
  .page-hero p { font-size: 14px !important; }
  .filters-bar { padding: 12px 16px !important; flex-wrap: wrap !important; gap: 8px !important; }
  .filters-left,
  .filters-right { width: 100% !important; }
  .filters-right { justify-content: space-between !important; }
  .sort-container { flex: 1 !important; }
  .sort-select { width: 100% !important; }
  .filters-panel.open { padding: 16px !important; }
  .filters-grid { grid-template-columns: 1fr !important; gap: 16px !important; }
  .products-section { padding: 16px !important; }

  /* ===== PRODUCT DETAIL PAGE (product.html, product-lentille.html) ===== */
  .product-title-top { padding: 12px 16px !important; font-size: 13px !important; }
  .product-tags-top { top: auto !important; bottom: auto !important; right: 12px !important; gap: 6px !important; }
  .product-tags-top .tag-top { display: none !important; }

  .gallery-fullwidth { height: 56vh !important; min-height: 320px !important; max-height: 480px !important; }
  .gallery-fullwidth img { max-width: 80% !important; max-height: 70% !important; }
  .gallery-arrow { width: 36px !important; height: 64px !important; font-size: 22px !important; }
  .gallery-dots-left { bottom: 14px !important; left: 14px !important; gap: 8px !important; }
  .gallery-dot { width: 8px !important; height: 8px !important; }
  .gallery-zoom-right { bottom: 14px !important; right: 14px !important; width: 40px !important; height: 40px !important; }
  .tryon-btn-center { bottom: 14px !important; padding: 9px 18px !important; font-size: 12px !important; }

  /* Stack the bottom action bar: title row, then price + buttons */
  .product-bottom-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 16px !important;
  }
  .bottom-bar-left,
  .bottom-bar-center,
  .bottom-bar-right { flex: 1 1 auto !important; text-align: left !important; }
  .bottom-bar-center { display: flex !important; align-items: baseline !important; gap: 10px !important; justify-content: flex-start !important; }
  .bottom-bar-right { display: flex !important; gap: 10px !important; }
  .bottom-bar-right .btn-cart-dark,
  .bottom-bar-right .btn-lens-blue {
    flex: 1 1 50% !important;
    padding: 14px 10px !important;
    font-size: 11px !important;
    letter-spacing: 0.5px !important;
  }
  .price-main { font-size: 22px !important; }
  .price-ttc { font-size: 12px !important; }

  /* Trust strip */
  .product-trust-strip { margin: 20px 16px 0 !important; padding-top: 16px !important; }

  /* Color variants grid: 3 columns is comfortable on phones */
  .color-variants {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    padding: 12px !important;
    margin: 16px !important;
  }
  .color-variant-img { font-size: 22px !important; }
  .color-variant-name { font-size: 11px !important; }

  /* Other-colors button */
  .colors-section-bottom { padding: 24px 16px !important; }
  .other-colors-title { font-size: 14px !important; }
  .other-colors-btn { padding: 9px 18px !important; font-size: 13px !important; }

  /* Details section: stack vertically */
  .details-section { flex-direction: column !important; padding: 32px 0 !important; }
  .dimensions-side,
  .specs-side { padding: 24px 16px !important; }
  .specs-title { margin-bottom: 24px !important; }
  .specs-row { padding: 14px 0 !important; }
  .specs-label { font-size: 12px !important; }
  .specs-value { font-size: 13px !important; }

  /* Color row + measurements on the simple product info layout */
  .product-info { padding-left: 0 !important; }
  .measurements { flex-wrap: wrap !important; }
  .measure-item { flex: 1 1 33% !important; }

  /* ===== CART ===== */
  .cart-main { padding: 16px 12px 60px !important; }
  .cart-container { grid-template-columns: 1fr !important; gap: 20px !important; }
  .order-summary { position: static !important; padding: 18px !important; }
  .cart-item { flex-direction: column !important; gap: 14px !important; padding: 16px !important; }
  .cart-item-img { width: 100% !important; height: 160px !important; }
  .cart-item-footer { flex-direction: column !important; align-items: stretch !important; gap: 12px !important; }
  .cart-item-footer .qty,
  .cart-item-footer .qty-controls { align-self: flex-start !important; }
  .commander-btn { font-size: 14px !important; padding: 16px !important; }
  .addr-row { grid-template-columns: 1fr !important; gap: 8px !important; }
  .discount-row-input { flex-direction: column !important; gap: 8px !important; }
  .discount-input,
  .discount-apply-btn { width: 100% !important; }
  .cart-benefits {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    padding: 14px !important;
  }
  .empty-tiles { grid-template-columns: 1fr !important; }
  .advance-mobile { gap: 6px !important; }
  .advance-mobile-tag { font-size: 11px !important; padding: 6px 10px !important; }

  /* ===== ARTICLE / BLOG ===== */
  .article-page { padding: 0 0 48px !important; }
  .article-hero { padding: 96px 16px 24px !important; }
  .article-title { font-size: clamp(26px, 8vw, 36px) !important; line-height: 1.15 !important; }
  .article-cat { font-size: 11px !important; letter-spacing: 2px !important; }
  .article-meta { font-size: 12px !important; flex-wrap: wrap !important; gap: 8px !important; }
  .article-cover { margin: 0 -16px 24px !important; }
  .article-cover-inner { border-radius: 0 !important; }
  .article-body { padding: 0 16px !important; font-size: 16px !important; line-height: 1.7 !important; }
  .article-body h2 { font-size: 22px !important; margin-top: 28px !important; }
  .article-body h3 { font-size: 18px !important; margin-top: 22px !important; }
  .article-body p { font-size: 16px !important; line-height: 1.7 !important; }
  .article-img { margin: 20px -16px !important; }
  .article-img.contain img { max-height: 240px !important; }

  /* Promo / large CTA banners */
  .promo-inner { flex-direction: column !important; padding: 32px 20px !important; text-align: center !important; gap: 16px !important; }

  /* Generic buttons */
  .btn-primary,
  .btn-outline { padding: 14px 22px !important; font-size: 12px !important; letter-spacing: 1.5px !important; }

  /* Search overlay */
  .search-overlay { padding-top: 80px !important; }
  .search-box input { font-size: 22px !important; padding: 14px 0 !important; }
  .search-close { top: 18px !important; right: 16px !important; padding: 10px !important; }

  /* Wishlist page */
  .wishlist-grid,
  .wl-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
}

/* Smaller Android phones */
@media (max-width: 360px) {
  section { padding: 36px 14px !important; }
  .section-title { font-size: 22px !important; }
  .price-main { font-size: 20px !important; }
  .bs-card { flex: 0 0 78vw !important; width: 78vw !important; max-width: 78vw !important; }
  .bottom-bar-right .btn-cart-dark,
  .bottom-bar-right .btn-lens-blue { font-size: 10px !important; padding: 13px 6px !important; }
  .header-logo-space img,
  .footer-logo-img { max-height: 34px !important; }
  .color-variants { grid-template-columns: repeat(2, 1fr) !important; }
}
