/* Galería y visor de plantillas web. Los tokens son los de staging/shaders/shaders.css, copiados
   (no importados): la sección se despliega sola. Chrome neutro: el color lo ponen las plantillas.
   El rosa del acento sólo aparece en el foco y en el candado Pro, siempre sobre blanco. */

:root {
  --bg: #ffffff;
  --canvas: #f7f7f7;
  --fg: #202020;
  --fg-strong: #000000;
  --muted: #858585;
  --faint: #b3b3b3;
  --chip: rgba(0, 0, 0, 0.06);
  --chip-hover: rgba(0, 0, 0, 0.09);
  --hairline: rgba(0, 0, 0, 0.08);
  --accent: #e0489a;
  --radius-s: 8px;
  --radius-m: 12px;
  --font: "Inter Variable", Inter, -apple-system, "system-ui", "SF Pro Text", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}


* { margin: 0; padding: 0; box-sizing: border-box; }
html { background: var(--bg); }
body { font-family: var(--font); font-size: 13px; line-height: 1.5; color: var(--fg); -webkit-font-smoothing: antialiased; background: var(--bg); }
button { font: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.view { display: none; }
body[data-view="galeria"] #view-galeria { display: block; }
body[data-view="vista"] #view-vista { display: grid; }
body[data-view="vista"] { height: 100vh; height: 100dvh; overflow: hidden; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--fg-strong); }
.brand span { font-weight: 450; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.brand-logo { display: inline-flex; }
.brand-logo img { width: 22px; height: 22px; object-fit: contain; }

.seg, .plan { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--chip); flex: none; }
.seg button, .plan button { padding: 4px 11px; border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.seg button:hover, .plan button:hover { background: var(--chip-hover); color: var(--fg); }
.seg button.on, .seg button.on:hover, .plan button.on, .plan button.on:hover { background: var(--fg-strong); color: #fff; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-s); font-size: 12px; font-weight: 500; white-space: nowrap; transition: background 0.15s; }
.btn-primary { background: var(--fg-strong); color: #fff; }
.btn-primary:hover { background: #2b2b2b; }
.btn-outline { border: 1px solid var(--hairline); background: var(--bg); color: var(--fg); }
.btn-outline:hover { background: var(--chip); }
.lock { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; font-size: 11px; }
.lock svg { width: 8px; height: 10px; fill: currentColor; }
.icon-btn { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: var(--radius-s); border: 1px solid var(--hairline); background: var(--bg); }
.icon-btn:hover { background: var(--chip); }
.icon-btn svg { width: 15px; height: 15px; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 28px;
  background: rgba(255, 255, 255, 0.9); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--hairline); }
.topbar mp-secciones { flex: 1 1 auto; min-width: 0; margin-left: 8px; }

/* ---------- galería ---------- */
.gallery-main { max-width: 1360px; margin: 0 auto; padding: 48px 28px 96px; }
.page-title { font-size: clamp(30px, 4vw, 44px); line-height: 1.08; font-weight: 600; letter-spacing: -0.03em; color: var(--fg-strong); }
.intro { margin-top: 12px; max-width: 56ch; color: var(--muted); font-size: 15px; }
.filtro { margin: 28px 0 36px; display: flex; max-width: 100%; }
.filtro .seg { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.filtro .seg::-webkit-scrollbar { display: none; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 28px; }
.tile { display: block; }
.tile-shot { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--radius-m); background: var(--canvas); border: 1px solid var(--hairline); }
.tile-shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform 0.5s cubic-bezier(.2, .7, .2, 1); }
.tile:hover .tile-shot img { transform: scale(1.025); }
/* sin miniatura (aún no generada): el hueco se pinta con la paleta de la plantilla */
.tile-shot.vacia { display: grid; place-items: center; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.tile-shot .movil { position: absolute; right: 14px; bottom: 14px; width: 17%; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22); border: 1px solid rgba(0, 0, 0, 0.1); }
.paleta { display: flex; height: 4px; margin-top: 12px; border-radius: 2px; overflow: hidden; }
.paleta i { flex: 1; }
.tile-info { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 10px; }
.tile-info strong { font-size: 15px; font-weight: 600; color: var(--fg-strong); letter-spacing: -0.01em; }
.tile-sector { color: var(--muted); font-size: 13px; }
.tile-fuentes { color: var(--faint); font-size: 12px; margin-top: 2px; }
.vacio { grid-column: 1 / -1; color: var(--muted); }

/* ---------- visor ---------- */
#view-vista { grid-template-rows: auto 1fr; }
.vbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--hairline); background: var(--bg); flex-wrap: wrap; }
.vbar-title { display: flex; align-items: baseline; gap: 9px; margin-right: auto; min-width: 0; }
.vbar-title strong { font-weight: 600; color: var(--fg-strong); font-size: 14px; }
.vbar-title span { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vbar-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.marco { min-height: 0; background: var(--canvas); display: flex; justify-content: center; }
.marco iframe { border: 0; width: 100%; height: 100%; background: #fff; }
.marco[data-modo="movil"] { padding: 18px 0; }
.marco[data-modo="movil"] iframe { width: 390px; max-width: 100%; border-radius: 18px; border: 1px solid var(--hairline); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); padding: 9px 14px; border-radius: var(--radius-s); background: var(--fg-strong); color: #fff; font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .tiles { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .gallery-main { padding: 32px 18px 72px; }
}
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .topbar mp-secciones { order: 3; flex-basis: 100%; margin-left: 0; }
  .plan { margin-left: auto; }
  .vbar { padding: 10px 12px; }
  .vbar-title { width: calc(100% - 42px); }
  .vbar-tools { width: 100%; }
  #v-modo { display: none; }
  .marco[data-modo="movil"] { padding: 0; }
  .marco[data-modo="movil"] iframe { width: 100%; border-radius: 0; border: 0; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { .tile-shot img, .toast { transition: none; } }
