/* Meeture's layout preference: equal panels, aligned rows and centered remainders.
   Keep pigment art and motion independent of the structural grid. */
.creative-hero,
.service-detail,
.empty-editorial,
.atelier-faq,
.auth-identity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.creative-hero .line-hero-copy {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.creative-hero .creative-composition {
  align-self: stretch;
  height: auto;
  min-height: 520px;
}

.portfolio-composition:has(.expression-note) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

/* Six tracks give three equal cards and center one or two remaining cards. */
.work-grid,
.collection-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.work-grid > .work-card,
.collection-grid > .collection-card {
  grid-column: span 2;
  grid-row: auto;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding-top: 0;
  display: flex;
  flex-direction: column;
}

.work-grid > .work-card:nth-child(3n + 1):last-child,
.collection-grid > .collection-card:nth-child(3n + 1):last-child {
  grid-column: 3 / span 2;
}

.work-grid > .work-card:nth-child(3n + 1):nth-last-child(2),
.collection-grid > .collection-card:nth-child(3n + 1):nth-last-child(2) {
  grid-column: 2 / span 2;
}

.work-grid > .work-card:nth-child(3n + 2):last-child,
.collection-grid > .collection-card:nth-child(3n + 2):last-child {
  grid-column: 4 / span 2;
}

.work-grid > .work-card:nth-child(n) .work-image {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  flex: 0 0 auto;
  border: 0;
  padding: 8px;
}

.work-grid > .work-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #fffaf4;
}

.work-bottom {
  flex: 1;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
}

.creative-portfolio .work-grid:has(> .work-card:only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.creative-portfolio .work-grid > .work-card:only-child {
  grid-column: 1;
}

.expression-note {
  align-self: stretch;
  padding: 32px;
  border-radius: 4px;
}

.services-grid,
.studio-locations,
.beauty-path-grid,
.collection-duo,
.booking-form .service-select {
  grid-auto-rows: 1fr;
  align-items: stretch;
}

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

.services-grid > .service-card {
  grid-column: span 2;
  min-width: 0;
}

.services-grid > .service-card:nth-child(odd):last-child {
  grid-column: 2 / span 2;
}

.services-grid > :not(.service-card) {
  grid-column: 1 / -1;
}

.creative-services .services-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.studio-location {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.studio-locations {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.studio-locations > .studio-location {
  grid-column: span 2;
}

.studio-locations > .studio-location:nth-child(odd):last-child {
  grid-column: 2 / span 2;
}

.studio-location > .button {
  margin-top: auto;
  justify-content: space-between;
}

.studio-location-actions {
  margin-bottom: 20px;
}

.beauty-path-grid {
  gap: 16px;
}

.beauty-path-grid > .beauty-path-step:nth-child(n) {
  padding: 24px;
  border: 1px solid var(--line);
}

.service-directory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
}

.service-directory:has(> :only-child) {
  grid-template-columns: minmax(0, 1fr);
}

.service-directory:has(> :nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.service-directory:has(> :nth-child(3):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.service-directory .filter {
  min-width: 0;
  width: 100%;
  white-space: normal;
  text-align: center;
  display: grid;
  place-items: center;
  padding: 12px;
}

.service-detail {
  gap: 36px;
  align-items: stretch;
}

.service-detail-visual {
  height: auto;
  min-height: 410px;
}

.service-detail-copy {
  align-self: stretch;
}

.collection-group {
  display: flex;
  flex-direction: column;
}

.collection-coming {
  flex: 1;
}

/* Published groups can have different counts; stack the groups rather than
   presenting uneven columns. Their cards keep the same grid and image ratio. */
.collection-duo:has(.collection-grid) {
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: auto;
  gap: 48px;
}

.collection-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.collection-copy > div {
  margin-top: auto;
  padding-top: 10px;
}

.collection-copy p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.collection-detail,
.member-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 36px;
}

.member-card {
  width: 100%;
  align-self: stretch;
}

.collection-detail-images {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.collection-detail-images > :nth-child(n) {
  grid-column: span 2;
}

.collection-detail-images > :nth-child(odd):last-child {
  grid-column: 2 / span 2;
}

.email-auth-shell .auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-registration-steps > span {
  flex: 1 1 0;
  min-width: 0;
}

@media (min-width: 761px) and (max-width: 1000px) {
  .work-grid,
  .collection-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .work-grid > .work-card:nth-child(n):nth-last-child(n),
  .collection-grid > .collection-card:nth-child(n):nth-last-child(n) {
    grid-column: span 2;
  }

  .work-grid > .work-card:nth-child(odd):last-child,
  .collection-grid > .collection-card:nth-child(odd):last-child {
    grid-column: 2 / span 2;
  }

  .creative-portfolio .work-grid > .work-card:only-child {
    grid-column: 1;
  }
}

@media (max-width: 900px) {
  .beauty-path-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .creative-hero,
  .portfolio-composition:has(.expression-note),
  .service-detail,
  .empty-editorial,
  .atelier-faq,
  .collection-duo,
  .studio-locations {
    grid-template-columns: minmax(0, 1fr);
  }

  .creative-hero .creative-composition {
    align-self: center;
    min-height: 0;
    height: 365px;
  }

  .portfolio-composition:has(.expression-note) {
    grid-auto-rows: 1fr;
  }

  .work-grid,
  .creative-services .services-grid,
  .services-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-grid > .work-card:nth-child(n):nth-last-child(n),
  .services-grid > .service-card:nth-child(n):nth-last-child(n),
  .studio-locations > .studio-location:nth-child(n):nth-last-child(n) {
    grid-column: 1;
  }

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

  .collection-grid > .collection-card:nth-child(n):nth-last-child(n) {
    grid-column: span 2;
  }

  .collection-grid > .collection-card:nth-child(odd):last-child {
    grid-column: 2 / span 2;
  }

  .service-directory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-directory:has(> :nth-child(3):last-child) {
    grid-template-columns: minmax(0, 1fr);
  }

  .service-detail-visual {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .expression-note {
    padding: 28px;
  }
}

@media (max-width: 600px) {
  .auth-identity-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 480px) {
  .beauty-path-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
