/* Phase 0: shared portfolio and responsive refinements. */

html {
  --anchor-scroll-offset: 136px;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding-top: var(--anchor-scroll-offset);
}

body {
  max-width: 100%;
}

.anchor-target {
  scroll-margin-top: var(--anchor-scroll-offset);
}

.source-guide-promo,
.source-guide-room-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.58fr);
  gap: clamp(34px, 8vw, 110px);
  align-items: center;
  background: var(--mist, #edf0eb);
}

.source-guide-promo-copy {
  max-width: 760px;
}

.source-guide-promo h2,
.source-guide-room-cta h2 {
  margin: 0;
  color: var(--heading-brown, #3a2c25);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 5.4vw, 72px);
  font-weight: 400;
  line-height: 1.02;
}

.source-guide-promo-copy > p:not(.section-kicker),
.source-guide-room-cta p {
  margin: 22px 0 0;
  color: var(--soft-ink, #655f56);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.62;
}

.source-guide-promo .text-link,
.source-guide-room-cta .text-link {
  margin-top: 26px;
}

.source-guide-promo-card {
  display: grid;
  grid-template-rows: auto 1fr;
  margin: 0;
  background: var(--paper, #f7f3ec);
  border: 1px solid var(--line, rgba(58, 44, 37, 0.18));
}

.source-guide-promo-card figure {
  aspect-ratio: 1 / 1;
  margin: 0;
  overflow: hidden;
}

.source-guide-promo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.source-guide-promo-card div {
  padding: 24px;
}

.source-guide-promo-card p {
  margin: 0 0 8px;
  color: var(--clay, #9b735f);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.source-guide-promo-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 400;
  line-height: 1.05;
}

.source-guide-room-cta {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: clamp(56px, 8vw, 96px) clamp(18px, 6vw, 86px);
  border-top: 1px solid var(--line, rgba(58, 44, 37, 0.18));
}

/* Preserve the complete composition of editorial, full-width images. */
.gallery-strip,
.gallery-strip--short {
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
}

.gallery-strip > img,
.gallery-strip--short > img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center center;
}

/* Most paired photography is portrait (roughly 3:4), so give it room. */
.gallery-pair figure {
  height: auto;
  min-height: 0;
  aspect-ratio: 3 / 4;
}

.gallery-pair--tall figure {
  height: auto;
  aspect-ratio: 4 / 7;
}

.gallery-pair figure img {
  object-fit: cover;
}

/* Keep paired editorial images comfortably viewable within a desktop viewport. */
@media (min-width: 901px) {
  .gallery-pair figure {
    height: min(76svh, 760px);
    aspect-ratio: auto;
  }

  .gallery-pair--tall figure {
    height: min(78svh, 840px);
    aspect-ratio: auto;
  }
}

@media (max-width: 900px) {
  html {
    --anchor-scroll-offset: 102px;
  }

  .source-guide-promo,
  .source-guide-room-cta {
    grid-template-columns: 1fr;
  }

  .site-header {
    min-height: 82px;
    padding: 16px 18px;
  }

  .mobile-panel {
    inset-block-start: 82px;
    max-height: calc(100dvh - 82px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .gallery-page,
  .portfolio-page,
  .service-page {
    padding-top: 82px;
  }

  .gallery-pair {
    gap: 12px;
    padding: 12px;
  }

  .gallery-pair figure,
  .gallery-pair--tall figure {
    height: auto;
  }

  .portfolio-hero,
  .service-hero,
  .portfolio-grid-section,
  .service-detail,
  .service-gallery,
  .portfolio-cta,
  .service-cta {
    padding-inline: clamp(22px, 5vw, 42px);
  }

  .portfolio-hero,
  .service-hero {
    gap: 30px;
    padding-top: clamp(52px, 8vw, 76px);
    padding-bottom: clamp(48px, 7vw, 68px);
  }

  .portfolio-hero figure,
  .service-hero figure {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .service-hero figure img {
    transform: none;
    object-position: center center;
  }

  .portfolio-grid-section,
  .service-detail,
  .service-gallery,
  .portfolio-cta,
  .service-cta {
    padding-block: clamp(54px, 8vw, 78px);
  }

  .portfolio-grid,
  .service-gallery {
    gap: 24px;
  }

  .portfolio-card figure,
  .service-gallery figure {
    aspect-ratio: 4 / 3;
  }

  footer {
    gap: 10px;
    padding-block: 24px;
    line-height: 1.5;
  }
}

@media (min-width: 561px) and (max-width: 900px) {
  .gallery-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  /* Portfolio category pages: streamline the mobile entry point and respect
     each card image's natural composition. Desktop and homepage cards are
     intentionally outside this scoped system. */
  .portfolio-category-page .portfolio-hero {
    padding-bottom: 32px;
  }

  .portfolio-category-page .portfolio-hero figure {
    display: none;
  }

  .portfolio-category-page .portfolio-grid-section {
    padding-top: 32px;
  }

  .service-detail-page .service-hero {
    padding-bottom: 32px;
  }

  .service-detail-page .service-hero figure {
    display: none;
  }

  .service-detail-page .service-detail {
    padding-top: 32px;
  }

  .portfolio-category--studies .portfolio-card:nth-child(1) figure,
  .portfolio-category--studies .portfolio-card:nth-child(2) figure,
  .portfolio-category--renderings .portfolio-card:nth-child(1) figure {
    aspect-ratio: 16 / 9;
  }

  .portfolio-category--studies .portfolio-card:nth-child(3) figure,
  .portfolio-category--renderings .portfolio-card:nth-child(3) figure {
    aspect-ratio: 7 / 8;
  }

  .portfolio-category--renderings .portfolio-card:nth-child(2) figure,
  .portfolio-category--living .portfolio-card:nth-child(1) figure {
    aspect-ratio: 4 / 3;
  }

  .portfolio-category--renderings .portfolio-card:nth-child(2) figure img {
    object-position: center center;
  }

  .portfolio-category--living .portfolio-card:nth-child(2) figure,
  .portfolio-category--living .portfolio-card:nth-child(4) figure,
  .portfolio-category--living .portfolio-card:nth-child(5) figure,
  .portfolio-category--living .portfolio-card:nth-child(6) figure {
    aspect-ratio: 3 / 4;
  }

  .portfolio-category--living .portfolio-card:nth-child(3) figure {
    aspect-ratio: 4 / 5;
  }

  .service-detail-page--interiors .service-gallery figure:nth-child(1),
  .service-detail-page--landscape .service-gallery figure:nth-child(1) {
    aspect-ratio: 4 / 3;
  }

  .service-detail-page--interiors .service-gallery figure:nth-child(2),
  .service-detail-page--interiors .service-gallery figure:nth-child(3),
  .service-detail-page--millwork .service-gallery figure:nth-child(2),
  .service-detail-page--millwork .service-gallery figure:nth-child(3),
  .service-detail-page--landscape .service-gallery figure:nth-child(3) {
    aspect-ratio: 3 / 4;
  }

  .service-detail-page--millwork .service-gallery figure:nth-child(1) {
    aspect-ratio: 3 / 5;
  }

  .service-detail-page--landscape .service-gallery figure:nth-child(2) {
    aspect-ratio: 2 / 3;
  }

  .service-detail-page--interiors .service-gallery figure:nth-child(3) img {
    object-position: center center;
  }

  .service-detail-page--landscape .service-gallery figure:nth-child(2) img {
    object-position: center top;
  }

  html {
    --anchor-scroll-offset: 92px;
  }

  .source-guide-promo,
  .source-guide-room-cta {
    gap: 28px;
  }

  .source-guide-promo-card div {
    padding: 21px;
  }

  .source-guide-room-cta {
    padding: 52px 18px;
  }

  .site-header {
    min-height: 76px;
    padding: 13px 16px;
  }

  .site-header .brand {
    max-width: calc(100vw - 88px);
    min-height: 38px;
    padding: 8px 11px;
    font-size: 17px;
  }

  .menu-toggle {
    width: 42px;
    height: 42px;
  }

  .mobile-panel {
    inset-block-start: 76px;
    gap: 0;
    max-height: calc(100dvh - 76px);
    padding: 12px 18px 20px;
  }

  .mobile-panel a {
    padding-block: 15px;
    font-size: 17px;
  }

  .gallery-page,
  .portfolio-page,
  .service-page {
    padding-top: 76px;
  }

  .gallery-image-title {
    top: 12px;
    left: 14px;
    font-size: clamp(15px, 4.5vw, 19px);
  }

  .gallery-pair {
    gap: 10px;
    padding: 10px;
  }

  .gallery-pair figure,
  .gallery-pair--tall figure {
    aspect-ratio: 3 / 4;
  }

  /* Explicitly marked secondary details remain available on larger screens. */
  .mobile-secondary {
    display: none;
  }

  .hero {
    min-height: calc(100svh - 76px);
    margin-top: 76px;
  }

  .hero-content {
    padding: 36px 18px 42px;
  }

  .hero-note {
    gap: 20px;
    margin-top: 24px;
    padding-top: 18px;
  }

  .hero-note p {
    font-size: 16px;
    line-height: 1.5;
  }

  .hero,
  .intro,
  .featured,
  .process,
  .sources,
  .contact,
  #studio,
  #work,
  #process,
  #journal,
  #contact {
    padding-top: 52px;
    padding-bottom: 52px;
  }

  #studio {
    gap: 20px;
    min-height: auto;
  }

  #studio .portrait {
    aspect-ratio: 4 / 5;
  }

  .section-kicker {
    margin-bottom: 14px;
  }

  .section-head,
  .sources-head {
    gap: 18px;
    margin-bottom: 28px;
  }

  .project-grid {
    gap: 22px;
  }

  .project > div,
  .project > a > div,
  .portfolio-card > div {
    min-height: 0;
    padding: 21px 22px 23px;
  }

  .project h3,
  .portfolio-card h2 {
    font-size: clamp(27px, 9vw, 36px);
  }

  #process {
    gap: 30px;
    min-height: auto;
    padding-top: 52px;
    padding-bottom: 52px;
  }

  #process h2 {
    font-size: clamp(40px, 13vw, 54px);
  }

  #process .step {
    grid-template-columns: 24px minmax(0, 1fr) minmax(92px, 108px);
    gap: 10px;
    align-items: stretch;
    padding: 18px 0;
  }

  #process .step-image {
    height: 100%;
    min-height: 180px;
    aspect-ratio: auto;
  }

  #process .step:nth-child(1) .step-image img {
    object-position: 48% center;
  }

  #process .step:nth-child(2) .step-image img {
    object-position: center center;
  }

  #process .step:nth-child(3) .step-image img {
    object-position: center top;
  }

  .sources-head,
  .source-list {
    gap: 28px;
  }

  .source-group {
    gap: 14px;
    padding-top: 22px;
  }

  .source-item {
    gap: 6px;
    padding: 14px 0;
  }

  .contact {
    gap: 28px;
  }

  .contact p:not(.section-kicker) {
    margin-top: 18px;
    font-size: 17px;
  }

  .contact-actions {
    gap: 12px;
  }

  .button {
    min-height: 48px;
    padding: 13px 20px;
  }

  .portfolio-hero,
  .service-hero,
  .portfolio-grid-section,
  .service-detail,
  .service-gallery,
  .portfolio-cta,
  .service-cta {
    padding-inline: 18px;
  }

  .portfolio-hero,
  .service-hero {
    gap: 24px;
    padding-top: 42px;
    padding-bottom: 44px;
  }

  .portfolio-hero h1,
  .service-hero h1 {
    font-size: clamp(43px, 14vw, 60px);
    line-height: 0.98;
  }

  .portfolio-hero p:not(.section-kicker),
  .service-hero p:not(.section-kicker) {
    margin-top: 18px;
    font-size: 17px;
    line-height: 1.52;
  }

  .portfolio-grid-section,
  .service-detail,
  .service-gallery,
  .portfolio-cta,
  .service-cta {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .portfolio-grid,
  .service-gallery {
    gap: 20px;
  }

  .portfolio-card figure,
  .service-gallery figure {
    aspect-ratio: 16 / 11;
  }

  .service-detail {
    gap: 26px;
  }

  .service-detail h2,
  .service-cta h2,
  .portfolio-cta h2 {
    font-size: clamp(34px, 11vw, 46px);
  }

  .service-detail p,
  .service-detail li,
  .service-cta p,
  .portfolio-cta p {
    font-size: 17px;
    line-height: 1.55;
  }

  footer {
    padding: 20px 18px;
    font-size: 11px;
    letter-spacing: 0.1em;
  }
}
