/* =========================================================
   /sub/gallery.css  — 3DCOMMUNITY.NET
   Tema neon (verde/naranja) + header/botones como about.css
   (Fuentes absolutas para que funcionen desde /sub/)
========================================================= */

/* 0) Reset básico */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* 1) Variables de tema */
:root{
  /* Colores base */
  --bg-0: #0a0a0a;
  --bg-1: #0f0f0f;
  --bg-2: #151515;
  --panel: #1b1b1b;
  --text: #f2f2f2;
  --muted: #a9a9a9;

  /* Neon */
  --neon-green:  #39FF14;
  --neon-orange: #FF7A18;

  /* Gradientes & sombras */
  --grad-gn-or: linear-gradient(90deg, var(--neon-green) 0%, var(--neon-orange) 100%);
  --shadow: rgba(0,0,0,.6);
  --stroke: #161616;

  /* Tipografías (coherentes con about.css) */
  --font-ui: 'Oxanium', 'Rajdhani', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --font-title: 'ThreeDIsometric', var(--font-ui);
  --font-display: 'Gunplay', var(--font-ui);

  /* Tamaños */
  --radius: 14px;
  --gap: clamp(12px, 1.8vw, 20px);
  --pad: clamp(12px, 2vw, 24px);
}

/* 2) @font-face (rutas absolutas para que funcionen desde /sub) */
@font-face{
  font-family: 'ThreeDIsometric';
  src: url('/fonts/3DIsometric-Regular.ttf') format('truetype'),
       url('/fonts/3DIsometric-Regular.otf') format('opentype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face{
  font-family: 'Gunplay';
  src: url('/fonts/Gunplay-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face{
  font-family: 'Oxanium';
  src: url('/fonts/Oxanium-VariableFont_wght.ttf') format('truetype');
  font-weight: 200 800; font-style: normal; font-display: swap;
}

/* 3) Base documento */
body{
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(1400px 700px at 0% 0%, rgba(57,255,20,.06), transparent 60%),
    linear-gradient(180deg, #121212 0%, #0e0e0e 100%);
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* Scrollbar suave */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* 4) HEADER — mismo estilo que about.css */
.site-header{
  background: linear-gradient(180deg, #0e0e0e 0%, #0a0a0a 100%);
  border-bottom: 1px solid #121212;
  box-shadow: 0 6px 24px var(--shadow);
  display: grid;
  grid-auto-rows: min-content;
  align-content: center;
  justify-items: center;
  gap: .65rem;
  padding: clamp(10px, 2vw, 18px) clamp(14px, 2.4vw, 22px) clamp(14px, 2.6vw, 28px);
}
.site-title{
  font-family: var(--font-title);
  font-weight: 800;
  font-size: clamp(2.6rem, 6.5vw, 5rem);
  letter-spacing: .06em;
  color: var(--neon-orange);
  text-shadow: 0 0 6px rgba(255,122,24,.25), 0 12px 28px rgba(0,0,0,.45);
  white-space: nowrap;
}
.nav-menu{
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: .75rem .85rem;
}
/* Botones del header (bonitos + hover) */
.nav-menu button{
  --h: clamp(42px, 5.2vh, 54px);
  --px: clamp(14px, 2.2vw, 22px);

  display: inline-flex; align-items: center; justify-content: center;
  height: var(--h); padding: 0 var(--px);
  border-radius: 12px; border: 1px solid #1a1a1a;
  font-family: var(--font-display);
  font-weight: 800; letter-spacing: .02em;
  font-size: clamp(1.02rem, 1.5vw, 1.28rem);
  cursor: pointer;

  background-image: var(--grad-gn-or);
  background-size: 220% 100%; background-position: 0% 50%;
  color: #0b0b0b;

  box-shadow: 0 6px 18px rgba(0,0,0,.55);
  transition: background-position .35s ease, transform .12s ease,
              box-shadow .25s ease, filter .2s ease, border-color .2s ease;
}
.nav-menu button:hover{
  background-position: 100% 50%; transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0,0,0,.6),
              0 0 18px rgba(57,255,20,.28),
              0 0 28px rgba(255,122,24,.22);
  border-color: #262626; filter: saturate(1.06);
}
.nav-menu button:active{ transform: translateY(0); box-shadow: inset 0 4px 10px rgba(0,0,0,.45); }
.nav-menu button:focus-visible{ outline: 2px solid rgba(57,255,20,.9); outline-offset: 3px; }
.nav-menu button.active{
  background: var(--neon-green);
  color: #0b0b0b;
  border-color: #2b2b2b;
  box-shadow: 0 8px 22px rgba(0,0,0,.5), 0 0 10px rgba(57,255,20,.35);
}

/* 5) Utilidades */
.state-anchor{ position: absolute; left: -9999px; width: 0; height: 0; overflow: hidden; }

/* 6) Contenedor de página (full width real) */
.gallery-page{
  width: 100%;
  padding: var(--pad);
  display: grid; gap: var(--gap);
}

/* 7) Barra de búsqueda compacta (1 fila en desktop) */
.gallery-bar{
  background: linear-gradient(180deg, #151515 0%, #111 100%);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 8px 18px var(--shadow);
  padding: clamp(10px, 1.6vw, 14px);
  display: grid; gap: .6rem;
}
.gallery-bar form{
  display: grid;
  grid-template-columns: 1fr repeat(4, minmax(140px, 220px)) auto;
  gap: .6rem; align-items: center;
}
.gallery-bar input[type="search"],
.gallery-bar select{
  width: 100%;
  padding: .65rem .7rem;
  border-radius: 10px;
  border: 2px solid #2a2a2a;
  background: #151515;
  color: var(--text);
  transition: border-color .2s ease, box-shadow .2s ease, transform .08s ease;
}
.gallery-bar input::placeholder{ color:#8e8e8e; }
.gallery-bar input:hover, .gallery-bar select:hover{
  border-color: #333; box-shadow: 0 0 0 2px rgba(255,122,24,.12) inset;
}
.gallery-bar input:focus-visible, .gallery-bar select:focus-visible{
  outline: none; border-color: var(--neon-green); box-shadow: 0 0 0 3px rgba(57,255,20,.16);
}
.gallery-count{ color: var(--muted); }

/* Botón genérico (coherente con about.css) */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  min-height: 44px; padding:.6rem 1rem;
  border-radius: 10px; border: 1px solid #2a2a2a;
  background: #191919; color: var(--text);
  text-decoration: none; font-weight: 800; letter-spacing:.01em; font-family: var(--font-display);
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease,
              background-position .35s ease, filter .2s ease;
}
.btn:hover{ transform: translateY(-1px); filter: saturate(1.05); }
.btn:focus-visible{ outline: 2px solid rgba(57,255,20,.9); outline-offset: 3px; }

.btn-orange{
  background: var(--neon-orange); color:#111; border-color:#ff8a38;
  box-shadow: 0 4px 10px rgba(0,0,0,.45), 0 0 10px rgba(255,122,24,.25);
}
.btn-orange:hover{ box-shadow: 0 8px 18px rgba(0,0,0,.55), 0 0 16px rgba(255,122,24,.35); }

.btn-outline{
  background:#151515; color:var(--text);
}
.btn-outline:hover{ border-color: var(--neon-green); box-shadow: 0 0 0 3px rgba(57,255,20,.16); }

.btn-green{
  color:#0b0b0b; border:none;
  background-image: var(--grad-gn-or);
  background-size: 220% 100%; background-position: 0% 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.btn-green:hover{
  background-position: 100% 50%;
  box-shadow: 0 8px 22px rgba(0,0,0,.55),
              0 0 12px rgba(57,255,20,.35),
              0 0 24px rgba(255,122,24,.25);
}

/* 8) Rejilla 3→2→1 columnas */
.gallery-grid.big{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
  align-content: start;
}

/* 9) Tarjetas */
.g-card{
  background:#141414;
  border:1px solid #1f1f1f;
  border-radius: var(--radius);
  box-shadow: 0 8px 18px var(--shadow);
  overflow: hidden;
  display:grid; grid-template-rows:auto 1fr auto;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease, filter .2s ease;
}
.g-card:hover{
  transform: translateY(-2px);
  border-color: var(--neon-green);
  box-shadow:
    0 12px 26px rgba(0,0,0,.6),
    0 0 14px rgba(57,255,20,.18),
    0 0 22px rgba(255,122,24,.18);
  filter: saturate(1.06);
}
.g-link{ display:block; }
.g-thumb{
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background:
    radial-gradient(60% 60% at 50% 45%, rgba(255,255,255,.04), transparent 60%),
    linear-gradient(180deg, #0b0b0b, #0f0f0f);
}
/* Placeholder si falta imagen */
.g-thumb[src=""], .g-thumb:not([src]){
  background:
    linear-gradient(135deg, rgba(57,255,20,.08), rgba(255,122,24,.08)),
    repeating-linear-gradient(45deg, #121212 0 10px, #141414 10px 20px);
  border-bottom: 1px solid #1f1f1f;
}
.g-body{
  padding: clamp(12px, 1.6vw, 16px);
  display:grid; gap:.35rem; color: var(--text);
}
.g-title{ font-weight: 800; letter-spacing: .01em; }
.g-meta{ font-size: .9rem; color: var(--muted); }
.g-actions{
  padding: clamp(12px, 1.6vw, 16px);
  display:flex; gap:.5rem; justify-content:space-between; align-items:center;
  border-top:1px solid #1e1e1e;
}

/* 10) Overlay visor 3D (sin JS con :target) */
.viewer-overlay{
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 700px at 8% -10%, rgba(57,255,20,.06), transparent 55%),
    rgba(0,0,0,.86);
  backdrop-filter: blur(2px);
  display: none; z-index: 60;
  padding: clamp(10px, 2vw, 20px);
}
.viewer-overlay:target{ display:block; }
/* al ir a #grid, se cierra */
#grid:target ~ .viewer-overlay{ display:none; }

.viewer-overlay .inner{
  max-width: 1280px; height: min(90vh, 860px);
  margin: 0 auto;
  background: #0b0b0b;
  border: 1px solid #1f1f1f;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0,0,0,.65), 0 0 24px rgba(57,255,20,.08) inset;
  display:grid; grid-template-rows:auto 1fr; overflow:hidden;
}
.viewer-overlay header{
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  padding:.75rem 1rem;
  border-bottom:1px solid #1f1f1f;
  background: linear-gradient(180deg, #121212, #0f0f0f);
  color: var(--text);
}
.viewer-overlay .title{ font-weight: 800; letter-spacing: .02em; }
.viewer-overlay .close{
  text-decoration:none; padding:.45rem .8rem; border-radius:10px;
  border:1px solid #2a2a2a; background:#151515; color:var(--text);
  transition: border-color .2s ease, transform .08s ease, box-shadow .2s ease;
}
.viewer-overlay .close:hover{
  transform: translateY(-1px);
  border-color: var(--neon-green);
  box-shadow: 0 0 0 3px rgba(57,255,20,.14);
}
.viewer-overlay model-viewer{ width:100%; height:100%; background:#000; }
.nojs-msg{ padding:1rem; color:#ddd; }

/* 11) Accesibilidad */
.g-link:focus-visible,
.g-actions .btn:focus-visible,
.viewer-overlay .close:focus-visible{
  outline: 2px solid var(--neon-green);
  outline-offset: 3px;
}

/* 12) Responsive */
@media (max-width:1100px){
  .gallery-bar form{
    grid-template-columns: 1fr repeat(3, minmax(140px, 1fr)) auto;
  }
  .gallery-grid.big{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width:680px){
  .site-title{ font-size: clamp(2.1rem, 7vw, 3.2rem); }
  .nav-menu{ gap: .55rem .6rem; }
  .nav-menu button{ height: clamp(40px, 5.2vh, 50px); font-size: 1rem; }

  .gallery-bar form{
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(44px, auto);
  }
  .gallery-bar .btn{ grid-column: 1 / -1; }
  .gallery-grid.big{ grid-template-columns: 1fr; }

  .viewer-overlay .inner{
    height: calc(100svh - 2 * clamp(10px, 2vw, 20px));
    max-width: 100%;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ animation: none !important; transition: none !important; }
}
