/* Shared sizing keeps grid and flex content within the viewport. */
.hero,
.custom-section,
.story,
.project-detail-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.hero > *,
.custom-section > *,
.story > *,
.project-detail-layout > *,
.section-heading > * {
  min-width: 0;
}
h1, h2, h3, p, a, button {
  overflow-wrap: anywhere;
}
.header { gap: 24px; }
.header .brand { flex-shrink: 0; }
.header nav { flex-wrap: wrap; }
.hero-actions { flex-wrap: wrap; }
footer { flex-wrap: wrap; }
input, select, textarea { min-width: 0; max-width: 100%; }
.button { min-height: 44px; }
.filters button { min-height: 44px; }
.project-gallery-controls button { width: 44px; height: 44px; }
.project-detail-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
#project-dialog { max-height: 90dvh; }
.close-project { width: 44px; height: 44px; }

@media (max-width: 1050px) {
  .header { flex-wrap: wrap; gap: 16px; }
  .header nav {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 8px 24px;
  }
  .header nav a { display: inline-flex; align-items: center; min-height: 44px; }
  .product-grid, .product-grid:has(.product[hidden]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .section-heading { align-items: flex-start; flex-wrap: wrap; }
  .custom-section { padding: 36px; gap: 28px; }
  .custom-copy h2 { font-size: clamp(32px, 4vw, 42px); }
}

@media (max-width: 900px) {
  .hero, .custom-section { grid-template-columns: minmax(0, 1fr); }
  .hero { gap: 24px; }
  .hero-copy .intro { max-width: 650px; }
  .hero-actions { flex-direction: row; align-items: center; }
  .hero-art { height: auto; aspect-ratio: 1; width: min(100%, 420px); margin-inline: auto; }
  .custom-copy > p:not(.eyebrow) { max-width: none; }
  .custom-copy h2 { font-size: clamp(34px, 5.5vw, 49px); }
  #enquiry-form { width: 100%; }
  .story { grid-template-columns: minmax(0, .55fr) minmax(0, 1fr); gap: 24px; padding: 32px; }
  .project-detail-layout { grid-template-columns: minmax(0, 1fr); }
  .project-detail-gallery .project-detail-photo {
    height: 44vh;
    height: 44dvh;
    min-height: 180px;
  }
  .project-detail-copy { padding: 28px; }
  .project-detail-copy .button { max-width: 100%; }
}

@media (max-width: 700px) {
  .header { padding-block: 18px; }
  .header nav { font-size: 13px; gap: 4px 16px; }
  h1 { font-size: clamp(36px, 8.5vw, 55px); letter-spacing: -1.8px; }
  .section-heading { flex-direction: column; }
  .hero-actions { gap: 14px; }
  .hero-actions .text-link { font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; }
  .category-tile { padding: 16px; }
  .category-tile > span:first-child { font-size: clamp(16px, 3.3vw, 22px); }
  .custom-section { padding: 28px 20px; gap: 24px; }
  .custom-copy h2 { font-size: clamp(30px, 7.5vw, 42px); letter-spacing: -1px; }
  form { padding: 24px; }
  input, select, textarea { font-size: 16px; }
  .story { grid-template-columns: minmax(0, 1fr); padding: 28px 22px; }
  .story-logo { max-width: 180px; }
  footer { gap: 12px 20px; }
  footer > a:not(.brand) { display: inline-flex; align-items: center; min-height: 44px; }
  #project-dialog { width: calc(100% - 24px); }
  .project-detail-copy { padding: 24px; }
}

@media (max-width: 380px) {
  .header .brand { font-size: 21px; }
  .header .small { padding: 10px; gap: 8px; max-width: 150px; }
  .header .store-logo { width: 32px; height: 32px; margin-right: 6px; }
  .header nav { justify-content: flex-start; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .text-link { justify-content: center; }
  .product-grid, .product-grid:has(.product[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .product-photo { aspect-ratio: 4 / 3; }
  .custom-section { padding: 24px 16px; }
  form { padding: 18px; }
  .project-content, .project-detail-copy { padding: 20px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  #project-dialog { max-height: 94vh; max-height: 94dvh; }
  .project-detail-gallery .project-detail-photo { height: 65vh; height: 65dvh; min-height: 140px; }
}

/* Photo project carousel: two cards on desktop, one on mobile. */
.project-carousel { min-width: 0; }
.project-carousel .project-grid {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--blue) var(--soft);
  padding-bottom: 12px;
}
.project-carousel .project-card {
  flex: 0 0 calc((100% - 22px) / 2);
  min-width: 0;
  scroll-snap-align: start;
}
.project-carousel-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 18px; }
.project-carousel-arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--blue);
  font-size: 22px;
  cursor: pointer;
}
.project-carousel-arrow:hover:not(:disabled) { background: var(--soft); border-color: var(--blue); }
.project-carousel-arrow:disabled { opacity: .35; cursor: default; }
.project-carousel-arrow:focus-visible, .project-carousel .project-grid:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.project-carousel-count { min-width: 78px; margin: 0; text-align: center; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .project-carousel .project-grid { gap: 16px; }
  .project-carousel .project-card { flex-basis: 100%; }
}
