/* ── Videos/ID — BrandBook ── */

/* ─── Video hero ─── */
.video-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  margin-bottom: 3rem;
  align-items: center;
  animation: fadeIn 0.5s ease-out;
}

.hero-video { width: 100%; }

.video-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  border: 2px solid var(--bs-border);
  box-shadow: 0 12px 40px -16px rgba(0, 0, 0, 0.8);
}

.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* Suprimir degradados globales que se filtran aquí */
#all-videos .hero-video::before,
#all-videos .hero-video::after,
#all-videos .video-hero::before,
#all-videos .video-hero::after { display: none !important; }

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 1rem;
}

.hero-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bs-primary);
  margin-bottom: 0.6rem;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.2;
  color: var(--bs-text-0);
  margin: 0 0 1rem;
  text-align: left !important;
}

.hero-title::after { display: none !important; }

.hero-description {
  font-family: 'Lexend', sans-serif;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--bs-text-1);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-actions .btn {
  padding: 0.7rem 1.4rem;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.short-video-note {
  margin-top: 1rem;
  font-family: 'Lexend', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--bs-text-2);
}

/* ─── Secondary button ─── */
.btn-secondary {
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--bs-primary) 50%, transparent);
  color: var(--bs-primary);
  border-radius: 999px;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
  border-color: var(--bs-primary);
  box-shadow: 0 0 20px -8px color-mix(in srgb, var(--bs-primary) 60%, transparent);
  transform: translateY(-2px);
}

/* ─── Search ─── */
#search-container {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-start;
  max-width: 600px;
  margin: 1.5rem auto 2rem;
}

#video-search {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--bs-border);
  background: var(--bs-surface-0);
  color: var(--bs-text-0);
  font-family: 'Lexend', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

#video-search::placeholder { color: var(--bs-text-2); }

#video-search:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-primary) 18%, transparent);
}

/* ─── Note container ─── */
#note-container { max-width: 600px; margin: 0 auto 1.2rem; }

#note-container > div {
  background: var(--bs-surface-1);
  color: var(--bs-text-0);
  border: 1px solid var(--bs-border);
  border-left: 3px solid var(--bs-primary);
  border-radius: 10px;
  padding: 0.7em 1em;
  font-family: 'Lexend', sans-serif;
  font-size: 0.95em;
  font-weight: 300;
  margin-bottom: 0.5em;
}

.note-label { font-weight: 600; color: var(--bs-text-0); }

/* ─── All videos title ─── */
#all-videos h1 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 3.5vw, 2rem);
  color: var(--bs-text-0);
  text-align: center;
  margin: 2.5rem 0 2rem;
  position: relative;
  padding-bottom: 1rem;
}

#all-videos h1::after {
  content: '';
  width: 48px;
  height: 2px;
  background: var(--bs-primary);
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  border-radius: 2px;
}

/* ─── Video grid ─── */
#all-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin: 1rem 0 2rem;
}

/* ─── Recursos tree ─── */
#recursos-content,
#recursos-tree { margin-top: 2rem; }

.recursos-tree-card {
  background: var(--bs-surface-0);
  border: 1px solid var(--bs-border);
  border-radius: 18px;
  padding: 2rem 2rem 1.2rem;
  margin-top: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 32px -16px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.recursos-tree-card:hover {
  border-color: color-mix(in srgb, var(--bs-primary) 40%, var(--bs-border));
  box-shadow:
    0 12px 40px -16px rgba(0, 0, 0, 0.7),
    0 0 0 1px color-mix(in srgb, var(--bs-primary) 15%, transparent);
  transform: translateY(-2px);
}

.recursos-header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bs-border);
}

.recursos-tree-header {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--bs-text-0);
  margin: 0 !important;
  line-height: 1.2;
}

.recursos-tree-list {
  list-style: none;
  padding-left: 1em;
  margin-bottom: 0.5em;
}

/* Lista de recursos pre-renderizada en HTML (fallback SEO / sin JS).
   recursos.js la reemplaza por la versión interactiva al cargar. */
.recursos-seo-count {
  color: var(--bs-text-2);
  font-size: 0.9em;
  margin: 0 0 0.75em;
}

.recursos-file-type {
  display: inline-block;
  margin-left: 0.5em;
  padding: 0.05em 0.45em;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--bs-text-2);
  background: var(--bs-surface-2, rgba(127, 127, 127, 0.12));
  border-radius: 4px;
  vertical-align: middle;
}

