*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #13100e;
  --surface:      #1e1813;
  --surface-deep: #2a1a0f;
  --border:       #3d2e1e;
  --border-hover: #6b5340;
  --accent:       #b91c1c;
  --accent-dark:  #991515;
  --gold:         #c4962a;
  --text:         #f5e6c8;
  --text-muted:   #a89070;
  --text-faint:   #6b5340;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

/* ── Header ── */

.site-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px 12px;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toolbar-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  padding: 9px 10px 9px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-wrap input::placeholder { color: var(--text-faint); }
.search-wrap input:focus { border-color: var(--accent); }

select {
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}
select:focus { border-color: var(--accent); }

.count {
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-add-album {
  padding: 9px 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-add-album:hover { background: var(--accent-dark); }

.logo-link {
  display: flex;
  align-items: center;
  padding-left: 4px;
}
.logo { height: 60px; width: auto; display: block; }

/* Hidden on desktop by default (shown via the mobile media query below); the header's own
   nav (.main-nav) is always visible above that breakpoint, so there's nothing to toggle. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
}

/* Sized to match the mobile logo (32px, see .site-header--main .logo below) rather than a
   generic icon-button size - a bigger toggle read as heavier/oversized next to the small logo. */
.nav-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  pointer-events: none;
}

/* ── Grid ── */

main { padding: 1.25rem 1.5rem 3rem; }

#grid {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.year-label {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 0.6rem;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
}

/* ── Card ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-cover {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-deep);
  position: relative;
  overflow: hidden;
}

.card-cover a {
  display: block;
  width: 100%;
  height: 100%;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.date-badge,
.no-date-badge {
  position: absolute;
  bottom: 4px;
  left: 2px;
  background: rgba(8, 6, 4, 0.8);
  border: 1px solid rgba(61, 46, 30, 0.5);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.date-badge    { color: var(--gold); }
.no-date-badge { color: var(--text-faint); }

.card-body {
  padding: 10px 12px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  letter-spacing: 0.3px;
  flex: 1;
}

.btn-count {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
}
.btn-count:hover { color: var(--gold); }
.btn-count svg { width: 11px; height: 11px; pointer-events: none; flex-shrink: 0; }
.btn-count span { font-size: 10px; font-variant-numeric: tabular-nums; line-height: 1; }

.btn-open-photos {
  display: inline-flex;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 0;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.btn-open-photos:hover { opacity: 1; }
.btn-open-photos svg { width: 13px; height: 13px; pointer-events: none; }

.btn-copy {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 0;
}
.btn-copy:hover { color: var(--gold); }
.btn-copy svg { width: 13px; height: 13px; pointer-events: none; }

#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
}
#toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Footer ── */

.footer {
  text-align: center;
  padding: 0.6rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 11px;
}

.footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.footer a:hover { color: var(--gold); }

.footer-tags {
  display: block;
  margin-top: 0.35rem;
}

/* ── Empty state ── */

.empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-faint);
  font-size: 14px;
}

/* ── Desktop: 33% larger tiles ── */

@media (min-width: 601px) {
  .year-grid {
    grid-template-columns: repeat(auto-fill, minmax(246px, 1fr));
    gap: 1.33rem;
  }

  .year-label { font-size: 18px; }

  .card { border-radius: 11px; }

  .card-body { padding: 13px 16px; }

  .card-title { font-size: 16px; }

  .date-badge,
  .no-date-badge {
    border-radius: 5px;
    padding: 4px 9px;
    font-size: 16px;
  }

  .btn-count svg { width: 15px; height: 15px; }
  .btn-count span { font-size: 13px; }

  .btn-open-photos svg { width: 17px; height: 17px; }

  .btn-copy svg { width: 17px; height: 17px; }
}

/* ── Focused view ── */

.toolbar[hidden] { display: none; }

.back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--gold); }

