/* ==========================================================================
   Dsquare Studio — Master Responsive Stylesheet
   Mobile-First & Desktop-Aligned Fluid Hierarchy
   Zero horizontal overflow, flexible containers, accessible interactions
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Laptop & Large Desktop (<= 1280px)
   -------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .hero-top {
    gap: 48px;
  }
  .about-wrap {
    gap: 44px;
  }
}

/* --------------------------------------------------------------------------
   2. Standard Laptop & Tablet Landscape (<= 1100px)
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .section {
    padding: 64px 0;
  }
  .hero {
    padding-bottom: 54px;
  }
  .h1, h1.hero-headline {
    font-size: 50px;
    line-height: 1.08;
  }
  .h2 {
    font-size: 42px;
  }

  /* Services: 2 columns */
  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
  }
  .service-card {
    grid-column: auto !important;
    margin-top: 0 !important;
    border: none !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .service-card:nth-child(5) {
    grid-column: 1 / -1 !important;
  }

  /* Work: 2 columns */
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }
  .work-card:nth-child(7) {
    grid-column: auto;
  }

  /* Process: 2 columns */
  .process-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
  }

  /* Testimonials: 1 card per slide on tablet/mobile for maximum clarity */
  .testimonial-slide {
    grid-template-columns: 1fr;
  }
  .testimonial {
    min-height: auto;
  }

  .trust-logos {
    gap: 36px;
  }
}

/* --------------------------------------------------------------------------
   3. Small Laptop / iPad Landscape (<= 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .nav-group {
    gap: 20px;
  }
  .main-nav {
    gap: 20px;
    font-size: 15px;
  }
  .desktop-cta .btn-primary {
    padding: 0 20px;
    font-size: 13px;
    height: 40px;
  }
  .hero-top {
    gap: 40px;
  }
  .about-wrap {
    gap: 36px;
  }
  .about-heading {
    font-size: 36px;
  }
}

/* --------------------------------------------------------------------------
   4. Tablet Portrait Switch (<= 900px)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .section {
    padding: 56px 0;
  }
  .hero {
    padding-bottom: 44px;
  }

  /* About section: remains stable 2 columns on tablet */
  .about {
    padding: 56px 0;
  }
  .about-wrap {
    gap: 28px;
    min-height: auto;
    padding: 0 var(--gutter-tablet);
  }
  .about-content {
    padding: 0;
  }
  .about-image-frame {
    min-height: 280px;
    border-radius: 4px;
  }
  .about-heading {
    font-size: clamp(23px, 3vw, 28px);
    line-height: 1.16;
  }
  .about-desc {
    font-size: 15px;
    margin-bottom: 18px;
  }
  .about-card-row {
    padding: 15px 18px;
    gap: 14px;
  }
  .about-card-icon {
    width: 28px;
    height: 28px;
  }
  .about-card-icon svg {
    width: 24px;
    height: 24px;
  }
  .about-card-title {
    font-size: 18px;
  }
  .about-card-desc {
    font-size: 14px;
  }

  /* Footer at tablet */
  .footer-top {
    flex-direction: column;
    gap: 34px;
  }
  .footer-cta,
  .footer-links {
    max-width: 100%;
    width: 100%;
  }

  /* Modal at tablet */
  .modal-inner {
    grid-template-columns: 1fr;
  }
  .contact-form-wrap {
    padding: 32px 24px;
  }

  /* Case study pages at tablet */
  .case-hero {
    padding-top: 64px;
  }
  .wrap-case {
    padding: 0 28px;
  }
  .case-title {
    font-size: 40px;
  }
  .case-meta {
    grid-template-columns: 1fr;
    gap: 28px 0;
  }
  .brand-row {
    flex-direction: column;
    gap: 36px;
  }
  .brand-col,
  .brand-col.narrow {
    max-width: 100%;
    width: 100%;
    flex: none;
  }
  .two-col-frames {
    gap: 32px;
  }
  .two-col-frames .frame-img {
    flex: 1 1 100%;
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   5. Mobile Navigation & Header Switch (<= 860px)
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  /* Header navigation switch */
  .main-nav {
    display: none !important;
  }
  .desktop-cta {
    display: none !important;
  }
  .menu-toggle {
    display: flex !important;
  }

  .site-header-wrap,
  .case-header {
    padding: 0;
  }

  .site-header,
  .site-header.bordered > .wrap-inner {
    position: relative;
    padding: 14px var(--gutter-tablet);
  }

  body.scrolled .site-header,
  body.scrolled .case-header .site-header.bordered {
    padding: 12px var(--gutter-tablet);
  }

  /* Full-width slide drawer mobile navigation */
  .mobile-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(250, 249, 246, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(20, 20, 20, 0.08);
    border-bottom: 1px solid rgba(20, 20, 20, 0.08);
    box-shadow: 0 20px 40px rgba(20, 20, 20, 0.12);
    padding: 24px var(--gutter-tablet) 28px;
    flex-direction: column;
    gap: 16px;
    z-index: 1000;
  }

  .mobile-nav.open {
    display: flex !important;
  }

  .mobile-nav a:not(.btn) {
    font-family: var(--font-body);
    font-size: 18px;
    font-weight: 500;
    color: var(--charcoal);
    padding: 8px 0;
    transition: color .2s ease;
    text-decoration: none;
    display: block;
  }

  .mobile-nav a:not(.btn):hover,
  .mobile-nav a:not(.btn).active {
    color: var(--red);
    font-weight: 600;
  }

  .mobile-nav .btn {
    width: 100%;
    margin-top: 10px;
    border-radius: 100px;
    height: 48px;
    font-size: 14px;
    color: var(--white) !important;
    background: var(--charcoal) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
  }

  .mobile-nav .btn:hover {
    background: var(--red) !important;
    color: var(--white) !important;
  }

  /* Hero: stacked layout */
  .hero-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 32px;
  }
  .hero-copy {
    width: 100%;
    gap: 24px;
  }
  .hero-media {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    order: 0;
  }
  .h1, h1.hero-headline {
    font-size: 40px;
    line-height: 1.1;
  }
  .h2 {
    font-size: 34px;
  }
  .h3 {
    font-size: 28px;
  }
}

