/* ========================================
   J&S Vehicle Care — Responsive Layer
   Mobile implementation (section by section)
   Desktop (≥992px) styles remain in style.css
   ======================================== */

/* ---- Breakpoints ----
   Desktop  ≥1200px
   Laptop   992–1199px
   Tablet   768–991px
   Mobile   ≤767px
   -------------------- */

/* ========================================
   1. Navigation — Tablet & below (≤991px)
   ======================================== */

@media (max-width: 991px) {
  .nav__logo-img {
    height: 48px;
    max-width: 120px;
  }

  .nav__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    margin-right: -6px;
    -webkit-tap-highlight-color: transparent;
  }

  .nav__links {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 28px 24px 32px;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(-6%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      transform var(--transition),
      opacity var(--transition),
      visibility var(--transition);
  }

  .nav__links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
  }

  .nav__links li {
    width: 100%;
  }

  .nav__links a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--black-border);
  }

  .nav__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 22px;
    margin-top: 16px;
    text-align: center;
    border-bottom: none !important;
  }
}

/* ========================================
   1. Navigation — Mobile (≤767px)
   ======================================== */

@media (max-width: 767px) {
  :root {
    --nav-touch-transition: 280ms ease-out;
  }

  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }

  body.nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(0, 0, 0, 0.62);
    animation: navBackdropIn var(--nav-touch-transition) forwards;
  }

  .nav__logo-img {
    height: 48px;
    max-width: 120px;
  }

  .nav__toggle {
    min-width: 48px;
    min-height: 48px;
  }

  .nav__toggle span {
    transition: transform var(--nav-touch-transition), opacity var(--nav-touch-transition);
  }

  .nav__links {
    padding: 48px 24px max(40px, env(safe-area-inset-bottom, 0px));
    gap: 4px;
    transition:
      transform var(--nav-touch-transition),
      opacity var(--nav-touch-transition),
      visibility var(--nav-touch-transition);
  }

  .nav__links a {
    min-height: 52px;
    padding: 14px 8px;
    font-size: 0.9375rem;
    letter-spacing: 0.06em;
    border-radius: 4px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.6);
  }

  .nav__links li:last-child a.nav__cta {
    border-bottom: none;
  }

  .nav__cta {
    min-height: 52px;
    margin-top: 28px;
    padding: 14px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--gold) !important;
  }
}

@media (max-width: 479px) {
  .nav__logo-img {
    height: 45px;
    max-width: 110px;
  }
}

@keyframes navBackdropIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Touch feedback — replaces hover on coarse pointers */
@media (max-width: 991px) and (hover: none) and (pointer: coarse) {
  .nav__links a:active {
    color: var(--gold);
    background: rgba(255, 255, 255, 0.04);
  }

  .nav__cta:active {
    background: rgba(201, 168, 76, 0.14) !important;
    color: var(--gold) !important;
  }

  .nav__toggle:active {
    opacity: 0.65;
  }
}

/* Hero scroll hint — hidden on desktop */
@media (min-width: 992px) {
  .hero__scroll-hint {
    display: none;
  }
}

/* ========================================
   2. Homepage Hero — Laptop (992–1199px)
   ======================================== */

@media (max-width: 1199px) and (min-width: 992px) {
  .hero__logo {
    width: 300px;
  }

  .hero__gold-line {
    display: none;
  }
}

/* ========================================
   2. Homepage Hero — Tablet & below (≤991px)
   ======================================== */