.focused-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.btn-delete-gallery {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-delete-gallery:hover { background: var(--accent); color: var(--text); }
.btn-delete-gallery svg { width: 14px; height: 14px; flex-shrink: 0; pointer-events: none; }

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal-card {
  width: 100%;
  max-width: 340px;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.auth-modal-card p {
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 14px;
}

.focused-layout {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.thumb-col:empty { display: none; }

.thumb-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 316px;
  flex-shrink: 0;
}

.thumb {
  display: block;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-deep);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.focused-card {
  max-width: 420px;
  margin-bottom: 2rem;
}

.focused-card .card-title { font-size: 18px; }

.focused-card .date-badge,
.focused-card .no-date-badge {
  font-size: 15px;
  padding: 5px 10px;
}

.related-label {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.5px;
  margin-bottom: 0.6rem;
}

/* ── Mobile ── */

@media (max-width: 600px) {
  /* display:contents makes site-header transparent to layout so its children
     (logo-link and toolbar) are treated as direct children of <body>.
     This allows .toolbar to be sticky across the whole page, not just within
     the header's bounds. */
  .site-header {
    display: contents;
  }

  .logo-link {
    display: block;
    width: 100%;
    padding: 0;
  }

  .logo-link picture { width: 100%; }
  .logo { width: 100%; height: auto; }

  .toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    gap: 6px;
    display: flex;
    flex-wrap: wrap;
  }

  .search-wrap { flex: 1 1 100%; }

  .toolbar-controls { flex: 1 1 100%; flex-wrap: wrap; }

  select { flex: 1; }

  .btn-add-album { flex: 1 1 100%; text-align: center; }

  main { padding: 1rem 1rem 2.5rem; }

  .year-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .focused-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    justify-content: center;
  }
  .thumb-col { display: contents; }
  .focused-card { grid-column: 1 / -1; order: -1; max-width: 320px; margin: 0 auto 1rem; }

  .drive-hero-prev, .drive-hero-next { width: 36px; height: 36px; }
  .drive-hero-prev svg, .drive-hero-next svg { width: 18px; height: 18px; }
  .drive-gallery-actions { width: 100%; }
  .btn-drive-action, .drive-gallery-actions .btn-delete-gallery { flex: 1 1 auto; justify-content: center; }
  .drive-gallery-header { margin-bottom: 0.75rem; }
  .focused-header { flex-direction: column; align-items: stretch; }
  .drive-hero { margin-bottom: 0.75rem; }
  .drive-gallery-grid { gap: 0.4rem; }
}

/* ── Add-album page ── */

.add-album-main {
  padding: 2rem 1.5rem 3rem;
  display: flex;
  justify-content: center;
}

.add-album-card {
  width: 100%;
  max-width: 480px;
}

/* Reuses .add-album-card's width/typography for the galerie page's sign-in gate (KRKG-0031),
   which - unlike the add-album page - has no .add-album-main flex wrapper to center it in. */
.galerie-gate {
  margin: 3rem auto;
  padding: 0 1.5rem;
}

