/**
 * mobile.css
 * ──────────
 * Mobile & tablet responsiveness ONLY.
 * Loaded after responsive.css — does not change desktop (901px+).
 *
 * Breakpoints:
 *   ≤900px   hamburger menu + backdrop
 *   ≤768px   phones (320px–768px)
 *   769–900px tablets
 */

/* ══════════════════════════════════════
   HAMBURGER NAV (≤900px — phones + tablets)
   ══════════════════════════════════════ */

@media (max-width: 900px) {
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
  }

  .nav-toggle {
    z-index: 1004;
  }

  .nav-menu {
    z-index: 1003;
    width: min(320px, 88vw);
    inset: var(--nav-height) 0 0 auto;
    left: auto;
    right: 0;
    padding: 28px 24px 32px;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08);
  }

  html[dir="rtl"] .nav-menu {
    inset: var(--nav-height) auto 0 0;
    left: 0;
    right: auto;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.08);
  }

  .nav-menu .nav-links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .nav-menu .btn-primary {
    min-height: 48px;
  }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(17, 17, 17, 0.35);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease), visibility 0.35s;
    -webkit-tap-highlight-color: transparent;
  }

  .nav-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
  }
}

/* ══════════════════════════════════════
   PHONES (≤768px)
   ══════════════════════════════════════ */

