/* ================================================================
   SID Home Improvements — Shared Mobile Stylesheet
   style.css

   IMPORTANT: This file is MOBILE ONLY.
   Desktop/laptop layout is untouched.
   All rules live inside max-width media queries.
   Link this AFTER all page-level <style> blocks.
================================================================ */


/* ================================================================
   @media (max-width: 768px) — Tablets & Phones
================================================================ */
@media (max-width: 768px) {

  /* ── Prevent horizontal overflow without breaking position:sticky ──
     'clip' (unlike 'hidden') does NOT create a new scroll container,
     so nav position:sticky keeps working correctly.               ── */
  body {
    overflow-x: clip;
    max-width: 100%;
  }

  /* ── Images never overflow their container ── */
  img {
    max-width: 100%;
    height: auto;
  }

  /* ── Tap target minimum size (WCAG AA) ── */
  a,
  button,
  input[type="submit"],
  input[type="button"],
  .house-tab,
  .tab-link,
  .page-tab-nav a,
  .btn-hero,
  .btn-dark,
  .btn-orange,
  .btn-submit,
  .btn-fb,
  .btn-sm,
  .radio-option,
  .quick-card,
  .direct-card,
  .social-btn {
    min-height: 44px;
  }

  /* ── Top bar — single row, never wraps ─────────────────────────
     Force identical look on every page regardless of inline styles.
     display:flex + align-items on the links fixes emoji misalignment
     (some pages have it, some don't — we normalise it here).       ── */
  .top-bar {
    padding: 7px 14px !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    overflow: hidden !important;
  }
  .top-bar a {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
    font-size: 12px !important;
    letter-spacing: 0.5px !important;
  }
  /* Hide email address — too long for mobile; phone + estimate only */
  .top-bar a:nth-child(2) {
    display: none !important;
  }

  /* ── Nav — keep phone & hamburger on the exact same centre line ── */
  .nav-inner {
    padding: 0 14px;
    align-items: stretch;   /* children fill the full 74px height */
  }
  /* Both elements become flex containers that centre their own
     content, so the visual midpoint of each matches exactly.   */
  .nav-phone,
  .hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    align-self: stretch;    /* fill the 74px bar top-to-bottom */
  }
  .nav-phone {
    margin-left: auto;      /* push right, hamburger follows */
    font-size: 12px;
    letter-spacing: 0;
    white-space: nowrap;
    line-height: 1;
    padding: 0 2px;
  }
  .hamburger {
    margin-left: 8px;
    flex-shrink: 0;
    padding: 0 6px;
  }

  /* ── Hero ── */
  .hero {
    min-height: 320px;
  }
  .hero-inner {
    padding: 48px 16px 40px;
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero-card {
    display: none; /* hidden on mobile; floating CTA replaces it */
  }
  .hero-badge-row {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Quick cards ── */
  .quick-cards {
    grid-template-columns: 1fr;
    padding: 0 16px;
    margin-top: 24px;
  }

  /* ── Services grid ── */
  .services-grid {
    grid-template-columns: 1fr;
    padding: 0 16px !important;
    margin-bottom: 48px !important;
  }
  .svc-tile {
    aspect-ratio: 16 / 7;
  }

  /* ── Section wrapper ── */
  .section-wrap {
    padding: 48px 16px;
  }

  /* ── Guarantees grid ── */
  .guarantees-grid {
    grid-template-columns: 1fr;
  }

  /* ── About ── */
  .about-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  /* ── Financing / CTA banners ── */
  .financing-banner,
  .cta-banner {
    padding: 48px 16px;
  }

  /* ── Footer ── */
  .footer-main {
    grid-template-columns: 1fr;
    padding: 40px 16px;
    gap: 28px;
  }
  .footer-bottom {
    padding: 20px 16px;
    text-align: center;
  }

  /* ── Footer contact column — tighter spacing on mobile ── */
  .footer-contact-item {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
  }
  /* Email Us button — override the global min-height:44px tap rule so
     it stays compact while remaining easy to tap via the surrounding row */
  .footer-contact-item a[href^="mailto"] {
    min-height: auto;
    padding: 5px 12px;
    font-size: 11px;
    letter-spacing: 0.3px;
    line-height: 1.4;
  }

  /* ── Page hero ── */
  .page-hero {
    padding: 50px 16px 40px;
  }

  /* ── Services page ── */
  .svc-section {
    padding: 52px 16px;
  }
  .svc-intro {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .svc-num {
    display: none;
  }
  .svc-body {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .svc-tabs-inner {
    padding: 0 12px;
  }

  /* ── Contact page ── */
  .contact-wrap {
    grid-template-columns: 1fr;
    padding: 40px 16px;
    gap: 36px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-wrap {
    padding: 28px 16px;
  }
  .promise-strip {
    grid-template-columns: 1fr 1fr;
  }

  /* ── Gallery page ── */
  .gallery-wrap {
    padding: 32px 12px 48px;
  }
  .cat-gallery {
    padding: 40px 12px;
  }
  .page-tab-nav-inner {
    padding: 0 12px;
  }

  /* Carousel arrows ── */
  .carousel-arrow {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  /* ── Lightbox nav arrows ─────────────────────────────────────────
     gallery.html hides .lightbox-arrow at 768px with display:none,
     leaving no way to advance photos in the expanded view on mobile.
     Override that here: show them, sized for thumb-friendly tapping.
  ─────────────────────────────────────────────────────────────────── */
  .lightbox-arrow {
    display: flex !important;
    width: 52px;
    height: 52px;
    font-size: 30px;
  }
  .lightbox-arrow.prev { left: 6px; }
  .lightbox-arrow.next { right: 6px; }

  /* Thumbnails ── */
  .thumb-strip {
    gap: 4px;
  }
  .thumb {
    width: 60px;
    height: 42px;
  }

  /* House tabs ── */
  .house-tab {
    padding: 10px 14px;
    font-size: 12px;
  }

  /* ── Mobile nav: "Build" accordion (tap row to expand) ─────────
     .mobile-has-sub    = parent <li>
     .mobile-parent-row = full-width tappable row (onclick toggles)
     .mobile-parent-label = "Build" text label inside the row
     .mobile-sub-toggle = ▾ chevron at right edge of the row
     .mobile-sub-menu   = hidden <ul>; shown when .open is present
  ─────────────────────────────────────────────────────────────── */
  .mobile-parent-row {
    display: flex;
    align-items: stretch;
    cursor: pointer;
  }
  .mobile-parent-label {
    flex: 1;
    display: block;
    padding: 14px 24px;
    font-family: 'Oswald', sans-serif;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,.85);
    border-bottom: 1px solid rgba(255,255,255,.05);
  }
  .mobile-has-sub.open .mobile-parent-label {
    color: #E87120;
  }
  .mobile-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    flex-shrink: 0;
    background: none;
    border: none;
    border-left: 1px solid rgba(255,255,255,.08);
    border-bottom: 1px solid rgba(255,255,255,.05);
    color: #E87120;
    font-size: 13px;
    cursor: pointer;
    transition: transform .25s;
  }
  .mobile-has-sub.open .mobile-sub-toggle {
    transform: rotate(180deg);
  }
  .mobile-sub-menu {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 3px solid rgba(232,113,32,.4);
    background: rgba(0,0,0,.18);
  }
  .mobile-has-sub.open .mobile-sub-menu {
    display: block;
  }
  .mobile-sub-menu li a {
    display: block;
    padding: 11px 24px 11px 36px;
    font-family: 'Oswald', sans-serif;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,.55);
    border-bottom: 1px solid rgba(255,255,255,.04);
    transition: color .2s, background .2s;
  }
  .mobile-sub-menu li a::before {
    content: '↳ ';
    color: #E87120;
    opacity: .75;
  }
  .mobile-sub-menu li a:hover,
  .mobile-sub-menu li a.active {
    color: #E87120;
    background: rgba(232,113,32,.08);
  }


  /* ============================================================
     MOBILE SWIPEABLE PHOTO GALLERIES
     CSS scroll-snap converts static grids into touch carousels.
     Desktop grids are completely untouched (rules inside this
     max-width block only).
  ============================================================ */

  /* ── index.html: 4-photo preview gallery ── */
  .gallery-grid {
    display: flex !important;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    scrollbar-width: none;
    /* Remove grid layout */
    grid-template-columns: unset;
  }
  .gallery-grid::-webkit-scrollbar {
    display: none;
  }
  .gallery-grid .gallery-item {
    flex: 0 0 84%;
    max-width: 84%;
    scroll-snap-align: center;
    border-radius: 10px;
    aspect-ratio: 4 / 3;
  }
  .gallery-grid .gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
  }

  /* ── gallery.html / rentals.html / custom-homes.html /
        landlord.html: .photo-grid ── */
  .photo-grid {
    display: flex !important;
    flex-direction: row;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    scrollbar-width: none;
    grid-template-columns: unset;
  }
  .photo-grid::-webkit-scrollbar {
    display: none;
  }
  .photo-grid .photo-card {
    flex: 0 0 82%;
    max-width: 82%;
    scroll-snap-align: center;
    border-radius: 10px;
    min-height: 0;
  }
  .photo-grid .photo-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    height: auto;
    border-radius: 8px 8px 0 0;
  }

  /* ── gallery.html: for-sale grid ── */
  .sale-grid {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
    grid-template-columns: unset;
  }
  .sale-card {
    width: 100%;
  }

  /* ── Floor plan iframes — gallery.html ──────────────────────────
     The PDF iframes don't render usably on mobile; hide them and
     surface the "View Full Size" link as a full-width tap button,
     matching the pattern used on floor-plans.html.              ── */
  #gallery-floorplans iframe {
    display: none !important;
  }
  /* Style the existing "View Full Size ↗" anchor as an orange button */
  #gallery-floorplans a[href$=".pdf"] {
    display: block !important;
    width: 100%;
    background: #E87120;
    color: #111111 !important;
    font-family: 'Oswald', sans-serif !important;
    font-size: 15px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: center !important;
    padding: 18px 16px !important;
    text-decoration: none;
    box-sizing: border-box;
    /* Reset inline right-alignment from parent div */
    margin: 0;
  }
  #gallery-floorplans a[href$=".pdf"]:active {
    background: #c45e10;
  }

  /* ── For-sale folder listing card ──────────────────────────────
     On desktop the price bar (bottom) and photo-count badge
     (bottom-right of image) don't collide.  On mobile the card
     is narrower and both stack up at the bottom, overlapping.
     Fix: move the badge to the top-right of the image so it
     sits well away from the $price overlay at the bottom.    ── */
  .stack-count-badge {
    bottom: auto !important;
    top: 12px;
    right: 12px;
    font-size: 11px;
    padding: 4px 10px;
    letter-spacing: 1px;
  }

  /* ── Facebook embed ── */
  .fb-section {
    padding: 48px 16px;
  }
  .fb-section-inner {
    max-width: 100%;
  }
  .fb-embed-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

} /* end @media 768px */