.add-album-title {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.add-album-intro {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.add-album-section {
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.add-album-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.add-album-section-title {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.4rem;
}

.add-album-section-intro {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.field input {
  width: 100%;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field input::placeholder { color: var(--text-faint); }
.field input:focus { border-color: var(--accent); }

.field input[type="date"] {
  color-scheme: dark;
}

.add-album-error {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 1rem;
}

.add-album-submit {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.add-album-submit:hover { background: var(--accent-dark); }

.add-album-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.add-album-submit:disabled:hover { background: var(--accent); }

/* ── Drive gallery view ── */

.drive-gallery-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.drive-gallery-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.btn-drive-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-drive-action:hover { border-color: var(--accent); color: var(--gold); }
.btn-drive-action svg { width: 14px; height: 14px; flex-shrink: 0; pointer-events: none; }

.drive-gallery-title {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.drive-gallery-date {
  display: inline-flex;
  align-items: center;
  background: rgba(8, 6, 4, 0.8);
  border: 1px solid rgba(61, 46, 30, 0.5);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.drive-gallery-status[hidden] {
  display: none;
}

.drive-gallery-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 1rem;
}

.drive-gallery-status .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.drive-hero[hidden] {
  display: none;
}

/* Column now (image row, then the attribution caption below it) instead of centering the
   image row directly - see .drive-hero-row, which holds what this rule used to (prev/image/
   next centered in a row) so the caption can sit below that row without becoming a third flex
   item next to .drive-gallery-grid in .drive-gallery-browser's own row on desktop. */
.drive-hero {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.drive-hero-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 900px) {
  .drive-gallery-browser {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
  }

  .drive-gallery-browser .drive-hero {
    flex: 1 1 auto;
    min-width: 0;
    margin-bottom: 0;
    position: sticky;
    top: 220px;
  }

  .drive-gallery-browser .drive-hero-image-wrap img {
    max-height: calc(100vh - 260px);
  }

  .drive-gallery-browser .drive-gallery-grid {
    flex: 0 0 480px;
    grid-template-columns: repeat(3, 1fr);
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
  }
}

.drive-hero-image-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.drive-hero-image-wrap img {
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: 8px;
  cursor: pointer;
  display: block;
}

.drive-hero-prev,
.drive-hero-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(30, 24, 19, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.drive-hero-prev { left: 0.5rem; }
.drive-hero-next { right: 0.5rem; }
.drive-hero-prev:hover,
.drive-hero-next:hover { border-color: var(--accent); color: var(--gold); }
.drive-hero-prev svg,
.drive-hero-next svg { width: 20px; height: 20px; pointer-events: none; }

.btn-download-image {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(30, 24, 19, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-download-image:hover { border-color: var(--accent); color: var(--gold); }

/* "Dodane przez" caption - shows who uploaded the currently-viewed photo and when (see GET
   /gallery-photos/uploaders), hidden entirely when the photo predates attribution tracking or
   the log entry is otherwise missing. A caption below the frame (not an overlay on top of the
   photo, per user feedback: it was obscuring part of the image) - .drive-hero-row/
   .lightbox-image-wrap are the actual image row/box, this sits below/after them as a normal,
   centered block instead. */
.photo-attribution {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem auto 0;
  padding: 0.3rem 0.75rem;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.photo-attribution img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.photo-attribution .photo-attribution-name {
  color: var(--text);
  font-weight: 600;
}
.btn-download-image svg { width: 17px; height: 17px; pointer-events: none; }

.drive-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1px;
  gap: 0.5rem;
}

.drive-gallery-thumb {
  display: block;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s;
}
.drive-gallery-thumb:hover { border-color: var(--accent); }
.drive-gallery-thumb.active { border-color: var(--accent); }

.drive-gallery-expanded {
  grid-column: 1 / -1;
  position: relative;
  border: none;
  background: none;
  overflow: visible;
  cursor: default;
}

.drive-gallery-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
  z-index: 200;
}

.lightbox-image-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 75vh;
}

.lightbox-image-wrap img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.lightbox-filmstrip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  max-width: 90vw;
  padding: 0.25rem;
}

.lightbox-filmstrip-thumb {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-deep);
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s;
}
.lightbox-filmstrip-thumb:hover { opacity: 1; }
.lightbox-filmstrip-thumb.active { opacity: 1; border-color: var(--accent); }

.lightbox-filmstrip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 2;
  background: rgba(30, 24, 19, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { border-color: var(--accent); color: var(--gold); }

.lightbox-close { top: 1rem; right: 1rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-prev svg,
.lightbox-next svg { width: 22px; height: 22px; pointer-events: none; }

/* ── Loading spinner ── */

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  display: block;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(245, 230, 200, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.page-spinner[hidden] {
  display: none;
}

.page-spinner {
  display: flex;
  justify-content: center;
  padding: 4rem 0;
}

.drive-hero-image-wrap .spinner,
.lightbox-image-wrap .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -16px 0 0 -16px;
  z-index: 1;
}

.drive-hero-image-wrap.loaded .spinner,
.lightbox-image-wrap.loaded .spinner {
  display: none;
}

/* ── Direct photo upload (Dodaj galerię) ── */

.upload-signin {
  margin-bottom: 1.5rem;
}

.upload-signed-in {
  margin-bottom: 1.5rem;
  font-size: 14px;
  color: var(--text-muted);
}

.upload-forbidden {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  color: var(--accent);
}

.upload-reauth {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
}

.upload-reauth p {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.upload-success {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--gold);
  border-radius: 6px;
  font-size: 14px;
}

.upload-success p {
  margin-bottom: 0.5rem;
}

.upload-success a {
  color: var(--gold);
}


.upload-progress {
  margin: 1rem 0;
  font-size: 13px;
  color: var(--text-muted);
}

.upload-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--surface-deep);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.upload-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.2s ease;
}

.upload-failed-list {
  color: var(--accent);
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

/* ── Wojownicy self-service photo upload ── */

.wrzuc-preview-wrap {
  margin-top: 1.5rem;
}

.wrzuc-preview-wrap .people-grid {
  padding: 1.5rem 0;
  max-width: none;
}

.wrzuc-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.wrzuc-actions .add-album-submit {
  width: auto;
  flex: 1;
}

.btn-cancel {
  padding: 10px 1.25rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-cancel:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Crop affordance on the Wrzuc preview only - person-tile.js only renders these when called
   with {editable: true}, so the real About Us grids (o-nas.js, editable left at its default
   false) never get them. */
.photo-crop-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(30, 24, 19, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-crop-btn:hover { border-color: var(--accent); color: var(--gold); }
.photo-crop-btn svg { width: 16px; height: 16px; pointer-events: none; }

.person-gallery-item {
  position: relative;
  flex-shrink: 0;
}
.person-gallery-item .photo-crop-btn {
  width: 22px;
  height: 22px;
  top: 2px;
  right: 2px;
}
.person-gallery-item .photo-crop-btn svg { width: 11px; height: 11px; }

.crop-modal[hidden] {
  display: none;
}

.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  z-index: 300;
}

.crop-modal-inner {
  width: min(90vw, 600px);
  height: min(70vh, 600px);
  background: var(--surface-deep);
}

/* Cropper.js hides the source <img> itself once it initializes and renders its own canvas/
   layers in its place - this just bounds the space it has to work with. */
.crop-modal-inner img {
  display: block;
  max-width: 100%;
}

.crop-modal-actions {
  display: flex;
  gap: 0.75rem;
}

.crop-modal-actions .add-album-submit,
.crop-modal-actions .btn-cancel {
  width: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.crop-modal-error {
  color: var(--accent);
  font-size: 14px;
}

/* ── Main Navigation (Main Site) ── */

/* flex, not grid: .header-actions (nav-auth-slot + nav-toggle) needs to stay pinned to the
   row's end on every breakpoint while .main-nav is free to wrap onto its own line on mobile -
   see the 768px block below. */
.site-header--main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

/* Groups the sign-in avatar with the hamburger toggle so both stay visible in the header's
   top row even when .main-nav is collapsed on mobile - previously the avatar lived inside
   .main-nav itself and was hidden behind the hamburger until the menu was opened. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Krucze Galerie's own page (see galerie/index.html, dodaj-galerie.html) already has its own
   sticky .site-header with the search/sort/add-album toolbar - stacking a second sticky bar on
   top of it would need its own scroll-offset math to avoid overlapping. Simplest fix: this
   variant of the standard nav bar just scrolls away normally instead. */
.site-header--static {
  position: static;
  top: auto;
}

/* align-items:center (not the flex default of stretch) - otherwise taller items (the
   .nav-item-dropdown wrapper, the Google sign-in button) get stretched to the row's full
   height and then internally centered within that extra space, while a plain .nav-item <a>
   just sits at the top of its own stretched box - visibly misaligning "My, Wojownicy" and
   "Zaloguj się" below the plain text items instead of sharing their baseline. */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.nav-item {
  padding: 0.5rem 0;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.nav-item--active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Just red text, same on desktop and mobile - no background/glow/pill treatment. */
.nav-item--highlighted {
  color: var(--accent);
  font-weight: 600;
}

.nav-item--highlighted:hover {
  color: var(--gold);
}

/* Desktop: hover-triggered floating dropdown for the Wojownicy nav item. Collapses to a
   static always-visible nested list on mobile instead (see the 768px block below) - no JS
   needed for either mode beyond the existing hamburger toggle. */
/* display:flex here (not just position:relative) so its child .nav-item link is blockified
   the same way .main-nav's direct <a> children are - otherwise the link stays inline (an <a>'s
   default), and inline layout's line-box metrics sit it a few pixels higher than its own
   wrapper, visibly misaligned against the other top-level nav items. */
.nav-item-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0;
  z-index: 20;
}

.nav-item-dropdown:hover .nav-dropdown-menu,
.nav-item-dropdown:focus-within .nav-dropdown-menu {
  display: block;
}

.nav-subitem {
  display: block;
  padding: 0.5rem 1rem;
  border-bottom: none;
  white-space: nowrap;
}

/* Lives in .header-actions (top bar, next to the hamburger) - holds only the avatar once
   signed in, nothing while signed out. The "Zaloguj" button and "Panel admina" link live in
   the menu itself instead (.nav-signin-slot / #nav-admin-link below), not here - see nav.js. */
.nav-auth-slot {
  display: flex;
  align-items: center;
}

/* Wraps the Google-rendered sign-in button as a .main-nav child, so it gets the same row
   treatment as the other menu items rather than sitting flush against them unstyled. */
.nav-signin-slot {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
}

/* An unconditional `display` here would otherwise beat the browser's own [hidden] rule
   (author styles win over the UA stylesheet regardless of specificity) - nav.js toggles the
   `hidden` attribute on this element once signed in, and without this override the button
   kept showing even though it was actually hidden=true. */
.nav-signin-slot[hidden] {
  display: none;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: block;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* ── Banner Carousel ── */

/* aspect-ratio (not a height:100% chain) is what actually gives #banner-carousel and
   .carousel-image a definite height to size against - .banner-section previously had no
   explicit height (just a max-height cap), so height:100% on its children never resolved to
   anything real and silently fell back to auto/min-height, producing mismatched box sizes
   (carousel taller than its own parent, image shorter than both) and the odd
   dead-space-plus-cropping look on mobile. */
.banner-section {
  width: 100%;
  aspect-ratio: 21 / 9;
  max-height: 500px;
  overflow: hidden;
  background: var(--surface-deep);
}

#banner-carousel {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-nav {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 5;
}

.carousel-btn {
  background: rgba(20, 20, 20, 0.7);
  border: 1px solid var(--border-hover);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.carousel-btn:hover {
  background: rgba(20, 20, 20, 0.9);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Main Content Layout ── */

.main-content {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 3rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

.content-left {
  min-width: 0;
}

/* Single-column prose pages (O nas, Nabór, Kontakt, Kruczy Turniej) - no .content-right
   sidebar, so the two-column grid default would leave a dead empty column instead of
   centering the text. */
.main-content--single {
  grid-template-columns: 1fr;
  max-width: 900px;
}

.content-section .content-image {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

.content-section figcaption {
  color: var(--text);
  opacity: 0.7;
  font-size: 0.85rem;
  margin-top: -1rem;
  margin-bottom: 1.5rem;
}

.content-section h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: 1px;
}

.content-section h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.content-section h3 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.content-section p {
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 1rem;
}

.content-section ul {
  list-style: none;
  padding-left: 0;
}

.content-section li {
  padding: 0.5rem 0 0.5rem 2rem;
  position: relative;
  color: var(--text);
  line-height: 1.6;
}

.content-section li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.content-section a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: all 0.2s ease;
}

.content-section a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Category pages (Blachowi, Kandydaci, ...) render their intro paragraph directly in <main>
   rather than inside .content-section, so links there need the same treatment repeated here. */
.category-intro a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: all 0.2s ease;
}

.category-intro a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Pushed down to line up with the first Facebook post tile, not with the "Aktualności"
   heading above it - matches the h1's own rendered height + margin-bottom (measured, since
   the two columns are independent grid items with no shared row to align them automatically). */
.content-right {
  min-width: 0;
  margin-top: 70px;
}

.instagram-embed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  padding: 1rem;
}

/* ── Instagram feed widget ── */

.ig-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s;
}

.ig-header:hover {
  color: var(--accent);
}

.ig-header svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--accent);
}

.ig-posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 1rem;
}

.ig-post {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-deep);
  border-radius: 4px;
}

.ig-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.ig-post:hover img {
  transform: scale(1.05);
}

.ig-more-link {
  display: block;
  text-align: center;
  padding: 0.6rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s, border-color 0.15s;
}

.ig-more-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.ig-feed-empty,
.ig-feed-error {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── YouTube feed widget ── */

.youtube-embed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  padding: 1rem;
  margin-top: 1.5rem;
}

.yt-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.15s;
}

.yt-header:hover {
  color: var(--accent);
}

.yt-header svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--accent);
}

