/* doc-theme: sentry-v4
 *
 * Estilos del centro de documentación, inspirados en docs.sentry.io.
 * La app NO sobrescribe este archivo: edítalo y recarga el navegador.
 * Si lo borras, se vuelve a crear con el diseño por defecto al publicar.
 *
 * Para cambiar el aspecto de todo el sitio basta con tocar las variables
 * de :root (colores, fuente, anchos).
 */

/* ─── Fuente (local, funciona sin internet) ─────────────────────────────── */

@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/rubik-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Rubik";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("../fonts/rubik-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ─── Variables del tema ───────────────────────────────────────────────── */

:root {
  --font: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", Consolas, "Liberation Mono", monospace;

  --accent: #6a5fc1;          /* morado Sentry: activo, enlaces, números */
  --accent-strong: #584ac0;
  --accent-soft: #f0eefb;     /* fondos suaves del acento */
  --accent-border: #d6d1f2;

  --bg: #ffffff;
  --bg-subtle: #fbfafc;       /* menú lateral */
  --bg-hover: #f2f0f5;
  --fg: #2b2233;              /* texto principal */
  --fg-muted: #6e6378;        /* texto secundario */
  --fg-faint: #9a90a4;
  --border: #e7e1ec;

  --info-bg: #f0eefb;    --info-fg: #6a5fc1;
  --tip-bg: #eaf7ef;     --tip-fg: #1f8a4c;
  --warning-bg: #fdf6e3; --warning-fg: #a26b00;
  --danger-bg: #fdecee;  --danger-fg: #c4314b;

  --header-height: 64px;
  --sidebar-width: 290px;
  --toc-width: 240px;
  --content-width: 760px;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(43, 34, 51, 0.06), 0 4px 16px rgba(43, 34, 51, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #9e93f0;
    --accent-strong: #b6adf5;
    --accent-soft: #2a2545;
    --accent-border: #3d3566;

    --bg: #181225;
    --bg-subtle: #1d1630;
    --bg-hover: #271f3d;
    --fg: #ece8f2;
    --fg-muted: #a99fb8;
    --fg-faint: #7d7290;
    --border: #2e2542;

    --info-bg: #2a2545;    --info-fg: #b6adf5;
    --tip-bg: #13301f;     --tip-fg: #5fd38d;
    --warning-bg: #33280c; --warning-fg: #f0c45a;
    --danger-bg: #3a1720;  --danger-fg: #ff8095;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}

/* ─── Base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--header-height) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

kbd {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--fg-muted);
  background: var(--bg);
}

/* ─── Header ───────────────────────────────────────────────────────────── */

.docs-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  flex-shrink: 0;
}
.docs-brand:hover { text-decoration: none; }

/* TP_Logo_Oscuro sobre fondo claro; base.html cambia a TP_Logo_Blanco en modo oscuro. */
.docs-brand picture { display: flex; }
.docs-brand-logo { height: 30px; width: auto; }

.docs-brand-name {
  font-size: 1.15rem;
  font-weight: 500;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
}

.docs-search {
  flex: 0 1 420px;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 38px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg-faint);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.docs-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.docs-search input {
  flex: 1;
  min-width: 0;
  width: 100%; /* sin esto el input no baja de su ancho natural en móvil */
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
}

.docs-header-links { display: flex; gap: 1.25rem; flex-shrink: 0; }
.docs-header-links a { color: var(--fg-muted); font-size: 0.9rem; }
.docs-header-links a:hover { color: var(--accent); text-decoration: none; }

.docs-menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 6px;
  width: 38px;
  height: 38px;
  font-size: 1.25rem;
  cursor: pointer;
}

/* ─── Estructura: menú | contenido | en esta página ───────────────────── */

.docs-shell {
  display: flex;
  padding-top: var(--header-height);
  min-height: 100vh;
}

.docs-sidebar {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  padding: 1.25rem 1rem 2rem;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  font-size: 0.9rem;
}

.docs-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 2rem 3rem 0;
  display: flex;
  flex-direction: column;
}

.docs-article {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  flex: 1;
}

.docs-toc {
  display: none;
  position: sticky;
  top: var(--header-height);
  align-self: flex-start;
  width: var(--toc-width);
  flex-shrink: 0;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 2rem 1.25rem 2rem 0;
  font-size: 0.85rem;
}
@media (min-width: 1200px) {
  .has-toc .docs-toc { display: block; }
}

/* ─── Menú lateral ─────────────────────────────────────────────────────── */

.nav-section {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  padding: 0.5rem 0.5rem 0.35rem;
  margin-top: 1rem;
}
.nav-section:first-child { margin-top: 0; }

.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-list .nav-list { padding-left: 0.85rem; margin: 2px 0 4px 0.6rem; border-left: 1px solid var(--border); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  color: var(--fg);
  opacity: 0.82;
  line-height: 1.45;
  transition: background 0.12s ease-out, opacity 0.12s;
}
.nav-link:hover { opacity: 1; background: var(--bg-hover); text-decoration: none; }
.nav-link.active { opacity: 1; background: var(--accent); color: #fff; font-weight: 500; }
.nav-link .bi { font-size: 0.95rem; opacity: 0.75; }
.nav-count {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--fg-muted);
}
.nav-link.active .nav-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

