/* ==========================================================================
   Diotor Entertainment — Sistema de diseño global
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Superficies */
  --bg: #0b0d11;
  --bg-elevated: #11141a;
  --surface: #151922;
  --surface-hover: #1a1f2b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  /* Texto */
  --text-primary: #eef1f6;
  --text-secondary: #9aa4b5;
  --text-muted: #6b7484;

  /* Acento */
  --accent: #4fd1ff;
  --accent-strong: #35b8ea;
  --accent-soft: rgba(79, 209, 255, 0.12);
  --accent-glow: rgba(79, 209, 255, 0.25);

  /* Estado */
  --success: #4ade80;
  --danger: #f87171;
  --warning: #fbbf24;

  /* Tipografía */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max-width: 1120px;
  --nav-height: 68px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);

  --transition: 160ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  scrollbar-color: var(--border-strong) var(--bg-elevated);
  scrollbar-width: thin;
}

/* Scrollbar oscuro consistente en navegadores basados en WebKit/Blink.
   Se aplica globalmente (incluye la sidebar de documentación, que antes
   heredaba un scrollbar claro por defecto y rompía el tema oscuro). */
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--bg-elevated);
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid var(--bg-elevated);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% -10%, rgba(79, 209, 255, 0.06), transparent 40%),
    radial-gradient(circle at 100% 0%, rgba(79, 209, 255, 0.04), transparent 35%), var(--bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  font-weight: 800;
}
h2 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}
h3 {
  font-size: 1.2rem;
}

p {
  color: var(--text-secondary);
  margin: 0 0 1em;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Navbar ---------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  background: rgba(11, 13, 17, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.brand .brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #06121a;
  flex: none;
}

.brand .brand-sub {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary,
a.btn-primary:link,
a.btn-primary:visited,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:active {
  background: var(--accent);
  color: #06121a;
  box-shadow: 0 0 0 rgba(79, 209, 255, 0);
}

a.btn-primary:hover,
a.btn-primary:focus {
  background: var(--accent-strong);
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 0 24px var(--accent-glow);
}

.btn-secondary,
a.btn-secondary:link,
a.btn-secondary:visited,
a.btn-secondary:hover,
a.btn-secondary:focus,
a.btn-secondary:active {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

a.btn-secondary:hover,
a.btn-secondary:focus {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Tarjetas ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: border-color var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--border-strong);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

/* ---------- Badges / estado ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.dot-offline {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.6);
}
.dot-online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}
.dot-planned {
  background: var(--warning);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

/* ---------- Secciones ---------- */

.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: block;
}

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 28px;
  background: var(--bg-elevated);
}

.footer-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
  opacity: 0.9;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 32px;
  margin-bottom: 40px;
}

.footer-col h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.92rem;
  padding: 5px 0;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Placeholder de branding (hasta recibir assets oficiales) ---------- */

.brand-placeholder-note {
  font-size: 0.75rem;
  color: var(--warning);
  border: 1px dashed rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.06);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

/* ---------- Componente de logo (usa /assets/branding/*.png si existe,
   con fallback automático a una letra si el archivo aún no fue subido) ---------- */

.brand-logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex: none;
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-logo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #06121a;
  font-weight: 800;
}

.brand-logo.brand-logo--fallback .brand-logo-fallback {
  display: flex;
}

.brand-logo--nav {
  width: 28px;
  height: 28px;
}
.brand-logo--nav .brand-logo-fallback {
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.brand-logo--hero {
  width: 84px;
  height: 84px;
  margin: 0 auto 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
}
.brand-logo--hero .brand-logo-fallback {
  font-size: 1.6rem;
  background: none;
  color: var(--accent);
}
.brand-logo--hero:not(.brand-logo--fallback) {
  border-color: transparent;
  background: none;
  padding: 6px;
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumbs a {
  color: var(--text-muted);
  transition: color var(--transition);
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs .sep {
  color: var(--border-strong);
}

.breadcrumbs .current {
  color: var(--text-secondary);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    gap: 2px;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    padding: 12px 14px;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-actions {
    display: none;
  }
}

/* ---------- Utilidades de contenido extendido ---------- */

.lede {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 720px;
}

.callout {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.callout strong {
  color: var(--text-primary);
}

.callout-warning {
  border-left-color: var(--warning);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface);
}

.stat .stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
}

.stat .stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.timeline {
  list-style: none;
  margin: 24px 0;
  padding: 0;
  counter-reset: step;
}

.timeline li {
  position: relative;
  padding: 0 0 26px 40px;
  border-left: 1px solid var(--border-strong);
  margin-left: 14px;
}

.timeline li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -15px;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.timeline h4 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.timeline p {
  margin: 0;
  font-size: 0.88rem;
}

.subsection {
  margin: 40px 0;
}

.subsection h3 {
  margin-bottom: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.tag-row .badge {
  font-weight: 500;
}

table.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.88rem;
}

table.doc-table th,
table.doc-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

table.doc-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.internal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.fade-in {
  animation: fadeIn 420ms ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Foto de fundador (con fallback circular automático) ---------- */

.founder-photo {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  flex: none;
}

.founder-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.founder-photo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #06121a;
  font-weight: 800;
  font-size: 1.8rem;
}

.founder-photo.founder-photo--fallback .founder-photo-fallback {
  display: flex;
}

/* ---------- Badges de estado de producto ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-active {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-discontinued {
  background: rgba(251, 191, 36, 0.1);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* ---------- Navbar: ligera contracción al hacer scroll ---------- */

.navbar.scrolled {
  background: rgba(11, 13, 17, 0.96);
  box-shadow: var(--shadow-sm);
}

/* ---------- Scroll reveal (usa IntersectionObserver desde main.js) ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 480ms ease, transform 480ms ease;
}

.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- Guía interactiva: progreso + navegación anterior/siguiente ---------- */

.guide-progress-track {
  position: sticky;
  top: var(--nav-height);
  z-index: 10;
  height: 3px;
  background: var(--border);
  margin-bottom: 8px;
}

.guide-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 120ms ease;
}

.guide-progress-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.guide-pagination {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.guide-pagination .btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ---------- Contenedor a prueba de overflow horizontal ---------- */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* ---------- Producto: tarjeta de proyecto en el portal ---------- */

.product-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.product-card-head h3 {
  margin: 0;
}

.product-card .btn-row {
  margin-top: auto;
  padding-top: 4px;
}

/* ---------- Ecosistema: diagrama simple ---------- */

.ecosystem-tree {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 24px 0;
  font-size: 0.92rem;
}

.ecosystem-root {
  font-weight: 800;
  color: var(--text-primary);
}

.ecosystem-branch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 24px;
  position: relative;
  color: var(--text-secondary);
}

.ecosystem-branch::before {
  content: '├─';
  color: var(--border-strong);
  font-family: var(--font-mono);
}

.ecosystem-branch:last-child::before {
  content: '└─';
}

.ecosystem-branch a {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Mejores estados focus/hover generales ---------- */

.card[tabindex],
.card a.card-link,
a.card {
  cursor: pointer;
}

.card:focus-within {
  border-color: var(--accent);
}

a:hover {
  text-decoration-thickness: 1px;
}
