/* ─── EPA Responsive — mobile + tablet overrides ────────────────────
   Goals on mobile:
   - No horizontal scroll. Ever.
   - Everything centered within the viewport.
   - All interactions DISABLED (hovers, reveals, carousels, parallax).
   - Pages static, legible, with right proportions.
   Desktop (>1024px) is untouched. */

/* ═══════════════════════════════════════════════════════════════
   UNIVERSAL — applied on ALL viewports to prevent overflow sources.
   ═══════════════════════════════════════════════════════════════ */
html, body { overflow-x: hidden !important; max-width: 100vw; }

/* Partner logo grid — consistent desktop sizing (all logos scale to same height) */
.partner-logo-grid img {
  max-height: 54px;
  max-width: 80%;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════════
   TABLET — 1024px and below
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  section { padding-left: 48px !important; padding-right: 48px !important; }

  /* collapse 2 / 3 / 4-col grids to single or double column */
  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="gridTemplateColumns:\"1fr 1fr\""] { grid-template-columns: 1fr !important; }

  div[style*="repeat(3"] { grid-template-columns: repeat(2, 1fr) !important; }
  div[style*="repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
  div[style*="repeat(6"] { grid-template-columns: repeat(3, 1fr) !important; }

  /* asymmetric hero + split grids */
  div[style*="1fr 1.1fr"],
  div[style*="1.1fr 1fr"],
  div[style*="1fr auto 1fr"] { grid-template-columns: 1fr !important; gap: 40px !important; }

  div[style*="140px 1fr 420px"],
  div[style*="420px 1fr 140px"] { grid-template-columns: 1fr !important; }

  h1 { font-size: clamp(56px, 9vw, 96px) !important; line-height: 1.04 !important; }
  h2 { font-size: clamp(40px, 6.2vw, 68px) !important; line-height: 1.06 !important; }
  h3 { font-size: clamp(28px, 4.2vw, 42px) !important; }
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE — 720px and below
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 720px) {

  /* ─── A) No horizontal overflow ─── */
  *, *::before, *::after { max-width: 100vw; box-sizing: border-box; }
  img, svg, video { max-width: 100% !important; height: auto !important; }
  /* Universe cards — keep photo stretched to fill card height (h=100% must NOT become auto) */
  [id="concierge"] img, [id="travel"] img, [id="events"] img,
  [id="aurum"] img, [id="hotel"] img,
  #concierge img, #travel img, #events img {
    height: 100% !important;
    object-fit: cover !important;
  }
  /* But keep absolutely-positioned decorative SVGs unconstrained (they're clipped by parent) */
  [style*="position:absolute"] svg,
  [style*="position:\"absolute\""] svg { max-width: none !important; }

  /* ─── B) Sections: tight padding, centered content ─── */
  section {
    padding: 72px 20px !important;
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  /* ─── C) Nav: clean single bar, language + CTA only ─── */
  nav {
    padding: 14px 18px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  /* Hide desktop nav links on mobile */
  nav > div[style*="gap:36"],
  nav > div[style*="gap: 36"] { display: none !important; }
  /* Make sure language + CTA are compact */
  nav > div:last-child { gap: 8px !important; }
  nav > div:last-child a {
    padding: 7px 10px !important;
    font-size: 9.5px !important;
    letter-spacing: .12em !important;
  }
  /* Show hamburger; hide Request access button in nav (accessible via menu) */
  nav [data-epa-menu-btn] { display: inline-flex !important; align-items:center; }
  nav > div:last-child a[href="request-access.html"] { display: none !important; }

  /* ─── D) Force every multi-column grid to single column — EXCEPT specific ones ─── */
  section[style*="grid-template-columns"],
  section[style*="gridTemplateColumns"],
  section > div[style*="grid-template-columns"],
  section > div[style*="gridTemplateColumns"],
  section > div > div[style*="grid-template-columns"],
  section > div > div[style*="gridTemplateColumns"] {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
  }

  /* ─── D2) EXCEPTIONS — certain grids keep multi-columns on mobile ─── */

  /* 4-col grids (Figures, hotel logos) → 2 cols on mobile */
  section div[style*="repeat(4,1fr)"],
  section div[style*="repeat(4, 1fr)"],
  section > div[style*="repeat(4,1fr)"],
  section > div[style*="repeat(4, 1fr)"],
  .agency-figures-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0 !important;
  }

  /* Aurum phone — preserve ALL internal grids at their authored values */
  [data-aurum-phone] div[style*="grid-template-columns"],
  [data-aurum-phone] div[style*="gridTemplateColumns"] {
    grid-template-columns: revert !important;
    gap: revert !important;
  }
  /* Phone tab bar — force 5 columns even if parent rule leaked through */
  [data-aurum-phone] div[style*="repeat(5,1fr)"],
  [data-aurum-phone] div[style*="repeat(5, 1fr)"] {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 2px !important;
  }

  /* Instagram feed — 2 cols */
  div[style*="repeat(6, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* ─── E) Heights: collapse fixed-px hero heights ─── */
  section[style*="height:960"],
  section[style*="height: 960"],
  section[style*="height:780"],
  section[style*="height: 780"],
  section[style*="height:720"],
  section[style*="height: 720"],
  section[style*="height:680"],
  section[style*="height: 680"],
  section[style*="height:640"],
  section[style*="height: 640"],
  section[style*="height:600"],
  section[style*="height: 600"],
  section[style*="minHeight:\"100vh\""],
  section[style*="min-height:100vh"] {
    height: auto !important;
    min-height: 560px !important;
  }
  div[style*="height:720"],
  div[style*="height: 720"] { height: 340px !important; }
  div[style*="height:680"],
  div[style*="height: 680"] { height: 360px !important; }
  div[style*="height:640"],
  div[style*="height: 640"] { height: 340px !important; }
  div[style*="height:600"],
  div[style*="height: 600"] { height: 320px !important; }
  div[style*="height:540"],
  div[style*="height: 540"] { height: 300px !important; }
  div[style*="height:520"],
  div[style*="height: 520"] { height: 300px !important; }
  div[style*="height:480"],
  div[style*="height: 480"] { height: 280px !important; }
  div[style*="height:420"],
  div[style*="height: 420"] { height: 260px !important; }
  div[style*="height:380"],
  div[style*="height: 380"] { height: 240px !important; }
  div[style*="height:360"],
  div[style*="height: 360"] { height: 220px !important; }
  div[style*="height:320"],
  div[style*="height: 320"] { height: 220px !important; }

  /* ─── F) Typography — section-level h1/h2/h3 only, not inside phone/UI mocks ─── */
  section > h1, section > div h1, section h1:not([data-keep-size]) { font-size: clamp(38px, 10vw, 62px) !important; letter-spacing: 0 !important; line-height: 1.08 !important; }
  section > h2, section > div h2, section h2:not([data-keep-size]) { font-size: clamp(28px, 7vw, 46px) !important; line-height: 1.1 !important; letter-spacing: 0 !important; }
  section > h3, section > div h3, section h3:not([data-keep-size]) { font-size: clamp(22px, 5vw, 32px) !important; line-height: 1.2 !important; }
  /* But keep phone UI mocks at their authored size */
  [data-aurum-phone] h1, [data-aurum-phone] h2, [data-aurum-phone] h3,
  [data-aurum-phone] p {
    font-size: inherit !important; line-height: inherit !important;
  }
  p  { font-size: clamp(14px, 3.6vw, 17px) !important; line-height: 1.6 !important; }
  blockquote { font-size: clamp(18px, 4.6vw, 26px) !important; line-height: 1.4 !important; }

  /* Numerals */
  div[style*="font-size:120px"],
  div[style*="font: 300 120px"],
  div[style*="font: 400 120px"] { font-size: 56px !important; }
  div[style*="font-size:140px"] { font-size: 64px !important; }
  div[style*="font-size:100px"] { font-size: 48px !important; }

  /* ─── G) Kill ALL hover/reveal/parallax interactions ─── */
  /* Force reveal elements to their visible end state */
  [data-epa-reveal],
  .epa-reveal,
  [style*="opacity:0"][style*="transform"] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  /* Disable cursor: pointer hover shifts on cards etc. */
  * { transition-duration: 0s !important; }

  /* Neutralise transforms except where they are pure layout (e.g. scale on intro video) */
  a:hover, button:hover, .epa-card:hover, [role="button"]:hover { transform: none !important; }

  /* ─── H) Footer stacks vertically ─── */
  footer { padding: 56px 24px !important; }
  footer > div:first-child { flex-direction: column !important; align-items: flex-start !important; gap: 36px !important; }
  footer div[style*="repeat(3,auto)"],
  footer div[style*="repeat(3, auto)"] { grid-template-columns: 1fr !important; gap: 24px !important; }
  footer div[style*="justify-content:space-between"][style*="paddingTop:28"],
  footer div[style*="justifyContent:\"space-between\""][style*="paddingTop:28"] {
    flex-direction: column !important; gap: 12px !important; text-align: center !important;
    align-items: center !important;
  }

  /* ─── I) Decorative sticky elements become static ─── */
  div[style*="position:sticky"],
  div[style*="position: sticky"] { position: static !important; top: auto !important; }

  /* ─── J) maxWidths inside narrow viewport get full width ─── */
  div[style*="maxWidth:1500"],
  div[style*="maxWidth:1400"],
  div[style*="maxWidth:1300"],
  div[style*="maxWidth:1200"],
  div[style*="maxWidth:1100"],
  div[style*="maxWidth:1000"],
  div[style*="maxWidth:900"],
  div[style*="maxWidth:820"],
  div[style*="maxWidth:800"],
  div[style*="maxWidth:780"],
  div[style*="maxWidth:760"],
  div[style*="maxWidth:720"],
  div[style*="maxWidth:680"],
  div[style*="maxWidth:640"],
  div[style*="maxWidth:620"],
  div[style*="maxWidth:600"],
  div[style*="maxWidth:580"],
  div[style*="maxWidth:560"],
  div[style*="maxWidth:540"],
  div[style*="maxWidth:520"],
  div[style*="maxWidth:500"],
  div[style*="maxWidth:480"],
  div[style*="maxWidth:460"],
  div[style*="maxWidth:440"],
  div[style*="maxWidth:420"] {
    max-width: 100% !important;
  }

  /* ─── K) Hotel partner logos — uniform size, 2-col grid on mobile ─── */
  section div[style*="repeat(4, 1fr)"],
  section div[style*="repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0 !important;
  }
  section div[style*="repeat(4, 1fr)"] > div,
  section div[style*="repeat(4,1fr)"] > div {
    min-height: 110px !important;
    padding: 20px 14px !important;
  }
  section div[style*="repeat(4, 1fr)"] img,
  section div[style*="repeat(4,1fr)"] img {
    max-height: 42px !important;
    max-width: 75% !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    filter: brightness(0) invert(1) opacity(.85) !important;
  }

  /* ─── K2) Chapter eyebrows — reduce letter-spacing so they fit one line ─── */
  div[style*="letterSpacing:\".5em\""],
  div[style*="letter-spacing:.5em"],
  div[style*="letter-spacing: .5em"] {
    letter-spacing: .22em !important;
    font-size: 10px !important;
  }

  /* ─── K3/K4) Home hero — mobile cartouche at bottom-left overlap (desktop-matching) ─── */
  .epa-hero-section {
    height: auto !important;
    min-height: 0 !important;
    padding: 120px 24px 80px !important;
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .epa-hero-section > div:first-child > div:first-child {
    margin-top: 20px !important;
  }
  .epa-hero-photo {
    height: 520px !important;
    width: 100% !important;
    overflow: visible !important;
    position: relative !important;
    margin-bottom: 100px !important;
  }
  .epa-hero-photo > div[style*="transform"] {
    transform: none !important;
    height: 100% !important;
  }
  .epa-hero-cartouche {
    position: absolute !important;
    z-index: 5 !important;
    top: auto !important;
    left: 16px !important;
    right: 16px !important;
    bottom: -80px !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 26px 22px 24px !important;
    background: rgba(26,18,11,.96) !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(170,135,87,.35) !important;
  }
  /* The cartouche children in order: pearl (absolute), eyebrow, title, subtitle */
  .epa-hero-cartouche > div:nth-child(2) {
    font-size: 10px !important;
    letter-spacing: .3em !important;
    margin-bottom: 12px !important;
  }
  .epa-hero-cartouche > div:nth-child(3) {
    font-size: 28px !important;
    line-height: 1.1 !important;
    margin-bottom: 8px !important;
  }
  .epa-hero-cartouche > div:nth-child(4) {
    font-size: 13px !important;
    line-height: 1.4 !important;
  }

  /* ─── K5) Universes plates — expandable on tap (height controlled by JSX) ─── */
  /* JSX sets height 260px collapsed / 560px expanded — do NOT force CSS height */
  /* Keep photo backdrop absolute (desktop behaviour) */
  div[id="concierge"] > div[style*="position:absolute"][style*="inset:0"]:first-of-type,
  div[id="travel"] > div[style*="position:absolute"][style*="inset:0"]:first-of-type,
  div[id="events"] > div[style*="position:absolute"][style*="inset:0"]:first-of-type {
    transform: none !important;
  }
  /* Numeral — smaller */
  div[id="concierge"] > div[style*="top:32"],
  div[id="travel"] > div[style*="top:32"],
  div[id="events"] > div[style*="top:32"] {
    top: 20px !important;
    left: 20px !important;
    font-size: 44px !important;
  }
  /* Content block — compact padding */
  div[id="concierge"] > div[style*="bottom:0"],
  div[id="travel"] > div[style*="bottom:0"],
  div[id="events"] > div[style*="bottom:0"] {
    padding: 24px 20px !important;
  }
  div[id="concierge"] > div[style*="bottom:0"] h3,
  div[id="travel"] > div[style*="bottom:0"] h3,
  div[id="events"] > div[style*="bottom:0"] h3 {
    font-size: 28px !important;
    line-height: 1.05 !important;
  }

  /* ─── K6) Aurum phone — smaller on mobile, tight layout ─── */
  /* The INTERACTIVE badge at top-right */
  [data-aurum-phone] > div[style*="top:-14"][style*="right:-14"] {
    top: -12px !important;
    right: -8px !important;
    font-size: 8px !important;
    padding: 5px 9px !important;
    letter-spacing: .24em !important;
  }

  /* Aurum phone itself — fit mobile viewport, reduce height */
  [data-aurum-phone] {
    width: 300px !important;
    height: 620px !important;
    max-width: 100% !important;
    transform: none !important;
    margin: 0 auto !important;
  }
  /* Force phone inner content to fit */
  [data-aurum-phone] h1 {
    font-size: 24px !important;
    line-height: 1.05 !important;
  }

  /* ─── K7) Figures grid tiles — readable in 2-col mobile layout ─── */
  section div[style*="repeat(4,1fr)"] > *,
  .agency-figures-grid > * {
    min-height: 140px !important;
    padding: 28px 14px !important;
  }
  section div[style*="repeat(4,1fr)"] > * > div:first-child,
  section div[style*="repeat(4,1fr)"] div[style*="font-size:64px"],
  section div[style*="repeat(4,1fr)"] div[style*="font: 300 64px"],
  .agency-figures-grid > * > div > div:first-child {
    font-size: 30px !important;
    letter-spacing: -.02em !important;
    white-space: nowrap !important;
  }
  /* Ensure the section itself isn't overflowing */
  .agency-figures-grid {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .agency-figures-grid > * {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* ─── K10) Partner logo grid — uniform cell height + cap logo heights ─── */
  .partner-logo-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .partner-logo-grid > div {
    height: 140px !important;
    padding: 22px 20px !important;
  }
  .partner-logo-grid img {
    width: 100% !important;
    height: 64px !important;
    max-height: 64px !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }
  /* Reset per-cell borders for the 2-col mobile layout (4 rows × 2 cols) */
  .partner-logo-grid > div:nth-child(even) {
    border-right: none !important;
  }
  .partner-logo-grid > div:nth-child(odd) {
    border-right: 1px solid rgba(170,135,87,.2) !important;
  }
  .partner-logo-grid > div:nth-last-child(1),
  .partner-logo-grid > div:nth-last-child(2) {
    border-bottom: none !important;
  }
  .partner-logo-grid > div:not(:nth-last-child(1)):not(:nth-last-child(2)) {
    border-bottom: 1px solid rgba(170,135,87,.2) !important;
  }

  /* Home hotel logo grid — same uniform mobile treatment */
  .home-logo-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    width: calc(100% - 4px) !important;
    margin: 0 auto !important;
  }
  .partner-logo-grid {
    width: calc(100% - 4px) !important;
    margin: 0 auto !important;
    border: 1px solid rgba(170,135,87,.28) !important;
  }
  .home-logo-grid {
    border: 1px solid rgba(170,135,87,.28) !important;
  }
  .home-logo-grid > div {
    min-height: 140px !important;
    height: 140px !important;
    padding: 22px 20px !important;
    border-right: none !important;
    border-bottom: none !important;
  }
  .home-logo-grid img {
    width: 100% !important;
    height: 64px !important;
    max-height: 64px !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }
  .home-logo-grid > div:nth-child(odd) {
    border-right: 1px solid rgba(170,135,87,.18) !important;
  }
  .home-logo-grid > div:not(:nth-last-child(1)):not(:nth-last-child(2)) {
    border-bottom: 1px solid rgba(170,135,87,.18) !important;
  }
  /* ─── K9) Aurum HERO — AURUM title mustn't touch "COMING END OF 2026" ─── */
  /* On mobile, make the absolute "— Coming · End of 2026 —" static so it doesn't overlap */
  section[style*="radial-gradient(ellipse at 50% 20%"] > div:first-child {
    position: static !important;
    top: auto !important;
    margin: 0 0 24px !important;
    text-align: center !important;
  }
  /* The AURUM wordmark 140px is too large; shrink + add clear space */
  section h1[style*="AURUM"],
  section h1[style*="font:400 140px"],
  section h1[style*="font: 400 140px"] {
    font-size: 64px !important;
    line-height: 1.05 !important;
    margin: 28px 0 18px !important;
  }
  /* Hero section — trim top padding since eyebrow is now in-flow */
  section[style*="radial-gradient(ellipse at 50% 20%"] {
    padding-top: 60px !important;
    min-height: auto !important;
    height: auto !important;
  }
  footer div[style*="repeat(3,auto)"],
  footer div[style*="repeat(3, auto)"] {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px 16px !important;
    text-align: center !important;
  }
  footer div[style*="repeat(3,auto)"] > *,
  footer div[style*="repeat(3, auto)"] > * {
    white-space: nowrap !important;
  }

  /* ─── L) Forms ─── */
  div[style*="120px 1fr"] { grid-template-columns: 1fr !important; }
  input, textarea, select, button { font-size: 16px !important; /* prevents iOS zoom */ }

  /* ─── M) Hero texts centered (many heroes use left-alignment) ─── */
  section h1,
  section h2 { text-align: center !important; }

  /* ─── N) Universe plates: make each plate full-width, maintain aspect ─── */
  div[style*="aspect-ratio:3/4"],
  div[style*="aspectRatio:\"3/4\""] { aspect-ratio: 1/1 !important; }

  /* ─── O) Pillars + cards with huge inner padding ─── */
  div[style*="padding:\"60px 40px"] { padding: 36px 22px !important; }
  div[style*="padding:\"50px 40px"] { padding: 32px 20px !important; }
  div[style*="padding:\"48px 40px"] { padding: 32px 20px !important; }
  div[style*="padding:\"40px 36px"] { padding: 28px 20px !important; }
  div[style*="padding:\"40px 32px"] { padding: 28px 20px !important; }

  /* ─── P) Horizontal scroll carousels become stack ─── */
  div[style*="overflow-x:auto"],
  div[style*="overflowX:\"auto\""],
  div[style*="overflow-x:scroll"],
  div[style*="overflowX:\"scroll\""] {
    overflow-x: visible !important;
    flex-direction: column !important;
  }

  /* ─── Q) Position sticky/fixed elements that hang off viewport ─── */
  div[style*="left:\"50%\""][style*="transform:\"translateX(-50%)\""] {
    width: 100% !important;
    left: 0 !important;
    transform: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   VERY SMALL — under 420px
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
  h1 { font-size: clamp(32px, 11vw, 48px) !important; }
  h2 { font-size: clamp(24px, 8vw, 36px) !important; }
  h3 { font-size: clamp(20px, 6vw, 28px) !important; }
  section { padding: 60px 16px !important; }
  nav { padding: 12px 14px !important; }
  nav > div:last-child a { padding: 6px 8px !important; font-size: 9px !important; }
}

/* ═══════════════════════════════════════════════════════════════
   TOUCH DEVICES — disable hover behaviours site-wide
   ═══════════════════════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
  /* Any element that relies on :hover for state gets its hover skipped */
  *:hover { transform: none !important; }

  /* Static image tiles: no zoom on tap */
  img { transform: none !important; }

  /* Candle cursor / custom cursors disabled */
  body { cursor: auto !important; }
}
