/* ============================================================
   Star One Roofing — Responsive Styles
   Breakpoints: 1400px, 1200px, 992px, 768px, 576px
   Mobile-first adjustments for every component
   ============================================================ */

/* ==========================================================
   MAX 1400px — Large Desktop Adjustments
   ========================================================== */

@media (max-width: 1400px) {

  .footer__grid {
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: var(--space-xl);
  }

  .gallery-grid {
    gap: var(--space-sm);
  }

}

/* ==========================================================
   MAX 1200px — Standard Desktop / Large Tablet
   ========================================================== */

@media (max-width: 1200px) {

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

  .services-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .form-section {
    gap: var(--space-2xl);
  }

  .about-grid {
    gap: var(--space-2xl);
  }

  .footer__grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-xl);
  }

  .footer__brand {
    grid-column: 1 / -1;
    max-width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--clr-border);
    margin-bottom: var(--space-md);
  }

  .footer__social {
    justify-content: center;
  }

}

/* ==========================================================
   MAX 992px — Tablet
   ========================================================== */

@media (max-width: 992px) {

  /* Navbar — Switch to Mobile */
  .navbar__menu {
    display: none;
  }

  .navbar__cta {
    display: none;
  }

  .navbar__hamburger {
    display: flex;
  }

  /* Hero */
  .hero__content {
    padding: var(--space-2xl) var(--container-padding);
  }

  .hero__service-line {
    gap: 0.25rem;
    margin-bottom: var(--space-xl);
  }

  .hero__description {
    font-size: var(--fs-body);
  }

  /* Grids */
  .grid--2 {
    grid-template-columns: 1fr;
  }

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

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

  /* Services */
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  /* Form Section — Stack */
  .form-section {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    max-width: 100%;
    overflow: hidden;
  }

  .form-section__image {
    min-height: 300px;
    max-height: 400px;
    max-width: 100%;
    margin: 0 auto;
  }
  
  .form-panel {
    max-width: 100%;
    margin: 0 auto;
  }

  /* About — Stack */
  .about-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .about-image {
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
  }

  .about-image img {
    width: 100%;
    height: auto;
  }

  .about-content {
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .about-content .flex {
    flex-wrap: wrap;
    justify-content: center;
    margin-top: var(--space-xl);
  }

  .about-content .flex .btn {
    flex: 1 1 auto;
    min-width: 160px;
    max-width: 280px;
    text-align: center;
    justify-content: center;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-item--wide {
    grid-column: span 1;
  }

  /* Process Timeline */
  .process-timeline {
    padding-left: var(--space-2xl);
  }

  .process-step__marker {
    left: calc(-1 * var(--space-2xl) + 8px);
  }

  /* Google Reviews */
  .google-reviews {
    flex-direction: column;
    text-align: center;
    gap: var(--space-lg);
  }

  /* Testimonial - Show 1 card */
  .testimonial-card {
    flex: 0 0 100%;
  }

  /* Footer */
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }

  .footer__brand {
    grid-column: 1 / -1;
  }

  /* Map */
  .map-container {
    height: 350px;
  }

  /* Lightbox */
  .lightbox__prev {
    left: var(--space-md);
  }

  .lightbox__next {
    right: var(--space-md);
  }

  .lightbox__close {
    top: var(--space-md);
    right: var(--space-md);
  }

}

/* ==========================================================
   MAX 768px — Large Mobile / Small Tablet
   ========================================================== */

@media (max-width: 768px) {

  /* Section Spacing */
  .section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
  }

  /* Prevent horizontal slide animations from causing overflow on mobile */
  html.js-animate [data-animate="fade-left"]:not(.is-animated),
  html.js-animate [data-animate="fade-right"]:not(.is-animated) {
    transform: translateY(30px);
  }

  /* Prevent long buttons from causing horizontal overflow */
  .btn {
    white-space: normal;
    max-width: 100%;
    text-align: center;
  }

  .section--sm {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  /* Section Header */
  .section-header {
    margin-bottom: var(--space-2xl);
  }

  /* Trust Bar */
  .trust-bar__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }

  /* Services */
  .services-grid {
    grid-template-columns: 1fr;
  }

  /* Grid */
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-item--tall {
    grid-row: span 1;
  }

  /* Before/After */
  .ba-slider {
    aspect-ratio: 4 / 3;
  }

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

  /* Hero Actions */
  .hero__actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
  }

  .hero__actions .btn {
    width: 100%;
  }

  /* CTA Section */
  .cta-section__actions {
    flex-direction: column;
  }

  .cta-section__actions .btn {
    width: 100%;
    max-width: 320px;
  }

  /* Page Header */
  .page-header {
    padding: calc(var(--navbar-height) + var(--space-2xl)) 0 var(--space-2xl);
    text-align: center;
  }

  .page-header p {
    margin-left: auto;
    margin-right: auto;
  }

  /* Form Grid */
  .form-grid {
    grid-template-columns: 1fr;
  }

  /* Form Panel */
  .form-panel {
    padding: var(--space-xl);
  }

  /* Footer */
  .footer__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer__brand {
    border-bottom: 1px solid var(--clr-border);
    padding-bottom: var(--space-xl);
  }

  .footer__links {
    align-items: center;
  }

  .footer__contact-item {
    justify-content: center;
  }

  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }

  .footer__legal {
    justify-content: center;
  }

  /* Emergency Phone */
  .emergency__phone {
    font-size: var(--fs-h4);
    padding: var(--space-md) var(--space-xl);
  }

  /* Map */
  .map-container {
    height: 300px;
    border-radius: var(--radius-md);
  }

  /* Lightbox */
  .lightbox__image {
    max-width: 95vw;
    max-height: 70vh;
  }

  .lightbox__nav {
    width: 40px;
    height: 40px;
  }

  .lightbox__prev {
    left: var(--space-sm);
  }

  .lightbox__next {
    right: var(--space-sm);
  }

  /* Show Mobile CTA Bar */
  .mobile-cta {
    display: block;
  }

  /* Add bottom padding to body for mobile CTA */
  body {
    padding-bottom: 72px;
  }

  /* Adjust back to top position above mobile CTA */
  .back-to-top {
    bottom: calc(72px + var(--space-md));
    right: var(--space-md);
  }

  /* Breadcrumbs */
  .breadcrumbs {
    justify-content: center;
  }

  /* Testimonial card padding */
  .testimonial-card__inner {
    padding: var(--space-xl);
  }

  .testimonial-card__quote-mark {
    font-size: 3.5rem;
  }

}

