/* ════════════════════════════════════════════════════════════
   AMBER & BARK — mobile.css  (v2 — complete rewrite)

   This file is the SINGLE source of truth for all
   responsive behaviour. It overrides everything in
   style.css, enhancements.css, polish.css, redesigns.css.

   Key fixes:
   1. Global overflow-x guard so nothing bleeds off-screen
   2. reveal-left/right clamped so translateX never causes
      horizontal scroll on narrow viewports
   3. Every section centred properly at each breakpoint
   4. Hero, products, story, grades, history, legacy,
      craft, origin, quality, contact, footer all fixed
════════════════════════════════════════════════════════════ */

/* ─── GLOBAL OVERFLOW GUARD ─── */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Prevent reveal animations from causing horizontal bleed */
.reveal-left     { transform: translateX(-28px); }
.reveal-right    { transform: translateX(28px); }
.reveal-diagonal { transform: translate(16px, 16px) rotate(0.6deg); }
.reveal-scale    { transform: scale(0.95) translateY(12px); }

/* Disable image JS-parallax scale (causes width bleed) */
.img-frame img,
.gift-img-frame img {
  transform: none !important;
  will-change: auto !important;
}

/* Disable heavy will-change on elements where it's not critical */
.quality-ring-container { will-change: auto; }
.cinematic-inner        { will-change: auto; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ════════════════════════════════════
   TABLET LANDSCAPE  ≤ 1024px
════════════════════════════════════ */
@media (max-width: 1024px) {
  .section-pad { padding: 80px 0; }

  /* Force single column on ALL grid-2 layouts */
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 3rem !important;
  }

  .products-grid { grid-template-columns: 1fr 1fr; gap: 1.8rem; }
  .footer-inner  { grid-template-columns: 1fr; gap: 3rem; }

  .nav-links { gap: 1.2rem; }
  .nav-links li a { font-size: 0.72rem; }
  .nav-logo-img { height: 42px; width: 42px; }
}