.yt-videos-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.yt-video {
  display: flex;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.yt-video-thumb {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-deep);
}

.yt-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.yt-video-duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(8, 6, 4, 0.85);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
}

.yt-video-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.yt-video-title {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-video-date {
  font-size: 12px;
  color: var(--text-faint);
  margin: 0;
}

.yt-more-link {
  display: block;
  text-align: center;
  padding: 0.6rem;
  background: var(--surface-deep);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.15s, border-color 0.15s;
}

.yt-more-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.yt-feed-empty,
.yt-feed-error {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Compact Instagram/YouTube widgets (inlined between Facebook posts on mobile - see
   facebook-feed.js's render()). Single scrollable row, no header text beyond a small label,
   no "see more" link - deliberately lighter than the full sidebar versions. ── */

.inline-widget-slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
}

/* Qualified with the .inline-widget-slot ancestor (rather than bare .ig-compact-header etc.)
   to out-specificity .content-section a - these slots live inside .content-section now (the
   full-size sidebar versions never did), so without this they'd inherit that rule's red
   border-bottom and color on every link here, same as the .fb-post-date/.facebook-link-btn
   fixes elsewhere in this file. */
.inline-widget-slot a.ig-compact-header,
.inline-widget-slot a.yt-compact-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: none;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.inline-widget-slot a.ig-compact-header:hover,
.inline-widget-slot a.yt-compact-header:hover {
  color: var(--accent);
  border-bottom: none;
}

.ig-compact-header svg,
.yt-compact-header svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--accent);
}