/* ==========================================================
   MAX 576px — Small Mobile
   ========================================================== */

@media (max-width: 576px) {

  /* Typography Adjustments */
  .display-heading {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  h1 {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
  }

  h2 {
    font-size: clamp(1.5rem, 5vw, 1.75rem);
  }

  /* Container padding */
  :root {
    --container-padding: 1rem;
  }

  /* Hero */
  .hero__eyebrow {
    font-size: 0.65rem;
    padding: var(--space-xs) var(--space-md);
  }

  .hero__title {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .hero__scroll-indicator {
    display: none;
  }

  /* Trust Bar */
  .trust-bar__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .trust-bar__number {
    font-size: var(--fs-h3);
  }

  .trust-bar__label {
    font-size: var(--fs-xs);
  }

  /* Service Cards */
  .service-card {
    padding: var(--space-lg);
  }

  /* Why Cards */
  .why-card {
    padding: var(--space-lg);
  }

  .why-card__icon {
    width: 52px;
    height: 52px;
  }

  /* Gallery */
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-filters {
    gap: var(--space-xs);
  }

  .gallery-filter-btn {
    padding: var(--space-xs) var(--space-md);
    font-size: var(--fs-xs);
  }

  /* Before/After */
  .ba-slider {
    border-radius: var(--radius-md);
  }

  .ba-slider__info {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
  }

  /* Form */
  .form-panel {
    padding: var(--space-lg);
  }

  .form-section__image {
    min-height: 200px;
    max-height: 250px;
  }

  /* Upload Zone */
  .upload-zone {
    padding: var(--space-lg);
  }

  .upload-preview {
    width: 64px;
    height: 64px;
  }

  /* Emergency */
  .emergency__badge {
    font-size: 0.65rem;
    padding: var(--space-xs) var(--space-md);
  }

  .emergency__phone {
    font-size: var(--fs-body);
    padding: var(--space-md) var(--space-lg);
    width: 100%;
    justify-content: center;
  }

  /* Testimonials */
  .testimonial-card__inner {
    padding: var(--space-lg);
  }

  .testimonial-card__text {
    font-size: var(--fs-body);
  }

  .carousel-nav {
    gap: var(--space-sm);
  }

  .carousel-btn {
    width: 40px;
    height: 40px;
  }

  /* Process Timeline */
  .process-timeline {
    padding-left: var(--space-xl);
  }

  .process-timeline::before {
    left: 14px;
  }

  .process-step__marker {
    left: calc(-1 * var(--space-xl) + 2px);
    width: 22px;
    height: 22px;
  }

  .process-step__marker::after {
    width: 8px;
    height: 8px;
  }

  /* FAQ */
  .faq-question {
    font-size: var(--fs-body);
    padding: var(--space-md) 0;
  }

  /* Footer */
  .footer__top {
    padding: var(--space-2xl) 0 var(--space-xl);
  }

  .footer__logo {
    height: 40px;
  }

  /* Carousel */
  .testimonial-card {
    padding: 0 var(--space-xs);
  }

  /* Mobile Menu */
  .mobile-menu__link {
    font-size: var(--fs-h4);
  }

  /* CTA Section */
  .cta-section__actions .btn {
    max-width: 100%;
  }

  /* Google Reviews */
  .google-reviews {
    padding: var(--space-lg);
  }

  .google-reviews__score {
    font-size: var(--fs-h2);
  }

  /* About Image Badge */
  .about-image__badge {
    bottom: var(--space-md);
    right: var(--space-md);
    padding: var(--space-sm) var(--space-md);
  }

  .about-image__badge-number {
    font-size: var(--fs-h3);
  }

  /* Lightbox */
  .lightbox__image {
    max-width: 98vw;
    max-height: 65vh;
    border-radius: 0;
  }

  .lightbox__close {
    top: var(--space-sm);
    right: var(--space-sm);
    width: 40px;
    height: 40px;
  }

  .lightbox__nav {
    width: 36px;
    height: 36px;
  }

  .lightbox__prev {
    left: var(--space-xs);
  }

  .lightbox__next {
    right: var(--space-xs);
  }
}

/* ==========================================================
   MAX 380px — Extra Small Mobile (iPhone SE, etc.)
   ========================================================== */

@media (max-width: 380px) {

  :root {
    --container-padding: 0.875rem;
  }

  .hero__title {
    font-size: clamp(1.75rem, 9vw, 2.5rem);
  }

  .hero__eyebrow {
    font-size: 0.6rem;
    letter-spacing: var(--ls-wide);
  }

  .trust-bar__grid {
    gap: var(--space-sm);
  }

  .mobile-cta__btn {
    font-size: var(--fs-xs);
    padding: var(--space-sm) var(--space-xs);
  }

  .service-card {
    padding: var(--space-md);
  }

  .form-panel {
    padding: var(--space-md);
  }

  .emergency__phone {
    font-size: var(--fs-small);
  }
}

/* ==========================================================
   LANDSCAPE MOBILE
   ========================================================== */

@media (max-height: 500px) and (orientation: landscape) {

  .hero {
    min-height: auto;
    padding: var(--space-4xl) 0 var(--space-2xl);
  }

  .hero__content {
    padding-top: var(--navbar-height);
  }

  .hero__scroll-indicator {
    display: none;
  }

}

/* ==========================================================
   HOVER SUPPORT — Only apply hover effects on devices
   that support hover (prevents sticky hover on mobile)
   ========================================================== */

@media (hover: none) {

  .service-card:hover {
    transform: none;
    box-shadow: none;
  }

  .service-card:hover::before {
    background: none;
  }

  .why-card:hover {
    transform: none;
  }

  .gallery-item:hover img {
    transform: none;
  }

  .gallery-item__overlay {
    opacity: 1;
  }

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

  .footer__social-link:hover {
    transform: none;
  }

  .back-to-top:hover {
    transform: none;
  }
}

/* ==========================================================
   PRINT STYLES
   ========================================================== */

@media print {

  .navbar,
  .mobile-cta,
  .back-to-top,
  .scroll-progress,
  .hero__particles,
  .hero__scroll-indicator,
  .lightbox,
  .mobile-menu,
  .page-transition {
    display: none !important;
  }

  body {
    background: white;
    color: black;
    padding-bottom: 0;
  }

  .hero {
    min-height: auto;
    padding: 2rem 0;
  }

  .hero__overlay {
    background: none;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  .section {
    padding: 1.5rem 0;
  }

  .btn {
    border: 1px solid black;
    background: none;
    color: black;
    box-shadow: none;
  }

}