/* ════════════════════════════════════
   TABLET PORTRAIT  ≤ 768px
════════════════════════════════════ */
@media (max-width: 768px) {
  html { font-size: 15px; }
  .section-pad { padding: 60px 0; }
  .container { padding: 0 1.2rem; }

  /* ── Navbar: slide-out menu ── */
  .nav-hamburger { display: flex !important; }
  .nav-links {
    position: fixed !important;
    top: 0 !important;
    right: -100% !important;
    width: min(300px, 80vw) !important;
    height: 100dvh !important;
    background: var(--cream) !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 5rem 1.8rem 2rem !important;
    gap: 0 !important;
    transition: right 0.38s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    box-shadow: -4px 0 40px rgba(92,46,14,0.18) !important;
    z-index: 1000 !important;
    overflow-y: auto !important;
  }
  .nav-links.open { right: 0 !important; }
  .nav-links li { width: 100%; border-bottom: 1px solid rgba(92,46,14,0.08); }
  .nav-links li a {
    display: block !important;
    padding: 0.95rem 0 !important;
    font-size: 0.88rem !important;
    color: var(--text-dark) !important;
  }
  .nav-links .btn-order {
    margin-top: 1.5rem !important;
    display: block !important;
    text-align: center !important;
    width: 100% !important;
    padding: 0.9rem 1rem !important;
  }

  /* ── Hero editorial ── */
  .hero { min-height: 100dvh; align-items: stretch; }
  .hero-content.hero-editorial {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-col-title {
    flex: none;
    padding: 12vh 1.6rem 2rem 1.6rem;
    justify-content: flex-start;
  }
  .hero-vrule { display: none; }
  .hero-col-side {
    flex: none;
    padding: 1.5rem 1.6rem 9vh 1.6rem;
    opacity: 1 !important;
    animation-delay: 1.2s;
  }
  .hero-word { font-size: clamp(4rem, 17vw, 7rem); }
  .hero-amp  { font-size: clamp(2.5rem, 11vw, 5rem); }
  .hero-side-tagline { margin-bottom: 1.8rem; font-size: 0.95rem; }
  .hero-grade-stamp { margin-top: 1.4rem; }
  .hero-editorial-actions { flex-direction: row; flex-wrap: wrap; gap: 1.4rem 2rem; }
  .hero-corner      { display: none; }
  .hero-bottom-bar  { display: none; }
  .hero-scroll-hint { display: none; }

  /* ── ALL grid-2 → single column ── */
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
    align-items: start !important;
  }

  /* ── Story ── */
  .story-images { order: 1; }
  .story-text   { order: 2; text-align: center; }
  .story-text .section-eyebrow,
  .story-text .section-heading { text-align: center; }
  .story-text .body-text { text-align: left; }
  .img-frame-top { width: 88%; margin: 0 auto 1.2rem; }
  .img-frame-bot { width: 62%; margin-top: -2.5rem; }
  .img-stack { max-width: 420px; margin: 0 auto; }
  /* disable float on mobile — performance */
  .img-frame-top, .img-frame-bot { animation: none !important; }
  .story-stats {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
  }
  .stat-divider { display: none; }
  .stat-item { flex: 1 1 140px; text-align: center; }

  /* ── Products ── */
  .products-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
    margin-top: 2rem;
  }
  .products-subhead { font-size: 0.95rem; margin-bottom: 2rem; }
  .grades-list { grid-template-columns: 1fr !important; gap: 0.9rem; }
  .grades-banner-inner { padding: 1.4rem 1.2rem; }
  .grade-pill { padding: 1.1rem 1.2rem; }

  /* ── History ── */
  .history .section-heading,
  .history-intro { padding: 0 0.5rem; }

  /* timeline: left-aligned rail */
  .history-timeline {
    padding: 0 0.5rem;
    margin-top: 3rem;
  }
  .history-timeline::before {
    left: 19px;
    top: 0; bottom: 0;
  }
  .history-era {
    display: grid !important;
    grid-template-columns: auto 1fr !important;
    gap: 0 1rem !important;
    margin-bottom: 2.5rem !important;
  }
  /* Reset ALL era nth-child ordering for mobile */
  .history-era .era-ornament {
    order: 0 !important;
    grid-column: 1 !important;
    grid-row: 1 / span 2 !important;
    width: 38px !important;
    height: 38px !important;
    font-size: 0.9rem !important;
    align-self: start !important;
    box-shadow: 0 0 0 4px var(--brown-dark) !important;
    flex-shrink: 0 !important;
  }
  .history-era .era-year {
    order: 1 !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    text-align: left !important;
    font-size: 0.78rem !important;
    padding-top: 0.1rem !important;
    padding-bottom: 0.2rem !important;
  }
  .history-era .era-content {
    order: 2 !important;
    grid-column: 2 !important;
    grid-row: 2 !important;
    text-align: left !important;
  }
  .era-title { font-size: 1.05rem; }
  .era-text  { font-size: 0.82rem; line-height: 1.7; }

  /* ── Legacy showcase ── */
  .legacy-showcase { padding: 4rem 1.2rem; }
  .legacy-stats {
    flex-direction: column !important;
    align-items: center;
    gap: 2rem;
  }
  .legacy-divider {
    width: 50px !important;
    height: 1px !important;
    background: linear-gradient(to right, transparent, rgba(201,168,76,0.25), transparent) !important;
    align-self: center !important;
  }
  .legacy-stat {
    padding: 0 !important;
    width: 100%;
    text-align: center;
  }
  .ls-num   { font-size: clamp(3rem, 16vw, 4.5rem); }
  .ls-label { max-width: 85%; margin: 0 auto; }

  /* ── Origin ── */
  .origin-visual { order: 1; }
  .origin-text   { order: 2; }
  .origin-text .section-eyebrow,
  .origin-text .section-heading { text-align: center; }
  .origin-map-circle { width: min(300px, 80vw); margin: 0 auto; }

  /* ── Craft ── */
  .craft-header {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    margin-bottom: 2.5rem;
    text-align: center;
  }
  .craft-tagline {
    border-left: none !important;
    padding-left: 0 !important;
    border-top: 1px solid rgba(200,112,42,0.18);
    padding-top: 1rem !important;
    text-align: center;
  }
  .craft-steps {
    grid-template-columns: 1fr 1fr !important;
    gap: 1px !important;
    background: rgba(200,112,42,0.08) !important;
  }
  .craft-steps::before,
  .craft-step::before { display: none !important; }
  .craft-step {
    background: var(--cream) !important;
    padding: 1.4rem 1rem !important;
    text-align: center !important;
    transform: none !important;  /* prevent hover shift on touch */
  }

  /* ── Gift / Heritage ── */
  .gift-text   { order: 2; text-align: center; }
  .gift-images { order: 1; }
  .gift-text .body-text,
  .gift-text .pull-quote { text-align: left; }
  .gift-text .section-eyebrow,
  .gift-text .section-heading { text-align: center; }
  .gift-img-stack { max-width: 420px; margin: 0 auto; }
  .gift-frame-1 { width: 88%; }
  .gift-frame-2 { width: 58%; margin-top: -3rem; }
  .gift-frame-1, .gift-frame-2 { animation: none !important; }

  /* ── Quality ── */
  .quality-text   { order: 2; }
  .quality-visual { order: 1; }
  .quality-text .section-eyebrow,
  .quality-text .section-heading { text-align: center; }
  .quality-text .body-text { text-align: left; }
  .quality-ring-container {
    width: 220px !important;
    height: 220px !important;
    margin: 0 auto 1.5rem !important;
    transform: none !important;
  }

  /* ── Brand quote ── */
  .brand-blockquote { font-size: 1.1rem; text-align: center; }

  /* ── Contact ── */
  .contact-info      { order: 1; text-align: center; }
  .contact-form-wrap { order: 2; }
  .contact-info .section-eyebrow,
  .contact-info .section-heading { text-align: center; }
  .contact-info .body-text { text-align: left; }
  .contact-details { margin-top: 1.5rem; }
  .contact-item { text-align: left; }
  .form-row { grid-template-columns: 1fr !important; }
  .contact-form-wrap { padding: 1.6rem !important; }

  /* ── Footer ── */
  .footer-inner {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
    text-align: center;
  }
  .footer-brand { text-align: center; }
  .footer-logo-img { margin: 0 auto 0.6rem; height: 52px; }
  .footer-bio { max-width: 100%; margin: 0 auto 1.2rem; }
  .footer-links-wrap {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.8rem !important;
    text-align: left;
  }
}