.ig-compact-row,
.yt-compact-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.inline-widget-slot a.ig-compact-post {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-deep);
  border-bottom: none;
}

.ig-compact-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.inline-widget-slot a.yt-compact-post {
  flex: 0 0 150px;
  border-bottom: none;
}

.yt-compact-thumb {
  position: relative;
  width: 150px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-deep);
}

.yt-compact-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Responsive Main Site ── */

@media (max-width: 1024px) {
  .main-nav {
    gap: 1.5rem;
    font-size: 12px;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 1rem;
  }

  /* No order override here (there used to be one, order: -1, promoting Instagram/YouTube
     above Aktualności on mobile) - content-right is secondary/supplementary on desktop (a
     sidebar beside the main content), so it should stay secondary on mobile too (below, in
     source order) rather than flipping to the first thing visitors see. */
}

@media (max-width: 768px) {
  .site-header--main {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  /* Instagram/YouTube move inline between Facebook posts on mobile (compact single-row
     widgets, see facebook-feed.js's render()) rather than showing here too - hidden instead
     of just left empty, since .instagram-embed/.youtube-embed would otherwise still render
     as visible empty-ish card chrome. */
  .content-right {
    display: none;
  }

  /* The old gallery header's mobile rule (.logo { width: 100%; height: auto })
     bleeds onto this header too since both share the .site-header base class -
     override it here with higher specificity so the main-site logo stays small
     regardless of stylesheet order. */
  .site-header--main .logo-link {
    width: auto;
    padding: 0;
  }

  .site-header--main .logo {
    height: 32px;
    width: auto;
  }

  .nav-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    flex-basis: 100%;
    font-size: 15px;
  }

  .main-nav.is-open {
    display: flex;
  }

  .banner-section {
    aspect-ratio: 16 / 9;
    max-height: 280px;
  }

  .nav-item {
    padding: 0.85rem 0;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
  }

  .nav-item:last-child {
    border-bottom: none;
  }

  /* #nav-admin-link and .nav-signin-slot are the true trailing items in the menu (see nav.js) -
     only one is ever visible at a time, and whichever one is hidden still counts as the
     structural :last-child, so the rule above never reaches the one that's actually showing. */
  #nav-admin-link {
    border-bottom: none;
  }

  /* .nav-item-dropdown is display:flex (row, centered) for desktop's single-line nav bar -
     on mobile it needs to stack instead: the Wojownicy link on its own row, the submenu
     block below it. Without this override, flex row + align-items:center from the desktop
     rule puts them side by side and vertically centers "Wojownicy" against the whole
     submenu's height. */
  .nav-item-dropdown {
    flex-direction: column;
    align-items: stretch;
  }

  /* Mobile: no hover, so the dropdown becomes a static, always-visible nested indented
     list instead of a hidden hover panel - .nav-item-dropdown's own .nav-item (Wojownicy)
     stays a normal top-level row, and the submenu just renders inline beneath it. */
  .nav-dropdown-menu {
    display: block;
    position: static;
    border: none;
    padding: 0;
    background: transparent;
  }


  .nav-subitem {
    padding-left: 1.5rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-subitem:last-child {
    border-bottom: none;
  }

  .main-content {
    grid-template-columns: 1fr;
    padding: 1.5rem 0.75rem;
  }

  .content-section h1 {
    font-size: 1.75rem;
  }

  .content-section h2 {
    font-size: 1.2rem;
  }

  .carousel-nav {
    bottom: 12px;
    gap: 8px;
  }

  .carousel-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ── Social Media Feed ── */

.social-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.social-post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
}

