/* ============================================================
   anafotos2026-net — hoja de estilo pública (tema oscuro)
   ============================================================ */
:root {
  --bg: #0e1218;
  --surface: #191f29;
  --surface-2: #222a37;
  --surface-3: #2b3442;
  --text: #e6eaf2;
  --muted: #9aa6b6;
  --accent: #ec3b36;          /* rojo diana */
  --accent-dark: #b3241f;
  --ink: #f4f7fc;             /* títulos */
  --border: #2e3742;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .35);
  --maxw: 2000px;   /* ancho máximo del contenido; márgenes laterales mínimos */
  --gutter: 1.5rem; /* margen lateral en pantallas grandes */
  --header-bg: 15, 19, 25;    /* rgb del header, para velos */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* Fondo de pantalla global (se activa desde Ajustes) — capa fija tras el contenido */
body.has-bg { background: transparent; }
.bg-layer {
  position: fixed; inset: 0; z-index: -1;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }

.container { width: calc(100% - 2 * var(--gutter)); max-width: var(--maxw); margin-inline: auto; }
@media (max-width: 640px) { :root { --gutter: .9rem; } }

/* Campos de formulario (tema oscuro) */
input[type="text"], input[type="search"], input[type="date"], input[type="number"],
input[type="url"], input[type="email"], select, textarea {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: .5rem .7rem; font: inherit;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cabecera (barra oscura) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(var(--header-bg), .92);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; }
.brand-logo { height: 44px; width: auto; display: block; }
.site-nav { display: flex; align-items: center; gap: 1.35rem; flex-wrap: wrap; font-size: .96rem; font-weight: 600; }
/* En pantallas grandes, el menú un par de puntos más grande */
@media (min-width: 1100px) { .site-nav { font-size: 1.08rem; } }
.site-nav > a { color: rgba(255, 255, 255, .72); padding: .35rem 0; border-bottom: 2px solid transparent; }
.site-nav > a:hover { color: #fff; }
.site-nav > a.is-active { color: #fff; border-bottom-color: var(--accent); }
.menu-toggle { display: none; border: 0; background: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

.dropdown { position: relative; }
.dropdown-toggle { border: 0; background: none; font: inherit; font-weight: 600; color: rgba(255,255,255,.72); cursor: pointer; padding: .35rem 0; }
.dropdown-toggle:hover { color: #fff; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: 130%;
  min-width: 220px; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: .4rem 0;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: .5rem .9rem; color: var(--text); font-weight: 500; }
.dropdown-menu a:hover { background: var(--surface-2); color: var(--accent); }

/* ---------- Hero (siempre oscuro) ---------- */
.hero {
  background: linear-gradient(120deg, #12161c, #2a1114 60%, var(--accent-dark));
  color: #fff; padding: clamp(2.2rem, 6vw, 4rem) 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 0; color: #fff; }
.hero-sub { margin: .6rem 0 0; opacity: .82; font-size: 1.05rem; }

/* ---------- Layout con barra lateral ---------- */
.layout { display: grid; grid-template-columns: 1fr; gap: 1.8rem; padding: 1.8rem 0 3rem; }
@media (min-width: 960px) { .layout.container { grid-template-columns: minmax(0, 1fr) 260px; } }
.content { min-width: 0; }

.sidebar { align-self: start; position: sticky; top: 84px; }
.sidebar-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .7rem; }
.sponsors {
  display: grid; gap: .7rem;
  grid-template-columns: repeat(2, 1fr);
  background: rgba(var(--header-bg), .92);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: .7rem;
}
@media (min-width: 960px) { .sponsors { grid-template-columns: 1fr; } }
.sponsor {
  display: block; border-radius: 8px; overflow: hidden;
  background: rgba(255, 255, 255, .04);
}
.sponsor img { width: 100%; height: auto; display: block; object-fit: cover; }

/* ---------- Encabezado de sección ---------- */
.section-head { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; margin-bottom: 1.4rem; box-shadow: var(--shadow-sm); }
.section-head h2 { margin: 0; font-size: 1.4rem; }
.section-head p { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; }

/* ---------- Rejilla de tarjetas ---------- */
.card-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
/* Portada / próximos: 4 en una fila, sin estirar las tarjetas a la misma altura */
.card-grid--home { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; }
@media (max-width: 900px) { .card-grid--home { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .card-grid--home { grid-template-columns: 1fr; } }

/* Tarjeta que muestra el cartel entero (sin recortar) */
.card--poster .card-thumb { aspect-ratio: auto; background: transparent; }
.card--poster .card-thumb img { width: 100%; height: auto; object-fit: contain; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-thumb { aspect-ratio: 4 / 3; background: var(--surface-2) center/cover no-repeat; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: .8rem .9rem 1rem; display: flex; flex-direction: column; gap: .35rem; }
.card-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--ink); }
.card-meta { font-size: .85rem; color: var(--muted); margin-top: auto; }

.pill-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.pill { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: .15rem .7rem; font-size: .8rem; color: var(--muted); }
.pill.accent { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Días de un campeonato ---------- */
.dias-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.dia-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); text-align: center; transition: transform .15s ease; }
.dia-card:hover { transform: translateY(-3px); }
.dia-card .dia-img { aspect-ratio: 1 / 1; background: var(--surface-2); display: grid; place-items: center; }
.dia-card .dia-img img { width: 100%; height: 100%; object-fit: contain; }
.dia-card .dia-label { padding: .6rem; font-weight: 700; color: var(--ink); }
.dia-card .dia-count { display: block; font-weight: 500; font-size: .82rem; color: var(--muted); }

/* ---------- Detalle de campeonato / día ---------- */
.detail-head { display: grid; gap: 1.2rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; }
@media (min-width: 640px) { .detail-head { grid-template-columns: 220px 1fr; align-items: start; } }
/* Sin cartel (vista de galería): el texto ocupa todo el ancho */
.detail-head--text { grid-template-columns: 1fr !important; }
.detail-head .poster { border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.detail-head h1 { font-size: clamp(1.25rem, 3.5vw, 1.7rem); margin: .3rem 0; overflow-wrap: anywhere; }
.detail-head .lead { color: var(--muted); }

/* ---------- Índice de fotos (miniaturas a tamaño real) + lightbox ---------- */
.grid-hint { color: var(--muted); font-size: .9rem; margin: 0 0 .7rem; }
.grid-hint i { color: var(--accent); font-style: normal; }
.photo-grid { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-start; }
.photo-thumb { margin: 0; cursor: pointer; border-radius: 6px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); }
.photo-thumb .ph-img { display: block; line-height: 0; position: relative; }
.photo-thumb img { display: block; width: auto; height: auto; max-width: 100%; transition: opacity .15s ease; }
.photo-thumb:hover { border-color: var(--accent); }
.photo-thumb:hover img { opacity: .85; }
.photo-thumb .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 1.4rem; background: rgba(0,0,0,.35); line-height: 1;
}
.photo-thumb.is-video { border-color: var(--accent); }
.photo-thumb figcaption {
  padding: .25rem .3rem; text-align: center; font-size: .72rem; color: var(--muted);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}

.lightbox { position: fixed; inset: 0; background: rgba(6, 8, 11, .96); display: none;
  place-items: center; z-index: 100; }
.lightbox.open { display: grid; }
.lightbox .lb-stage { display: grid; place-items: center; width: 100%; }
.lightbox .lb-stage img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 6px; }
.lightbox .lb-video { width: min(90vw, 1100px); aspect-ratio: 16 / 9; }
.lightbox .lb-video iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: #000; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0;
  font-size: 2rem; width: 54px; height: 54px; border-radius: 50%; cursor: pointer; z-index: 2; }
.lightbox button:hover { background: rgba(255,255,255,.22); }
.lightbox .lb-close { top: 1rem; right: 1rem; }
.lightbox .lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-count { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: .9rem; opacity: .85; }

/* ---------- Paginación ---------- */
.pager { display: flex; justify-content: center; gap: .4rem; margin: 2rem 0 0; flex-wrap: wrap; }
.pager a, .pager span { padding: .4rem .8rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); font-weight: 600; font-size: .9rem; color: var(--text); }
.pager .current { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Botones ---------- */
.btn-accent { display: inline-block; background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: .55rem 1rem; font-weight: 600; cursor: pointer; }
.btn-accent:hover { background: var(--accent-dark); }

/* ---------- Contenido de texto (páginas, clasificaciones) ---------- */
.prose { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.6rem; box-shadow: var(--shadow-sm); overflow-x: auto; }
/* Los párrafos sueltos no pasan de un ancho legible; tablas/fotos usan todo el ancho */
.prose > p, .prose > ul, .prose > ol, .prose > h1, .prose > h2, .prose > h3 { max-width: 80ch; }
.prose img { border-radius: 8px; margin: .6rem 0; max-width: 100%; height: auto; }
.prose h2, .prose h3 { margin-top: 1.2em; }
.prose a { color: var(--accent); }
/* Fotos dentro de una clasificación: miniatura a tamaño real, sin pie */
.prose .cl-foto { display: inline-block; margin: 2px; border: 1px solid var(--border);
  border-radius: 5px; overflow: hidden; line-height: 0; cursor: zoom-in; vertical-align: top; }
.prose .cl-foto:hover { border-color: var(--accent); }
.prose .cl-foto img { display: block; width: auto; height: auto; max-width: none; margin: 0; border-radius: 0; }
/* Neutraliza colores/tamaños incrustados en el contenido migrado de Joomla */
.prose [style] { color: var(--text) !important; background: transparent !important; font-size: inherit !important; }
.prose a[style] { color: var(--accent) !important; }
.prose font { color: inherit !important; }

.empty { background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

/* ---------- Pie ---------- */
.site-footer { border-top: 1px solid var(--border); background: rgba(var(--header-bg), .6); color: var(--muted); }

/* ---------- Responsive nav ---------- */
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .site-nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding-bottom: 1rem; }
  body.nav-open .site-nav { display: flex; }
  .header-inner { flex-wrap: wrap; }
  .dropdown-menu { position: static; box-shadow: none; border: 0; padding-left: 1rem; background: transparent; }
  .dropdown-menu a { color: rgba(255,255,255,.72); }
}