/* ════════════════════════════════════
   PHONE LARGE  ≤ 480px
════════════════════════════════════ */
@media (max-width: 480px) {
  html { font-size: 14px; }
  .section-pad { padding: 50px 0; }
  .container { padding: 0 1rem; }

  /* Hero editorial — small phone */
  .hero-col-title { padding: 10vh 1.1rem 1.5rem 1.1rem; }
  .hero-col-side  { padding: 1rem 1.1rem 7vh 1.1rem; }
  .hero-word { font-size: clamp(3.2rem, 19vw, 5.5rem); }
  .hero-amp  { font-size: clamp(2rem, 12vw, 3.5rem); }
  .hero-side-tagline { font-size: 0.88rem; margin-bottom: 1.4rem; }
  .hero-editorial-actions { flex-direction: column; gap: 1rem; }
  .hero-grade-stamp span { font-size: 0.55rem; }

  /* Products */
  .product-card-body { padding: 1.4rem; }
  .product-name { font-size: 1.55rem; }
  .grades-banner-inner { padding: 1rem; }
  .grade-pill-desc { font-size: 0.75rem; }

  /* History */
  .history-timeline { padding: 0 0.2rem; margin-top: 2.5rem; }
  .history-era { margin-bottom: 2rem !important; }
  .era-title { font-size: 0.98rem; }

  /* Legacy */
  .legacy-showcase { padding: 3rem 1rem; }
  .ls-num { font-size: clamp(3rem, 18vw, 4rem); }
  .legacy-quote { font-size: 0.92rem; padding: 0 0.5rem; }

  /* Craft */
  .craft-steps { grid-template-columns: 1fr !important; }
  .craft-step { padding: 1.2rem 1rem !important; }
  .cs-title { font-size: 0.9rem; }
  .cs-text  { font-size: 0.75rem; }

  /* Origin */
  .origin-map-circle { width: min(240px, 75vw) !important; }
  .map-pulse { display: none; } /* reduces jank */

  /* Quality */
  .quality-ring-container { width: 180px !important; height: 180px !important; }
  .ring-outer, .ring-middle, .ring-inner { animation-duration: 30s !important; } /* slower = less GPU */

  /* Contact */
  .contact-icon { display: none; }
  .contact-form-wrap { padding: 1.2rem !important; }

  /* Footer */
  .footer-links-wrap { grid-template-columns: 1fr 1fr !important; gap: 1.2rem !important; }

  /* Marquee */
  .marquee-track { animation-duration: 36s; }
}

/* ════════════════════════════════════
   PHONE SMALL  ≤ 360px
════════════════════════════════════ */
@media (max-width: 360px) {
  html { font-size: 13px; }
  .container { padding: 0 0.9rem; }
  .hero-title { font-size: 2.6rem; }
  .hero-ctas .btn { width: 88vw; }
  .nav-links { width: 90vw !important; padding: 5rem 1.4rem 2rem !important; }
  .footer-links-wrap { grid-template-columns: 1fr !important; }
  .grades-list { gap: 0.7rem; }
  .craft-step { padding: 1rem 0.8rem !important; }
  .legacy-showcase { padding: 2.5rem 0.9rem; }
}
