/* ============================================================
   Dalexxx — Estilos optimizados para galería
   ============================================================ */

:root {
  --paper:      #f9f9f9;
  --surface:    #ffffff;
  --soft:       #f0f0f0;
  --ink:        #111111;
  --ink-muted:  #666666;
  --line:       #e0e0e0;
  --accent:     #c0392b;
  --focus:      #0066cc;
  --radius:     8px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.2;
  margin-top: 0;
}

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a { color: var(--accent); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Contenedores */
.container {
  width: min(1120px, 100% - 2rem);
  margin-inline: auto;
}
.container--wide {
  width: min(1440px, 100% - 2rem); /* Más ancho para la grilla */
}

/* Enlace de salto para accesibilidad */
.skip-link {
  position: absolute;
  left: 1rem; top: -5rem;
  z-index: 1100;
  background: var(--ink);
  color: #fff;
  padding: .55rem 1rem;
  text-decoration: none;
  border-radius: 4px;
}
.skip-link:focus { top: 1rem; color: #fff; }

/* Modal de verificación de edad */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.9);
  padding: 1.5rem;
  overflow-y: auto;
}
.age-gate__box {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}
.age-gate__box h2 { margin-bottom: 1rem; font-size: 1.5rem; }
.age-gate__box p { color: var(--ink-muted); margin-bottom: 1.5rem; }
.age-gate__actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.age-gate__legal { font-size: 0.8rem; margin-bottom: 0 !important; }

/* Cabecera principal */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand__logo { display: block; width: 144px; height: auto; }
.brand__badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
}

/* Navegación */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 2.5rem; height: 2.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}
.nav-toggle__bar {
  height: 2px;
  background: var(--ink);
  width: 100%;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex: 1;
  justify-content: space-between;
}
.main-nav__list {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav__link {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.main-nav__link:hover, .main-nav__link[aria-current="page"] {
  color: var(--ink);
}
.main-nav__link[aria-current="page"] {
  border-bottom: 2px solid var(--accent);
}

/* Buscador */
.search-form {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  max-width: 400px;
  min-width: 0;
}
.search-form__input {
  width: 100%;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.9rem;
}
.search-form__btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}
.search-form__btn:hover { background: #333; }

/* Barra de herramientas (Título y Filtros) */
.toolbar {
  padding: 2rem 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.toolbar__head {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 320px;
  min-width: 0;
}
.catalog-intro { margin: 0; color: var(--ink-muted); font-size: 0.85rem; max-width: 65ch; }
.page-title {
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  max-width: 24ch;
  text-wrap: balance;
}
.page-title__badge {
  font-size: 0.45em;
  background: var(--ink);
  color: #fff;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  vertical-align: middle;
  font-family: system-ui, sans-serif;
}
.results-status {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin: 0;
}
.catalog-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 2rem; font-size: 0.85rem; }

/* Filtros por categoría */
.filters {
  flex: 0 1 580px;
  width: 100%;
  min-width: 0;
  max-width: 580px;
}
.filters__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
}
.filters__list > .filter-btn {
  flex-shrink: 0;
  white-space: nowrap;
}
.filters__more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}
.filter-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink-muted);
  transition: all 0.1s ease;
}
.filter-btn:hover { border-color: var(--ink-muted); }
.filter-btn[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Selección editorial de videos recomendados */
.recommendations {
  margin: 0 0 2.5rem;
}
.recommendations__intro {
  margin-bottom: 1rem;
}
.recommendations__intro h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}
.recommendations__intro p {
  margin: 0;
  color: var(--ink-muted);
}

/* Grilla de videos */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 1.5rem;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.video-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}
.video-card-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.video-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.video-card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.video-card__img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
}
.video-card__duration {
  position: absolute;
  right: 0.5rem; bottom: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}
.video-card__body {
  padding: 0.8rem 1rem 1rem;
}
.video-card__category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink-muted);
  margin: 0 0 0.2rem;
  font-weight: 600;
}
.video-card__title {
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  font-family: system-ui, sans-serif;
}
.video-card-link:hover .video-card__title { color: var(--accent); }

