/* ===========================================================================
   Centro de Ayuda — Tableros Power BI · Nimbus BI
   Paleta: violeta Nimbus + dorado Nimbus BI · Responsive · Light/Dark
   =========================================================================== */

:root {
  /* Marca */
  --brand:        #7c2fd6;   /* violeta Nimbus */
  --brand-strong: #5b1fa6;
  --brand-soft:   #f3ecfd;
  --brand-2:      #a855f7;   /* lila */
  --gold:         #d99a1c;   /* dorado Nimbus BI */
  --gold-2:       #f2c14e;
  --gold-soft:    #fdf5e2;

  /* Neutros (light) */
  --bg:        #ffffff;
  --surface:   #f7f7fb;
  --surface-2: #f1f1f7;
  --card:      #ffffff;
  --text:      #1a1a2e;
  --muted:     #64647a;
  --border:    #e7e7f0;
  --border-2:  #d8d8e6;
  --shadow:    0 1px 2px rgba(24,24,48,.05), 0 8px 24px rgba(24,24,48,.06);
  --shadow-lg: 0 12px 40px rgba(24,24,48,.16);

  /* Callouts */
  --info-bg:#eef4ff; --info-bd:#3b82f6;
  --tip-bg:#ecfdf3;  --tip-bd:#12b76a;
  --warn-bg:#fff7ed; --warn-bd:#f79009;

  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 820px;
  --sidebar-w: 288px;
  --topbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg:        #14141c;
  --surface:   #1a1a24;
  --surface-2: #20202e;
  --card:      #1c1c28;
  --text:      #ececf4;
  --muted:     #9a9ab2;
  --border:    #2b2b3c;
  --border-2:  #363648;
  --brand-soft:#241a3a;
  --gold-soft: #2b2410;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
  --info-bg:#16233d; --tip-bg:#0f2a20; --warn-bg:#2e2310;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------- Topbar ---------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }
.brand img { height: 30px; display: block; }
.brand .divider { width: 1px; height: 22px; background: var(--border-2); }
.brand .tag { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.menu-btn {
  display: none; border: 1px solid var(--border); background: var(--card);
  color: var(--text); width: 40px; height: 40px; border-radius: 10px;
  cursor: pointer; align-items: center; justify-content: center; flex-shrink: 0;
}
.menu-btn svg { width: 20px; height: 20px; }

/* Buscador */
.search-wrap { position: relative; flex: 1; max-width: 520px; margin-left: auto; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 0 12px; height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-box input {
  border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 15px; width: 100%; font-family: inherit;
}
.search-box .kbd-hint { font-size: 12px; color: var(--muted); border: 1px solid var(--border-2);
  border-radius: 6px; padding: 2px 6px; white-space: nowrap; }

.search-results {
  position: absolute; top: 52px; left: 0; right: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  max-height: 65vh; overflow-y: auto; padding: 6px; display: none;
}
.search-results.open { display: block; }
.sr-item { display: block; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--surface); text-decoration: none; }
.sr-cat { font-size: 12px; color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.sr-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 2px 0; }
.sr-snippet { font-size: 13px; color: var(--muted); line-height: 1.45; }
.sr-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
mark { background: var(--gold-2); color: #3a2c05; border-radius: 3px; padding: 0 2px; }

.icon-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }

/* Búsqueda mobile: botón lupa (topbar) + cerrar (dentro del box) — ocultos en desktop */
.search-toggle { display: none; }
.search-close { display: none; border: 0; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 2px 0 6px; flex-shrink: 0; }
.search-close:hover { color: var(--brand); }

/* ---------- Layout ---------------------------------------------------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; align-items: start; }

.sidebar {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto; padding: 24px 14px 40px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar .cat { margin-bottom: 22px; }
.sidebar .cat-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 6px 12px; margin-bottom: 2px;
}
.sidebar .cat-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.sidebar .nav-link {
  display: block; padding: 8px 12px; border-radius: 9px;
  font-size: 14.5px; color: var(--text); cursor: pointer; line-height: 1.35;
}
.sidebar .nav-link:hover { background: var(--surface); text-decoration: none; }
.sidebar .nav-link.active { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }
:root[data-theme="dark"] .sidebar .nav-link.active { color: var(--brand-2); }

.scrim { display: none; }

/* ---------- Main ------------------------------------------------------ */
.main { min-width: 0; padding: 32px 40px 80px; }
.container { max-width: var(--maxw); margin: 0 auto; }

/* Home */
.hero {
  border-radius: 20px; padding: 44px 40px;
  background:
    radial-gradient(1200px 220px at 12% -30%, rgba(168,85,247,.18), transparent 60%),
    linear-gradient(135deg, var(--brand-strong), var(--brand) 55%, #8b3ff0);
  color: #fff; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(242,193,78,.35), transparent 65%); pointer-events: none;
}
.hero h1 { margin: 0 0 10px; font-size: 30px; line-height: 1.2; letter-spacing: -.01em; }
.hero p { margin: 0; font-size: 16px; color: rgba(255,255,255,.9); max-width: 620px; }
.hero .hero-search { margin-top: 22px; max-width: 560px; }
.hero .hero-search .search-box { height: 50px; background: #fff; border-color: transparent; }
.hero .hero-search .search-box input { color: #1a1a2e; }
.hero .hero-search .search-box svg { color: #64647a; }

.section-title { font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); margin: 40px 0 16px; }

.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.cat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: transform .12s, box-shadow .12s, border-color .12s;
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); text-decoration: none; }
.cat-card .cc-icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 14px;
}
.cat-card .cc-icon svg { width: 24px; height: 24px; }
.cat-card h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.cat-card p { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.cat-card .cc-count { font-size: 13px; color: var(--brand); font-weight: 600; }

.popular-list { display: grid; gap: 10px; }
.popular-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text); transition: border-color .12s, background .12s;
}
.popular-item:hover { border-color: var(--brand); background: var(--surface); text-decoration: none; }
.popular-item svg { width: 18px; height: 18px; color: var(--gold); flex-shrink: 0; }
.popular-item .pi-arrow { margin-left: auto; color: var(--muted); }

/* Article */
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 18px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { opacity: .6; }

.article h1 { font-size: 30px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -.01em; }
.article .lead { font-size: 17px; color: var(--muted); margin: 0 0 28px; }

.article-body { font-size: 16px; }
.article-body h2 {
  font-size: 21px; margin: 36px 0 12px; padding-top: 12px; letter-spacing: -.01em;
  scroll-margin-top: 80px;
}
.article-body h3 { font-size: 17px; margin: 26px 0 8px; }
.article-body p { margin: 0 0 16px; }
.article-body ul, .article-body ol { margin: 0 0 18px; padding-left: 22px; }
.article-body li { margin-bottom: 8px; }
.article-body ol { counter-reset: step; list-style: none; padding-left: 0; }
.article-body ol > li {
  position: relative; padding-left: 44px; margin-bottom: 16px; min-height: 30px;
}
.article-body ol > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: -1px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-strong);
  font-weight: 700; font-size: 14px; display: grid; place-items: center;
}
:root[data-theme="dark"] .article-body ol > li::before { color: var(--brand-2); }
.article-body strong { color: var(--text); font-weight: 700; }
.article-body code, .kbd {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: .9em;
}
.kbd {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; color: var(--text);
  font-weight: 600; white-space: nowrap;
}

