/* ══════════════════════════════════════════════════════════════
   gallery.css — Galerías privadas de clientes
   Depende de las variables de main.css (--terra, --ink, --bg, --card, --serif, --sans).
   ══════════════════════════════════════════════════════════════ */

/* ─── Reset de body para la galería ───────────────────────────── */
.g-body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans, system-ui, sans-serif);
  min-height: 100vh;
  margin: 0;
}

/* ─── Pantalla de contraseña ───────────────────────────────────── */
.g-lock-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.g-lock-card {
  background: var(--card, #fbfaf5);
  border-radius: 12px;
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 2px 24px rgba(34,31,21,.1);
  text-align: center;
}

.g-lock-logo {
  font-family: var(--serif, Georgia, serif);
  font-size: 26px;
  letter-spacing: .06em;
  color: var(--ink);
  margin-bottom: 28px;
}
.g-lock-logo b { color: var(--terra, #a8553a); }

.g-lock-title {
  font-family: var(--serif, Georgia, serif);
  font-weight: 400;
  font-size: 22px;
  margin: 0 0 8px;
}

.g-lock-text {
  color: var(--ink);
  opacity: .65;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.g-error {
  background: rgba(168,85,58,.08);
  border: 1px solid rgba(168,85,58,.3);
  color: var(--terra, #a8553a);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: left;
}

.g-lock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.g-lock-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid rgba(34,31,21,.18);
  border-radius: 6px;
  font-size: 16px;
  background: var(--bg);
  color: var(--ink);
  box-sizing: border-box;
  outline: none;
  transition: border-color .2s;
}
.g-lock-input:focus { border-color: var(--terra, #a8553a); }

.g-lock-btn {
  padding: 13px;
  background: var(--terra, #a8553a);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-family: var(--sans, system-ui, sans-serif);
  cursor: pointer;
  transition: opacity .2s;
}
.g-lock-btn:hover:not(:disabled) { opacity: .85; }
.g-lock-btn:disabled { opacity: .45; cursor: not-allowed; }

.g-lock-foot {
  margin: 20px 0 0;
  font-size: 12px;
  opacity: .5;
}

.g-lock-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--terra, #a8553a);
  text-decoration: none;
  font-size: 14px;
}

/* ─── Header de la galería ─────────────────────────────────────── */
.g-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(214,212,196,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(34,31,21,.1);
}

.g-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.g-brand {
  font-family: var(--serif, Georgia, serif);
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .04em;
}
.g-brand b { color: var(--terra, #a8553a); }

.g-header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Botones de galería ───────────────────────────────────────── */
.g-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1.5px solid rgba(34,31,21,.22);
  border-radius: 6px;
  background: var(--card, #fbfaf5);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s, background .2s;
  white-space: nowrap;
}
.g-btn:hover { border-color: var(--ink); background: var(--bg); }

.g-btn-primary {
  background: var(--terra, #a8553a);
  color: #fff;
  border-color: transparent;
}
.g-btn-primary:hover { background: #944a30; border-color: transparent; }

.g-btn-lg { padding: 13px 28px; font-size: 15px; }

.g-btn-count {
  background: rgba(34,31,21,.12);
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* ─── Página de galería ────────────────────────────────────────── */
.g-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ─── Cabecera de entrega ──────────────────────────────────────── */
.g-delivery-head {
  text-align: center;
  padding: clamp(100px, 14vw, 160px) var(--gutter, 24px) clamp(48px, 6vw, 72px);
  max-width: 760px;
  margin: 0 auto;
}

.g-delivery-eyebrow {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  font-family: var(--hdr, 'Space Mono', monospace);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: .55;
  margin: 0 0 18px;
}

.g-delivery-star {
  font-family: var(--hdr, 'Space Mono', monospace);
  color: var(--terra, #B85C38);
  font-size: 18px;
  line-height: 1;
  opacity: 1;
}

.g-delivery-title {
  font-family: var(--serif, Georgia, serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(38px, 7vw, 72px);
  letter-spacing: -.02em;
  margin: 0 0 12px;
  line-height: 1.05;
  color: var(--ink);
}

.g-delivery-date {
  font-family: var(--hdr, 'Space Mono', monospace);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  opacity: .45;
  margin: 0 0 24px;
}

.g-delivery-msg {
  max-width: 520px;
  margin: 0 auto 28px;
  font-size: 16px;
  line-height: 1.7;
  opacity: .7;
}

.g-delivery-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 28px;
  border-top: 1px solid rgba(34,31,21,.1);
}

/* ─── Barra de proofing ────────────────────────────────────────── */
.g-proof-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 0;
  border-top: 1px solid rgba(34,31,21,.1);
  border-bottom: 1px solid rgba(34,31,21,.1);
  flex-wrap: wrap;
}

.g-proof-tabs {
  display: flex;
  gap: 4px;
}

.g-tab {
  padding: 7px 14px;
  border: 1.5px solid transparent;
  border-radius: 20px;
  background: none;
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  opacity: .55;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.g-tab:hover { opacity: .8; }
.g-tab.active {
  border-color: var(--ink);
  opacity: 1;
  background: rgba(34,31,21,.06);
}

.g-tab-n {
  background: rgba(34,31,21,.12);
  border-radius: 20px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
}

.g-proof-counter {
  font-size: 14px;
  font-weight: 600;
  color: var(--terra, #a8553a);
}

/* ─── Cuadrícula de fotos ──────────────────────────────────────── */
.g-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* Fila por fila (no por columnas): #1 izquierda, #2 derecha, #3 izquierda…
     Impares en la columna izquierda, pares en la derecha. El lightbox va aparte,
     siempre correlativo (1, 2, 3…) porque usa el orden del DOM. */
  grid-auto-flow: row;
  gap: 16px;
}

@media (max-width: 1100px) { .g-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .g-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
@media (max-width: 420px)  { .g-grid { grid-template-columns: 1fr; } }

.g-cell {
  background: var(--card, #fbfaf5);
  border-radius: 8px;
  overflow: hidden;
  transition: opacity .2s;
}

.g-cell.g-cell-hidden { display: none; }

/* Estado de selección */
.g-cell.g-approved .g-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid #5a9e5a;
  border-radius: 8px 8px 0 0;
  pointer-events: none;
}

.g-cell.g-rejected {
  opacity: .45;
}
.g-cell.g-rejected .g-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid rgba(168,85,58,.6);
  border-radius: 8px 8px 0 0;
  pointer-events: none;
}

.g-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  cursor: pointer;
}

.g-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.g-thumb:hover img { transform: scale(1.025); }

.g-overlay {
  position: absolute;
  inset: 0;
  background: rgba(34,31,21,0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s;
}
.g-thumb:hover .g-overlay { background: rgba(34,31,21,.22); }
.g-overlay .g-open-lb { opacity: 0; transform: scale(.85); transition: opacity .2s, transform .2s; }
.g-thumb:hover .g-open-lb { opacity: 1; transform: scale(1); }

.g-cell-foot {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.g-ref {
  font-size: 12px;
  opacity: .45;
  font-variant-numeric: tabular-nums;
}

.g-cell-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* ─── Botones de icono ─────────────────────────────────────────── */
.g-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(34,31,21,.06);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background .2s, color .2s;
  padding: 0;
  flex-shrink: 0;
}
.g-icon-btn:hover { background: rgba(34,31,21,.14); }

/* Aprobar */
.g-approve.g-sel-active { background: rgba(90,158,90,.15); color: #3d7a3d; }
.g-approve.g-sel-active:hover { background: rgba(90,158,90,.25); }

/* Rechazar */
.g-reject.g-rej-active { background: rgba(168,85,58,.12); color: var(--terra, #a8553a); }
.g-reject.g-rej-active:hover { background: rgba(168,85,58,.22); }

/* Overlay en la miniatura para lightbox */
.g-open-lb {
  background: rgba(251,250,245,.9);
  color: var(--ink);
  width: 40px;
  height: 40px;
}
.g-open-lb:hover { background: #fff; }

/* ─── Lightbox ─────────────────────────────────────────────────── */
.g-lb {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(34,31,21,.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.g-lb[hidden] { display: none; }

.g-lb-inner {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 56px 72px 0;
  box-sizing: border-box;
}

.g-lb-img {
  max-width: 100%;
  max-height: calc(100vh - 130px);
  object-fit: contain;
  display: block;
  border-radius: 4px;
}

.g-lb-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  color: rgba(251,250,245,.7);
  font-size: 13px;
}

.g-lb-dl {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(251,250,245,.7);
  text-decoration: none;
  transition: color .2s;
}
.g-lb-dl:hover { color: #fff; }

.g-lb-close,
.g-lb-arrow {
  position: absolute;
  background: rgba(251,250,245,.1);
  border: none;
  color: rgba(251,250,245,.85);
  cursor: pointer;
  border-radius: 50%;
  transition: background .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.g-lb-close:hover,
.g-lb-arrow:hover { background: rgba(251,250,245,.2); }

.g-lb-close {
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 1;
}

.g-lb-arrow {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  font-size: 32px;
  line-height: 1;
}
.g-lb-prev { left: 12px; }
.g-lb-next { right: 12px; }

@media (max-width: 600px) {
  .g-lb-inner { padding: 52px 12px 0; }
  /* Flechas visibles también en móvil: más pequeñas, pegadas al borde y con
     fondo oscuro para que se lean encima de la foto (aquí la imagen ocupa
     casi todo el ancho, no queda hueco lateral como en escritorio). */
  .g-lb-arrow {
    z-index: 2;
    width: 42px;
    height: 42px;
    font-size: 26px;
    background: rgba(34, 31, 21, .5);
    color: #fff;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  .g-lb-arrow:hover,
  .g-lb-arrow:active { background: rgba(34, 31, 21, .7); }
  .g-lb-prev { left: 8px; }
  .g-lb-next { right: 8px; }
}

/* ─── CTAs de pie ──────────────────────────────────────────────── */
.g-foot-ctas {
  margin-top: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.g-foot-note {
  width: 100%;
  text-align: center;
  font-size: 13px;
  opacity: .5;
  margin: 4px 0 0;
}

/* ─── Toast de avisos ──────────────────────────────────────────── */
.g-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 500;
  text-align: center;
  max-width: calc(100vw - 48px);
}
.g-toast.g-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.g-toast.g-toast-warn {
  background: var(--terra, #a8553a);
  color: #fff;
}

/* ─── Cierre / footer cálido de la galería ─────────────────────── */
.g-footer {
  border-top: 1px solid rgba(34, 31, 21, .1);
  margin-top: clamp(48px, 8vw, 96px);
  padding: clamp(56px, 9vw, 100px) 24px clamp(48px, 7vw, 80px);
  text-align: center;
}
.g-footer-eyebrow {
  font-family: var(--hdr, 'Space Mono', monospace);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: .55;
  margin: 0 0 20px;
}
.g-footer-star {
  font-family: var(--hdr, 'Space Mono', monospace);
  color: var(--terra, #a8553a);
}
.g-footer-title {
  font-family: var(--serif, Georgia, serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.12;
  margin: 0 auto 22px;
  max-width: 620px;
  color: var(--ink);
}
.g-footer-referral {
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 16px;
  line-height: 1.65;
  opacity: .7;
  max-width: 460px;
  margin: 0 auto 30px;
}
.g-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 15px;
  margin-bottom: 32px;
}
.g-footer-links a { color: var(--terra, #a8553a); text-decoration: none; }
.g-footer-links a:hover { text-decoration: underline; }
.g-footer-sep { opacity: .35; }
.g-footer-more {
  display: inline-block;
  font-family: var(--hdr, 'Space Mono', monospace);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(34, 31, 21, .25);
  border-radius: 30px;
  padding: 11px 24px;
  transition: background .2s, color .2s, border-color .2s;
}
.g-footer-more:hover {
  background: var(--terra, #a8553a);
  color: #fff;
  border-color: var(--terra, #a8553a);
}
.g-footer-brand {
  margin-top: clamp(40px, 6vw, 64px);
  line-height: 0;
  opacity: .45;
}
.g-footer-brand svg {
  width: clamp(110px, 14vw, 140px);
  height: auto;
  color: var(--ink);
}
