/* ============================================================
   Ayuda de Dodo DOCS — hoja de estilo compartida
   Identidad visual de 3ysolutions.com:
     tipografías  Bricolage Grotesque / Source Sans 3 / JetBrains Mono
     acento       cian  #00BDC7  (enlaces y estados: cyan-deep)
     tema         claro / oscuro con conmutador (data-theme + localStorage)
   ============================================================ */

:root {
  /* superficies */
  --ground: #f4f7f8;        /* page-alt: fondo de página */
  --surface: #ffffff;        /* page */
  --surface-2: #e9eff1;      /* sunken */
  /* texto */
  --ink: #10243a;
  --ink-soft: #4e6779;
  --muted: #8ca1af;          /* ink-faint */
  /* líneas */
  --border: #dce6ea;         /* rule */
  --border-strong: #c7d5dc;
  /* acento cian */
  --accent: #00bdc7;         /* cyan */
  --accent-ink: #00707a;     /* cyan-deep — enlaces, eyebrows, estado activo */
  --accent-bg: #e0f7f9;      /* cyan-wash */
  /* dorado — usado en consejos y etiqueta de administradores */
  --code-ink: #6b6200;       /* gold-deep */
  --code-bg: #f7f1be;        /* gold-wash */
  --code-border: #e5d982;
  --warn-bg: #f7f1be;
  --warn-border: #e5d982;
  --warn-ink: #6b6200;
  --danger-bg: #fbeae8;
  --danger-border: #e6b0a8;
  --danger-ink: #98261a;
  /* verde — usado solo en la insignia "Nuevo" */
  --new-bg: #e2f6ea;
  --new-border: #a7ddbc;
  --new-ink: #16794a;
  --shadow: 0 1px 2px rgba(16,36,58,.05), 0 20px 46px -26px rgba(16,36,58,.28);
  /* tipografías */
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --body-font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --meta: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

/* Oscuro por preferencia del sistema (salvo que el usuario haya elegido claro) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0a1620;
    --surface: #0e1e2b;
    --surface-2: #060f17;
    --ink: #e8f2f7;
    --ink-soft: #94aebe;
    --muted: #627d8e;
    --border: #1a3244;
    --border-strong: #24435a;
    --accent: #2bdde9;
    --accent-ink: #00bdc7;
    --accent-bg: #07303a;
    --code-ink: #f1e7a2;
    --code-bg: #2b2607;
    --code-border: #4a4210;
    --warn-bg: #2b2607;
    --warn-border: #4a4210;
    --warn-ink: #f1e7a2;
    --danger-bg: #2a1512;
    --danger-border: #5a2a22;
    --danger-ink: #f0a99e;
    --new-bg: #0f2b1c;
    --new-border: #1f4a30;
    --new-ink: #7fe3ab;
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 20px 46px -26px rgba(0,0,0,.85);
  }
}

/* Oscuro elegido explícitamente con el conmutador */
:root[data-theme="dark"] {
  --ground: #0a1620;
  --surface: #0e1e2b;
  --surface-2: #060f17;
  --ink: #e8f2f7;
  --ink-soft: #94aebe;
  --muted: #627d8e;
  --border: #1a3244;
  --border-strong: #24435a;
  --accent: #2bdde9;
  --accent-ink: #00bdc7;
  --accent-bg: #07303a;
  --code-ink: #f1e7a2;
  --code-bg: #2b2607;
  --code-border: #4a4210;
  --warn-bg: #2b2607;
  --warn-border: #4a4210;
  --warn-ink: #f1e7a2;
  --danger-bg: #2a1512;
  --danger-border: #5a2a22;
  --danger-ink: #f0a99e;
  --new-bg: #0f2b1c;
  --new-border: #1f4a30;
  --new-ink: #7fe3ab;
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 20px 46px -26px rgba(0,0,0,.85);
}

/* Claro elegido explícitamente (gana sobre prefers-color-scheme: dark) */
:root[data-theme="light"] {
  --ground: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #e9eff1;
  --ink: #10243a;
  --ink-soft: #4e6779;
  --muted: #8ca1af;
  --border: #dce6ea;
  --border-strong: #c7d5dc;
  --accent: #00bdc7;
  --accent-ink: #00707a;
  --accent-bg: #e0f7f9;
  --code-ink: #6b6200;
  --code-bg: #f7f1be;
  --code-border: #e5d982;
  --warn-bg: #f7f1be;
  --warn-border: #e5d982;
  --warn-ink: #6b6200;
  --danger-bg: #fbeae8;
  --danger-border: #e6b0a8;
  --danger-ink: #98261a;
  --new-bg: #e2f6ea;
  --new-border: #a7ddbc;
  --new-ink: #16794a;
  --shadow: 0 1px 2px rgba(16,36,58,.05), 0 20px 46px -26px rgba(16,36,58,.28);
}

* { box-sizing: border-box; }
/* Tamaño base de todo el sitio. Subir aquí escala texto y espacios en rem
   de forma proporcional (títulos, lede, intro, índice…). */
html { font-size: 18px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body-font);
  font-weight: 400;
  line-height: 1.7;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
::selection { background: var(--code-bg); color: var(--ink); }

.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 28px 120px;
}

