:root {
  --bg: #fbf9f4;
  --surface: #ffffff;
  --ink: #151933;
  --muted: #565c76;
  --line: #e4dfd2;
  --primary: #3a47e8;
  --primary-ink: #ffffff;
  --accent: #ffd43b;
  --accent-ink: #151933;
  --ok: #138a5e;
  --warn-bg: #fff4d6;
  --warn-ink: #6d4a00;
  --shadow: #151933;
  --radius: 14px;
  --font-head: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-ref: "Source Serif 4", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1226;
    --surface: #181c38;
    --ink: #f1f2fa;
    --muted: #a3a8c6;
    --line: #2a2f55;
    --primary: #8a93ff;
    --primary-ink: #0f1226;
    --ok: #5fd3a2;
    --warn-bg: #3a2f10;
    --warn-ink: #ffdf8a;
    --shadow: #000000;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--font-body);
}

a { color: var(--primary); text-underline-offset: 3px; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

header.site .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font: 800 1.35rem var(--font-head); color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand span { background: var(--accent); color: var(--accent-ink); padding: 0 6px; border-radius: 6px; margin-left: 1px; }
nav.main { display: flex; gap: 20px; font-size: 15px; }
nav.main a { color: var(--muted); text-decoration: none; }
nav.main a:hover { color: var(--ink); }

h1, h2, h3 { font-family: var(--font-head); letter-spacing: -.02em; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); font-weight: 800; margin: 20px 0 12px; }
h1 mark { background: linear-gradient(transparent 58%, var(--accent) 58%); color: inherit; padding: 0 2px; }
h2 { font-size: 1.6rem; font-weight: 700; margin: 48px 0 10px; }
.lead { color: var(--muted); font-size: 1.15rem; max-width: 620px; margin: 0 0 28px; }

/* Tarjetas con borde marcado: dan carácter sin cargar la página */
.card {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 28px; }
.card h2 { margin: 0 0 4px; font-size: 1.25rem; }

.search { display: flex; gap: 10px; }
.search input { flex: 1; min-width: 0; }
@media (max-width: 560px) { .search { flex-direction: column; } }

input[type=text], input[type=number], textarea, select {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: 10px;
}
input:focus, textarea:focus, select:focus, button:focus-visible, .tab:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 84px; }

label.field { display: block; font-weight: 700; font-size: 14px; margin: 0 0 5px; }
.hint { font-size: 13.5px; color: var(--muted); margin-top: 4px; }

