:root {
  --primary: #c7192d;
  --primary-dark: #961322;
  --ink: #18191d;
  --muted: #68707c;
  --line: #e6e8ec;
  --surface: #ffffff;
  --surface-soft: #f6f7f9;
  --shadow: 0 18px 50px rgba(18, 24, 40, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.6;
}

body.modal-open {
  overflow: hidden;
}

img,
video {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.container {
  width: min(calc(100% - 40px), var(--container));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(230, 232, 236, 0.85);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.header-content {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(199, 25, 45, 0.25);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 0.98rem;
}

.brand small {
  margin-top: -2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  color: #4d535d;
  font-size: 0.9rem;
  font-weight: 600;
}

.main-nav a:hover {
  color: var(--primary);
}

.hero {
  overflow: hidden;
  padding: 90px 0 82px;
  background:
    radial-gradient(circle at 85% 20%, rgba(199, 25, 45, 0.16), transparent 28%),
    linear-gradient(135deg, #fff 0%, #f8f8fa 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  align-items: center;
  gap: 60px;
}

.eyebrow {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--primary);
  background: rgba(199, 25, 45, 0.1);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 20px 0 20px;
  font-size: clamp(2.55rem, 5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.hero-copy > p {
  max-width: 680px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 1.08rem;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 23px;
  border-radius: 12px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(199, 25, 45, 0.24);
  transition: transform 180ms ease, background 180ms ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  background: var(--primary-dark);
}

.hero-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 30px;
  color: #fff;
  background: linear-gradient(145deg, #17181c, #2e3038);
  box-shadow: var(--shadow);
  transform: rotate(2deg);
}

.hero-card-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: 36px;
  border-radius: 50%;
  color: #fff;
  background: var(--primary);
  font-size: 1.4rem;
}

.hero-card strong,
.hero-card span {
  display: block;
}

.hero-card strong {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.hero-card span {
  color: #c9cbd1;
}

.category-section {
  padding: 88px 0;
}

.section-soft {
  background: var(--surface-soft);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-number {
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

.section-heading p {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(18, 24, 40, 0.055);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.video-card:hover,
.video-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(199, 25, 45, 0.35);
  box-shadow: 0 18px 38px rgba(18, 24, 40, 0.12);
  outline: none;
}

.video-thumbnail {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(199, 25, 45, 0.86), rgba(70, 8, 17, 0.96)),
    #c7192d;
}

.video-thumbnail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.2), transparent 35%);
}

.play-button {
  position: relative;
  z-index: 1;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--primary);
  background: #fff;
  font-size: 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.video-card-body {
  padding: 22px;
}

.video-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.video-card h3 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  line-height: 1.35;
}

.video-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed #cfd3da;
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
}

.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.87rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.footer-content p {
  margin: 0;
}

.footer-content a {
  color: var(--primary);
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
}

.modal.is-open {
  display: grid;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 10, 13, 0.76);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.modal-video-wrapper {
  aspect-ratio: 16 / 9;
  background: #090a0c;
}

.modal-video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.modal-content {
  padding: 28px 32px 34px;
}

.modal-category {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-content h3 {
  margin: 7px 0 10px;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.modal-content p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 900px) {
  .main-nav {
    display: none;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-card {
    min-height: 220px;
    transform: none;
  }

  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    width: min(calc(100% - 28px), var(--container));
  }

  .hero {
    padding: 64px 0;
  }

  .hero h1 {
    font-size: 2.65rem;
  }

  .category-section {
    padding: 64px 0;
  }

  .section-heading {
    display: block;
  }

  .section-heading > div {
    margin-bottom: 12px;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .footer-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .modal {
    padding: 12px;
  }

  .modal-content {
    padding: 24px 22px 28px;
  }
}

/* Controles de cabecera, subpáginas y modo oscuro */
.header-right, .header-actions { display: flex; align-items: center; gap: 14px; }
.header-right { gap: 28px; }
.icon-button, .language-button {
  min-height: 40px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink);
  background: var(--surface); font: inherit; font-weight: 700; cursor: pointer;
}
.icon-button { width: 42px; font-size: 1.15rem; }
.language-button { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; }
.main-nav a.is-active { color: var(--primary); }
.section-link { display: inline-flex; margin-top: 26px; color: var(--primary); font-weight: 700; }
.footer-contact > div { max-width: 850px; }
.footer-contact strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 1rem; }
.category-hero { padding: 76px 0 60px; background: linear-gradient(135deg, var(--surface) 0%, var(--surface-soft) 100%); }
.category-hero h1 { margin: 18px 0 12px; font-size: clamp(2.7rem, 6vw, 5.5rem); line-height: 1; letter-spacing: -0.055em; }
.category-hero p { max-width: 680px; margin: 0; color: var(--muted); font-size: 1.08rem; }
.back-link { display: inline-flex; margin-bottom: 28px; color: var(--primary); font-weight: 700; }

html[data-theme="dark"] {
  --ink: #f5f6f8; --muted: #aeb4bf; --line: #30343c; --surface: #17191e; --surface-soft: #111318;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
}
html[data-theme="dark"] body { background: var(--surface); }
html[data-theme="dark"] .site-header { border-color: rgba(48,52,60,.9); background: rgba(23,25,30,.92); }
html[data-theme="dark"] .hero { background: radial-gradient(circle at 85% 20%, rgba(199,25,45,.18), transparent 28%), linear-gradient(135deg, #17191e 0%, #111318 100%); }
html[data-theme="dark"] .video-card, html[data-theme="dark"] .modal-dialog { background: #1d2026; }
html[data-theme="dark"] .empty-state { background: rgba(255,255,255,.025); border-color: #3a3f48; }
html[data-theme="dark"] .main-nav { color: #c5c9d0; }

@media (max-width: 900px) {
  .header-right { gap: 12px; }
  .header-content { min-height: 72px; }
}
@media (max-width: 520px) {
  .brand small { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .header-actions { gap: 8px; }
  .language-button { padding: 0 9px; }
  .category-hero { padding: 56px 0 42px; }
}

/* Identidad visual de The Team */
.brand {
  flex-shrink: 0;
  gap: 13px;
}

.brand-logo {
  width: 112px;
  height: 48px;
  display: block;
  object-fit: contain;
  object-position: left center;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.2;
}

@media (max-width: 680px) {
  .brand-logo {
    width: 86px;
    height: 38px;
  }

  .brand-copy strong {
    font-size: .9rem;
  }

  .brand-copy small {
    font-size: .67rem;
  }
}

@media (max-width: 420px) {
  .brand-logo {
    width: 72px;
  }

  .brand-copy small {
    display: none;
  }
}

/* YouTube */
.video-thumbnail {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.modal-youtube {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

/* Categorías dinámicas de la portada */
#dynamicCategories .tutorial-section {
  padding: 88px 0;
}

#dynamicCategories .tutorial-section:nth-child(even) {
  background: var(--surface-soft);
}

#dynamicCategories .section-heading {
  align-items: center;
}

#dynamicCategories .section-heading > div {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 14px;
}

#dynamicCategories .section-heading .eyebrow {
  grid-column: 1 / -1;
  width: fit-content;
  margin-bottom: 12px;
}

#dynamicCategories .section-heading h2 {
  grid-column: 1;
}

#dynamicCategories .section-heading p {
  grid-column: 2;
}

#dynamicCategories .section-link {
  color: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}

#dynamicCategories .video-grid {
  margin-top: 34px;
}

@media (max-width: 760px) {
  #dynamicCategories .tutorial-section {
    padding: 64px 0;
  }

  #dynamicCategories .section-heading {
    display: grid;
    align-items: start;
  }

  #dynamicCategories .section-heading > div {
    display: block;
  }

  #dynamicCategories .section-heading h2 {
    margin-top: 14px;
  }

  #dynamicCategories .section-heading p {
    margin-top: 10px;
  }

  #dynamicCategories .section-link {
    margin-top: 8px;
  }
}
