/* Truckers Legacy Life mobile-first overrides for the purchased funnel layout.
   Linked from every funnel. Isolated deploys: copy lives in each folder's shared/. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}
body {
  overflow-x: clip;
  min-width: 0;
  max-width: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
img, svg, video, canvas { max-width: 100%; height: auto; }
img[style*="height:100%"] { height: 100% !important; }
iframe { display: block; max-width: 100%; }
input, select, textarea, button { max-width: 100%; }
button, a, [onclick], [onClick] { touch-action: manipulation; }
:focus-visible { outline-offset: 3px; }

/* Sticky mobile dock */
.aa-dock {
  display: none;
}
@media (max-width: 720px) {
  .aa-dock {
    display: grid;
    grid-template-columns: minmax(96px, auto) 1fr;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, Canvas 88%, transparent);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-top: 1px solid color-mix(in srgb, CanvasText 12%, transparent);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.12);
  }
  .aa-dock a,
  .aa-dock button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 10px;
    font: 700 15px/1.1 inherit;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: 0.01em;
  }
  .aa-dock a {
    border: 1px solid color-mix(in srgb, CanvasText 22%, transparent);
    background: transparent;
    color: inherit;
  }
  .aa-dock button {
    border: 0;
    background: CanvasText;
    color: Canvas;
  }
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

  /* Quiz overlay sits above the dock */
  [data-screen-label$="Quiz"],
  [data-screen-label*="Quiz"],
  [data-screen-label*="Booking"],
  [data-screen-label="Thank You"],
  [style*="z-index:100"] {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (max-width: 860px) {
  iframe[src*="cal.com"] {
    height: min(68vh, 540px) !important;
    min-height: 420px;
  }

  /* Sticky nav bars that were a fixed 66–70px */
  [style*="height:66px"],
  [style*="height:68px"],
  [style*="height:70px"] {
    height: auto !important;
    min-height: 56px;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  table[style*="min-width"] {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  div:has(> table[style*="min-width"]) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  /* Whale process rows: number | title | copy */
  [style*="minmax(60px,80px)"] {
    grid-template-columns: 52px 1fr !important;
    gap: 8px 16px !important;
  }
  [style*="minmax(60px,80px)"] > :nth-child(3) {
    grid-column: 2 / -1 !important;
  }
}

@media (max-width: 640px) {
  /* Hero / editorial media: designed height, not a desktop crop leftover */
  [style*="height:400px"],
  [style*="height:340px"],
  [style*="height:320px"],
  [style*="height:300px"] {
    height: 210px !important;
  }
  [style*="height:280px"],
  [style*="height:260px"],
  [style*="height:240px"] {
    height: 190px !important;
  }
  [style*="min-height:340px"] { min-height: 200px !important; }

  /* Don't squash the Cal iframe with the height rules above */
  iframe[src*="cal.com"] {
    height: min(62vh, 500px) !important;
    min-height: 400px !important;
  }

  /* Tighter page gutters */
  [style*="padding:0 clamp("] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Section breathing room — mobile is designed, not scaled-down desktop */
  [style*="padding:clamp(70px"],
  [style*="padding:clamp(66px"],
  [style*="padding:76px 0"],
  [style*="padding:72px 0"],
  [style*="padding:64px 0"] {
    padding-top: 48px !important;
  }

  /* Four-up option chips: wrap instead of shrinking below tap size */
  [style*="display:flex"][style*="gap:0"][style*="border:"] {
    flex-wrap: wrap;
  }
  [style*="display:flex"][style*="gap:0"][style*="border:"] > button {
    min-width: 25%;
    min-height: 44px;
  }

  /* iOS: never zoom-on-focus */
  input, select, textarea {
    font-size: 16px !important;
  }
  input[type="range"] {
    min-height: 32px;
  }

  /* Comparison grids that are 4 columns (truckers v2) */
  [style*="grid-template-columns:1.5fr 1fr 1fr 1fr"] {
    min-width: 520px;
    font-size: 12px !important;
  }
  div:has(> [style*="grid-template-columns:1.5fr 1fr 1fr 1fr"]) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  /* Header phone lines wrap cleanly */
  [style*="letter-spacing:0.1em"][style*="text-transform:uppercase"] {
    text-align: right;
  }

  /* Ticker / proof bars with 3 squeezed labels */
  [style*="letter-spacing:.06em"][style*="justify-content:space-between"] {
    flex-wrap: wrap;
    gap: 8px 14px;
    justify-content: flex-start !important;
  }

  /* Quiz: more thumb room, less chrome */
  [style*="z-index:100"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  [style*="z-index:100"] > div {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Giant display figures stay on one line */
  [style*="font-variant-numeric:tabular-nums"] {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 400px) {
  iframe[src*="cal.com"] {
    height: 460px !important;
    min-height: 380px !important;
  }
  [style*="height:210px"],
  [style*="height:190px"] { /* no-op fallback */ }
  h1, [style*="clamp(38px"], [style*="clamp(40px"], [style*="clamp(42px"], [style*="clamp(44px"], [style*="clamp(46px"] {
    line-height: 1.12 !important;
  }
  .aa-dock {
    grid-template-columns: 1fr 1.4fr;
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .aa-dock a, .aa-dock button {
    font-size: 14px;
    padding: 0 10px;
  }
}

/* Landscape phones: keep dock, don't eat the quiz */
@media (max-height: 480px) and (orientation: landscape) {
  iframe[src*="cal.com"] { height: 70vh !important; min-height: 280px !important; }
  .aa-dock { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
}

.aa-dock-dark {
  background: rgba(11, 18, 32, 0.94);
  border-top-color: rgba(227, 179, 65, 0.28);
  color: #f4f1ea;
  box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.35);
}
.aa-dock-dark a {
  border-color: rgba(245, 165, 36, 0.45);
  color: #f5a524;
}
.aa-dock-dark button {
  background: #e3b341;
  color: #131a24;
}

@media (prefers-reduced-motion: reduce) {
  .aa-dock { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
