/* =============================================================================
 * Realcovery Idaho: /gallery.html ("Photos of Our Homes"), 2026-09-29.
 * Grid of thumbnails (site theme tokens, both themes) + a loupe viewer that is
 * ALWAYS dark, whatever the theme, like a photo editor's loupe view.
 * Photos are shown whole (object-fit: contain): nothing is cropped, even in a
 * thumbnail. The page script is /js/gallery.js (no inline script: CSP).
 * ========================================================================== */

/* The shared breadcrumb markup is an <ol> laid out with flex; without this its list numbers
   print ("1. Home 2. 3. ..."). Scoped to this page; the other pages share the same rule set. */
.breadcrumb-inner { list-style: none; }

/* ---- Toolbar: filter chips + live status -------------------------------- */
.gallery-page { padding-bottom: 40px; }
.gallery-toolbar { margin: 0 0 8px; }
.gallery-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gallery-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--gold-border); border-radius: 999px; background: transparent; color: var(--text);
  font-family: var(--sans); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.03em; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.gallery-chip:hover { border-color: var(--gold-border-hover); color: var(--gold); }
.gallery-chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--bg-primary); }
.gallery-chip-count {
  min-width: 26px; padding: 1px 7px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; text-align: center;
  background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--gold-border);
}
.gallery-chip[aria-pressed="true"] .gallery-chip-count { background: rgba(0, 0, 0, 0.18); color: var(--bg-primary); border-color: transparent; }
.gallery-status { text-align: center; font-size: 0.85rem; color: var(--text-dim); margin: 12px 0 0; }

/* ---- One section per house ---------------------------------------------- */
.gallery-house { padding-top: 28px; }
.gallery-house[hidden] { display: none; }
.gallery-house-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 0 0 14px; border-bottom: 1px solid var(--gold-border); padding-bottom: 8px; }
.gallery-house-head h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
.gallery-house-meta { font-size: 0.85rem; color: var(--text-muted); }
.gallery-house-meta a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }

/* ---- Grid (the "grid view") ----------------------------------------------- */
.gallery-grid { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
@media (min-width: 600px) { .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; } }
.gallery-grid > li { min-width: 0; }
.gallery-thumb {
  display: block; position: relative; aspect-ratio: 1 / 1; padding: 6px; border-radius: 4px;
  background: var(--bg-card); border: 1px solid var(--gold-border); color: inherit;
  transition: border-color .15s, box-shadow .15s, transform 160ms var(--ease-out, ease);
}
.gallery-thumb picture { display: block; width: 100%; height: 100%; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumb:hover { border-color: var(--gold-border-hover); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
.gallery-thumb:active { transform: scale(0.98); }
.gallery-thumb:focus-visible { outline: var(--focus-outline); outline-offset: 3px; }
/* the photo last viewed in the loupe stays marked in the grid, like a selection */
.gallery-thumb.is-current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
@media (hover: none) { .gallery-thumb:hover { box-shadow: none; } }

/* ---- CTA ------------------------------------------------------------------ */
.gallery-cta { text-align: center; padding: 48px 24px; margin: 8px auto 60px; max-width: 800px; background: var(--bg-card); border: 1px solid var(--gold-border); border-radius: 4px; }
.gallery-cta h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 14px; }
.gallery-cta p { color: var(--text-muted); margin: 0 auto 24px; font-size: 1rem; line-height: 1.8; max-width: 560px; }
.gallery-cta-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }

/* =============================================================================
 * LOUPE: full-viewport viewer. Hard-coded dark colours on purpose (it stays dark
 * in the light theme). Rows: bar / stage / caption / filmstrip.
 * ========================================================================== */