.social-post:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.social-post-link {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
}

.social-post img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.social-post-caption {
  padding: 1rem;
  background: var(--surface-deep);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.social-post-caption p {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.social-post-caption time {
  font-size: 12px;
  color: var(--text-muted);
}

.social-feed-empty,
.social-feed-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.social-feed.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Facebook Feed ── */

#facebook-feed {
  min-height: 300px;
}

.fb-posts-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.fb-post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

/* .fb-post a.fb-post-date/.fb-post-engagement (rather than just the single class) is needed
   to out-specificity .content-section a, which otherwise wins the cascade (class+type beats
   a single class) and forces its own border-bottom onto these - a bright red line under the
   date, and an overridden bottom-border color that broke .fb-post-engagement's intended
   subtle divider. */
.fb-post a.fb-post-date {
  display: block;
  padding: 1rem 1rem 0.5rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: none;
  transition: color 0.15s;
}

.fb-post a.fb-post-date:hover {
  color: var(--gold);
  border-bottom: none;
}

.fb-post-media {
  width: 100%;
  max-height: 500px;
  overflow: hidden;
  background: var(--surface-deep);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fb-post-media img {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  display: block;
}

.fb-post a.fb-post-engagement {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-deep);
  text-decoration: none;
  color: var(--text-muted);
  transition: color 0.15s;
}

.fb-post a.fb-post-engagement:hover {
  color: var(--gold);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.fb-post-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.fb-post-stat svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  pointer-events: none;
}

.fb-post-fb-icon {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.fb-post-fb-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}

.fb-post-content {
  padding: 1rem;
  background: var(--surface-deep);
}

.fb-post-content p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Long posts get clamped to 16 lines with a "Rozwiń" button (facebook-feed.js removes the
   button itself for posts short enough that the clamp never kicks in). */
.fb-post-text {
  display: -webkit-box;
  -webkit-line-clamp: 16;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fb-post-text--expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.fb-post-expand {
  display: block;
  margin-top: 0.5rem;
  padding: 0;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.fb-post-expand:hover {
  color: var(--gold);
}

.facebook-link-container {
  text-align: center;
  margin-top: 2rem;
}

/* .facebook-link-container a.facebook-link-btn (rather than just .facebook-link-btn) is
   needed to out-specificity .content-section a above, which otherwise wins the cascade
   (class+type selector beats a single class) and paints the button's text the same red as
   its own background - invisible except while :hover swaps it to gold. */
.facebook-link-container a.facebook-link-btn {
  display: inline-block;
  padding: 1rem 2rem;
  background: var(--accent);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  border-bottom: none;
  transition: background 0.15s;
  letter-spacing: 0.5px;
}

.facebook-link-container a.facebook-link-btn:hover {
  background: var(--accent-dark);
  color: var(--text);
  border-bottom: none;
}

.fb-load-more-wrap {
  text-align: center;
  margin-top: 1.5rem;
}

.fb-load-more-btn {
  padding: 0.65rem 1.5rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.fb-load-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.fb-feed-empty,
.fb-feed-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.loading-spinner {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

/* ── O nas: person tile grid ── */

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  padding: 2rem 1.25rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
}

.person-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  padding: 1.25rem;
  transition: border-color 0.15s, transform 0.15s;
}

.person-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.person-name {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

/* Fixed aspect-ratio so every tile in the grid is the same size regardless of a photo's own
   resolution/orientation - object-fit:contain (not cover) then scales each photo to fit
   inside that fixed box without cropping it, letterboxing into the surface-deep background
   instead. 3:4 was picked because most of the migrated photos are portrait; it's a compromise,
   not a perfect fit for every photo, but no fixed ratio can be without cropping something.
   max-width caps it well under the tile's own width and centers it - the tile doesn't need a
   full-width photo when clicking through to the lightbox is one tap away for the full view. */
.person-main-photo {
  position: relative;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-deep);
  margin: 0 auto 0.75rem;
  cursor: pointer;
}

.person-main-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.15s;
}

.person-main-photo:hover img {
  transform: scale(1.03);
}

/* In memoriam (see admin.js's "Oznacz jako in memoriam" toggle, person-tile.js's
   inMemoriam-driven markup): every photo of the person renders grayscale, and the main photo
   additionally gets a black ribbon banner across its top-left corner. The ribbon is a plain
   rotated bar clipped by .person-main-photo's own overflow:hidden, not a separate asset. */
.person-tile--in-memoriam .person-main-photo img,
.person-tile--in-memoriam .person-gallery img {
  filter: grayscale(100%);
}

.in-memoriam-ribbon {
  position: absolute;
  bottom: 22px;
  right: -42px;
  width: 150px;
  height: 24px;
  background: #000;
  transform: rotate(-45deg);
  transform-origin: center;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.person-gallery {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.person-gallery img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}

.person-gallery img:hover {
  opacity: 0.8;
}

.person-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

@media (max-width: 700px) {
  .people-grid {
    grid-template-columns: 1fr;
    padding: 1.5rem 1rem 3rem;
  }
}