/* ================================================================
   @media (max-width: 480px) — Small phones (iPhone SE, etc.)
================================================================ */
@media (max-width: 480px) {

  /* ── Top bar tiny phones — shrink further if needed ── */
  .top-bar {
    gap: 6px;
    padding: 6px 10px;
  }
  .top-bar a {
    font-size: 11px;
  }

  /* ── Hero text tighter ── */
  .hero-left h1 {
    font-size: clamp(26px, 8vw, 40px);
  }
  .hero-left p {
    font-size: 15px;
  }
  .hero-badge {
    font-size: 11px;
    padding: 5px 10px;
  }

  /* ── Section titles ── */
  .section-title {
    font-size: clamp(22px, 7vw, 32px);
  }

  /* ── CTA phone number ── */
  .cta-banner .phone,
  .financing-banner a[href^="tel"] {
    font-size: 26px;
    letter-spacing: 1px;
  }
  .financing-banner h2,
  .cta-banner h2 {
    font-size: clamp(20px, 7vw, 30px);
  }

  /* ── Quick cards: icon + text, no arrow overflow ── */
  .quick-card {
    padding: 18px 14px;
    gap: 12px;
  }
  .quick-card .qc-icon {
    width: 48px;
    height: 48px;
    font-size: 26px;
  }
  .quick-card h3 {
    font-size: 14px;
  }

  /* ── Gallery items take a bit more width on tiny screens ── */
  .gallery-grid .gallery-item {
    flex: 0 0 90%;
    max-width: 90%;
  }
  .photo-grid .photo-card {
    flex: 0 0 88%;
    max-width: 88%;
  }

  /* ── About stats 2-col on tiny screens ── */
  .about-stats {
    grid-template-columns: 1fr 1fr;
  }

  /* ── Contact form ── */
  .form-wrap {
    padding: 20px 12px;
  }
  .promise-strip {
    grid-template-columns: 1fr;
  }

  /* ── Page hero text ── */
  .page-hero h1 {
    font-size: clamp(28px, 9vw, 44px);
  }
  .page-hero p {
    font-size: 15px;
  }

  /* ── Guarantee cards: tighter padding ── */
  .guarantee-card {
    padding: 22px 18px;
  }

  /* ── Footer brand ── */
  .footer-brand p {
    font-size: 13px;
  }

  /* ── Nav logo text shrink ── */
  .logo-text-wrap .l1 {
    font-size: 13px;
  }
  .logo-text-wrap .l2 {
    font-size: 10px;
    letter-spacing: 1px;
  }

} /* end @media 480px */
