/* ==========================================================================
   Tablet and Small Laptop Navigation
   Below 1280px the dense desktop IA becomes a full-screen mobile menu while
   preserving the same logical service groupings.
   ========================================================================== */

@media (max-width: 1279px) {
  :root {
    --section: 90px;
  }

  .desktop-nav {
    display: none;
  }

  .header__inner {
    justify-content: space-between;
  }

  .site-header {
    color: var(--white);
  }

  .menu-toggle {
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(8, 28, 46, 0.12);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(8, 28, 46, 0.10);
    transition: background 180ms ease, box-shadow 180ms ease;
  }

  .menu-toggle:hover {
    background: rgba(190, 30, 45, 0.08);
    box-shadow: none;
  }

  .menu-toggle:focus-visible {
    outline: 3px solid rgba(190, 30, 45, 0.25);
    outline-offset: 2px;
  }

  .site-header.is-scrolled .menu-toggle,
  body.menu-open .menu-toggle {
    background: rgba(8, 28, 46, 0.05);
    box-shadow: none;
  }

  .site-header.is-scrolled .menu-toggle:hover,
  body.menu-open .menu-toggle:hover {
    background: rgba(190, 30, 45, 0.08);
  }

  .mobile-menu {
    position: fixed;
    inset: 84px 0 0;
    z-index: 200;
    display: block;
    overflow: auto;
    background: rgba(255, 255, 255, 0.98);
    color: var(--text);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  }

  body.menu-open .mobile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .mobile-menu__inner {
    display: grid;
    width: min(calc(100% - 48px), 720px);
    margin-inline: auto;
    padding-block: 30px 52px;
    gap: 12px;
  }


  .mobile-menu a,
  .mobile-menu summary {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--white);
    padding: 15px 18px;
    color: var(--text);
    cursor: pointer;
    font-weight: 800;
    list-style: none;
    text-align: right;
  }

  .mobile-menu summary::-webkit-details-marker {
    display: none;
  }

  .mobile-menu summary::after {
    content: "+";
    float: left;
    color: var(--red);
    font-size: 1.25rem;
    line-height: 1;
  }

  .mobile-menu details[open] summary::after {
    content: "-";
  }

  .mobile-menu details a {
    display: block;
    margin-top: 8px;
    margin-inline-start: 18px;
    border-color: transparent;
    background: var(--soft);
    color: var(--navy);
    font-weight: 650;
  }

  .mobile-menu .btn {
    margin-top: 8px;
    border-bottom: 0;
    text-align: center;
  }


  .card-grid--four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .link-panel-grid,
  .card-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer__top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-shell {
    grid-template-columns: 1fr;
  }

  .toc-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  .toc-panel strong {
    grid-column: 1 / -1;
  }

  .editorial-block,
  .info-grid,
  .info-grid--asymmetric,
  .service-list,
  .service-list--compact,
  .steps--light {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editorial-block--work > .image-slot {
    order: 0;
  }
}

/* ==========================================================================
   Tablet Layout Adjustments
   Collapse major editorial and form layouts before the mobile breakpoint so
   content remains readable on iPad-sized screens.
   ========================================================================== */

