/* ========================================================================== 
   HAIKAL UNITED v1.3.0 — Phone + tablet experience
   Loaded after app.css and responsive.css on all public pages.
   Keep all small-screen presentation fixes in this one documented file.
   ========================================================================== */

/* 01. The full-screen menu is never shown on desktops. */
.mobile-menu-intro,
.mobile-menu-bottom {
  display: none;
}

/* 02. Tablet and phone navigation: a real viewport-wide overlay. */
@media (max-width: 980px) {
  html.menu-open,
  body.menu-open {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .nav,
  .nav.scrolled {
    z-index: 150;
    position: sticky;
    top: 0;
    isolation: auto;
    /* Blur creates a containing block for fixed children on some browsers. */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  body.menu-open .nav,
  body.menu-open .nav.scrolled {
    background: #fff;
    box-shadow: 0 1px 0 rgba(20, 24, 30, .08);
  }

  .nav .brand,
  .nav .lang,
  .nav .nav-toggle {
    position: relative;
    z-index: 153;
  }

  .nav .nav-toggle {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    border-color: #dedad2;
    background: #faf8f4;
    transition:
      background .28s ease,
      border-color .28s ease,
      transform .28s ease;
  }

  .nav .nav-toggle:active {
    transform: scale(.94);
  }

  .nav .nav-toggle:focus-visible,
  .nav nav a:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 3px;
  }

  /* Existing nav markup works on the homepage and both truck pages. */
  .nav nav,
  .nav nav.is-open {
    position: fixed;
    inset: 0;
    top: 0;
    bottom: 0;
    inset-inline: 0;
    z-index: 151;
    display: flex;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding:
      calc(92px + env(safe-area-inset-top, 0px))
      clamp(22px, 6vw, 56px)
      calc(28px + env(safe-area-inset-bottom, 0px));
    flex-flow: column nowrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-radius: 0;
    background:
      radial-gradient(circle at 96% 20%, rgba(201, 147, 63, .13), transparent 40%),
      linear-gradient(160deg, #fffdfa, #f3f0e9);
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-14px);
    transition:
      opacity .38s cubic-bezier(.2, .7, .2, 1),
      transform .44s cubic-bezier(.2, .7, .2, 1),
      visibility .44s;
    -webkit-overflow-scrolling: touch;
  }

  .nav nav.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }

  .nav nav .mobile-menu-intro {
    display: grid;
    gap: 5px;
    margin-bottom: clamp(22px, 3vh, 34px);
    color: #986c32;
    text-align: start;
  }

  .mobile-menu-intro > span {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .22em;
  }

  .mobile-menu-intro > strong {
    color: #131921;
    font-size: clamp(22px, 5vw, 31px);
    line-height: 1.4;
  }

  .nav nav > a {
    width: 100%;
    margin: 0;
    padding: clamp(10px, 1.7vh, 17px) 4px;
    border-radius: 0;
    border-bottom: 1px solid rgba(20, 24, 30, .1);
    color: #202730;
    font-size: clamp(23px, 5.6vw, 34px);
    line-height: 1.32;
    font-weight: 700;
    letter-spacing: -.015em;
    text-align: start;
    white-space: normal;
    transition:
      color .25s ease,
      padding-inline .32s ease,
      background .25s ease;
  }

  .nav nav > a::after {
    display: none;
  }

  .nav nav > a:hover,
  .nav nav > a:focus-visible,
  .nav nav > a.active {
    color: #9d6b2c;
    background: transparent;
    padding-inline-start: 12px;
  }

  .nav nav.is-open > a {
    animation: menuLinkEnter .56s cubic-bezier(.16, .8, .2, 1) both;
    animation-delay: calc(80ms + var(--menu-index, 0) * 48ms);
  }

  @keyframes menuLinkEnter {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }

  .nav nav .mobile-menu-bottom {
    display: grid;
    gap: 12px;
    margin-top: auto;
    padding-top: 26px;
    text-align: start;
  }

  .mobile-menu-bottom > span {
    color: #68717b;
    font-size: 13px;
  }

  .nav nav .mobile-menu-contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 12px 18px;
    border: 0;
    border-radius: 16px;
    background: #121923;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    white-space: normal;
  }

  .nav nav .mobile-menu-contact span {
    font-size: 22px;
    line-height: 1;
  }

  .mobile-menu-bottom small {
    color: #9d6b2c;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
  }

  /* 03. A taller, continuous hero photo, not a short image strip. */
  .hero {
    min-height: max(880px, 105svh);
    min-height: max(880px, 105dvh);
    align-content: center;
    overflow: hidden;
    padding-block: clamp(65px, 9vh, 108px) 80px;
    background-color: #f8f4ed;
  }

  .hero > .hero-bg.has-photo,
  [dir="rtl"] .hero > .hero-bg.has-photo {
    position: absolute;
    inset: -18px;
    background-image:
      linear-gradient(
        180deg,
        rgba(250, 248, 244, .58) 0%,
        rgba(250, 248, 244, .81) 36%,
        rgba(250, 248, 244, .90) 70%,
        rgba(250, 248, 244, .97) 100%
      ),
      var(--hero-photo, none);
    background-size: 100% 100%, cover;
    background-position: center, 65% 38%;
    background-repeat: no-repeat;
    transform-origin: center center;
    animation: heroPhotoDrift 20s ease-in-out infinite alternate;
  }

  @keyframes heroPhotoDrift {
    from { transform: scale(1.01) translate3d(0, 0, 0); }
    to { transform: scale(1.055) translate3d(-5px, 0, 0); }
  }

  .hero-inner,
  .hero-media {
    min-width: 0;
    width: 100%;
  }

  .hero-inner > p {
    line-height: 1.85;
    max-width: 44ch;
  }

  /* 04. Calm, readable entrance animations for phones and tablets. */
  .section.reveal,
  .reveal {
    filter: none;
    transform: translate3d(0, 20px, 0);
    transition:
      opacity .88s cubic-bezier(.2, .7, .2, 1),
      transform .88s cubic-bezier(.2, .7, .2, 1);
    transition-delay: var(--reveal-delay, 0ms);
  }

  .reveal.in-view,
  .section.reveal.in-view {
    filter: none;
    transform: none;
  }

  .product-card,
  .project-card,
  .card,
  .location-grid article {
    transition:
      box-shadow .45s ease,
      transform .45s cubic-bezier(.2, .7, .2, 1),
      border-color .45s ease;
  }

  .btn:active,
  .product-card:active,
  .project-card:active {
    transform: scale(.985) !important;
  }

  /* 05. Clear truck detail text on both sides of a small screen. */
  .product-detail {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 36px;
    width: 100%;
    min-width: 0;
    padding: 52px clamp(20px, 5vw, 42px) 66px;
  }

  .product-media-column,
  .product-info {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .product-info {
    padding-inline: clamp(3px, 1.5vw, 12px);
  }

  .product-info .eyebrow {
    display: block;
    max-width: 100%;
    font-size: 11px;
    line-height: 1.65;
    letter-spacing: .08em;
    overflow-wrap: anywhere;
  }

  .product-info h1 {
    max-width: 100%;
    margin-block: 10px 22px;
    color: var(--ink);
    font-size: clamp(30px, 6.1vw, 46px);
    line-height: 1.32;
    letter-spacing: -.018em;
    font-weight: 800;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
    text-wrap: pretty;
  }

  [dir="rtl"] .product-info h1 {
    letter-spacing: 0;
    line-height: 1.42;
  }

  .product-info .hero-word-wrap {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
  }

  .product-info .lead,
  .product-copy .lead {
    max-width: 100%;
    font-size: clamp(16px, 3.6vw, 19px);
    line-height: 1.95;
    overflow-wrap: break-word;
    word-break: normal;
  }

  .product-info .product-actions {
    gap: 13px;
    margin-top: 28px;
  }

  .product-info .product-actions .btn {
    min-height: 56px;
    padding: 14px 18px;
    font-size: 16px;
    line-height: 1.5;
    white-space: normal;
  }

  .product-copy.section,
  .specs-section.section {
    padding: 72px clamp(22px, 5vw, 42px);
  }

  .product-copy h2,
  .specs-section h2 {
    font-size: clamp(30px, 6vw, 45px);
    line-height: 1.3;
  }

  .spec-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .spec-list > div {
    min-width: 0;
    flex-wrap: wrap;
  }

  /* Keep horizontally scrollable thumbnails inside their own column. */
  .gallery-thumbnails {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }
}