/* Estados (Cargando / Error / Vacío) */
.state-block {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.state-block--error { border-color: #e74c3c; background: #fdf2f0; }
.state-block h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }

/* Paginación */
.pagination {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}
.page-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}
.page-btn:hover:not(:disabled) { border-color: var(--ink); }
.page-btn:disabled { background: var(--soft); color: #999; cursor: not-allowed; }
.page-btn[aria-current="page"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Listado de categorías (Vista Categorías) */
.category-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 1rem;
}
.category-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
.category-card:hover { border-color: var(--accent); }
.category-card__name { font-family: Georgia, serif; font-size: 1.1rem; }
.category-card__count { font-size: 0.8rem; color: var(--ink-muted); }

/* Vista de Detalle del Video */
.back-link { color: var(--ink-muted); text-decoration: none; font-size: 0.9rem; display: inline-block; margin-bottom: 1rem; }
.back-link:hover { color: var(--ink); text-decoration: underline; }
.video-detail { max-width: 800px; margin: 0 auto; background: var(--surface); padding: 1.5rem; border-radius: var(--radius); border: 1px solid var(--line); }
.video-detail__embed {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  background: #000;
}
.video-detail__embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-detail__title { font-size: 1.8rem; margin: 0 0 0.5rem; }
.video-detail__meta { color: var(--ink-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.video-detail__note { color: var(--ink-muted); padding-top: 0.65rem; margin: 1rem 0 0; border-top: 1px solid var(--line); font-size: 0.75rem; line-height: 1.5; }
.video-detail__note small { font-size: inherit; }

/* Textos legales y de información */
.prose { max-width: 70ch; margin: 0 auto; background: var(--surface); padding: 2rem; border-radius: var(--radius); border: 1px solid var(--line); margin-top: 2rem; overflow-wrap: anywhere; }
.prose h2 { margin-bottom: 1rem; }
.prose h3 { margin-top: 1.5rem; margin-bottom: 0.5rem; font-size: 1.1rem; }
.prose p { color: var(--ink-muted); margin-bottom: 1rem; }

/* Botones genéricos */
.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
  text-align: center;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #a93226; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--soft); }

/* Publicidad */
.ad-slot {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  overflow: hidden;
}
.ad-slot:has(> div:empty) { margin-top: 0; }

/* Contacto y planes */
.contact-email { font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
.plans-note { font-size: 0.85rem; }
.footer-plans { text-align: center; margin: 0 0 1rem; font-size: 0.85rem; }
.footer-plans a { color: var(--ink-muted); }
.footer-plans a:hover { color: var(--ink); }

/* Pie de página */
.site-footer {
  margin-top: 4rem;
  padding: 3rem 0 1.5rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-brand__link { display: inline-block; max-width: 100%; }
.footer-brand__logo { display: block; width: 200px; max-width: 100%; height: auto; }
.footer-brand__text { font-size: 0.85rem; color: var(--ink-muted); }
.footer-col__title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 1rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { color: var(--ink-muted); text-decoration: none; font-size: 0.9rem; }
.footer-col a:hover { color: var(--ink); }
.footer-legal {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* Adaptación a móviles (Responsive) */
@media (max-width: 900px) {
  .header-inner { flex-wrap: wrap; }
  .nav-toggle { display: flex; margin-left: auto; }
  .search-form { order: 3; flex: 0 0 100%; width: 100%; max-width: none; }
  .main-nav {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 1rem;
  }
  .main-nav.is-open { display: flex; }
  .main-nav__list { flex-direction: column; gap: 0.5rem; width: 100%; }
  .toolbar { flex-direction: column; align-items: flex-start; }
  .toolbar__head, .filters { flex-basis: auto; }
  .filters { max-width: none; }
}

@media (max-width: 600px) {
  /* 2 columnas x 2 filas: 4 videos ocupan la pantalla */
  .video-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .video-card__media { aspect-ratio: 4 / 5; }
  .video-card__body { padding: 0.45rem 0.55rem 0.6rem; }
  .video-card__category { font-size: 0.6rem; }
  .video-card__title {
    font-size: 0.82rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  .header-inner { gap: 0.75rem; }
  .search-form__input { font-size: 1rem; }
  .search-form__btn, .page-btn, .filter-btn { min-height: 44px; }
  .prose, .video-detail { padding: 1rem; }
  .video-detail__title { font-size: 1.4rem; overflow-wrap: anywhere; }
  .age-gate { padding: 1rem; }
  .age-gate__box { padding: 1.25rem; }
  .age-gate__actions { flex-direction: column; }
}

/* Respeto por la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}