/*
  Responsive layer. style.css holds the base (wide-screen) design; every
  breakpoint, input-capability and motion-preference override lives here.

  Breakpoints (max-width, widest first so narrower rules win the cascade):
    1024px  tablets / small laptops : hero stacks, 3-col grids become 2-col
     900px  navigation collapses into the drawer, long lists go single column
     640px  phones                  : everything single column, full-width CTAs
     380px  very small phones       : tighter paddings and type
*/

/* ---------- <= 1024px : tablet landscape / small laptop ---------- */
@media (max-width: 1024px) {
  .hero.section {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    justify-items: center;
  }

  .hero-copy {
    width: 100%;
    max-width: 720px;
  }

  .hero-copy h1 {
    max-width: 16ch;
  }

  .hero-visual {
    max-width: 420px;
    margin: 0 auto;
  }

  .hero .hero-photo {
    max-height: 520px;
  }

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

  .feature-grid,
  .project-grid,
  .testimonial-grid,
  .timeline-grid,
  .about-tools-grid,
  .addon-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* three cards in two columns: centre the orphan instead of leaving a hole */
  .project-grid .project-card:last-of-type:nth-of-type(odd),
  .testimonial-grid .testimonial-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    max-width: 36rem;
  }

  .contact-layout,
  .packages-hero-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.6rem 1.45rem;
  }

  .footer-panel + .footer-panel::before {
    display: none;
  }
}

/* ---------- <= 900px : navigation becomes the drawer ---------- */
@media (max-width: 900px) {
  :root {
    --header-height: var(--header-height-mobile);
  }

  .desktop-nav,
  .header-actions {
    display: none;
  }

  /* hamburger on the left, logo on the right (original mobile arrangement) */
  .mobile-toggle {
    display: inline-flex;
    order: 1;
    margin-right: auto;
  }

  .logo-link {
    order: 2;
  }

  .logo-mark {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 16px;
  }

  .package-grid,
  .about-intro-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .package-card.featured {
    transform: none;
  }

  /* Process timeline: single column with a vertical connecting line */
  .timeline-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .timeline-grid::before {
    content: "";
    position: absolute;
    left: 1.5rem;
    top: 1.5rem;
    bottom: 1.5rem;
    width: 2px;
    background: linear-gradient(180deg, rgba(197,35,40,0.28), rgba(197,35,40,0.75), rgba(197,35,40,0.22));
    box-shadow: 0 0 24px rgba(197,35,40,0.36);
  }

  .timeline-step {
    margin-left: 3rem;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 1rem;
    row-gap: 0.5rem;
  }

  .timeline-step p {
    grid-column: 1 / -1;
  }

  /* comfortable 44px tap targets for the footer text links on handhelds */
  .footer-links a,
  .footer-call,
  .footer-bottom-links a,
  .contact-stat > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .footer-links {
    gap: 0;
  }

  .footer-bottom-links {
    gap: 0 1.25rem;
  }

  .footer-panel {
    gap: 0.35rem;
  }

  /* the floating card animation is decorative and costly on handheld GPUs */
  .service-card {
    animation: none;
  }

  .services-grid::before,
  .services-grid::after {
    display: none;
  }
}

