/* Styles for the Gallery page, the four collection pages, and the photo viewer.
   Shared tokens, header, buttons, and frames live in styles.css. */

/* ---------- Page headings ---------- */
.page-head { text-align: center; padding: 56px 0 40px; }
.page-head .back {
  display: inline-block;
  padding: 11px 6px;
  font-family: var(--sans);
  font-size: 0.9rem;
  margin-bottom: 12px;
  text-underline-offset: 4px;
}
.page-head h1 {
  font-weight: 400;
  font-size: clamp(2.6rem, 10vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}
.page-head .lede {
  font-size: clamp(1.15rem, 3.6vw, 1.4rem);
  line-height: 1.45;
  max-width: 28em;
  margin: 0 auto;
}
.page-head .lede a { text-underline-offset: 4px; }
.sub-title {
  font-weight: 400;
  font-size: clamp(1.5rem, 5vw, 2rem);
  text-align: center;
  margin: 0 0 24px;
}

@media (prefers-reduced-motion: no-preference) {
  .page-head > .wrap > * {
    opacity: 0;
    animation: arrive 0.8s ease forwards;
  }
  .page-head > .wrap > *:nth-child(2) { animation-delay: 0.08s; }
  .page-head > .wrap > *:nth-child(3) { animation-delay: 0.16s; }
  .page-head > .wrap > *:nth-child(4) { animation-delay: 0.24s; }
  @keyframes arrive {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Gallery hub: the rooms ---------- */
.rooms {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 1000px;
  display: grid;
  gap: 52px;
}
.room-link { display: block; text-decoration: none; }
.room .frame {
  padding: 7px;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.room-link:hover .frame,
.room-link:focus-visible .frame {
  transform: translateY(-4px);
  box-shadow: 0 34px 40px -26px rgba(0, 0, 0, 0.6);
}
.room .thumb img { transition: transform 0.8s ease; }
.room-link:hover .thumb img { transform: scale(1.04); }
.room h2 {
  font-weight: 400;
  font-size: clamp(1.9rem, 6vw, 2.5rem);
  line-height: 1.1;
  margin: 18px 0 4px;
}
.room p { font-size: 1.12rem; line-height: 1.45; max-width: 28em; }
.room .enter {
  display: inline-block;
  margin-top: 2px;
  padding: 11px 0 9px;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

@media (min-width: 720px) {
  .rooms { grid-template-columns: 1fr 1fr; gap: 72px 56px; }
  .room:nth-child(even) { margin-top: 64px; }
}

/* ---------- Collection page: photo grid ---------- */
.g-section { max-width: 1000px; margin: 0 auto; }
.g-section + .g-section { margin-top: 56px; }
.group-title {
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.3rem, 4.5vw, 1.7rem);
  text-align: center;
  margin: 0 0 20px;
}
.g-grid {
  list-style: none;
  padding: 0;
  margin: 0 auto;
}
.g-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}
.g-btn .frame { padding: 5px; }
.g-btn img { display: block; width: 100%; height: auto; }
.g-btn:hover .frame,
.g-btn:focus-visible .frame {
  transform: translateY(-3px);
  box-shadow: 0 26px 34px -24px rgba(0, 0, 0, 0.55);
}

/* Columns: the stacked look (Pets). Photos are placed by gallery.js into balanced columns. */
.g-grid--columns { display: flex; align-items: flex-start; gap: 14px; }
.g-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }

/* Rows: even rows where wide photos get more room (People, Cars, Businesses).
   Sizes are set by gallery.js. */
.g-grid--rows {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.g-grid--rows .g-item { flex: none; width: 45%; height: 200px; }
.g-grid--rows .g-btn,
.g-grid--rows .g-btn .frame { height: 100%; }
.g-grid--rows .g-btn img { height: 100%; object-fit: cover; }

.empty { text-align: center; color: var(--muted); font-style: italic; }

@media (min-width: 720px) {
  .g-grid--columns { gap: 22px; }
  .g-col { gap: 22px; }
  .g-grid--rows { gap: 20px; }
  .g-btn .frame { padding: 6px; }
}

/* ---------- Collection page: films ---------- */
.films {
  list-style: none;
  padding: 0;
  margin: 0 auto 56px;
  max-width: 780px;
  display: grid;
  gap: 32px;
}
.film-title { text-align: center; font-style: italic; margin-top: 10px; }
.film .thumb iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  z-index: 1;
}

/* ---------- Collection page: closing section ---------- */
.end-band { text-align: center; }
.end-band .wrap { max-width: 640px; }
.end-band h2 {
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 16px;
}
.end-band p { font-size: 1.2rem; margin-bottom: 26px; }
.end-band .book-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- Photo viewer ---------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(64px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.lb[hidden] { display: none; }
.lb-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 16px;
}
.lb-stage { margin: 0; max-width: 100%; display: flex; flex-direction: column; align-items: center; }
.lb-frame { display: inline-block; max-width: 100%; padding: 6px; }
.lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 250px);
  max-height: calc(100dvh - 250px);
  width: auto;
  height: auto;
}
.lb-cap { font-style: italic; margin-top: 10px; min-height: 1.5em; text-align: center; }
.lb-bar { display: flex; align-items: center; gap: 16px; margin-top: 10px; }
.lb-bar button[hidden] { display: none; }
.lb-count { font-family: var(--sans); font-size: 0.9rem; min-width: 5.5em; text-align: center; }
.lb-hint { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin-top: 12px; text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .lb:not([hidden]) { animation: lbin 0.25s ease; }
  @keyframes lbin { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Next gallery card (bottom of each collection page) ---------- */
.next-block { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--hair); }
.end-band .next-kicker { font-style: italic; color: var(--muted); font-size: 1.15rem; margin: 0 0 18px; }
.next-card { display: block; max-width: 340px; margin: 0 auto; text-decoration: none; }
.next-card .frame { padding: 6px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.next-card:hover .frame, .next-card:focus-visible .frame { transform: translateY(-3px); box-shadow: 0 28px 34px -24px rgba(0, 0, 0, 0.55); }
.next-title { display: block; font-size: 2rem; line-height: 1.1; margin-top: 16px; }
.next-link {
  display: inline-block;
  padding: 8px 0 6px;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.end-band .next-all { margin: 10px 0 0; font-size: 1.1rem; }
.end-band .next-all a { display: inline-block; padding: 10px 4px; text-underline-offset: 4px; }