/* ---------- Barra superior ---------- */
.sitebar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.sitebar .wrap {
  padding-top: 14px;
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sitebar a { color: inherit; text-decoration: none; }

/* marca: logo 3Y (dos variantes por tema) + nombre del producto */
.sitebar .brand { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.sitebar .brand img { height: 58px; width: auto; display: block; }
.sitebar .brand .logo-dark { display: none; }
:root[data-theme="dark"] .sitebar .brand .logo-light { display: none; }
:root[data-theme="dark"] .sitebar .brand .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sitebar .brand .logo-light { display: none; }
  :root:not([data-theme="light"]) .sitebar .brand .logo-dark { display: block; }
}
.sitebar .brand .prod {
  font-family: var(--display);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: -0.02em;
  padding-left: 12px;
  border-left: 1px solid var(--border-strong);
  color: var(--ink-soft);
}
.sitebar .brand .prod span { color: var(--accent-ink); }

.sitebar .right { display: flex; align-items: center; gap: 13px; }
.sitebar nav {
  font-family: var(--meta);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sitebar nav a:hover { color: var(--accent-ink); }

/* ---------- Conmutador de tema (44x44, área táctil) ---------- */
.toggle {
  width: 40px; height: 40px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: border-color .15s, color .15s;
  flex: none;
}
.toggle:hover { border-color: var(--ink); color: var(--ink); }
.toggle svg { width: 17px; height: 17px; }
.toggle .moon { display: none; }
:root[data-theme="dark"] .toggle .sun { display: none; }
:root[data-theme="dark"] .toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle .sun { display: none; }
  :root:not([data-theme="light"]) .toggle .moon { display: block; }
}

/* ---------- Miga de pan ---------- */
.crumbs {
  font-family: var(--meta);
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 26px 0 0;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-ink); }
.crumbs .sep { padding: 0 7px; opacity: .6; }

/* ---------- Cabecera de artículo ---------- */
header.mast {
  padding: 18px 0 34px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  font-family: var(--meta);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 16px;
}
h1 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.95rem, 4.6vw, 2.7rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 18px;
}
.lede {
  max-width: 62ch;
  font-size: 1.08rem;
  color: var(--ink-soft);
  margin: 0 0 22px;
}
.meta-tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Escuchar artículo (síntesis de voz del navegador) ---------- */
.listen {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.listen:hover { border-color: var(--accent); color: var(--accent-ink); }
.listen svg { width: 16px; height: 16px; flex: none; }
.listen[data-state="reproduciendo"],
.listen[data-state="pausado"] {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: var(--accent-bg);
}
.listen[hidden] { display: none; }

/* ---------- Distribución ---------- */
.layout { display: block; }
@media (min-width: 1000px) {
  .layout {
    display: grid;
    grid-template-columns: 214px minmax(0, 1fr);
    gap: 60px;
    align-items: start;
  }
}

nav.toc { margin: 40px 0 0; }
@media (min-width: 1000px) {
  nav.toc {
    position: sticky;
    top: 28px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    margin-top: 56px;
  }
}
nav.toc h2 {
  font-family: var(--meta);
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 500;
}
nav.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
nav.toc li { margin: 0; }
nav.toc a {
  counter-increment: toc;
  display: flex;
  gap: 9px;
  padding: 6px 0 6px 10px;
  margin-left: -12px;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
nav.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--meta);
  font-size: 12px;
  color: var(--muted);
  padding-top: 2px;
}
nav.toc a:hover { color: var(--accent-ink); }
nav.toc a.active {
  color: var(--accent-ink);
  border-left-color: var(--accent);
  font-weight: 600;
}

main { min-width: 0; }
main a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
main a:hover { text-decoration-thickness: 2px; }