html.loupe-open, html.loupe-open body { overflow: hidden; }
.loupe {
  position: fixed; inset: 0; z-index: 20000; display: flex; flex-direction: column;
  background: #06090d; color: #e8e4de; font-family: var(--sans);
  opacity: 1; transition: opacity 180ms ease;
}
.loupe[hidden] { display: none; }
.loupe.is-entering { opacity: 0; }
.loupe ::selection { background: #E8A623; color: #06090d; }
.loupe :focus-visible { outline: 3px solid #E8A623; outline-offset: 2px; }

.loupe-bar { flex: none; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 8px 6px 16px; border-bottom: 1px solid rgba(232, 166, 35, 0.18); }
.loupe-heading { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 12px; }
.loupe-title { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.02em; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loupe-counter { flex: none; font-size: 0.85rem; color: #b9c2cd; font-variant-numeric: tabular-nums; }
.loupe-keys { flex: none; font-size: 0.75rem; color: #8b96a3; white-space: nowrap; }
.loupe-keys kbd { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 3px; font-family: var(--sans); font-size: 0.72rem; line-height: 18px; text-align: center; color: #d6dbe1; }
@media (max-width: 899px), (hover: none) { .loupe-keys { display: none; } }
.loupe-actions { flex: none; display: flex; gap: 4px; }
.loupe-btn, .loupe-nav {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: 50%; background: transparent; color: #e8e4de; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.loupe-btn:hover, .loupe-nav:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(232, 166, 35, 0.45); color: #E8A623; }
.loupe-btn svg, .loupe-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.loupe-btn[hidden] { display: none; }
.loupe-btn[aria-pressed="true"] { color: #E8A623; }

.loupe-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 12px 64px; touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.loupe-picture { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; pointer-events: none; }
.loupe-img {
  display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain;
  pointer-events: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); background: #0d131a;
  opacity: 1; transition: opacity 160ms ease;
}
.loupe-img.is-loading { opacity: 0.35; }
.loupe-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 48px; height: 48px; background: rgba(6, 9, 13, 0.55); border-color: rgba(255, 255, 255, 0.14); }
.loupe-prev { left: 8px; }
.loupe-next { right: 8px; }
.loupe-nav[disabled] { opacity: 0.25; cursor: default; pointer-events: none; }

.loupe-info { flex: none; padding: 8px 16px 6px; text-align: center; }
.loupe-caption { font-size: 0.95rem; line-height: 1.5; color: #f1ede7; }
.loupe-house { font-size: 0.8rem; color: #9ba8b8; margin-top: 2px; }
.loupe-house a { color: #E8A623; text-decoration: underline; text-underline-offset: 3px; }
.loupe-house a:hover { color: #f3c46a; }

.loupe-strip { flex: none; display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; padding: 8px 12px 12px; scrollbar-width: thin; scrollbar-color: rgba(232, 166, 35, 0.4) transparent; }
.loupe-film { flex: none; width: 72px; height: 54px; padding: 2px; border: 2px solid transparent; border-radius: 3px; background: #121a23; cursor: pointer; opacity: 0.6; transition: opacity .15s, border-color .15s; }
.loupe-film:hover { opacity: 0.95; }
.loupe-film[aria-current="true"] { border-color: #E8A623; opacity: 1; }
.loupe-film picture, .loupe-film img { display: block; width: 100%; height: 100%; }
.loupe-film img { object-fit: contain; }
.loupe-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Phones: overlay the arrows on the photo edges, smaller filmstrip. */
@media (max-width: 599px) {
  .loupe-bar { padding-left: 12px; min-height: 52px; }
  .loupe-heading { gap: 8px; }
  .loupe-title { font-size: 0.85rem; }
  .loupe-counter { font-size: 0.8rem; }
  .loupe-actions { gap: 0; }
  .loupe-stage { padding: 8px 4px; }
  .loupe-nav { width: 44px; height: 44px; }
  .loupe-prev { left: 4px; }
  .loupe-next { right: 4px; }
  .loupe-caption { font-size: 0.88rem; }
  .loupe-film { width: 56px; height: 42px; }
  .loupe-strip { padding: 6px 8px 10px; }
}
/* Short landscape phones: keep the photo as large as possible. */
@media (max-height: 480px) {
  .loupe-bar { min-height: 44px; padding-top: 0; padding-bottom: 0; }
  .loupe-info { padding: 2px 12px; }
  .loupe-house { display: none; }
  .loupe-strip { display: none; }
}
/* Full screen: the photo gets everything but the bar and caption. */
.loupe:fullscreen .loupe-strip { display: none; }

@media (prefers-reduced-motion: reduce) {
  .loupe, .loupe-img, .gallery-thumb, .gallery-chip, .loupe-film { transition: none; }
  .loupe.is-entering { opacity: 1; }
  .gallery-thumb:active { transform: none; }
}
body.reduce-motion .loupe, body.reduce-motion .loupe-img { transition: none; }
