/* ── Mobile & tablet nav overlay (below lg breakpoint) ── */
@media (max-width: 1023px) {
  #mobile-menu {
    position: fixed;
    top: 4rem;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: none !important;
    background: rgba(8, 28, 48, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 40;
    overflow-y: auto;
    padding-bottom: 2rem;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.35s,
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  #mobile-menu.menu-open {
    max-height: none !important;
    opacity: 1 !important;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  #mobile-menu .max-w-7xl {
    padding: 1.25rem 1rem 2rem;
  }

  #navbar.scrolled #mobile-menu,
  #navbar.navbar-glass #mobile-menu {
    background: rgba(8, 28, 48, 0.98);
  }

  #navbar.scrolled .mobile-menu-glass {
    background: transparent;
    border-top-color: rgba(255, 255, 255, 0.08);
  }

  .mobile-menu-label {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.35);
    padding: 0 0.25rem 0.75rem;
    margin-bottom: 0.25rem;
  }

  #mobile-menu .mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.125rem;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92) !important;
    border-radius: 0.75rem;
    margin-bottom: 0.25rem;
    min-height: 3rem;
    background: transparent;
  }

  #mobile-menu .mobile-nav-link:hover,
  #mobile-menu .mobile-nav-link:active {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
  }

  #mobile-menu .pt-4 {
    padding-top: 1.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  #mobile-menu .btn-primary,
  #mobile-menu .btn-secondary {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    min-height: 3rem;
    border-radius: 0.75rem;
  }

  #mobile-menu .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
  }

  #mobile-menu .btn-primary {
    background: white;
    color: #00385b;
  }
}

