/* =========================================================================
   PseudoWiki — skin de Wikipedia MÓVIL (Minerva), fiel a es.m.wikipedia.org
   ========================================================================= */

:root {
  --link: #3366cc;
  --visited: #795cb2;
  --ink: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --line-soft: #c8ccd1;
  --bg-soft: #f8f9fa;
  --serif: 'Georgia', 'Linux Libertine', 'Times New Roman', serif;
  --sans: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--visited); }
a:active { text-decoration: underline; }

/* =============================================================== HEADER */

#topbar {
  position: sticky; top: 0; z-index: 20;
  background: #eaecf0;
  border-bottom: 1px solid #c8ccd1;
  display: flex; align-items: center; gap: 6px;
  height: 56px; padding: 0 12px;
}
.hb { /* hamburguesa */
  width: 34px; height: 40px; flex: 0 0 auto;
  border: 0; background: none; display: grid; place-items: center;
}
.hb span, .hb span::before, .hb span::after {
  content: ''; display: block; width: 20px; height: 2px; background: #54595d; border-radius: 2px;
}
.hb span { position: relative; }
.hb span::before { position: absolute; top: -6px; }
.hb span::after { position: absolute; top: 6px; }

.wordmark {
  font-family: var(--serif);
  font-size: 23px; color: #54595d;
  margin-left: 4px; flex: 0 0 auto;
  line-height: 1;
  /* el long-press no debe disparar selección de texto ni scroll */
  touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; cursor: pointer;
}
.wordmark small { font-size: .72em; letter-spacing: .3px; }
.topspacer { flex: 1; }
.topbtn {
  width: 40px; height: 40px; border: 0; background: none;
  display: grid; place-items: center;
}
.topbtn svg { width: 22px; height: 22px; fill: none; stroke: #54595d; stroke-width: 2; }
.topbtn.filled svg { fill: #54595d; stroke: none; }

/* =============================================================== BÚSQUEDA (overlay) */

#searchoverlay {
  position: fixed; inset: 0; z-index: 40; background: #fff;
  display: none; flex-direction: column;
}
#searchoverlay.on { display: flex; }
.so-bar {
  display: flex; align-items: center; gap: 4px;
  height: 56px; padding: 0 8px;
  background: var(--bg-soft);
}
.so-back { width: 40px; height: 40px; border: 0; background: none; display: grid; place-items: center; }
.so-back svg { width: 22px; height: 22px; fill: none; stroke: #54595d; stroke-width: 2; }
#so-input {
  flex: 1; outline: none; font: 16px var(--sans); color: var(--ink);
  background: #fff; padding: 9px 12px;
  border: 1px solid #a2a9b1; border-radius: 2px;
}
#so-input:focus { border-color: #3366cc; box-shadow: inset 0 0 0 1px #3366cc; }
#so-input::placeholder { color: #72777d; }
/* Resultados a ancho completo, como la búsqueda de Wikipedia móvil real:
   filas edge-to-edge con divisores, sin caja ni contorno. */
#suggest {
  flex: 1; background: #fff; overflow-y: auto;
  border-top: 1px solid var(--line-soft);
}
.sg {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  border-bottom: 1px solid #eaecf0;
}
.sg .thumb {
  width: 46px; height: 46px; flex: 0 0 auto;
  background: #eaecf0;
  display: grid; place-items: center; overflow: hidden; color: #a2a9b1;
}
.sg .thumb img { width: 100%; height: 100%; object-fit: cover; }
.sg .thumb svg { width: 22px; height: 22px; fill: currentColor; }
.sg .tx { min-width: 0; }
.sg .tt { font-size: 16px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg .ds { font-size: 13.5px; color: var(--muted); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============================================================== AJUSTES */

#settings {
  position: fixed; inset: 0; z-index: 50; background: #fff;
  display: none; flex-direction: column;
}
#settings.on { display: flex; }
.set-title { flex: 1; font: 600 17px var(--sans); color: var(--ink); }
.set-save {
  border: 0; background: #3366cc; color: #fff; border-radius: 2px;
  padding: 8px 15px; font: 600 14px var(--sans);
}
.set-body { flex: 1; overflow-y: auto; padding: 16px; }
.set-h { font-weight: 700; font-size: 15px; margin-bottom: 6px; color: var(--ink); }
.set-note { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 14px; }
.set-note b { color: var(--ink); }
#set-aliases {
  width: 100%; min-height: 130px; resize: vertical;
  border: 1px solid var(--line); border-radius: 4px; padding: 10px;
  font: 13px/1.5 ui-monospace, Consolas, monospace; color: var(--ink);
}
#set-aliases:focus { outline: 2px solid #3366cc; border-color: transparent; }

#set-cfg-url {
  width: 100%; border: 1px solid var(--line); border-radius: 4px;
  padding: 9px 10px; font: 13px/1.4 ui-monospace, Consolas, monospace;
  color: var(--ink); margin-bottom: 8px;
}
#set-cfg-url:focus { outline: 2px solid #3366cc; border-color: transparent; }
.set-sync {
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  border-radius: 4px; padding: 8px 14px; font: 600 13px var(--sans);
  margin-bottom: 18px;
}
.set-sync:disabled { opacity: .6; }

/* =============================================================== ARTÍCULO */

#article { padding: 14px 16px 0; }