.recursos-tree-item {
  margin-bottom: 0.5em;
  font-size: 1em;
}

.recursos-folder {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.6em;
  border-radius: 10px;
  padding: 0.6em 0.8em;
  background: var(--bs-surface-1);
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.recursos-folder:hover {
  border-color: color-mix(in srgb, var(--bs-primary) 50%, transparent);
  background: color-mix(in srgb, var(--bs-primary) 8%, var(--bs-surface-1));
  transform: translateX(4px);
}

.recursos-folder.open {
  border-left: 3px solid var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 6%, var(--bs-surface-1));
}

.folder-icon {
  color: var(--bs-primary);
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.recursos-folder.open .folder-icon { transform: rotate(90deg); }

.folder-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--bs-text-0);
  letter-spacing: 0.01em;
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  transition: color 0.2s;
}

.recursos-folder:hover .folder-name { color: var(--bs-primary); }

.recursos-tree-children {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(.4, 0, .2, 1);
  margin-left: 1.5em;
  margin-top: 0.5em;
  padding-left: 1em;
  border-left: 2px solid color-mix(in srgb, var(--bs-primary) 35%, transparent);
}

.recursos-tree-children.open {
  max-height: 1000px;
  transition: max-height 0.5s cubic-bezier(.4, 0, .2, 1);
}

/* Tarjeta del archivo. En la vista interactiva el enlace va envuelto en
   .recursos-file-card para que la licencia quepa dentro de la misma tarjeta;
   en el fallback estático (sin JS) el <a> es hijo directo del <li> y hace de
   tarjeta él mismo. Ambos comparten el mismo aspecto. */
.recursos-file-card,
.recursos-tree-item > .recursos-file {
  position: relative;
  margin-left: 0.5em;
  margin-bottom: 0.6em;
  border-radius: 10px;
  padding: 0.75em 1em;
  background: var(--bs-surface-1);
  border: 1px solid var(--bs-border);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  overflow: hidden;
}

.recursos-file-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.9em;
  row-gap: 0.4em;
}

.recursos-file {
  color: var(--bs-text-1);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: 0.8em;
}

/* Dentro de la tarjeta el enlace no pinta fondo: lo hace el contenedor. */
.recursos-file-card > .recursos-file {
  flex: 1 1 60%;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}

/* El enlace del archivo cubre toda la tarjeta; la licencia va por encima. */
.recursos-file-card > .recursos-file::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.recursos-file-card:hover,
.recursos-file-card:focus-within,
.recursos-tree-item > .recursos-file:hover {
  color: var(--bs-primary);
  border-color: color-mix(in srgb, var(--bs-primary) 55%, transparent);
  background: color-mix(in srgb, var(--bs-primary) 7%, var(--bs-surface-1));
  transform: translateY(-2px);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--bs-primary) 40%, transparent);
}

.recursos-file-card:hover > .recursos-file { color: var(--bs-primary); }

/* Licencia del archivo alojado: chip discreto al final de su propia tarjeta.
   Es hermano del enlace porque anidar dos <a> no es HTML válido. */
.recursos-file-license {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.2em 0.6em;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68em;
  letter-spacing: 0.03em;
  line-height: 1.5;
  white-space: nowrap;
  color: var(--bs-text-2);
  background: var(--bs-surface-2, rgba(127, 127, 127, 0.12));
  border: 1px solid var(--bs-border);
  border-radius: 999px;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.recursos-file-license svg { flex-shrink: 0; opacity: 0.8; }

.recursos-file-license:hover {
  color: var(--bs-primary);
  border-color: color-mix(in srgb, var(--bs-primary) 50%, transparent);
  background: color-mix(in srgb, var(--bs-primary) 10%, transparent);
}

.recursos-file-card.external-link,
.recursos-tree-item > .recursos-file.external-link {
  border-left: 3px solid color-mix(in srgb, var(--bs-cold-0) 60%, transparent);
}

.recursos-file-card.external-link:hover,
.recursos-tree-item > .recursos-file.external-link:hover {
  border-left-color: var(--bs-primary);
}

.recursos-file svg {
  margin-top: 0.2em;
  flex-shrink: 0;
  color: var(--bs-text-2);
  transition: color 0.2s;
}

.recursos-file-card:hover .recursos-file svg,
.recursos-tree-item > .recursos-file:hover svg { color: var(--bs-primary); }

.file-name {
  font-family: 'Lexend', sans-serif;
  font-weight: 300;
  font-size: 0.93em;
  color: inherit;
  letter-spacing: 0.01em;
  flex: 1;
  min-width: 0;
  line-height: 1.5;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Aequorea badge */
.aequorea-badge {
  width: 32px;
  height: 32px;
  margin-right: 0.6em;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.aequorea-item {
  border-left: 3px solid var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 5%, var(--bs-surface-1));
}

.aequorea-item:hover { transform: translateX(3px); }

/* External icon */
.external-icon {
  display: inline-flex;
  align-items: center;
  margin-left: 0.4em;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
  vertical-align: middle;
}

.recursos-file-card:hover .external-icon,
.recursos-tree-item > .recursos-file:hover .external-icon {
  opacity: 0.85;
  transform: translate(2px, -2px);
}

/* ─── Tabs ─── */
.recursos-tabs-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  width: 100%;
}

.recursos-tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bs-surface-1);
  border: 1px solid var(--bs-border);
  padding: 4px;
  border-radius: 14px;
  position: relative;
  min-width: 260px;
}

