/**
 * Production responsive hardening — Desktop → Tablet → Mobile.
 * Extends the existing JIA breakpoint system (1100 / 1024 / 900 / 640).
 * Does not restyle the brand; prevents overflow, cramped touch, and squeezed layouts.
 */

/* —— Global overflow & media safety —— */
html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
img,
video,
svg,
iframe {
  max-width: 100%;
  height: auto;
}
table {
  max-width: 100%;
}
.jia-table-scroll,
.jia-prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* —— Touch targets (mobile / tablet) —— */
@media (max-width: 1024px) {
  .jia-menu-btn,
  .jia-lang,
  .jia-btn,
  .jia-mobile a,
  .jia-mobile summary {
    min-height: 44px;
  }
  .jia-menu-btn,
  .jia-lang {
    display: inline-flex;
    align-items: center;
    padding-inline: 12px;
  }
  .jia-mobile {
    padding-block: 8px 24px;
  }
  .jia-mobile a,
  .jia-mobile summary {
    display: flex;
    align-items: center;
    padding-block: 12px;
    font-size: 16px;
    line-height: 1.4;
  }
  .jia-mobile__sub a {
    min-height: 40px;
    padding-block: 10px;
    font-size: 15px;
  }
  .jia-form input,
  .jia-form select,
  .jia-form textarea {
    width: 100%;
    max-width: 100%;
    min-height: 48px;
    font-size: 16px; /* avoids iOS zoom */
  }
  .jia-form textarea {
    min-height: 120px;
  }
  .jia-form .jia-btn {
    width: 100%;
    justify-content: center;
  }
}

/* —— Tablet (portrait / landscape) —— */
@media (max-width: 900px) {
  .jia-wrap {
    width: min(var(--jia-max), calc(100% - 40px));
  }
  .jia-hero__title {
    font-size: clamp(2.25rem, 5vw, 2.75rem);
    max-width: var(--jia-hero-text, 680px);
    overflow-wrap: break-word;
  }
  html[lang^="ar"] .jia-hero__title,
  html[dir="rtl"] .jia-hero__title {
    font-size: clamp(2rem, 4.8vw, 2.5rem);
  }
  .jia-mask-title,
  .jia-page-hero h1,
  .jia-svc-hero h1 {
    font-size: clamp(1.875rem, 4vw, 2.25rem);
    max-width: none;
    overflow-wrap: break-word;
    font-weight: 600;
  }
  .jia-answer,
  .jia-lead,
  .jia-prose p {
    font-size: clamp(1rem, 2.2vw, 1.0625rem);
  }
  .jia-people,
  .jia-people--full,
  .jia-advisers-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
  .jia-work--home {
    grid-template-columns: 1fr 1fr;
  }
  .jia-cta-band .jia-btn,
  .jia-hero__actions .jia-btn {
    min-height: 48px;
  }
  .jia-adviser-hero--split {
    gap: 28px;
  }
  .jia-svc-keywords {
    flex-wrap: wrap;
    gap: 6px 0;
  }
  .jia-header__actions .jia-btn--sm {
    display: none;
  }
}

