/* ==========================================================================
   AB Byg & Montage - responsive overrides
   Mobile-first: <=560 (phone), <=800 (tablet portrait), <=1080 (tablet ls)
   ========================================================================== */

/* ----- Tablet (and below): 1080 ----- */
@media (max-width: 1080px) {
  .container { padding: 0 40px; }
  .reuse__grid,
  .trustpilot__grid,
  .about__grid,
  .contact-cta__grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .works__grid { grid-template-columns: 1fr; }
  .works__col-secondary { grid-template-rows: auto auto; }
  .solroof__grid { grid-template-columns: 1fr; }
  .solroof__copy { padding: 64px 40px; }
  .solroof__visual { aspect-ratio: 16/10; }
  .site-footer__cols { grid-template-columns: 1fr 1fr; gap: 40px; }
  .hero { padding-top: 64px; padding-bottom: 48px; }
  .page-head { padding: 64px 0 48px; }
}

/* ----- Tablet portrait: 800 ----- */
@media (max-width: 800px) {
  .container { padding: 0 24px; }
  .section { padding: 56px 0; }
  .section.tight { padding: 40px 0; }

  .site-header { padding: 18px 0; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* Mobile nav — always flex but animated in/out with opacity + slide */
  .site-header__nav .menu-items {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--bg);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 16px 24px 24px;
    z-index: 49;
    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0.28s;
  }
  /* Open state — fade + slide down */
  .site-header.menu-open .site-header__nav .menu-items {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.28s ease, transform 0.28s ease, visibility 0s linear 0s;
  }
  .site-header__nav .menu-items > a {
    padding: 14px 0;
    border-bottom: 1px solid var(--rule);
    width: 100%;
    font-size: 15px;
    letter-spacing: 0.04em;
  }
  .site-header__nav .menu-items > a:last-of-type { border-bottom: none; }
  .site-header__nav .menu-items .sep { display: none; }
}

@media (max-width: 800px) {
  /* Hero */
  .hero { padding-top: 48px; padding-bottom: 40px; }
  .hero__cta { gap: 12px; margin-top: 32px; }
  .hero__lead { margin-top: 24px; max-width: none; }

  /* Approach grid - single col on mobile */
  .approach__head .display { margin-bottom: 40px; }
  .approach__grid { grid-template-columns: 1fr; }
  .approach__cell {
    padding: 28px 0;
    border-right: none;
  }

  /* Works - feature stacked, secondaries underneath */
  .works__head { margin-bottom: 40px; gap: 16px; }
  .works__col-secondary { gap: 16px; }

  /* Works: uniform 4/3 image height on mobile — overrides auto + 21/9 slots */
  .works__feature .photo-slot,
  .works__col-secondary .project-card .photo-slot,
  .works__col-primary .works__card--lower .photo-slot {
    aspect-ratio: 4/3;
    flex: none;
  }
  /* Override :first-child rule (higher specificity in style.css: flex:1 + aspect-ratio:auto) */
  .works__col-secondary .project-card:first-child .photo-slot {
    flex: none;
    min-height: unset;
    aspect-ratio: 4/3;
  }

  /* Reuse stats - single column */
  .reuse__stats { grid-template-columns: 1fr 1fr; gap: 16px; }
  .reuse__stat .num { font-size: 28px; }

  /* Solroof - copy padding */
  .solroof__copy { padding: 56px 24px; }

  /* About bio - stack */
  .about__bio { grid-template-columns: 1fr; gap: 18px; padding-top: 24px; }
  .about__quote { font-size: 22px; margin-bottom: 24px; }

  /* Trustpilot card */
  .trustpilot__card { padding: 24px; }
  .trustpilot__card .quote { font-size: 20px; margin: 16px 0 20px; }

  /* Contact cards */
  .contact-cta__grid { gap: 40px; }
  .contact-card { padding: 18px 20px; }

  /* Footer columns */
  .site-footer { padding: 56px 0 24px; }
  .site-footer__cols {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 40px;
  }
  .site-footer__col h4 { margin-bottom: 14px; }

  /* Page head */
  .page-head { padding: 48px 0 32px; }
  .page-head .display { font-size: clamp(36px, 9vw, 56px); }

  /* Project archive */
  .projects-archive__grid { grid-template-columns: 1fr; gap: 24px; }
  .project-detail__head { padding: 56px 0 32px; }
  .project-detail__cover { margin-top: 32px; }
  .project-detail__facts { grid-template-columns: 1fr 1fr; gap: 18px; padding: 28px 0; margin: 32px 0; }
  /* Split layout → stack on tablet/mobile */
  .project-detail__body-section--split { flex-direction: column; gap: 32px; }
  /* Gallery col goes full width when stacked */
  .project-detail__body-section--split .project-detail__gallery-col,
  .project-detail__body-section--split .project-detail__text-col { flex: none; width: 100%; }
  /* Split-layout gallery: 2 columns once stacked (was 3 — too small on mobile) */
  .project-gallery__grid--2col { grid-template-columns: repeat(2, 1fr); }
  .project-fact .value { font-size: 18px; }

  /* Entry content */
  .entry-content h2 { font-size: 28px; margin: 40px 0 14px; }
  .entry-content h3 { font-size: 20px; margin: 28px 0 10px; }
  .entry-content p, .entry-content li { font-size: 16px; }
}

/* ----- Phone: 560 ----- */
@media (max-width: 560px) {
  .container { padding: 0 20px; }
  .site-header { padding: 14px 0; }
  .site-logo { font-size: 12px; letter-spacing: 0.16em; }
  .site-logo svg { width: 18px; height: 20px; }

  /* Headlines tighter */
  h1.display { font-size: clamp(34px, 10vw, 48px); }
  h2.display { font-size: clamp(30px, 9vw, 44px); }
  .hero__headline { line-height: 1.02; }

  /* Buttons full-width on mobile when in a CTA row */
  .hero__cta .btn { flex: 1 1 100%; justify-content: center; }
  .hero__cta .btn-link { flex: 1 1 100%; text-align: center; }
  .cta-row .btn-light { flex: 1 1 100%; justify-content: center; }

  /* Reuse stats single column on phone */
  .reuse__stats { grid-template-columns: 1fr; }

  /* Contact card layout */
  .contact-card .value { font-size: 14px; }

  /* Solroof headline tighter */
  .solroof__copy .display { font-size: clamp(36px, 11vw, 56px); }
  .solroof__copy { padding: 48px 20px; }

  /* Project facts - single col on smallest */
  .project-detail__facts { grid-template-columns: 1fr; }

  /* Footer meta wrap */
  .site-footer__meta { flex-direction: column; align-items: flex-start; gap: 16px; }
  .site-footer__meta .legal { flex-wrap: wrap; }

  /* 404 */
  .error-404 { padding: 80px 0; }
  .error-404 .display { font-size: clamp(56px, 18vw, 96px); }
}

/* ----- Very large screens: cap container nicely ----- */
@media (min-width: 1600px) {
  .container { padding: 0 64px; }
}

/* ----- Hover: only enable on devices that actually hover ----- */
@media (hover: none) {
  .btn:hover { transform: none; }
  .post-card:hover h2 { color: inherit; }
}

/* ----- Archive grid + project gallery responsive ----- */
@media (max-width: 1080px) {
  .projects-archive__grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .project-gallery__grid  { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .projects-archive__grid { grid-template-columns: 1fr; gap: 20px; }
  /* Mobile: gallery images stack full-width, one per row */
  .project-gallery__grid,
  .project-gallery__grid--2col { grid-template-columns: 1fr; gap: 12px; }
}