@media (max-width: 1023px) {
  .section-heading--split,
  .two-column,
  .two-column--balanced,
  .cta-band__inner,
  .form-layout,
  .form-layout--wide,
  .consultation-types {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .form-note--sticky {
    position: static;
  }

  .compare-grid,
  .checklist-grid,
  .inline-cta {
    grid-template-columns: 1fr;
  }

  .hero,
  .hero__content {
    min-height: 720px;
  }

  .hero__media--image img {
    object-position: center right;
  }

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

  .trust-bar__inner div:nth-child(3) {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }

  .trust-bar__inner div:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .image-slot--portrait {
    min-height: 430px;
  }
}

/* ==========================================================================
   Mobile Layout
   Tightens spacing, stacks cards/forms/TOC panels, and keeps touch targets large
   enough for Persian RTL mobile browsing.
   ========================================================================== */

@media (max-width: 767px) {
  :root {
    --section: 60px;
  }

  .container {
    width: min(calc(100% - 32px), var(--container));
  }

  h1 {
    font-size: clamp(2.15rem, 13vw, 3.5rem);
  }

  h2 {
    font-size: clamp(1.55rem, 8vw, 2.3rem);
  }

  .site-header .btn--small,
  .language-switch {
    display: none;
  }

  .brand {
    min-width: 0;
  }

  .brand__logo-wrap {
    inline-size: 185px;
    block-size: 62px;
  }

  .hero,
  .hero__content {
    min-height: 700px;
  }

  .hero__media--image img {
    object-position: 62% center;
  }

  .page-hero {
    padding-block: 128px 54px;
  }

  .hero__content {
    padding-top: 116px;
    padding-bottom: 52px;
  }

  .hero__lead {
    font-size: 1.08rem;
  }

  .hero__proof {
    gap: 8px;
    margin-top: 30px;
  }

  .hero__proof span {
    width: 100%;
    border-radius: 12px;
  }

  .hero__actions,
  .cta-band__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }

  .trust-bar {
    margin-top: 0;
  }

  .trust-bar__inner,
  .card-grid--four,
  .card-grid--three,
  .link-panel-grid,
  .steps,
  .footer__top,
  .form-grid,
  .contact-card-grid,
    .toc-panel,
    .editorial-block,
    .info-grid,
    .info-grid--asymmetric,
    .service-list,
    .service-list--compact,
    .steps--light {
      grid-template-columns: 1fr;
    }

  .editorial-block--visitor > div:first-child,
  .editorial-block--immigration > div:first-child,
  .editorial-block--legal > div:first-child,
  .editorial-block--business > div:first-child {
    border-inline-start: 0;
    padding-inline-start: 0;
  }

  .content-main {
    gap: 60px;
  }

  .content-section > :is(
    .editorial-block,
    .compare-grid,
    .info-grid,
    .checklist-grid,
    .service-list,
    .document-table,
    .steps--light,
    .related-links,
    .faq-list,
    .inline-cta,
    .note-card,
    .quote-panel
  ) {
    margin-block-start: 20px;
  }

  .content-section > :is(
    .editorial-block,
    .compare-grid,
    .info-grid,
    .checklist-grid,
    .service-list,
    .document-table,
    .steps--light,
    .related-links,
    .faq-list,
    .inline-cta,
    .note-card,
    .quote-panel
  ) + :is(
    .editorial-block,
    .compare-grid,
    .info-grid,
    .checklist-grid,
    .service-list,
    .document-table,
    .steps--light,
    .related-links,
    .faq-list,
    .inline-cta,
    .note-card,
    .quote-panel,
    p
  ) {
    margin-block-start: 28px;
  }

  .document-table > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .form-card,
  .form-note {
    padding: 22px;
  }

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

  .trust-bar__inner div {
    padding: 22px;
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }

  .trust-bar__inner div:first-child {
    border-top: 0;
  }

  .link-panel,
  .steps article {
    min-height: auto;
  }

  .credential-card {
    position: static;
    margin-top: -72px;
    margin-inline: 16px;
  }

  .image-slot--wide,
  .image-slot--portrait {
    min-height: 320px;
  }

  .footer__strip .container,
  .footer__bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ==========================================================================
   Desktop Fit Guard
   1280-1370px is the tightest desktop range for the full navigation. These
   small adjustments prevent wrapping without changing the header architecture.
   ========================================================================== */

@media (min-width: 1280px) and (max-width: 1370px) {
  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .brand {
    min-width: 230px;
  }

  .brand__logo-wrap {
    inline-size: 230px;
    block-size: 62px;
  }

  .desktop-nav a,
  .desktop-nav button {
    padding-inline: 8px;
    font-size: 0.82rem;
  }

  .header__actions {
    gap: 8px;
  }

  .btn--small {
    padding-inline: 14px;
    font-size: 0.84rem;
  }
}
