/* Galería de las fichas de proyecto — ver js/at-gallery.js */

.at-gallery { margin-top: 40px; }

/* Sin JS: las miniaturas en grilla, sin pestañas. */
.at-gallery .atg-group {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.at-gallery .atg-group + .atg-group { margin-top: 8px; }
.at-gallery .atg-group img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--radius, 4px); display: block;
}
.at-gallery.atg-ready .atg-group { display: none; }

/* Pestañas */
.atg-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border, #E2DDD4);
  margin-bottom: 20px;
}
.atg-tab {
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2, #4B5563);
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 14px 16px 12px; min-height: 44px; margin-bottom: -1px;
  cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.atg-tab:hover { color: var(--text-1, #111827); }
.atg-tab.is-active { color: var(--text-1, #111827); border-bottom-color: var(--slate, #7B9EAB); }
.atg-tab-count {
  display: inline-block; margin-left: 6px;
  font-weight: 500; color: var(--slate-dark, #5C7E8C);
}

/* Visor */
.atg-stage {
  position: relative;
  display: block; width: fit-content; max-width: 100%; margin: 0 auto;
  min-height: 200px; min-width: min(100%, 280px);
  border-radius: var(--radius, 4px);
  overflow: hidden; outline: none;
}
.atg-stage:focus-visible { box-shadow: 0 0 0 2px var(--slate, #7B9EAB); }
.atg-main {
  width: auto; max-width: 100%; height: auto; max-height: min(62vh, 640px);
  object-fit: contain; display: block;
  cursor: zoom-in; user-select: none;
  transition: opacity 0.25s ease;
}
.atg-main.is-loading { opacity: 0.35; }

.atg-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.88); color: var(--text-1, #111827);
  border: 1px solid rgba(17,24,39,0.08);
  box-shadow: 0 4px 16px rgba(17,24,39,0.12);
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.atg-arrow:hover { background: var(--slate, #7B9EAB); color: #fff; }
.atg-arrow[hidden] { display: none; }
.atg-prev { left: 16px; }
.atg-next { right: 16px; }

.atg-expand {
  position: absolute; top: 14px; right: 14px;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.88); color: var(--text-1, #111827);
  border: 1px solid rgba(17,24,39,0.08); cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.atg-expand:hover { background: var(--slate, #7B9EAB); color: #fff; }

.atg-counter {
  position: absolute; bottom: 14px; right: 14px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  color: #fff; background: rgba(17,24,39,0.62);
  padding: 6px 12px; border-radius: 999px;
}

/* Tira de miniaturas */
.atg-strip {
  display: flex; gap: 8px; margin-top: 10px;
  overflow-x: auto; scroll-snap-type: x proximity;
  padding-bottom: 6px; scrollbar-width: thin;
}
.atg-strip[hidden] { display: none; }
.atg-thumb {
  flex: 0 0 auto; width: 104px; height: 72px; padding: 0;
  border: 2px solid transparent; border-radius: var(--radius, 4px);
  overflow: hidden;
  cursor: pointer; opacity: 0.62; scroll-snap-align: center;
  transition: opacity 0.2s, border-color 0.2s;
}
.atg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.atg-thumb:hover { opacity: 1; }
.atg-thumb.is-active { opacity: 1; border-color: var(--slate, #7B9EAB); }

/* Pantalla completa */
.atg-lb {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(10,14,20,0.96);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.atg-lb.is-open { opacity: 1; pointer-events: auto; }
.atg-lb-img {
  max-width: 92vw; max-height: 86vh; object-fit: contain;
  border-radius: var(--radius, 4px); user-select: none;
}
.atg-lb .atg-arrow {
  position: fixed;
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.18); box-shadow: none;
}
.atg-lb .atg-arrow:hover { background: rgba(123,158,171,0.35); }
.atg-lb-prev { left: 20px; }
.atg-lb-next { right: 20px; }
.atg-lb-close {
  position: fixed; top: 20px; right: 20px;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.18); cursor: pointer;
}
.atg-lb-counter {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-size: 12px; font-weight: 500; letter-spacing: 0.1em;
  color: rgba(255,255,255,0.6);
}

@media (max-width: 768px) {
  .atg-stage { min-height: 160px; }
  .atg-arrow { width: 40px; height: 40px; }
  .atg-prev { left: 8px; }
  .atg-next { right: 8px; }
  .atg-thumb { width: 80px; height: 56px; }
  .atg-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .atg-tabs::-webkit-scrollbar { display: none; }
  .atg-tab { flex: 0 0 auto; white-space: nowrap; padding: 12px 10px 10px; letter-spacing: 0.06em; }
  .atg-lb-prev { left: 8px; }
  .atg-lb-next { right: 8px; }
  .atg-lb-img { max-width: 100vw; max-height: 80vh; border-radius: 0; }
}
