/* ── Past Jobs Gallery — public section ───────────────────────────────────────
   Styles for #site-gallery-root rendered by /js/site-content/gallery-section.js
   Uses design tokens from styles.css (:root variables).
   ──────────────────────────────────────────────────────────────────────────── */

.sg-section {
  padding: 48px 0 44px;
  background: var(--bg, #f8faf6);
  border-top: 1px solid var(--line, #e2e8f0);
}

.sg-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.sg-heading {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary, #4a7c2f);
  letter-spacing: -0.01em;
}

.sg-subheading {
  margin: 0 0 32px;
  font-size: 0.95rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

/* Grid: 1 col mobile → 2 cols tablet → 3 cols desktop */
.sg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* Card */
.sg-card {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Image area */
.sg-card-images {
  display: grid;
  gap: 2px;
  background: var(--line, #e2e8f0);
}

.sg-card-images--single {
  grid-template-columns: 1fr;
}

.sg-card-images--both {
  grid-template-columns: 1fr 1fr;
}

.sg-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--line, #e2e8f0);
}

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

/* Before / After labels */
.sg-img-label {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  pointer-events: none;
}

.sg-img-label--after {
  background: rgba(74,124,47,0.82);
}

/* Card body */
.sg-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sg-card-title {
  margin: 0;
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text, #1a1a1a);
  line-height: 1.3;
}

.sg-card-area {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary, #4a7c2f);
}

.sg-card-caption {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

/* "View Full Gallery" link */
.sg-view-all {
  margin-top: 28px;
  text-align: center;
}

.sg-view-all-link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary, #4a7c2f);
  text-decoration: none;
  border: 1.5px solid var(--primary, #4a7c2f);
  border-radius: 6px;
  padding: 8px 20px;
  transition: background 0.15s, color 0.15s;
}

.sg-view-all-link:hover,
.sg-view-all-link:focus {
  background: var(--primary, #4a7c2f);
  color: #fff;
  text-decoration: none;
}

/* Full gallery section gets a slightly different background tint */
.sg-section--full {
  background: var(--panel, #fff);
  border-top: 1px solid var(--line, #e2e8f0);
}

/* Responsive tweaks */
@media (max-width: 600px) {
  .sg-section {
    padding: 36px 0 32px;
  }

  .sg-heading {
    font-size: 1.15rem;
  }

  .sg-subheading {
    margin-bottom: 24px;
  }

  /* Stack before/after vertically on very small screens */
  .sg-card-images--both {
    grid-template-columns: 1fr;
  }
}

/* ── Album gallery cards ─────────────────────────────────────────────────────── */

.alb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.alb-card {
  background: var(--panel, #fff);
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
}

.alb-card:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.alb-card-cover {
  aspect-ratio: 16 / 10;
  background: var(--line, #e2e8f0);
  overflow: hidden;
  position: relative;
}

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

.alb-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--muted, #64748b);
}

.alb-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.alb-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.alb-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #1a1a1a);
  line-height: 1.3;
  flex: 1;
}

.alb-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

.alb-badge--ba {
  background: rgba(74,124,47,0.12);
  color: var(--primary, #4a7c2f);
}

.alb-card-meta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary, #4a7c2f);
}

.alb-card-desc {
  margin: 0;
  font-size: 0.87rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.alb-card-count {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
}

.alb-card-footer {
  margin-top: auto;
  padding-top: 12px;
}

.alb-card-btn {
  display: inline-block;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--primary, #4a7c2f);
  text-decoration: none;
  border: 1.5px solid var(--primary, #4a7c2f);
  border-radius: 6px;
  padding: 7px 16px;
  transition: background 0.15s, color 0.15s;
}

.alb-card-btn:hover,
.alb-card-btn:focus {
  background: var(--primary, #4a7c2f);
  color: #fff;
  text-decoration: none;
}

/* ── Album detail view ───────────────────────────────────────────────────────── */

.alb-detail-section {
  background: var(--bg, #f8faf6);
}

.alb-detail-info {
  margin-bottom: 20px;
}

.alb-detail-desc {
  margin: 0;
  font-size: 0.97rem;
  color: var(--muted, #64748b);
  line-height: 1.6;
  max-width: 640px;
}

.alb-share-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.alb-share-btn {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  background: var(--panel, #fff);
  border: 1.5px solid var(--line, #e2e8f0);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.alb-share-btn:hover,
.alb-share-btn:focus {
  border-color: var(--primary, #4a7c2f);
  color: var(--primary, #4a7c2f);
}

.alb-share-btn--fb {
  background: #1877f2;
  color: #fff;
  border-color: #1877f2;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.alb-share-btn--fb:hover,
.alb-share-btn--fb:focus {
  background: #1464d0;
  border-color: #1464d0;
  color: #fff;
}

.alb-share-btn--copy,
.alb-share-btn--native {
  display: inline-flex;
  align-items: center;
}

.alb-img-group {
  margin-bottom: 40px;
}

.alb-img-group-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #64748b);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--line, #e2e8f0);
}

.alb-img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.alb-detail-img-wrap {
  border-radius: 8px;
  overflow: hidden;
  background: var(--line, #e2e8f0);
}

.alb-detail-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.alb-detail-img-caption {
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  padding: 6px 10px 8px;
  margin: 0;
  line-height: 1.4;
  background: var(--panel, #fff);
}

.alb-detail-empty {
  text-align: center;
  color: var(--muted, #64748b);
  padding: 40px 0;
  font-size: 0.95rem;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .alb-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .alb-card:hover {
    transform: none;
    box-shadow: none;
  }

  .alb-img-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
}

/* ── Lightbox ──────────────────────────────────────────────────────────────────
   Activated by gallery-lightbox.js via .glb-active / body.glb-scroll-locked.
   ──────────────────────────────────────────────────────────────────────────── */

body.glb-scroll-locked {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

#gallery-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

#gallery-lightbox.glb-active {
  display: flex;
}

.glb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

/* Centered panel: image + footer */
.glb-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(calc(100vw - 148px), 880px);
  max-height: 90vh;
  padding-top: 52px;
}

.glb-img-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.glb-img {
  max-width: 100%;
  max-height: calc(90vh - 180px);
  object-fit: contain;
  display: block;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

/* Close button */
.glb-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.glb-close:hover,
.glb-close:focus {
  background: rgba(255, 255, 255, 0.28);
  outline: 2px solid rgba(255,255,255,0.4);
  outline-offset: 2px;
}

/* Navigation arrows */
.glb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.glb-arrow:hover,
.glb-arrow:focus {
  background: rgba(255, 255, 255, 0.28);
  outline: 2px solid rgba(255,255,255,0.4);
  outline-offset: 2px;
}

.glb-arrow:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

.glb-arrow--prev {
  left: 16px;
}

.glb-arrow--next {
  right: 16px;
}

/* Footer: type badge + caption + counter */
.glb-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 16px;
  width: 100%;
  text-align: center;
  min-height: 40px;
}

.glb-type-badge {
  display: inline-block;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8da80;
  background: rgba(74, 124, 47, 0.35);
  padding: 3px 11px;
  border-radius: 20px;
}

.glb-caption {
  margin: 0;
  font-size: 0.93rem;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.5;
  max-width: 580px;
}

.glb-counter {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.05em;
}

/* Clickable indicator on gallery images */
.alb-detail-img-wrap,
.sg-img-wrap {
  cursor: pointer;
}

.alb-detail-img-wrap:focus-visible,
.sg-img-wrap:focus-visible {
  outline: 3px solid var(--primary, #4a7c2f);
  outline-offset: 2px;
}

@media (hover: hover) {
  .alb-detail-img-wrap:hover .alb-detail-img,
  .sg-img-wrap:hover .sg-img {
    opacity: 0.88;
    transition: opacity 0.15s;
  }
}

/* Mobile: full-width panel, arrows flush to edges */
@media (max-width: 640px) {
  .glb-panel {
    width: calc(100vw - 92px);
    max-height: 100dvh;
    padding-top: 60px;
  }

  .glb-img {
    max-height: calc(100dvh - 200px);
    border-radius: 3px;
  }

  .glb-arrow {
    width: 44px;
    height: 68px;
    border-radius: 0;
  }

  .glb-arrow--prev {
    left: 0;
    border-radius: 0 6px 6px 0;
  }

  .glb-arrow--next {
    right: 0;
    border-radius: 6px 0 0 6px;
  }

  .glb-footer {
    padding-top: 12px;
    gap: 5px;
  }

  .glb-caption {
    font-size: 0.87rem;
  }
}