/* 06. Phone-specific spacing, including small 320px screens. */
@media (max-width: 680px) {
  .hero {
    min-height: max(880px, 110svh);
    min-height: max(880px, 110dvh);
    gap: 30px;
    padding:
      clamp(68px, 8vh, 94px)
      clamp(20px, 5vw, 28px)
      84px;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(35px, 9vw, 45px);
    line-height: 1.22;
  }

  [dir="rtl"] .hero h1 {
    line-height: 1.35;
  }

  .hero-contact {
    gap: 12px;
    margin-top: 28px;
  }

  .hero-contact li {
    min-width: 0;
    padding: 16px;
  }

  .hero-contact strong {
    font-size: clamp(14px, 3.7vw, 17px);
    overflow-wrap: anywhere;
  }

  .brand-stage {
    margin-top: 16px;
  }

  .product-detail {
    padding: 34px 20px 66px;
  }

  .product-info {
    padding-inline: 4px;
  }

  .product-info h1 {
    font-size: clamp(29px, 7.8vw, 37px);
  }

  .product-copy.section,
  .specs-section.section {
    padding-inline: 24px;
  }

  .nav nav,
  .nav nav.is-open {
    padding-inline: clamp(23px, 6vw, 35px);
  }
}

/* 07. Low-height phones: let the full-screen menu scroll naturally. */
@media (max-width: 980px) and (max-height: 650px) {
  .nav nav,
  .nav nav.is-open {
    padding-top: 75px;
  }

  .nav nav > a {
    padding-block: 9px;
    font-size: 22px;
  }
}

/* 08. Reduced motion: no looping photo or forced element entrance. */
@media (prefers-reduced-motion: reduce) {
  .hero > .hero-bg.has-photo,
  [dir="rtl"] .hero > .hero-bg.has-photo {
    animation: none !important;
    transform: none !important;
  }

  .nav nav,
  .nav nav > a,
  .nav nav.is-open > a {
    animation: none !important;
    transition: none !important;
  }
}