@media (max-width: 768px) {
  :root {
    --nav-height: 64px;
    --section-gap: clamp(48px, 11vw, 72px);
  }

  /* ── Global: no horizontal scroll, safe text ── */
  html {
    overflow-x: hidden;
  }

  body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
  }

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

  img,
  video,
  svg {
    max-width: 100%;
    height: auto;
  }

  .section-title {
    font-size: clamp(1.65rem, 7vw, 2.25rem);
    overflow-wrap: anywhere;
  }

  .section-subtitle {
    font-size: 16px;
    margin-top: 14px;
  }

  .section-header {
    margin-bottom: clamp(32px, 8vw, 48px);
  }

  .site-header.is-scrolled,
  .site-header {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
  }

  .nav-logo img {
    width: 36px;
    height: 36px;
  }

  .nav-logo span {
    font-size: 14px;
  }

  .nav-toggle {
    display: flex;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }

  .nav-menu .nav-links a {
    font-size: 18px;
    padding-block: 4px;
  }

  .nav-menu .btn-primary {
    margin-top: 8px;
  }

  /* ── Hero ── */
  .hero {
    min-height: auto;
    padding: calc(var(--nav-height) + 12px) 0 40px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .hero-visual {
    order: -1;
    padding-inline: 0;
  }

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero-badge {
    margin-bottom: 16px;
    padding: 8px 14px;
    font-size: 12px;
  }

  .hero-title {
    font-size: clamp(1.75rem, 8.5vw, 2.35rem);
    margin-bottom: 16px;
    line-height: 1.12;
  }

  .hero-text {
    max-width: 100%;
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.75;
  }

  .hero-content .btn-group {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .hero-content .btn-group .btn {
    width: 100%;
    min-height: 48px;
  }

  .hero-tech {
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
  }

  .hero-tech__item {
    min-width: 56px;
  }

  .hero-tech__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
  }

  .hero-macbook {
    max-width: min(100%, 420px);
    transform: none;
  }

  .hero-macbook img {
    object-fit: contain;
    width: 100%;
    height: auto;
  }

  .hero-macbook__float {
    animation-duration: 9s;
  }

  .hero-macbook__shadow {
    height: 36px;
    filter: blur(14px);
  }

  /* ── Trust bar ── */
  .trust-bar {
    padding: 32px 0 40px;
  }

  .trust-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .trust-item {
    padding: 20px 12px;
  }

  .trust-item__value {
    font-size: clamp(1.5rem, 6vw, 1.85rem);
  }

  /* ── Projects ── */
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .project-card__body {
    padding: 24px 20px;
  }

  .project-card__title {
    font-size: 20px;
  }

  .project-card__desc {
    font-size: 14px;
  }

  .project-card__actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .project-card__actions .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .project-card__image img {
    object-fit: cover;
  }

  /* ── Services ── */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    min-height: 100%;
  }

  .service-card__icon {
    margin-inline: auto;
    margin-bottom: 16px;
  }

  .service-card__title {
    font-size: 19px;
  }

  .service-card__desc {
    font-size: 14px;
  }

  /* ── Why ── */
  .why-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .why-card {
    padding: 28px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .why-card__icon {
    margin-inline: auto;
  }

  /* ── About ── */
  .about-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .about-content {
    text-align: center;
  }

  .about-content p {
    font-size: 16px;
    margin-top: 16px;
  }

  .about-visual {
    order: -1;
  }

  .about-image {
    max-width: 280px;
    margin-inline: auto;
  }

  /* ── CTA ── */
  .cta-section {
    padding: clamp(48px, 10vw, 64px) 0;
  }

  .cta-section .btn-group {
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    margin-inline: auto;
  }

  .cta-section .btn-group .btn {
    width: 100%;
    min-height: 48px;
  }

  /* ── Footer ── */
  .site-footer {
    padding: 56px 0 32px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-bottom: 40px;
    text-align: center;
  }

  .footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-brand p {
    max-width: 100%;
    margin-inline: auto;
  }

  .footer-col ul {
    gap: 10px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .footer-socials {
    justify-content: center;
  }

  .footer-socials a {
    width: 48px;
    height: 48px;
  }

  /* ── Buttons (global touch targets) ── */
  .btn {
    min-height: 48px;
  }

  .btn-sm {
    min-height: 44px;
    padding: 12px 20px;
  }

  .btn-group {
    gap: 12px;
  }

  /* ── Case study pages ── */
  .case-hero {
    padding: calc(var(--nav-height) + 24px) 0 48px;
  }

  .case-hero__image {
    aspect-ratio: 16 / 10;
    margin-bottom: 32px;
    border-radius: var(--radius-lg);
  }

  .case-hero__image img {
    object-fit: cover;
    width: 100%;
    height: 100%;
  }

  .case-meta {
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
  }

  .case-hero .section-title {
    font-size: clamp(1.65rem, 7vw, 2.1rem);
  }

  .case-hero .btn-group {
    flex-direction: column;
    width: 100%;
  }

  .case-hero .btn-group .btn {
    width: 100%;
    min-height: 48px;
  }

  .case-block {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 40px 0;
  }

  .case-block__content p,
  .case-block__content li {
    font-size: 15px;
  }

  .case-cta {
    padding: 56px 0;
  }

  .case-cta .btn-group {
    flex-direction: column;
    width: 100%;
    max-width: 400px;
    margin-inline: auto;
  }

  .case-cta .btn-group .btn {
    width: 100%;
    min-height: 48px;
  }

  /* Device showcase: phone under desktop, no overlap */
  .screenshots-section {
    padding: clamp(56px, 12vw, 80px) 0;
  }

  .device-showcase__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    min-height: auto;
    padding: 16px 0;
    perspective: none;
  }

  .device-mockup--desktop {
    order: 1;
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
  }

  .device-mockup--phone {
    position: relative;
    inset: auto;
    order: 2;
    width: min(168px, 46vw);
    transform: rotate(-3deg);
    animation: none;
  }

  .device-mockup--phone:hover {
    transform: rotate(-2deg);
  }

  .device-mockup--desktop:hover .device-imac {
    transform: none;
  }

  .device-imac {
    transform: none;
  }

  .device-imac__screen img,
  .device-phone__screen img {
    object-fit: cover;
  }

  /* ── Softer animations on mobile ── */
  .reveal {
    transform: translateY(20px);
  }

  .card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }

  .project-card:hover .project-card__image img {
    transform: none;
  }

  .hero-tech__item:hover .hero-tech__icon {
    transform: none;
  }

  .btn-primary:hover,
  .btn-secondary:hover {
    transform: none;
  }
}

/* Very small phones (iPhone SE) */
@media (max-width: 375px) {
  .trust-grid {
    grid-template-columns: 1fr;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .hero-macbook {
    max-width: 100%;
  }

  .device-mockup--phone {
    width: min(150px, 44vw);
  }
}

/* ══════════════════════════════════════
   TABLETS (769px – 900px)
   ══════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 900px) {
  :root {
    --nav-height: 72px;
  }

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

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

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

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

  .hero-macbook {
    max-width: min(560px, 100%);
  }

  /* Case study: reduced device overlap on tablet */
  .device-mockup--phone {
    width: clamp(130px, 18vw, 170px);
  }

  .device-mockup--desktop {
    margin-inline-start: clamp(40px, 8vw, 90px);
  }
}

/* Touch devices: disable hover lift */
@media (hover: none) and (pointer: coarse) {
  .card:hover {
    transform: none;
  }
}