/* --------------------------------------------------------------------------
   6. Phablet & Mobile Breakpoint (<= 680px)
   -------------------------------------------------------------------------- */
@media (max-width: 680px) {
  .section {
    padding: 46px 0;
  }
  .section-head {
    margin-bottom: 26px;
  }

  /* Services: single column */
  .services-grid {
    grid-template-columns: 1fr;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
  }
  .service-card {
    grid-column: auto !important;
    margin-top: 0 !important;
    border: none !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 24px 20px;
    gap: 20px;
  }
  .service-icon {
    width: 46px;
    height: 46px;
  }
  .service-card h4 {
    font-size: 22px;
  }
  .service-card .desc {
    font-size: 15px;
    margin-top: 8px;
  }

  /* Work: single column */
  .work-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .work-card {
    aspect-ratio: 16 / 11;
  }

  /* Process: single column */
  .process-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .process-step {
    padding: 18px 0;
    gap: 14px;
  }
  .process-icon-row .line {
    display: none;
  }

  /* About section: naturally reflows to 1 column on mobile */
  .about {
    padding: 44px 0;
  }
  .about-wrap {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 24px;
    padding: 0 var(--gutter-mobile);
    min-height: auto;
  }
  .about-media {
    width: 100%;
    height: auto;
    max-width: 100%;
  }
  .about-image-frame {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 10;
    max-height: 320px;
    border-radius: 4px;
  }
  .about-content {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  .about-heading {
    font-size: 30px;
    line-height: 1.18;
    margin-bottom: 14px;
  }
  .about-desc {
    font-size: 15.5px;
    margin-bottom: 18px;
    max-width: 100%;
  }
  .about-cards-box {
    max-width: 100%;
  }
  .about-card-row {
    padding: 16px 18px;
    gap: 16px;
  }
  .about-card-icon {
    width: 30px;
    height: 30px;
  }
  .about-card-icon svg {
    width: 26px;
    height: 26px;
  }
  .about-card-title {
    font-size: 19px;
  }
  .about-card-desc {
    font-size: 14.5px;
  }

  /* Testimonials: mobile styling */
  .testimonial {
    padding: 22px 18px;
    gap: 16px;
    flex-direction: column;
  }
  .testimonial .quote-mark {
    width: 28px;
  }
  .testimonial .h4 {
    font-size: 20px;
    line-height: 1.35;
  }
  .carousel-nav {
    gap: 14px;
    margin-top: 24px;
  }

  /* Footer: single column layout */
  .footer {
    padding: 42px 0 22px;
  }
  .footer-wrap {
    padding: 0 var(--gutter-mobile);
  }
  .footer-top {
    gap: 28px;
  }
  .footer-heading {
    font-size: 32px;
    line-height: 1.15;
    margin-bottom: 14px;
  }
  .footer-desc {
    font-size: 16px;
    margin-bottom: 16px;
  }
  .footer-links {
    grid-template-columns: 1fr;
    gap: 22px;
    max-width: 100%;
    width: 100%;
  }
  .footer-col {
    padding: 0;
    width: 100%;
  }
  .footer-col + .footer-col {
    border-left: none;
    border-top: 1px solid rgba(20, 20, 20, 0.08);
    padding-top: 18px;
  }
  .footer-col-title {
    font-size: 20px;
    margin-bottom: 12px;
  }
  .footer-col ul {
    gap: 10px;
  }
  .footer-divider {
    margin: 26px 0 18px;
  }
  .footer-bottom-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* --------------------------------------------------------------------------
   7. Mobile Phones (<= 600px)
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  /* Gutter adjustment */
  .wrap,
  .hero-inner,
  .site-header,
  .site-header.bordered > .wrap-inner,
  .about-wrap,
  .mobile-nav {
    padding-left: var(--gutter-mobile);
    padding-right: var(--gutter-mobile);
  }

  .hero-inner {
    padding-top: 16px;
    gap: 20px;
  }
  .hero {
    padding-bottom: 36px;
  }

  .logo img {
    height: 42px;
  }

  .h1, h1.hero-headline {
    font-size: 32px;
    line-height: 1.12;
  }
  .h2 {
    font-size: 26px;
    line-height: 1.15;
  }
  .h3 {
    font-size: 22px;
  }
  .h4 {
    font-size: 20px;
  }
  .body-lg {
    font-size: 17px;
  }

  /* Trust logos */
  .trust-rule .line {
    max-width: 36px;
  }
  .trust-rule span {
    font-size: 11px;
    letter-spacing: 2px;
  }
  .trust-logos {
    gap: 16px;
  }
  .trust-logo-link {
    width: 110px;
    height: 38px;
  }

  /* Contact Modal: mobile safe */
  .contact-modal {
    padding: 32px 20px 24px;
    max-width: calc(100vw - 32px);
    max-height: 92vh;
    scrollbar-width: thin;
  }
  .modal-heading {
    font-size: 24px;
  }
  .form-row,
  .contact-modal .form-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .contact-submit {
    height: 48px;
    font-size: 14px;
  }
  .contact-modal.is-success {
    min-height: auto;
    max-height: 92vh;
    padding: 36px 20px;
  }

  /* Case study pages at mobile */
  .wrap-case {
    padding: 0 18px;
  }
  .case-title {
    font-size: 30px;
  }
  .brand-pair {
    grid-template-columns: 1fr;
    flex-direction: column;
    gap: 16px;
  }
  .brand-pair img {
    width: 100%;
  }
  .case-pagination {
    flex-direction: column;
    gap: 12px;
    padding: 32px 0;
  }
  .btn-pag {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .mobile-phones-row {
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }
  .phone-screen {
    max-width: 280px;
  }
}

/* --------------------------------------------------------------------------
   8. Small Mobile Screens (<= 430px)
   -------------------------------------------------------------------------- */
@media (max-width: 430px) {
  .hero-copy .btn-row {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }
  .hero-copy .btn-row .btn {
    width: 100%;
    height: 48px;
    font-size: 14px;
  }

  .h1, h1.hero-headline {
    font-size: 28px;
  }
  .h2 {
    font-size: 24px;
  }
  .about-heading {
    font-size: 24px;
    line-height: 1.2;
  }
  .footer-heading {
    font-size: 25px;
    line-height: 1.18;
  }

  .about-card-row {
    padding: 14px 14px;
    gap: 14px;
  }
  .about-card-icon {
    width: 26px;
    height: 26px;
  }
  .about-card-icon svg {
    width: 22px;
    height: 22px;
  }
  .about-card-title {
    font-size: 17px;
  }
  .about-card-desc {
    font-size: 13.5px;
  }

  .footer-tagline {
    font-size: 11px;
    letter-spacing: 0.12em;
  }

  .btn {
    height: 46px;
    padding: 0 20px;
    font-size: 14px;
  }
}

/* --------------------------------------------------------------------------
   9. Ultra-compact Screens (<= 360px)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  :root {
    --gutter-mobile: 16px;
  }
  .h1, h1.hero-headline {
    font-size: 26px;
  }
  .h2 {
    font-size: 22px;
  }
  .about-heading {
    font-size: 22px;
  }
  .footer-heading {
    font-size: 23px;
  }
  .trust-logo-link {
    width: 95px;
    height: 34px;
  }
  .service-card {
    padding: 20px 16px;
  }
}