/* ---------- Llamados / notas ---------- */
.note {
  margin: 26px 0 8px;
  padding: 16px 20px;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.note b { color: var(--ink); }
.note.result {
  background: var(--surface-2);
  border-color: var(--border-strong);
  border-left-color: var(--border-strong);
}
.note.tip {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn-ink);
  color: var(--warn-ink);
}
.note.tip b { color: var(--warn-ink); }
.note.warn {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  border-left-color: var(--danger-ink);
  border-left-width: 4px;
  color: var(--danger-ink);
}
.note.warn b { color: var(--danger-ink); }

/* ---------- Secciones ---------- */
section.area {
  padding-top: 52px;
  scroll-margin-top: 24px;
}
section.area > h2 {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
  margin: 0 0 6px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-strong);
}
section.area > h2 .num {
  font-family: var(--meta);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-ink);
  margin-right: 12px;
}
section.area > p {
  color: var(--ink-soft);
  margin: 14px 0 4px;
  max-width: 66ch;
}
section.area > p.intro { font-size: 1.03rem; color: var(--ink); }
section.area h3 {
  font-family: var(--display);
  font-size: 1.14rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 26px 0 4px;
  color: var(--ink);
}
section.area ul, section.area ol { max-width: 66ch; color: var(--ink-soft); }
section.area li { margin: 3px 0; }
section.area strong { color: var(--ink); }

/* pasos numerados */
ol.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 18px 0 6px;
  max-width: 66ch;
}
ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 2px 0 12px 40px;
  color: var(--ink-soft);
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-family: var(--meta);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
}

/* ---------- Etiquetas ---------- */
.tag {
  display: inline-block;
  font-family: var(--meta);
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 2px 7px;
  white-space: nowrap;
}
.tag.accent {
  color: var(--accent-ink);
  border-color: var(--border);
  background: var(--accent-bg);
}
.tag.admin {
  color: var(--code-ink);
  border-color: var(--code-border);
  background: var(--code-bg);
}

/* Insignia "Nuevo": marca una novedad reciente. Cada una lleva
   data-new="AAAA-MM-DD" (fecha en que se agregó a esta ayuda); un script
   en cada página la oculta sola pasados 8 meses — ver NEW_BADGE_JS en
   build_site.py. Sin JavaScript, la insignia queda visible siempre. */
.badge-new {
  display: inline-block;
  font-family: var(--meta);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--new-ink);
  background: var(--new-bg);
  border: 1px solid var(--new-border);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: 2px;
  white-space: nowrap;
}

/* ---------- Figuras ---------- */
figure.shot {
  margin: 20px 0 6px;
  max-width: 720px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
figure.shot.narrow { max-width: 420px; }
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot figcaption {
  font-family: var(--meta);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  letter-spacing: .02em;
}

/* ---------- Enlaces prev/next ---------- */
.prevnext {
  display: grid;
  gap: 12px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
@media (min-width: 620px) { .prevnext { grid-template-columns: 1fr 1fr; } }
.prevnext a {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
.prevnext a:hover { border-color: var(--accent); }
.prevnext .dir {
  font-family: var(--meta);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}
.prevnext .next { text-align: right; }

a.top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  font-family: var(--meta);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
a.top:hover { color: var(--accent-ink); }

footer.end {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  font-family: var(--meta);
  line-height: 1.7;
}

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

/* ---------- Portada ---------- */
.hero { padding: 64px 0 34px; border-bottom: 1px solid var(--border); }
.hero:has(.buscar-hint:not([hidden])) { padding-bottom: 18px; }
.hero p { max-width: 64ch; color: var(--ink-soft); }
.cat { padding-top: 44px; }
.cat h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-strong);
}
.cards {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  min-height: 168px;
  padding: 18px 18px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.card .icn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-bg);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.card .icn svg { width: 19px; height: 19px; }
.card b { font-weight: 700; font-size: .98rem; display: block; margin-bottom: 6px; }
.card p {
  margin: 0;
  font-size: .84rem;
  line-height: 1.5;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .go {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--meta);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.card:hover .go { color: var(--accent-ink); }
.card.pending { border-left-color: var(--border-strong); opacity: .62; }
.card.pending .icn { background: var(--surface-2); color: var(--muted); }
.card[hidden] { display: none; }

.cat h2 .count {
  font-family: var(--meta);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .04em;
  margin-left: 8px;
  vertical-align: 2px;
}
.muted-note { color: var(--muted); font-size: 15px; }
.buscar-hint { margin-top: 10px; }
.buscar-hint span {
  display: inline-block;
  font-size: 13px;
  color: var(--accent-ink);
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 11px;
}
.buscar {
  margin-top: 22px;
  width: 100%;
  max-width: 420px;
  display: block;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}
.buscar:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 620px) {
  .sitebar .brand .prod { display: none; }
  .sitebar .brand img { height: 46px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 18px 90px; }
}