.nav-empty { color: var(--fg-faint); padding: 0.4rem 0.5rem; }

/* Jerarquía del menú: la categoría es la rama padre (más marcada) y sus guías
   cuelgan de ella con sangría, una línea guía y letra más chica. Las subguías
   bajan un nivel más. */
.nav-group .nav-section {
  color: var(--fg);
  font-weight: 700;
  opacity: 0.85;
  margin-top: 1.1rem;
}
.nav-group > .nav-list {
  margin: 0.15rem 0 0.35rem 0.55rem;
  padding-left: 0.5rem;
  border-left: 1px solid var(--border);
}
.nav-group .nav-link {
  font-size: 0.84rem;
  padding: 0.32rem 0.5rem;
  line-height: 1.4;
}
.nav-group .nav-list .nav-list { margin-left: 0.5rem; }
.nav-group .nav-list .nav-list .nav-link { font-size: 0.79rem; }
/* Submenú dentro de una sección (campo "grupo" del catálogo): se abre y se
   cierra; aparece abierto si contiene la página actual. */
.nav-subgroup > summary { cursor: pointer; list-style: none; font-weight: 600; }
.nav-subgroup > summary::-webkit-details-marker { display: none; }
.nav-subgroup > summary .nav-caret { margin-left: auto; font-size: 0.7rem; transition: transform 0.15s; }
.nav-subgroup[open] > summary .nav-caret { transform: rotate(90deg); }
.is-filtered-out { display: none !important; }

/* ─── Migas de pan ─────────────────────────────────────────────────────── */

.docs-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.75rem;
}
.docs-breadcrumb a { color: var(--fg-muted); }
.docs-breadcrumb a:hover { color: var(--accent); text-decoration: none; }
.docs-breadcrumb .sep { color: var(--fg-faint); }

/* ─── Contenido ────────────────────────────────────────────────────────── */

.docs-title {
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}

.docs-lead {
  font-size: 1.1rem;
  color: var(--fg-muted);
  margin: 0 0 1rem;
}

.docs-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.25rem;
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-bottom: 1.75rem;
}
.docs-meta .bi { margin-right: 0.25rem; }

/* "De qué se trata": para qué sirve la funcionalidad, antes de los pasos. */
.docs-about { margin: 0 0 1.5rem; }
.docs-about h2, .docs-restrictions h2 { font-size: 1.15rem; font-weight: 500; margin: 0 0 0.5rem; }
.docs-about p:last-child, .docs-about ul:last-child { margin-bottom: 0; }

/* "Restricciones y consideraciones": límites, permisos y cosas a tener en cuenta. */
.docs-restrictions {
  padding: 1rem 1.25rem;
  margin: 0 0 1.75rem;
  border-radius: var(--radius);
  background: var(--warning-bg);
}
.docs-restrictions h2 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.docs-restrictions h2 .bi { color: var(--warning-fg); }
.docs-restrictions p:last-child, .docs-restrictions ul:last-child { margin-bottom: 0; }

/* "Antes de empezar": requisitos y contexto, en un recuadro suave. */
.docs-before {
  padding: 1rem 1.25rem;
  margin: 0 0 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}
.docs-before h2 { font-size: 1rem; font-weight: 600; margin: 0 0 0.5rem; }
.docs-before p:last-child, .docs-before ul:last-child { margin-bottom: 0; }

/* Video plegado: es apoyo, no lo central. */
.docs-video-box {
  margin: 0 0 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.docs-video-box summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  list-style: none;
  font-weight: 500;
  color: var(--accent);
  background: var(--bg-subtle);
}
.docs-video-box summary::-webkit-details-marker { display: none; }
.docs-video-box summary:hover { background: var(--accent-soft); }
.docs-video-box[open] summary { border-bottom: 1px solid var(--border); }
.docs-video-box .bi { font-size: 1.15rem; }
.docs-video-len { margin-left: auto; font-size: 0.8rem; font-weight: 400; color: var(--fg-muted); }
.docs-video-box .docs-video { margin: 0; border: none; border-radius: 0; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.docs-video {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 2.5rem;
  --plyr-color-main: var(--accent);
}
.docs-video video { display: block; width: 100%; }

.docs-section-title {
  font-size: 1.35rem;
  font-weight: 500;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ─── Pasos ────────────────────────────────────────────────────────────── */
/* Texto primero (se entiende sin el video), recuadros y la captura al final. */

.step { margin: 0 0 2.25rem; }

.step-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.35;
  margin: 0 0 0.5rem;
}

.step-num {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-size: 0.78rem;
  font-weight: 600;
}

.step-body { padding-left: 2.25rem; }
.step-body p { margin: 0 0 0.65rem; }
.step-body ul, .docs-about ul, .docs-restrictions ul, .docs-before ul { margin: 0 0 0.65rem; padding-left: 1.2rem; }
.step-body li { margin: 0.2rem 0; }
.step-body li::marker { color: var(--accent); }
.step .callout, .step .step-figure { margin-left: 2.25rem; }

/* Ancla "#" al pasar el mouse por el título, como en Sentry. */
.step-anchor {
  color: var(--fg-faint);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s;
}
.step-title:hover .step-anchor { opacity: 1; }
.step-anchor:hover { color: var(--accent); text-decoration: none; }

/* "▶ 0:15" a la derecha del título: salta a ese momento del video. */
.step-seek {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.step-seek:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Captura: referencia visual de tamaño contenido; clic = ampliar. */
.step-figure { margin-top: 0.85rem; margin-bottom: 0; margin-right: 0; }
.step-img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  width: auto;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: zoom-in;
  transition: box-shadow 0.15s;
}
.step-img:hover { box-shadow: var(--shadow); }

.zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(24, 18, 37, 0.82);
  cursor: zoom-out;
}
.zoom-overlay img { max-width: 100%; max-height: 100%; border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.5); }