/* ---------- <= 768px ---------- */
@media (max-width: 768px) {
  .footer-cta {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-cta-button {
    width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- <= 640px : phones ---------- */
@media (max-width: 640px) {
  .section {
    padding-top: var(--section-spacing-mobile);
    padding-bottom: var(--section-spacing-mobile);
  }

  .section-title {
    margin-bottom: 1.8rem;
  }

  .section-title small,
  .portfolio-kicker {
    letter-spacing: 0.18em;
  }

  .card {
    padding: 1.4rem;
  }

  .project-card {
    padding: 1rem;
  }

  .stats-grid,
  .feature-grid,
  .project-grid,
  .testimonial-grid,
  .about-tools-grid,
  .addon-grid,
  .packages-preview-grid,
  .packages-note-grid,
  .portfolio-details-grid,
  .form-row,
  .footer-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-grid .project-card:last-of-type:nth-of-type(odd),
  .testimonial-grid .testimonial-card:last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: stretch;
    max-width: none;
  }

  .portfolio-details-grid::before {
    display: none;
  }

  .about-tool-card {
    min-height: 0;
  }

  .service-card {
    padding: 1.6rem;
  }

  /* Full-width, easy-to-hit calls to action */
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hero-actions .button,
  .addon-card .button,
  .packages-bundle-card .button,
  .packages-preview-card .button,
  .feedback-submit-row .button,
  .contact-form-footer .button {
    width: 100%;
  }

  .hero-contact {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hero-copy .eyebrow {
    letter-spacing: 0.14em;
    font-size: 0.72rem;
  }

  .hero-visual {
    padding: 10px;
  }

  .hero-photo-wrapper {
    padding: 0.8rem;
  }

  .hero .hero-photo {
    max-height: 440px;
  }

  .hero-badge {
    left: 20px;
    bottom: 20px;
    max-width: calc(100% - 40px);
    font-size: 0.82rem;
  }

  .about-story-line {
    left: 1rem;
  }

  .about-story-card p {
    padding-left: 1.2rem;
  }

  /* Comparison table: one card per feature, each value labelled with its column */
  .packages-compare-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
  }

  .packages-compare-row.compare-heading {
    display: none;
  }

  .packages-compare-row .compare-label {
    color: #fff;
    font-size: 1.02rem;
  }

  .packages-compare-row .compare-value {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    text-align: right;
  }

  .packages-compare-row .compare-value::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-weight: 600;
    text-align: left;
  }

  .contact-form-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-panel {
    padding-bottom: 0.4rem;
  }
}

/* ---------- <= 380px : very small phones ---------- */
@media (max-width: 380px) {
  :root {
    --gutter: 1rem;
  }

  .hero-meta {
    gap: 0.45rem;
  }

  .hero-card {
    padding: 0.7rem 0.6rem;
    border-radius: 16px;
  }

  .hero-card span {
    font-size: 0.72rem;
  }

  .card,
  .packages-hero-card,
  .packages-preview-card,
  .addon-card,
  .packages-bundle-card,
  .package-note-card,
  .footer-cta {
    padding: 1.1rem;
  }

  .timeline-step {
    margin-left: 2.4rem;
  }

  .timeline-grid::before {
    left: 1.1rem;
  }

  .testimonial-topline {
    flex-wrap: wrap;
  }
}

/* ---------- short landscape screens (phones turned sideways) ---------- */
@media (max-height: 520px) and (orientation: landscape) {
  .hero.section {
    min-height: 0;
    padding-top: 2rem;
    padding-bottom: 2.5rem;
  }

  .hero .hero-photo {
    max-height: 300px;
  }

  .mobile-nav {
    padding-top: 0.6rem;
    gap: 0.5rem;
  }

  .mobile-nav-links a {
    min-height: 44px;
  }
}

/* ---------- touch / coarse pointers ---------- */
/* Hover lifts "stick" after a tap on touch screens, so they are limited to
   devices that really hover. Nothing essential is revealed on hover. */
@media (hover: none) {
  .card:hover,
  .service-card:hover,
  .project-card:hover,
  .package-card:hover,
  .timeline-step:hover,
  .feature-card:hover,
  .stat-card:hover,
  .testimonial-card:hover,
  .cta-panel:hover,
  .about-tool-card:hover,
  .portfolio-detail-card:hover,
  .logo-link:hover,
  .hero-contact .contact-chip:hover,
  .footer-cta-button:hover,
  .footer-whatsapp-link:hover,
  .footer-socials a:hover,
  .floating-whatsapp:hover,
  .button-primary:hover {
    transform: none;
  }

  .service-card:hover .service-icon,
  .service-card:hover h3,
  .service-card:hover p,
  .project-card:hover .project-visual img,
  .footer-socials a:hover .social-icon {
    transform: none;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  /* content is simply there: no fade/slide-in, no hover lifts, no parallax */
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .card:hover,
  .service-card:hover,
  .project-card:hover,
  .package-card:hover,
  .timeline-step:hover,
  .feature-card:hover,
  .stat-card:hover,
  .testimonial-card:hover,
  .cta-panel:hover,
  .floating-whatsapp:hover,
  .project-card:hover .project-visual img {
    transform: none;
  }

  .service-card,
  .about-image-card .hero-photo,
  .floating-whatsapp,
  .footer::after,
  .footer-cta::before,
  .portfolio-hero-section::before {
    animation: none !important;
  }

  .hero-visual {
    transform: none;
  }

  .custom-cursor {
    display: none;
  }
}

@media print {
  .page-loader,
  .site-header,
  .scroll-progress-wrap,
  .mobile-nav,
  .mobile-nav-overlay,
  .floating-whatsapp,
  .scroll-top,
  .custom-cursor {
    display: none !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  main {
    padding-top: 0;
  }
}