.tab-glider {
  position: absolute;
  top: 4px; left: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background: var(--bs-primary);
  border-radius: 10px;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: 1;
  box-shadow: 0 0 18px -6px color-mix(in srgb, var(--bs-primary) 60%, transparent);
}

.recursos-tabs[data-active="recursos"] .tab-glider { transform: translateX(0); }
.recursos-tabs[data-active="minijuego"] .tab-glider { transform: translateX(100%); }

.tab-btn {
  background: transparent;
  border: none;
  padding: 0.55rem 1.2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-text-1);
  opacity: 0.8;
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.2s ease, opacity 0.2s ease;
  text-align: center;
  position: relative;
  z-index: 2;
}

.tab-btn:hover { opacity: 1; color: var(--bs-primary); }
.tab-btn.active { opacity: 1; color: #040D14; font-weight: 700; }
.tab-btn.active:hover { color: #040D14; }

/* ─── Expand button ─── */
.btn-expand-all {
  background: transparent;
  border: 1px solid var(--bs-border);
  color: var(--bs-text-1);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-expand-all:hover {
  background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
  border-color: var(--bs-primary);
  color: var(--bs-primary);
  transform: translateY(-1px);
}

/* ─── Minijuego inline ─── */
.minijuego-card {
  padding: 0;
  /* Prevent the card from adding width beyond the viewport on mobile */
  max-width: 100%;
  overflow: hidden;
}

@media (max-width: 640px) {
  /* Remove card padding so grid-container can use full width */
  .recursos-tree-card.minijuego-card {
    padding: 0;
    border-radius: 12px;
  }
}

.game-container-inline {
  width: 100%;
}

/* ─── Tab content ─── */
.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: tabSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* ─── Notifications ─── */
.temporary-notification { position: relative; z-index: 1000; }

/* ─── Keyframes ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInDown {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

@keyframes fadeOut {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

@keyframes tabSlideUp {
  from { transform: translateY(15px); }
  to   { transform: translateY(0); }
}

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .video-hero { grid-template-columns: 1fr; gap: 2rem; }
  .hero-content { padding-top: 0; }
}

@media (max-width: 768px) {
  #search-container {
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem auto 1.5rem;
    padding: 0 1rem;
  }
  #video-search { width: 100%; max-width: none; }
  #all-video-grid { grid-template-columns: 1fr; gap: 1.5rem; padding: 0 1rem; }
  #note-container { padding: 0 1rem; }
}

@media (max-width: 480px) {
  .recursos-tree-card { padding: 1.25rem 1rem 1rem; border-radius: 12px; }
  .recursos-tree-list { padding-left: 0.5em; }
  .recursos-tree-children { margin-left: 0.8em; }
  .recursos-file-card,
  .recursos-tree-item > .recursos-file { margin-left: 0.8em; font-size: 0.9em; }
  .recursos-file-license { margin-left: 0; }
  .folder-name, .file-name { font-size: 0.9em; }
  .hero-actions .btn { width: 100%; justify-content: center; }
}

/* ── Videos relacionados (sección "Más videos" al pie de cada video) ── */
#related-videos {
  margin-top: 3.5rem;
  padding-bottom: 1rem;
}
#related-videos .related-heading {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}
#related-videos .related-grid {
  gap: 1.5rem;
}
#related-videos .card-body h3 {
  font-size: 1rem;
  line-height: 1.3;
}