/* ─── Detalle de la sección del paso ("Qué incluye", "Tipos de...") ──────── */

.step-details { margin: 0 0 1rem 2.25rem; }
.details-title {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.details-list {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.92rem;
}
.details-row {
  display: grid;
  grid-template-columns: minmax(8rem, 30%) 1fr;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
}
.details-row + .details-row { border-top: 1px solid var(--border); }
.details-row:nth-child(even) { background: var(--bg-subtle); }
.details-row dt { margin: 0; font-weight: 600; color: var(--fg); }
.details-row dd { margin: 0; color: var(--fg-muted); }
@media (max-width: 640px) {
  .step-details { margin-left: 0; }
  .details-row { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* ─── Recuadros (Nota / Consejo / Importante / Advertencia) ─────────────── */

.callout {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
  background: var(--info-bg);
}
.callout-icon { flex-shrink: 0; font-size: 1.1rem; line-height: 1.4; color: var(--info-fg); }
.callout-label { font-weight: 600; }
.callout-tip     { background: var(--tip-bg); }
.callout-tip     .callout-icon { color: var(--tip-fg); }
.callout-warning { background: var(--warning-bg); }
.callout-warning .callout-icon { color: var(--warning-fg); }
.callout-danger  { background: var(--danger-bg); }
.callout-danger  .callout-icon { color: var(--danger-fg); }

/* ─── En esta página ───────────────────────────────────────────────────── */

.toc-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-faint);
  margin-bottom: 0.6rem;
}
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc-list a {
  display: block;
  padding: 0.25rem 0 0.25rem 0.85rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--fg-muted);
  line-height: 1.4;
}
.toc-list a:hover { color: var(--fg); text-decoration: none; }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }

/* ─── Anterior / Siguiente ─────────────────────────────────────────────── */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 3rem 0 1rem;
}
.pager a {
  display: block;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pager a:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.pager small { display: block; font-size: 0.75rem; color: var(--fg-muted); }
.pager strong { font-weight: 500; color: var(--accent); }
.pager-next { grid-column: 2; text-align: right; }

/* ─── Portada ──────────────────────────────────────────────────────────── */
/* Una sección por categoría del catálogo, igual que el menú. */

.home-group { margin-top: 2rem; }
.home-group .docs-section-title { margin: 0 0 1rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
}

.guide-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.guide-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.guide-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}
.guide-card-body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.guide-card-title { font-weight: 500; font-size: 1rem; }
.guide-card-parent { font-size: 0.75rem; color: var(--fg-faint); }
.guide-card-summary {
  font-size: 0.85rem;
  color: var(--fg-muted);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.guide-card-meta { font-size: 0.75rem; color: var(--fg-faint); }

.empty-state {
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
}

/* ─── Pie ──────────────────────────────────────────────────────────────── */

.docs-footer {
  max-width: var(--content-width);
  width: 100%;
  margin: 3rem auto 0;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--fg-faint);
}

/* ─── Móvil ────────────────────────────────────────────────────────────── */

@media (max-width: 991.98px) {
  .docs-menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .docs-header { gap: 0.6rem; padding: 0 0.75rem; }
  .docs-header-links, .docs-search kbd { display: none; }
  .docs-brand-name { display: none; }
  .docs-brand-logo { height: 22px; }

  .docs-sidebar {
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .menu-open .docs-sidebar { transform: none; }
  .docs-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    z-index: 30;
    background: rgba(24, 18, 37, 0.4);
  }
  .menu-open .docs-sidebar-backdrop { display: block; }

  .docs-main { margin-left: 0; padding: 1.5rem 1rem 0; }
  .docs-title { font-size: 1.7rem; }
  .step-body { padding-left: 0; }
  .step .callout, .step .step-figure { margin-left: 0; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { grid-column: auto; }
}