@media (max-width: 991px) {
  /* Pull service map into hero flow (mobile hierarchy) */
  main {
    display: flex;
    flex-direction: column;
  }

  main > section {
    order: 10;
  }

  #hero {
    order: 0;
  }

  .services--maintenance,
  .services--maintenance > .container,
  .services--maintenance .services__inner {
    display: contents;
  }

  .services--maintenance .services__feature {
    order: 1;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 8px 24px 56px;
    position: relative;
  }

  .services--maintenance .services__feature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 72px;
    background: linear-gradient(to bottom, var(--black) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
  }

  .services--maintenance .services__feature > * {
    position: relative;
    z-index: 1;
  }

  #trust-strip {
    display: none !important;
  }

  #book-online {
    display: none !important;
  }

  .services--maintenance .services__feature {
    padding-bottom: 32px;
  }

  #products-we-use {
    display: none !important;
  }

  .services--maintenance .services__content {
    order: 4;
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 56px 24px 80px;
    background: var(--black);
  }

  .hero {
    min-height: auto;
    padding: calc(var(--header-height) + 40px) 0 56px;
    overflow: visible;
  }

  .hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent 0%, rgba(10, 10, 10, 0.45) 55%, var(--black) 100%);
    pointer-events: none;
    z-index: 4;
  }

  .hero__booking-note {
    display: none;
  }

  .hero__inner {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 44px;
  }

  .hero__logo-spotlight {
    order: -1;
  }

  .hero__copy {
    order: 0;
    max-width: 100%;
    text-align: center;
    padding: 0;
  }

  .hero__gold-line {
    display: none;
  }

  .hero__logo {
    width: min(232px, 56vw);
    margin: 0 auto;
  }

  .hero__title {
    font-size: clamp(1.85rem, 6.2vw, 2.65rem);
    line-height: 1.14;
    margin-bottom: 22px;
  }

  .hero__title-line {
    margin-top: 0.04em;
  }

  .hero__title-accent {
    font-size: clamp(0.72rem, 2.4vw, 0.875rem);
    margin-top: 0.7em;
    margin-left: auto;
    margin-right: auto;
    max-width: 32ch;
    line-height: 1.45;
  }

  .hero__eyebrow {
    border-bottom: none;
    padding-bottom: 0;
  }

  .hero__subtitle {
    font-size: 1.025rem;
    line-height: 1.78;
    max-width: 38ch;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 28px;
    border-left: none;
    padding-left: 0;
    text-wrap: pretty;
  }

  .hero__badges {
    justify-content: center;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    gap: 14px;
  }

  .hero__actions-primary {
    align-items: stretch;
    width: 100%;
    gap: 12px;
  }

  .hero__booking-note {
    justify-content: center;
  }

  .hero__actions .btn {
    width: 100%;
    min-height: 52px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .hero__scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
    width: 48px;
    height: 48px;
    margin: 4px auto 0;
    color: var(--gold);
    opacity: 0.7;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: opacity var(--transition);
  }

  .hero__scroll-hint-icon {
    display: block;
    width: 18px;
    height: 18px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-3px);
    animation: heroScrollBounce 2.4s ease-in-out infinite;
  }

  .services--maintenance .service-area-card--map-only {
    width: 100%;
    max-width: min(100%, 480px);
    margin: 0 auto;
  }

  .services--maintenance .service-map {
    width: 100%;
  }

  .services--maintenance .service-map__stage {
    width: 100%;
    max-width: 100%;
  }
}

/* ========================================
   2. Homepage Hero — Mobile (≤767px)
   ======================================== */

@media (max-width: 767px) {
  :root {
    --hero-touch-transition: 280ms ease-out;
  }

  .hero {
    padding: calc(var(--header-height) + 36px) 0 48px;
  }

  .hero__inner {
    gap: 36px;
  }

  .hero__logo {
    width: min(200px, 58vw);
  }

  .hero__title {
    font-size: clamp(1.75rem, 8.5vw, 2.35rem);
    line-height: 1.12;
    letter-spacing: 0.01em;
    margin-bottom: 20px;
  }

  .hero__title-accent {
    font-size: clamp(0.6875rem, 2.8vw, 0.8125rem);
    letter-spacing: 0.09em;
    max-width: 28ch;
  }

  .hero__subtitle {
    font-size: 1rem;
    line-height: 1.75;
    max-width: 34ch;
    margin-bottom: 32px;
  }

  .hero__actions {
    max-width: 100%;
    gap: 12px;
  }

  .hero__actions .btn {
    min-height: 52px;
    transition:
      background var(--hero-touch-transition),
      color var(--hero-touch-transition),
      border-color var(--hero-touch-transition),
      transform var(--hero-touch-transition),
      box-shadow var(--hero-touch-transition);
  }

  .hero__scroll-hint {
    margin-top: 8px;
    transition: opacity var(--hero-touch-transition);
  }

  .services--maintenance .services__feature {
    padding-top: 4px;
    padding-bottom: 48px;
  }
}

@media (max-width: 479px) {
  .hero__inner {
    gap: 32px;
  }

  .hero__logo {
    width: min(184px, 62vw);
  }

  .hero__subtitle {
    font-size: 0.975rem;
    max-width: 32ch;
  }

  .services--maintenance .service-area-card--map-only {
    max-width: min(100%, 420px);
  }
}