/* —— Standard / large mobile —— */
@media (max-width: 640px) {
  .jia-wrap,
  .jia-wrap--narrow {
    width: min(var(--jia-max), calc(100% - 40px));
  }
  .jia-section,
  .jia-svc-section,
  .jia-page-hero,
  .jia-cta-band {
    padding-block: var(--jia-section-pad-sm, 56px);
  }
  .jia-hero--photo,
  .jia-svc-hero--photo {
    min-height: auto;
    padding: 96px 0 48px;
    background-position: center 28%;
  }
  .jia-hero__title {
    font-size: clamp(1.95rem, 7vw, 2.25rem);
    line-height: 1.15;
  }
  html[lang^="ar"] .jia-hero__title,
  html[dir="rtl"] .jia-hero__title {
    font-size: clamp(1.8rem, 6.5vw, 2.1rem);
    line-height: 1.32;
  }
  .jia-mask-title {
    font-size: clamp(1.875rem, 6vw, 2.125rem);
  }
  html[lang^="ar"] .jia-mask-title,
  html[dir="rtl"] .jia-mask-title {
    font-size: clamp(1.75rem, 5.5vw, 2rem);
  }
  .jia-hero__actions,
  .jia-cta-band__actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .jia-hero__actions .jia-btn,
  .jia-cta-band__actions .jia-btn {
    width: 100%;
    justify-content: center;
  }
  .jia-people,
  .jia-people--full,
  .jia-advisers-grid,
  .jia-work--home,
  .jia-cap-list--compact,
  .jia-method-rail,
  .jia-process--narrative,
  .jia-child-index,
  .jia-offer-grid {
    grid-template-columns: 1fr;
  }
  .jia-practice-row {
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
    padding-block: 18px;
  }
  .jia-practice-row .jia-media--thumb,
  .jia-practice-row__go {
    display: none;
  }
  .page-template-template-home #practices .jia-practice-row,
  .page-template-template-home #practices .jia-practice-row.has-media,
  .page-template-template-home #practices .jia-practice-row:nth-child(n+4).has-media {
    grid-template-columns: 32px minmax(0, 1fr);
  }
  .page-template-template-home #practices .jia-practice-row.has-media .jia-media--thumb,
  .page-template-template-home #practices .jia-practice-row__go {
    display: none;
  }
  .jia-adviser-hero__portrait {
    max-width: 220px;
    margin-inline: auto;
  }
  .jia-adviser-hero--split {
    text-align: center;
  }
  [dir="rtl"] .jia-adviser-hero--split {
    text-align: center;
  }
  .jia-adviser-hero__copy {
    text-align: start;
  }
  .jia-person__media,
  .jia-adviser-hero .jia-person__media {
    width: min(160px, 42vw);
    margin-inline: auto;
  }
  .jia-footer__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .jia-contact-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .jia-mega {
    display: none !important;
  }
  body {
    font-size: 16px;
  }
  .jia-btn {
    font-size: 15px;
    padding: 14px 20px;
    min-height: 48px;
  }
}

/* —— Small mobile (320–380) —— */
@media (max-width: 380px) {
  .jia-wrap {
    width: calc(100% - 32px);
  }
  .jia-logo img.jia-logo__mark,
  .jia-logo__mark {
    height: 48px !important;
    max-width: 132px;
  }
  .jia-header__bar {
    min-height: 72px;
    gap: 8px;
  }
  .jia-hero__title,
  .jia-page-hero h1 {
    font-size: clamp(1.7rem, 7.5vw, 1.95rem);
    letter-spacing: -0.02em;
    line-height: 1.16;
  }
  html[lang^="ar"] .jia-hero__title,
  html[dir="rtl"] .jia-hero__title {
    font-size: clamp(1.55rem, 7vw, 1.8rem);
    line-height: 1.34;
  }
  .jia-mask-title {
    font-size: clamp(1.75rem, 6.5vw, 1.95rem);
  }
  .jia-kicker {
    font-size: 12px;
    letter-spacing: 0.1em;
  }
  .jia-cap-list--compact,
  .jia-glance {
    grid-template-columns: 1fr;
  }
}

/* —— RTL responsive polish —— */
@media (max-width: 900px) {
  [dir="rtl"] .jia-practice-row__go,
  [dir="rtl"] .jia-btn--arrow span {
    transform: scaleX(-1);
  }
  [dir="rtl"] .jia-hero__meta,
  [dir="rtl"] .jia-breadcrumbs {
    justify-content: flex-start;
  }
}

/* —— Prefer reduced motion already handled; keep production print sane —— */
@media print {
  .jia-header,
  .jia-mobile,
  .jia-menu-btn,
  .jia-cta-band {
    break-inside: avoid;
  }
  .jia-hero--photo,
  .jia-svc-hero--photo {
    min-height: 0;
    padding: 24px 0;
    background-image: none !important;
    color: #000;
  }
}