/* Figuras */
figure { margin: 22px 0; text-align: center; }
figure img {
  max-width: 100%; max-height: 540px; width: auto; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: zoom-in; display: inline-block; box-shadow: var(--shadow);
}
figure figcaption { font-size: 13.5px; color: var(--muted); margin-top: 8px; }
/* Pares de imágenes (ícono + resultado): natural size, sin upscalear ni distorsionar */
.imgrow { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start; margin: 22px 0; }
.imgrow figure { margin: 0; flex: 0 1 auto; max-width: calc(50% - 8px); }
.imgrow figure img { max-height: 380px; margin: 0; }

/* ---------- Mockups (reconstrucción de pantallas de apps) ------------ */
.mockrow { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: flex-start; margin: 22px 0; }
.mock { display: inline-block; text-align: center; }
.mock .mock-cap { font-size: 13px; color: var(--muted); margin-top: 10px; max-width: 260px; }

/* Teléfono (Google Authenticator, tema oscuro) */
.phone {
  width: 250px; background: #0c0c0e; border: 7px solid #202027; border-radius: 30px;
  box-shadow: var(--shadow-lg); overflow: hidden; text-align: left; color: #e6e6ea;
  font-size: 12.5px; line-height: 1.4;
}
.phone .scr { padding: 12px 14px 16px; min-height: 430px; position: relative; }
.phone .sbar { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: #b9b9c2; margin-bottom: 16px; }
.phone .sbar .dots { letter-spacing: 1px; }
.phone .ga-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.phone .ga-top b { font-size: 14px; font-weight: 600; color: #fff; }
.phone .ga-burger { display: grid; gap: 3px; }
.phone .ga-burger i { width: 16px; height: 2px; background: #cfcfe0; border-radius: 2px; display: block; }
.phone .ga-menu { background: #17171b; border: 1px solid #2a2a31; border-radius: 12px; padding: 6px; margin-top: 6px; }
.phone .ga-item { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 9px; color: #dcdce4; }
.phone .ga-item .gi { width: 20px; height: 20px; border-radius: 5px; background: #2f2f39; flex-shrink: 0; display: grid; place-items: center; color: #9aa7ff; font-size: 12px; }
.phone .ga-item.hi { background: rgba(120,140,255,.16); color: #fff; outline: 1.5px solid #6c7cf0; }
.phone .ga-h { font-size: 17px; font-weight: 600; color: #fff; margin: 14px 0 6px; }
.phone .ga-sub { color: #a9a9b6; font-size: 12px; margin-bottom: 16px; }
.phone .ga-card { background: #4a56c8; color: #fff; border-radius: 14px; padding: 13px 14px; margin-bottom: 12px; display: flex; gap: 12px; align-items: flex-start; }
.phone .ga-card.hi { outline: 2.5px solid #ffd24a; box-shadow: 0 0 0 4px rgba(255,210,74,.25); }
.phone .ga-card .gc-ic { font-size: 16px; }
.phone .ga-card b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.phone .ga-card span { font-size: 11.5px; color: rgba(255,255,255,.82); }
.phone .ga-scan { margin: 26px auto; width: 168px; height: 168px; position: relative; }
.phone .ga-scan i { position: absolute; width: 42px; height: 42px; }
.phone .ga-scan i::before, .phone .ga-scan i::after { content: ""; position: absolute; background: currentColor; border-radius: 2px; }
.phone .ga-scan i::before { width: 100%; height: 4px; }
.phone .ga-scan i::after { width: 4px; height: 100%; }
.phone .ga-scan .tl { top: 0; left: 0; color: #4285F4; }
.phone .ga-scan .tr { top: 0; right: 0; color: #FBBC04; }.phone .ga-scan .tr::after { right: 0; }.phone .ga-scan .tr::before { right: 0; }
.phone .ga-scan .bl { bottom: 0; left: 0; color: #34A853; }.phone .ga-scan .bl::before { bottom: 0; }
.phone .ga-scan .br { bottom: 0; right: 0; color: #EA4335; }.phone .ga-scan .br::before { bottom: 0; right: 0; }.phone .ga-scan .br::after { right: 0; }
.phone .ga-scantitle { text-align: center; color: #fff; font-size: 13px; margin-bottom: 4px; }
.phone .ga-btn { background: #3b82f6; color: #fff; text-align: center; border-radius: 22px; padding: 12px; font-size: 13px; font-weight: 600; margin-top: 18px; }

/* Diálogo Microsoft (tema claro) */
.win {
  width: 340px; background: #fff; border: 1px solid #d8d8d8; border-radius: 10px; overflow: hidden;
  box-shadow: var(--shadow-lg); text-align: left; color: #1b1b1b;
}
.win .win-bar { background: #f3f3f3; border-bottom: 1px solid #e2e2e2; padding: 7px 12px; font-size: 11px; color: #6b6b6b; display: flex; align-items: center; gap: 7px; }
.win .win-bar .lock { color: #8a8a8a; }
.win .win-body { padding: 26px 28px 24px; }
.win .ms-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.win .ms-logo .sq { display: grid; grid-template-columns: 10px 10px; grid-template-rows: 10px 10px; gap: 2px; }
.win .ms-logo .sq i { display: block; }
.win .ms-logo .sq i:nth-child(1){background:#f25022}.win .ms-logo .sq i:nth-child(2){background:#7fba00}.win .ms-logo .sq i:nth-child(3){background:#00a4ef}.win .ms-logo .sq i:nth-child(4){background:#ffb900}
.win .ms-logo span { font-size: 15px; color: #5e5e5e; font-weight: 600; }
.win .ms-mail { font-size: 13px; color: #1b1b1b; margin-bottom: 10px; }
.win .ms-h { font-size: 21px; font-weight: 600; margin: 2px 0 10px; }
.win .ms-p { font-size: 12.5px; color: #333; display: flex; gap: 8px; margin-bottom: 18px; }
.win .ms-p .k { border: 1px solid #bbb; border-radius: 3px; padding: 0 3px; font-size: 10px; color: #666; height: 16px; }
.win .ms-input { border-bottom: 1.5px solid #1b1b1b; color: #9a9a9a; font-size: 13px; padding-bottom: 4px; margin-bottom: 18px; }
.win .ms-link { color: #0067b8; font-size: 12.5px; margin-bottom: 20px; }
.win .ms-btns { display: flex; justify-content: flex-end; gap: 8px; }
.win .ms-btns .b { padding: 7px 20px; font-size: 13px; }
.win .ms-btns .b.cancel { background: #ebebeb; color: #1b1b1b; }
.win .ms-btns .b.ok { background: #0067b8; color: #fff; }
@media (max-width: 560px) { .win, .phone { width: 100%; max-width: 300px; } }

/* Callouts */
.callout {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm);
  margin: 20px 0; border: 1px solid transparent; font-size: 15px;
}
.callout .co-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.callout p { margin: 0; }
.callout p + p { margin-top: 6px; }
.callout.tip  { background: var(--tip-bg);  border-color: color-mix(in srgb, var(--tip-bd) 30%, transparent); }
.callout.tip  .co-icon { color: var(--tip-bd); }
.callout.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info-bd) 30%, transparent); }
.callout.info .co-icon { color: var(--info-bd); }
.callout.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn-bd) 30%, transparent); }
.callout.warn .co-icon { color: var(--warn-bd); }
.callout b { font-weight: 700; }

/* FAQ / accordion */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 10px; overflow: hidden; background: var(--card); }
.faq-q { padding: 15px 18px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.faq-q::after { content: "+"; margin-left: auto; color: var(--brand); font-size: 20px; font-weight: 400; }
.faq-item.open .faq-q::after { content: "\2013"; }
.faq-a { padding: 0 18px; max-height: 0; overflow: hidden; transition: max-height .25s, padding .25s; color: var(--muted); }
.faq-item.open .faq-a { padding: 0 18px 16px; max-height: 500px; }
.faq-a p { margin: 0 0 8px; }

/* Glosario */
.glossary { display: grid; gap: 0; }
.gloss-term { padding: 14px 0; border-bottom: 1px solid var(--border); }
.gloss-term dt { font-weight: 700; color: var(--brand-strong); margin-bottom: 3px; }
:root[data-theme="dark"] .gloss-term dt { color: var(--brand-2); }
.gloss-term dd { margin: 0; color: var(--muted); }

/* Prev / next + feedback */
.article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.nav-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px;
  cursor: pointer; color: var(--text); transition: border-color .12s;
}
.nav-card:hover { border-color: var(--brand); text-decoration: none; }
.nav-card.next { text-align: right; }
.nav-card .nc-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.nav-card .nc-title { font-size: 15px; font-weight: 600; color: var(--brand); margin-top: 3px; }

.feedback {
  margin-top: 40px; padding: 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.feedback span { font-weight: 600; }
.feedback .fb-btns { display: flex; gap: 10px; margin-left: auto; }
.feedback button {
  border: 1px solid var(--border-2); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 8px 16px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.feedback button:hover { border-color: var(--brand); color: var(--brand); }
.feedback .fb-thanks { color: var(--tip-bd); font-weight: 600; margin-left: auto; }

/* ---------- Footer ---------------------------------------------------- */
.footer {
  border-top: 1px solid var(--border); padding: 32px 40px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  color: var(--muted); font-size: 14px; background: var(--surface);
}
.footer img { height: 26px; opacity: .9; }
.footer .foot-right { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- Lightbox -------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(10,10,20,.86);
  display: none; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out;
  backdrop-filter: blur(4px);
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 10px; box-shadow: var(--shadow-lg); }
.lightbox .lb-close {
  position: absolute; top: 20px; right: 24px; color: #fff; background: rgba(255,255,255,.12);
  border: 0; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 22px;
}

/* ---------- Responsive ------------------------------------------------ */
@media (max-width: 980px) {
  .cat-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-flex; }
  .brand .tag, .brand .divider { display: none; }
  .search-box .kbd-hint { display: none; }

  /* La búsqueda inline y la del hero se reemplazan por el overlay */
  .search-toggle { display: inline-flex; margin-left: auto; }
  .search-wrap { display: none; }
  .hero .hero-search { display: none; }
  body.search-active .search-wrap {
    display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    background: var(--bg); padding: 10px 12px; border-bottom: 1px solid var(--border);
    max-width: none; margin: 0;
  }
  body.search-active .search-box { height: 46px; }
  body.search-active .search-close { display: inline-flex; }
  body.search-active .search-results {
    position: fixed; top: 67px; left: 0; right: 0; z-index: 60;
    max-height: calc(100vh - 67px); border-radius: 0; border-left: 0; border-right: 0;
    border-top: 1px solid var(--border); box-shadow: none;
  }
  body.search-active .sr-title { font-size: 16px; }
  body.search-active .sr-snippet { font-size: 14px; }
  /* El overlay de búsqueda vive DENTRO del .topbar (stacking context a z-50).
     Por eso el dim debe quedar POR DEBAJO del topbar (z-40): si estuviera por encima,
     taparía los resultados y bloquearía los toques sobre ellos. */
  body.search-active::after {
    content: ""; position: fixed; top: 67px; left: 0; right: 0; bottom: 0;
    background: rgba(10,10,20,.4); z-index: 40;
  }

  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; z-index: 45;
    width: 300px; max-width: 84vw;
    transform: translateX(-102%); transition: transform .25s ease, visibility 0s linear .25s;
    box-shadow: var(--shadow-lg);
    visibility: hidden; pointer-events: none;
  }
  .sidebar.open { transform: translateX(0); visibility: visible; pointer-events: auto; transition: transform .25s ease, visibility 0s; }
  .scrim.open { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 44; background: rgba(10,10,20,.4); }
  .main { padding: 22px 18px 70px; }
  .hero { padding: 32px 22px; }
  .hero h1 { font-size: 24px; }
  .imgrow { flex-direction: column; align-items: center; }
  .imgrow figure { max-width: 100%; }
  .article-nav { grid-template-columns: 1fr; }
  .footer { padding: 24px 18px; }
}
@media (max-width: 560px) {
  .search-wrap { max-width: none; }
  .article h1, .hero h1 { font-size: 22px; }
  .feedback .fb-btns { margin-left: 0; width: 100%; }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