@keyframes heroScrollBounce {
  0%,
  100% {
    transform: rotate(45deg) translateY(-3px);
    opacity: 0.55;
  }

  50% {
    transform: rotate(45deg) translateY(3px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__scroll-hint-icon {
    animation: none;
  }
}

/* Hero touch feedback */
@media (max-width: 991px) and (hover: none) and (pointer: coarse) {
  .hero__actions .btn:active {
    transform: scale(0.98);
  }

  .hero__scroll-hint:active {
    opacity: 1;
  }
}

/* ========================================
   3. Homepage Sections — Laptop (992–1199px)
   ======================================== */

@media (max-width: 1199px) and (min-width: 992px) {
  .features__grid,
  .trust__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-brands__grid {
    max-width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .local-seo__areas-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .selector__grid {
    grid-template-columns: 1fr;
  }

  .selector-card {
    min-height: auto;
  }

  .ceramic__inner {
    grid-template-columns: 1fr;
  }

  .trust-strip__inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .trust-strip__item:nth-child(2) {
    border-right: none;
  }

  .trust-strip__item:nth-child(1),
  .trust-strip__item:nth-child(2) {
    border-bottom: 1px solid var(--black-border);
  }
}

/* ========================================
   3. Homepage Sections — Tablet & below (≤991px)
   ======================================== */

.contact__intro--mobile {
  display: none;
}

@media (max-width: 991px) {
  :root {
    --section-touch-transition: 280ms ease-out;
  }

  /* Shared section rhythm */
  .section-header {
    margin-bottom: 44px;
  }

  .section-title {
    text-wrap: balance;
  }

  main .btn:not(.nav__cta) {
    min-height: 52px;
    padding-top: 15px;
    padding-bottom: 15px;
  }

  /* Product brands */
  .product-brands {
    padding: 72px 0 80px;
  }

  .product-brands__intro {
    font-size: 1.05rem;
    line-height: 1.75;
    text-wrap: pretty;
  }

  .product-brands__grid {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 100%;
    margin-top: 40px;
  }

  .product-brands__card {
    width: 100%;
    min-height: 120px;
    padding: 36px 28px;
    border-radius: 14px;
  }

  .product-brands__logo {
    height: 80px;
  }

  .product-brands__logo img {
    max-height: 80px;
  }

  .product-brands__disclaimer {
    margin-top: 32px;
    padding: 0 4px;
  }

  .product-brands__note {
    padding: 0 4px;
    text-wrap: pretty;
  }

  /* Services — maintenance content block */
  .services--maintenance .services__content {
    padding: 56px 24px 72px;
  }

  .services {
    padding: 80px 0;
  }

  .services__inner {
    display: flex;
    flex-direction: column;
    gap: 40px;
  }

  .services__content {
    width: 100%;
  }

  .services__desc {
    text-wrap: pretty;
  }

  .services__list li {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  .services__content > .btn {
    width: 100%;
    margin-top: 32px;
  }

  .services__stats {
    width: 100%;
    gap: 16px;
  }

  .stat {
    width: 100%;
    padding: 28px 28px;
  }

  /* Ceramic coatings */
  .ceramic {
    padding: 80px 0;
  }

  .ceramic__inner {
    display: flex;
    flex-direction: column;
    gap: 40px;
  }

  .ceramic__content {
    width: 100%;
  }

  .ceramic__desc {
    text-wrap: pretty;
  }

  .ceramic__content > .btn {
    width: 100%;
  }

  .ceramic__packages {
    width: 100%;
    gap: 16px;
  }

  .ceramic-package {
    width: 100%;
    padding: 28px 28px;
  }

  /* About */
  .about {
    padding: 80px 0;
  }

  .about__content p {
    text-wrap: pretty;
  }

  /* Trust cards */
  .trust {
    padding: 80px 0;
  }

  .features__grid,
  .trust__grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .trust-card {
    width: 100%;
    padding: 32px 28px;
    background: var(--black-card);
    border: 1px solid var(--black-border);
    border-radius: 8px;
  }

  /* Contact / partnerships (community) */
  .contact {
    padding: 56px 0 64px;
  }

  .contact__inner {
    display: flex;
    flex-direction: column;
    gap: 32px;
  }

  .contact__text .section-eyebrow {
    margin-bottom: 8px;
  }

  .contact__text .section-title {
    font-size: clamp(1.45rem, 4.8vw, 1.85rem);
    line-height: 1.15;
  }

  .contact__intro--desktop {
    display: none;
  }

  .contact__intro--mobile {
    display: block;
    margin: 16px 0 0;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--grey-light);
    text-wrap: pretty;
  }

  .contact__text p {
    text-wrap: pretty;
  }

  .contact__features {
    gap: 6px;
    margin: 20px 0 20px;
  }

  .contact__features li {
    min-height: 40px;
    padding: 6px 0;
    font-size: 0.875rem;
  }

  .contact__features-icon {
    width: 30px;
    height: 30px;
  }

  .contact__features-icon svg {
    width: 14px;
    height: 14px;
  }

  .contact__actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 4px;
  }

  .contact__actions .btn {
    width: 100%;
  }

  .contact__actions a[href^="tel:"],
  .contact__actions .btn--tertiary {
    display: none !important;
  }

  .contact__form {
    width: 100%;
    padding: 28px 24px;
  }

  .contact__form h3 {
    margin-bottom: 20px;
    font-size: 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .form-group textarea {
    min-height: 120px;
  }

  /* Local SEO */
  .local-seo {
    padding: 80px 0;
  }

  .local-seo__content p {
    text-wrap: pretty;
  }

  .local-seo__areas-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 20px;
  }

  .local-seo__areas-list li {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--black-border);
    border-radius: 6px;
  }

  /* Selector (if present) */
  .selector__grid {
    grid-template-columns: 1fr;
  }

  .selector-card {
    min-height: auto;
    width: 100%;
  }

  /* Map layout helper — does not alter map artwork/animation */
  .service-map {
    min-height: 0;
  }
}

/* ========================================
   3. Homepage Sections — Mobile (≤767px)
   ======================================== */

@media (max-width: 767px) {
  .section-header {
    margin-bottom: 36px;
  }

  .product-brands {
    padding: 64px 0 72px;
  }

  .product-brands__card {
    min-height: 128px;
    padding: 32px 24px;
  }

  .services--maintenance .services__content {
    padding: 48px 20px 64px;
  }

  .services {
    padding: 72px 0;
  }

  .services__inner {
    gap: 32px;
  }

  .ceramic {
    padding: 72px 0;
  }

  .ceramic__inner {
    gap: 32px;
  }

  .ceramic-package {
    padding: 26px 24px;
  }

  .about {
    padding: 72px 0;
  }

  .trust {
    padding: 72px 0;
  }

  .trust-card {
    padding: 28px 24px;
  }

  .contact {
    padding: 48px 0 56px;
  }

  .contact__inner {
    gap: 28px;
  }

  .contact__intro--mobile {
    margin-top: 14px;
    font-size: 0.925rem;
    line-height: 1.62;
  }

  .contact__features {
    gap: 4px;
    margin: 16px 0 16px;
  }

  .contact__features li {
    min-height: 36px;
    padding: 4px 0;
    font-size: 0.8125rem;
  }

  .contact__features-icon {
    width: 28px;
    height: 28px;
  }

  .contact__form {
    padding: 24px 20px;
  }

  .contact__form h3 {
    margin-bottom: 18px;
    font-size: 1.125rem;
  }

  .faq {
    padding: 72px 0;
  }

  .faq__item summary {
    padding: 18px 20px;
    font-size: 0.875rem;
  }

  .faq__answer {
    padding: 0 20px 18px;
    font-size: 0.925rem;
  }

  .footer__nav {
    gap: 10px 16px;
  }

  .local-seo__areas-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .local-seo__areas-list li {
    justify-content: flex-start;
    padding: 12px 16px;
  }

  /* Soften interactive transitions on touch */
  .product-brands__card,
  .ceramic-package,
  .trust-card,
  .stat,
  .booking-cta__inner,
  main .btn:not(.nav__cta) {
    transition-duration: 280ms;
    transition-timing-function: ease-out;
  }
}

/* Section touch feedback — replaces hover on coarse pointers */
@media (max-width: 991px) and (hover: none) and (pointer: coarse) {
  .product-brands__card:hover,
  .ceramic-package:hover,
  .trust-card:hover,
  .stat:hover,
  .trust-strip__item:hover {
    transform: none;
  }

  .product-brands__card:active,
  .ceramic-package:active,
  .trust-card:active {
    border-color: rgba(201, 168, 76, 0.35);
  }

  .trust-strip__item:active {
    background: rgba(201, 168, 76, 0.04);
  }

  main .btn:not(.nav__cta):active {
    transform: scale(0.98);
  }
}