/* ── Phone layout (max-width: 767px) ── */
@media (max-width: 767px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  #navbar nav {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  #navbar .nav-menu-btn {
    color: white;
  }

  #navbar.scrolled .nav-menu-btn {
    color: #00385b;
  }

  /* ── Hero: unified glass card ── */
  #hero {
    min-height: 100svh;
    display: block;
    padding-bottom: 3.5rem;
  }

  #hero > .relative.max-w-7xl {
    padding-top: 5.25rem;
    padding-bottom: 1.5rem;
  }

  #hero .grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 1.125rem;
    overflow: hidden;
    box-shadow:
      0 16px 48px rgba(0, 0, 0, 0.22),
      0 0 0 1px rgba(255, 255, 255, 0.08);
  }

  .hero-glass {
    border-radius: 0;
  }

  .hero-panel-left {
    border-radius: 0;
    animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
  }

  .hero-panel-right {
    border-radius: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    animation: heroFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
  }

  .hero-glass-inner {
    padding: 1.375rem !important;
  }

  .hero-title {
    font-size: 1.75rem !important;
    line-height: 1.12 !important;
  }

  .hero-line-accent {
    margin-top: 0.125rem;
    display: block;
  }

  .hero-item-5,
  .hero-cta {
    display: flex;
    flex-direction: column;
    gap: 0.625rem !important;
    width: 100%;
  }

  .hero-btn,
  .btn-hero-primary,
  .btn-hero-glass {
    width: 100%;
    justify-content: center;
    padding: 0.875rem 1.25rem !important;
    font-size: 0.9375rem !important;
    min-height: 3rem;
  }

  .hero-metrics {
    gap: 0.5rem;
    grid-template-columns: 1fr 1fr;
  }

  .hero-metric {
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 0.625rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .hero-metric-value {
    font-size: 1.375rem;
  }

  .hero-metric-label {
    font-size: 0.5625rem;
  }

  .hero-scroll-hint {
    bottom: 0.75rem;
  }

  .hero-glow-1,
  .hero-glow-2 {
    opacity: 0.45;
    transform: scale(0.65);
  }

  /* ── Section layout ── */
  .section-padding {
    padding-top: 3.25rem;
    padding-bottom: 3.25rem;
  }

  .section-padding-sm {
    padding-top: 2.75rem;
    padding-bottom: 2.75rem;
  }

  .mobile-section-head {
    text-align: center;
    margin-bottom: 2rem !important;
  }

  .mobile-section-head .section-label {
    margin-left: auto;
    margin-right: auto;
  }

  .mobile-section-head .section-title {
    max-width: 18rem;
    margin-left: auto;
    margin-right: auto;
  }

  .mobile-section-head .section-subtitle {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    max-width: 20rem;
  }

  #solutions.section-mesh {
    background:
      linear-gradient(180deg, #f8fafc 0%, #eef4f9 50%, #f8fafc 100%);
  }

  #services.section-services {
    background: white;
  }

  .services-header,
  .services-header-text {
    text-align: center;
  }

  .services-header .section-subtitle {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }

  .services-header-accent {
    display: none;
  }

  .section-title {
    font-size: 1.5625rem;
    line-height: 1.2;
  }

  /* ── Solution cards: vertical app-style ── */
  .compact-grid {
    gap: 1.125rem;
  }

  .compact-card {
    flex-direction: column !important;
    border-radius: 1.125rem;
    box-shadow: 0 4px 24px rgba(0, 56, 91, 0.09);
    transform: none !important;
  }

  .compact-card.glass-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 12px 36px rgba(0, 56, 91, 0.12);
  }

  .compact-thumb {
    width: 100% !important;
    height: 11rem !important;
    min-height: 11rem;
    position: relative;
  }

  .compact-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 56, 91, 0.35) 0%, transparent 50%);
    pointer-events: none;
  }

  .compact-content {
    padding: 1.25rem 1.25rem 1.375rem;
  }

  .compact-head h3 {
    font-size: 1.0625rem;
    line-height: 1.3;
  }

  .compact-content p {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    line-height: 1.6;
  }

  .compact-content .card-link {
    margin-top: 0.875rem;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.625rem 0;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
  }

  .badge-featured {
    font-size: 0.5625rem;
    padding: 0.1875rem 0.5rem;
  }

  /* ── Service cards: vertical stack ── */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .service-row {
    flex-direction: column;
    border-radius: 1.125rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 56, 91, 0.07);
  }

  .service-row-media {
    width: 100%;
    height: 9.5rem;
  }

  .service-row-media img {
    width: 100%;
    height: 100%;
  }

  .service-row-num {
    bottom: 0.75rem;
    left: 0.75rem;
    font-size: 0.6875rem;
    padding: 0.25rem 0.625rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 9999px;
  }

  .service-row-body {
    padding: 1.125rem 1.25rem 1.25rem;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .service-row-text p {
    font-size: 0.8125rem;
    line-height: 1.55;
  }

  .service-row-arrow {
    display: none;
  }

  .service-row-icon {
    width: 2.625rem;
    height: 2.625rem;
  }

  /* ── TadbirSmart ── */
  #tadbirsmart .grid {
    gap: 1.75rem;
    text-align: center;
  }

  #tadbirsmart h2 {
    font-size: 1.4375rem;
    line-height: 1.25;
  }

  #tadbirsmart .feature-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .feature-chip {
    padding: 0.8125rem 0.625rem;
    font-size: 0.6875rem;
    flex-direction: column;
    text-align: center;
    gap: 0.375rem;
    border-radius: 0.625rem;
  }

  .feature-chip svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  #tadbirsmart a {
    width: 100%;
    justify-content: center;
    min-height: 3rem;
    border-radius: 0.75rem;
  }

  /* ── Stats bar: 2×2 grid ── */
  .stats-bar {
    padding: 2.25rem 0;
  }

  .stats-bar-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stats-bar-divider {
    display: none !important;
  }

  .stats-bar-item {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.875rem;
    padding: 1.125rem 0.75rem;
    min-width: 0;
  }

  .stats-bar-num {
    font-size: 1.625rem;
  }

  .stats-bar-label {
    font-size: 0.5625rem;
    line-height: 1.4;
    margin-top: 0.25rem;
  }

  /* ── About ── */
  #about .grid {
    gap: 2rem;
  }

  #about .grid > div:last-child {
    text-align: center;
  }

  #about .section-label {
    margin-left: auto;
    margin-right: auto;
  }

  .about-image {
    aspect-ratio: 16 / 10;
    border-radius: 1.125rem;
    box-shadow: 0 8px 32px rgba(0, 56, 91, 0.1);
  }

  .about-badge {
    right: 1rem;
    bottom: -0.75rem;
    box-shadow: 0 4px 16px rgba(0, 56, 91, 0.12);
  }

  .about-row {
    padding: 1rem 1.125rem;
    background: white;
    border-radius: 0.875rem;
    border: 1px solid #e8edf2;
    box-shadow: 0 2px 12px rgba(0, 56, 91, 0.04);
    text-align: left;
  }

  #about a.inline-flex {
    width: 100%;
    justify-content: center;
    padding: 0.875rem;
    background: #e8f4fc;
    border-radius: 0.75rem;
    margin-top: 1.5rem;
  }

  /* ── Contact ── */
  #contact .mobile-section-head {
    margin-bottom: 0 !important;
  }

  #contact.section-padding {
    padding-top: 2.75rem;
    padding-bottom: 2.75rem;
  }

  #contact .grid {
    gap: 1.25rem;
  }

  #contact .lg\\:col-span-2,
  #contact .lg\\:col-span-3 {
    text-align: center;
  }

  #contact .section-title {
    font-size: 1.4375rem;
  }

  #contact .lg\\:col-span-2 > p {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
  }

  .contact-info-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem !important;
  }

  .contact-info-item {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: linear-gradient(135deg, #f8fafc 0%, #eef4f9 100%);
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    gap: 0.375rem;
  }

  .contact-info-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
  }

  .contact-info-item p:first-child {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .contact-info-item p:last-child {
    font-size: 0.8125rem;
    word-break: break-all;
  }

  .contact-form {
    padding: 1rem;
    border-radius: 1rem;
    margin-top: 0.25rem;
  }

  .contact-form-grid {
    gap: 0.625rem !important;
  }

  .form-group label {
    margin-bottom: 0.1875rem;
    font-size: 0.75rem;
    color: #475569;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.625rem 0.75rem;
    font-size: 0.9375rem;
    min-height: 2.625rem;
    border-radius: 0.5rem;
    background: #fafbfc;
  }

  .form-group textarea {
    min-height: 5.5rem;
    resize: vertical;
  }

  .form-group select {
    background-color: #fafbfc;
  }

  .contact-form-submit {
    margin-top: 0.75rem !important;
    width: 100%;
    min-height: 2.75rem;
    font-size: 0.875rem;
    border-radius: 0.625rem;
  }

  /* ── Footer ── */
  footer {
    background: linear-gradient(180deg, #00385b 0%, #002237 100%);
  }

  footer > div {
    padding-top: 2.5rem;
    padding-bottom: 1.5rem;
  }

  footer .grid {
    grid-template-columns: 1fr !important;
    text-align: center;
    gap: 0 !important;
  }

  footer .grid > div:first-child {
    padding-bottom: 1.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  footer .footer-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem 1rem;
    text-align: left;
    padding-bottom: 1.25rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  footer .footer-nav > div:last-child {
    grid-column: 1 / -1;
  }

  footer .footer-nav h4 {
    font-size: 0.6875rem;
    margin-bottom: 0.625rem;
    letter-spacing: 0.08em;
  }

  footer .footer-nav ul {
    gap: 0.375rem;
  }

  footer .sm\\:col-span-2 {
    grid-column: span 1;
  }

  footer img {
    margin: 0 auto;
    height: 1.75rem;
  }

  footer p.max-w-xs {
    margin-left: auto;
    margin-right: auto;
    font-size: 0.8125rem;
    margin-top: 0.75rem;
    line-height: 1.5;
  }

  footer ul {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    align-items: flex-start;
  }

  footer .footer-nav ul {
    gap: 0.375rem;
  }

  footer .footer-nav ul > * + * {
    margin-top: 0 !important;
  }

  footer .footer-link {
    font-size: 0.8125rem;
    display: block;
    padding: 0.125rem 0;
  }

  footer .footer-bottom {
    margin-top: 0 !important;
    padding-top: 1rem !important;
    text-align: center;
    flex-direction: column;
    gap: 0.25rem;
    border-top: none !important;
  }

  footer .footer-bottom p {
    font-size: 0.75rem;
  }

  /* ── Touch feedback ── */
  .compact-card:active,
  .service-row:active,
  .hero-btn:active,
  .feature-chip:active {
    transform: scale(0.98) !important;
  }

  .reveal-left {
    transform: translateY(24px);
  }

  .reveal-left.visible {
    transform: translateY(0);
  }

  .reveal-scale {
    transform: translateY(16px) scale(0.97);
  }

  .reveal-scale.visible {
    transform: translateY(0) scale(1);
  }
}

/* Small phones */
@media (max-width: 380px) {
  .hero-title {
    font-size: 1.5rem !important;
  }

  .hero-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
  }

  .hero-metric-value {
    font-size: 1.125rem;
  }

  #tadbirsmart .feature-grid {
    grid-template-columns: 1fr;
  }

  .feature-chip {
    flex-direction: row;
    text-align: left;
    justify-content: flex-start;
  }

  .compact-thumb {
    height: 9.5rem !important;
    min-height: 9.5rem;
  }
}

/* Tablet portrait */
@media (min-width: 768px) and (max-width: 1023px) {
  .compact-card {
    flex-direction: row !important;
  }

  .compact-thumb {
    width: 9rem !important;
    height: auto !important;
    min-height: 100%;
  }

  .services-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.875rem;
  }

  .hero-metrics {
    grid-template-columns: 1fr 1fr;
  }

  #hero .grid {
    flex-direction: row;
    gap: 0.875rem;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }

  .hero-panel-left,
  .hero-panel-right {
    border-radius: 1rem;
    flex: 1;
  }

  .hero-panel-right {
    border-top: none;
  }
}