.title {
  font-family: var(--serif);
  font-size: 32px; font-weight: 400; line-height: 1.2;
  margin-bottom: 3px;
}
.shortdesc { font-size: 16px; color: var(--muted); line-height: 1.35; margin-bottom: 12px; }

/* barra de acciones (idiomas · descargar · vigilar · editar) */
.actionbar {
  display: flex; align-items: center;
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  margin: 0 -16px 14px; padding: 4px 10px;
}
.actionbar .ab { width: 44px; height: 40px; border: 0; background: none; display: grid; place-items: center; }
.actionbar .ab svg { width: 21px; height: 21px; fill: none; stroke: #54595d; stroke-width: 1.9; }
.actionbar .sp { flex: 1; }

#body p { margin: 0 0 16px; font-size: 16.5px; line-height: 1.6; }
#body b { color: var(--ink); }

/* infobox móvil: ancho completo, borde suave */
.infobox {
  border: 1px solid var(--line-soft); background: var(--bg-soft);
  margin: 0 0 18px; font-size: 14px;
}
.infobox .ib-cap { text-align: center; font-weight: 700; padding: 9px; }
.infobox .ib-img { display: block; }
.infobox .ib-img img { display: block; width: 100%; height: auto; }
.infobox .ib-img.draw { height: 150px; display: grid; place-items: center;
  background: linear-gradient(160deg, #7fb0d6, #3b6ea5); }
.infobox .ib-foot { padding: 7px 9px; color: var(--muted); text-align: center; font-style: italic; }
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td { padding: 6px 9px; text-align: left; vertical-align: top; border-top: 1px solid #eaecf0; }
.infobox th { color: var(--ink); font-weight: 700; width: 40%; }
.infobox .ib-wd { padding: 8px 9px; font-size: 13px; }

/* secciones colapsables */
.section > h2 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 400;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 0; margin: 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.section > h2 .chev {
  flex: 0 0 auto; width: 18px; height: 18px; margin-top: 6px;
  fill: none; stroke: #54595d; stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s;
}
.section.open > h2 .chev { transform: rotate(180deg); }
.section .sec-body { display: none; padding-top: 14px; }
.section.open .sec-body { display: block; }
.section .sec-body p { margin: 0 0 16px; font-size: 16.5px; line-height: 1.6; }
.section .sec-body.thin { color: var(--muted); font-size: 14px; }

/* portada (home) */
.portada {
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: 2px; padding: 16px; margin: 4px 0 18px; text-align: center;
}
.pt-welcome { font-family: var(--serif); font-size: 24px; font-weight: 400; color: #3366cc; margin-bottom: 6px; }
.pt-welcome b { color: #3366cc; font-weight: 400; }
.pt-sub { font-size: 15px; color: var(--ink); line-height: 1.4; margin-bottom: 10px; }
.pt-count { font-size: 14px; color: var(--muted); }
.pt-count b { color: var(--ink); }

/* fila de navegación (Café · Ayuda · …) */
.pt-nav { display: flex; flex-wrap: wrap; gap: 7px 20px; margin: 0 0 20px; padding: 0 2px; }
.pt-nav-lnk { font-size: 15px; font-weight: 700; color: var(--ink); }

.pt-sec { font-family: var(--serif); font-size: 22px; font-weight: 400;
  border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; margin: 0 0 14px;
  clear: both; }        /* clear: para que el flotante del "bueno" no se monte */
#pt-feat p, #pt-good p { font-size: 16px; line-height: 1.6; margin: 0; }
.pt-fig { margin: 0 0 12px; }
.pt-fig img { width: 100%; height: auto; border: 1px solid var(--line-soft); }
.pt-fig figcaption { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* imagen flotada a la derecha del "artículo bueno" (estilo Abbey Road) */
.pt-good-fig { float: right; width: 42%; max-width: 175px;
  margin: 3px 0 8px 12px; border: 1px solid var(--line-soft); }

/* "¿Sabías que…?" */
.pt-dyk { margin: 0 0 18px; }
.pt-dyk-list { margin: 0; padding-left: 20px; }
.pt-dyk-list li { font-size: 15.5px; line-height: 1.55; margin: 0 0 9px; }

.seealso { margin: 0 0 6px 20px; }
.seealso li { margin: 5px 0; }

/* figura centrada con epígrafe (imagen real del artículo) */
.thumb { margin: 4px 0 18px; }
.thumb img { display: block; width: 100%; height: auto; border: 1px solid var(--line-soft); }
.thumb figcaption { font-size: 13px; color: var(--muted); margin-top: 5px; }

/* pie "última edición" */
#lastedit {
  display: flex; align-items: center; gap: 12px;
  margin: 18px -16px 0; padding: 14px 16px;
  background: var(--bg-soft); border-top: 1px solid var(--line-soft);
  color: var(--muted); font-size: 14px;
}
#lastedit svg { width: 22px; height: 22px; fill: none; stroke: #54595d; stroke-width: 1.8; flex: 0 0 auto; }
#lastedit b { color: var(--ink); }
#lastedit .sp { flex: 1; }
#lastedit .chev-r { width: 9px; height: 9px; border-right: 2px solid #54595d; border-top: 2px solid #54595d; transform: rotate(45deg); }

/* aviso de demo (solo localhost) */
#demo {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #202122; color: #fff; font-size: 12px; padding: 7px 12px; text-align: center;
}