button {
  font: 700 16px var(--font-body);
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--ink);
  transition: transform .1s ease, box-shadow .1s ease;
}
button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--shadow); }
button:active { transform: translate(0, 0); box-shadow: none; }
button.primary { background: var(--primary); color: var(--primary-ink); }
button.accent { background: var(--accent); color: var(--accent-ink); }
button.ghost { border-color: var(--line); font-weight: 400; padding: 8px 12px; font-size: 14px; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

.tabs { display: flex; gap: 8px; margin: 18px 0 14px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line);
  background: transparent; cursor: pointer; font: 700 15px var(--font-body); color: var(--muted);
}
.tab[aria-selected=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.status { min-height: 1.4em; margin-top: 10px; font-size: 15px; color: var(--muted); }
.status.err { color: #c0392b; }
@media (prefers-color-scheme: dark) { .status.err { color: #ff9b8f; } }

.picks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.picks button { width: 100%; text-align: left; font-weight: 400; border-color: var(--line); }
.picks b { display: block; }
.picks small { color: var(--muted); }

.preview {
  font-family: var(--font-ref);
  font-size: 18px;
  line-height: 1.6;
  background: #fff;
  color: #1c1c1c;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-top: 4px;
  padding-left: calc(18px + 1.5em);
  text-indent: -1.5em;
}
.preview.empty { color: #777; font-style: italic; text-indent: 0; padding-left: 18px; }
.cite-in { font-family: var(--font-ref); font-size: 17px; background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px; padding: 10px 18px; display: inline-block; }

.warns { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.warns li { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 9px 13px; font-size: 15px; }
.warns button { margin-left: 8px; padding: 3px 10px; font-size: 13px; border-width: 1px; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

.bib-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.bib { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.bib li { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.bib .ref {
  flex: 1; font-family: var(--font-ref); font-size: 17px; line-height: 1.55;
  background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 10px calc(14px + 1.5em); text-indent: -1.5em;
}
.bib .acts { display: flex; flex-direction: column; gap: 6px; }
.bib-empty { color: var(--muted); margin: 14px 0 0; }

.ad-slot {
  margin: 32px 0; min-height: 90px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; border: 1px dashed var(--line); border-radius: 10px;
}

.prose { max-width: 700px; }
.prose h2 { margin-top: 44px; }
.prose h3 { font-size: 1.1rem; margin: 26px 0 6px; font-weight: 700; }
.prose ol, .prose ul { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose code { background: var(--line); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.example { font-family: var(--font-ref); background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 8px 0 14px; }

footer.site { margin-top: 56px; border-top: 2px solid var(--ink); padding: 24px 0 40px; font-size: 14.5px; color: var(--muted); }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
footer.site a { color: var(--muted); }

.sr { position: absolute; left: -9999px; }
main { padding-bottom: 20px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  button { transition: none; }
}


/* Guías desplegables */
.guias { margin-top: 20px; }
details.guia { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); margin-bottom: 12px; }
details.guia summary {
  list-style: none; cursor: pointer; padding: 15px 18px;
  font: 700 1.08rem var(--font-head); display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
details.guia summary::-webkit-details-marker { display: none; }
details.guia summary::after { content: "+"; font-size: 1.4rem; line-height: 1; transition: transform .15s ease; }
details.guia[open] summary::after { transform: rotate(45deg); }
details.guia summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.guia-cuerpo { padding: 0 18px 18px; }
.guia-cuerpo h3 { font-size: 1.02rem; margin: 20px 0 6px; font-weight: 700; }
.guia-cuerpo ul, .guia-cuerpo ol { padding-left: 22px; }
.guia-cuerpo li { margin: 4px 0; }
.nota { font-size: 14px; color: var(--muted); margin: 20px 0 12px; }

/* Pie discreto */
.legal { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: baseline; font-size: 14px; }
details.mini summary { cursor: pointer; color: var(--muted); list-style: none; }
details.mini summary::-webkit-details-marker { display: none; }
details.mini summary:hover { color: var(--ink); text-decoration: underline; }
details.mini[open] { flex-basis: 100%; order: 10; }
.mini-cuerpo { max-width: 640px; font-size: 14.5px; color: var(--muted); padding: 8px 0 4px; }
.mini-cuerpo ul { padding-left: 20px; }
button.enlace {
  font: inherit; font-size: 14px; background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); text-decoration: none; box-shadow: none; transform: none;
}
button.enlace:hover { color: var(--ink); text-decoration: underline; box-shadow: none; transform: none; }

/* Aviso de cookies */
#cookies {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50;
  max-width: 620px; margin: 0 auto; background: var(--surface);
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--shadow);
  padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; justify-content: space-between;
}
#cookies p { margin: 0; flex: 1 1 280px; font-size: 15px; line-height: 1.5; }
.cookies-btns { display: flex; gap: 10px; }
.cookies-btns button { padding: 9px 16px; font-size: 15px; }

/* Impresión de una guía como PDF */
#zona-impresion { display: none; }
@media print {
  body.imprimiendo > *:not(#zona-impresion) { display: none !important; }
  body.imprimiendo { background: #fff !important; color: #000 !important; }
  body.imprimiendo #zona-impresion { display: block; font-family: var(--font-ref); font-size: 12pt; line-height: 1.5; color: #000; }
  #zona-impresion h1 { font-size: 20pt; margin: 0 0 14pt; color: #000; }
  #zona-impresion h3 { font-size: 13pt; margin: 14pt 0 4pt; color: #000; }
  #zona-impresion .example { border: 1px solid #999; background: #fff; color: #000; padding: 6pt 10pt; margin: 4pt 0 8pt; }
  #zona-impresion .nota { color: #444; }
  #zona-impresion .pie-imp { margin-top: 24pt; font-size: 10pt; color: #555; border-top: 1px solid #aaa; padding-top: 6pt; }
}

/* Páginas de guía */
.migas { font-size: 14px; color: var(--muted); margin: 22px 0 0; }
.migas a { color: var(--muted); }
.pagina h1 { font-size: clamp(1.9rem, 5vw, 2.8rem); margin-top: 10px; }
.pagina .guia-cuerpo { padding: 0; max-width: 700px; }
.pagina .guia-cuerpo h2 { margin: 36px 0 8px; font-size: 1.45rem; }
.pagina .lead { margin-bottom: 20px; }
.formula {
  font-family: var(--font-ref); background: #fff; color: #1c1c1c; border: 2px solid var(--ink);
  border-radius: 10px; padding: 14px 18px; margin: 8px 0 14px; box-shadow: 4px 4px 0 var(--shadow);
}
.formula small { display: block; font-family: var(--font-body); font-size: 13px; color: #555; margin-bottom: 4px; }
.cta-card {
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 18px 20px; margin: 34px 0; display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
}
.cta-card p { margin: 0; font-weight: 700; flex: 1 1 260px; }
.btn-link {
  display: inline-block; font: 700 16px var(--font-body); padding: 11px 20px; border-radius: 10px;
  background: var(--ink); color: var(--bg); text-decoration: none; border: 2px solid var(--ink);
}
.btn-link:hover { filter: brightness(1.15); }
.relacionadas { margin-top: 40px; }
.relacionadas ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.relacionadas a { display: block; padding: 10px 14px; border: 2px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.relacionadas a:hover { border-color: var(--primary); }
.guias-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 14px; }
.guia-card { display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 14px 16px; font-weight: 700; font-family: var(--font-head); }
.guia-card:hover { box-shadow: 4px 4px 0 var(--shadow); transform: translate(-1px,-1px); }
.guia-card span { display: block; font: 400 14px var(--font-body); color: var(--muted); margin-top: 3px; }

/* Demo animada */
.demo { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--shadow); padding: 16px; margin: 18px 0 8px; max-width: 700px; }
.demo-etiqueta { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.demo-barra { display: flex; gap: 10px; }
.demo-caja { flex: 1; min-height: 46px; padding: 11px 14px; background: var(--bg); border: 2px solid var(--line); border-radius: 10px; font-size: 16px; }
.demo-caja:empty::before { content: "DOI, ISBN o título"; color: var(--muted); }
.demo-btn { padding: 11px 18px; background: var(--primary); color: var(--primary-ink); border: 2px solid var(--ink); border-radius: 10px; font-weight: 700; transition: transform .12s ease; }
.demo-btn.pulsado { transform: scale(.94); }
.demo-res, .demo-cita { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
.demo-res.ver, .demo-cita.ver { opacity: 1; transform: none; }
.demo-res { margin-top: 14px; font-family: var(--font-ref); font-size: 17px; line-height: 1.55; background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 12px calc(16px + 1.5em); text-indent: -1.5em; min-height: 4.4em; }
.demo-cita { margin-top: 10px; font-family: var(--font-ref); font-size: 16px; background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px; display: inline-block; min-height: 2.4em; }
@media (prefers-reduced-motion: reduce) { .demo-res, .demo-cita, .demo-btn { transition: none; } }

/* Elementos de las guías largas */
h3.grupo { font-size: 1.15rem; margin: 28px 0 0; }
.tabla-wrap { overflow-x: auto; margin: 10px 0 18px; }
table.tabla-guia { width: 100%; border-collapse: collapse; font-size: 15.5px; background: var(--surface); }
.tabla-guia th, .tabla-guia td { text-align: left; vertical-align: top; padding: 9px 12px; border: 1px solid var(--line); }
.tabla-guia th { background: var(--accent); color: var(--accent-ink); border-color: var(--ink); font-family: var(--font-head); }
.mb { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin: 12px 0 6px; }
@media (max-width: 640px) { .mb { grid-template-columns: 1fr; } }
.mb > div { background: #fff; color: #1c1c1c; font-family: var(--font-ref); font-size: 16px; line-height: 1.55; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); border-left-width: 6px; }
.mb strong { display: block; font-family: var(--font-body); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.mb .mal { border-left-color: #c0392b; }
.mb .mal strong { color: #c0392b; }
.mb .bien { border-left-color: #138a5e; }
.mb .bien strong { color: #138a5e; }
.porque { font-size: 15px; color: var(--muted); margin: 4px 0 18px; }
.aviso-guia { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 11px 15px; font-size: 15px; margin: 14px 0; }
ul.check { list-style: none; padding-left: 0; }
ul.check li::before { content: "\2713"; color: var(--ok); font-weight: 700; margin-right: 8px; }
.portada-ej { font-family: var(--font-ref); text-align: center; background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px; padding: 22px 16px; margin: 8px 0 14px; line-height: 1.8; }
.apa-tabla { font-family: var(--font-ref); background: #fff; color: #1c1c1c; border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin: 10px 0 16px; max-width: 480px; }
.apa-tabla p { margin: 0 0 4px; }
.apa-tabla table { width: 100%; border-collapse: collapse; margin: 6px 0; }
.apa-tabla th { text-align: left; border-top: 1.5px solid #1c1c1c; border-bottom: 1.5px solid #1c1c1c; padding: 4px 8px; }
.apa-tabla td { padding: 3px 8px; }
.apa-tabla tbody tr:last-child td { border-bottom: 1.5px solid #1c1c1c; }
.apa-nota { font-size: 14.5px; }
@media print { #zona-impresion .tabla-guia th { background: #eee; color: #000; } #zona-impresion .aviso-guia { background: #f3f3f3; color: #000; } #zona-impresion .mb > div { border: 1px solid #999; } }
