/* ──────────────────────────────────────────────────────────────────────
   haqodesh — vanilla CSS, self-contained, no external dependencies.
   Stack: Plus Jakarta Sans + Inter (self-hosted en /fonts/).
   System fallback hasta que los .woff2 se inclyan en build.
   ────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: "Plus Jakarta Sans";
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/PlusJakartaSans-Variable.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Inter";
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/Inter-Variable.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Source Code Pro";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/SourceCodePro-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Source Code Pro";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/SourceCodePro-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Source Code Pro";
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  src: url("/fonts/SourceCodePro-It.woff2") format("woff2");
}
@font-face {
  font-family: "Source Code Pro";
  font-weight: 700;
  font-style: italic;
  font-display: swap;
  src: url("/fonts/SourceCodePro-BoldIt.woff2") format("woff2");
}
/* Phoenician font fallback — only loads when phoenician chars present (unicode-range gate) */
@font-face {
  font-family: "Noto Sans Phoenician";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/NotoSansPhoenician.woff2") format("woff2");
  unicode-range: U+10900-1091F;
}

/* Hebreo cuadrado (כתב אשורי) — cubre el bloque hebreo para las citas del
   texto masorético en el corpus. Sin esto, el hebreo cuadrado salía en tofu. */
@font-face {
  font-family: "Noto Sans Hebrew";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/NotoSansHebrew.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+FB1D-FB4F;
}

/* Fuentes de escritura por idioma (árabe, devanagari, CJK, hangul) — subseteadas a
   los codepoints usados en cada corpus. Se seleccionan por html[lang] (ver --script)
   para evitar el conflicto chino/japonés en el bloque Han compartido. */
@font-face {
  font-family: "Noto Sans Arabic";
  font-weight: 100 900; font-style: normal; font-display: swap;
  src: url("/fonts/NotoSansArabic.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans Devanagari";
  font-weight: 100 900; font-style: normal; font-display: swap;
  src: url("/fonts/NotoSansDevanagari.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans SC";
  font-weight: 100 900; font-style: normal; font-display: swap;
  src: url("/fonts/NotoSansSC.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans JP";
  font-weight: 100 900; font-style: normal; font-display: swap;
  src: url("/fonts/NotoSansJP.woff2") format("woff2");
}
@font-face {
  font-family: "Noto Sans KR";
  font-weight: 100 900; font-style: normal; font-display: swap;
  src: url("/fonts/NotoSansKR.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --bg-card: #ffffff;
  --fg: #0a0e1a;
  --fg-soft: #4a5568;
  --fg-muted: #718096;
  --accent: #003178;
  --accent-soft: #295ea6;
  --rule: #e2e8f0;
  --gold: #b89438;
  --script: "Inter";  /* fuente de escritura no-latina; se sobreescribe por html[lang] */
  --serif: "Plus Jakarta Sans", var(--script), "Noto Sans Phoenician", "Noto Sans Hebrew", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --sans: "Inter", var(--script), "Noto Sans Phoenician", "Noto Sans Hebrew", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Source Code Pro", var(--script), "Noto Sans Phoenician", "Noto Sans Hebrew", ui-monospace, "SF Mono", Menlo, Monaco, monospace;
  --phn-stack: "Noto Sans Phoenician", "Noto Sans Hebrew", serif;
}

/* Selección de fuente de escritura por idioma (evita conflicto chino/japonés en Han) */
html[lang="ar"] { --script: "Noto Sans Arabic"; }
html[lang="hi"] { --script: "Noto Sans Devanagari"; }
html[lang="zh"] { --script: "Noto Sans SC"; }
html[lang="ja"] { --script: "Noto Sans JP"; }
html[lang="ko"] { --script: "Noto Sans KR"; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0e1a;
    --bg-alt: #131a2b;
    --bg-card: #131a2b;
    --fg: #e8edf5;
    --fg-soft: #b0bcd0;
    --fg-muted: #7a8699;
    --accent: #5b8fd9;
    --accent-soft: #8fb3e8;
    --rule: #1f2940;
    --gold: #d4a749;
  }
}

[data-theme="light"] {
  --bg: #ffffff; --bg-alt: #f5f7fa; --bg-card: #ffffff;
  --fg: #0a0e1a; --fg-soft: #4a5568; --fg-muted: #718096;
  --accent: #003178; --accent-soft: #295ea6;
  --rule: #e2e8f0; --gold: #b89438;
}
[data-theme="dark"] {
  --bg: #0a0e1a; --bg-alt: #131a2b; --bg-card: #131a2b;
  --fg: #e8edf5; --fg-soft: #b0bcd0; --fg-muted: #7a8699;
  --accent: #5b8fd9; --accent-soft: #8fb3e8;
  --rule: #1f2940; --gold: #d4a749;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ─────────────────────────────────────────────────────────── */

header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10,14,26,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
@media (prefers-color-scheme: light) {
  header.site { background: rgba(255,255,255,0.85); }
}
[data-theme="light"] header.site { background: rgba(255,255,255,0.85); }

.nav-row {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.logo {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.logo .phn { font-family: var(--phn-stack); font-size: 1.05em; opacity: 0.95; }
.phn { font-family: var(--phn-stack); }
.logo .name { font-family: var(--serif); font-weight: 800; }

nav.primary { display: flex; gap: 2rem; }
nav.primary a {
  color: var(--fg-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s;
}
nav.primary a:hover { color: var(--accent); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.4rem 0.7rem;
  color: var(--fg-soft);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
  /* Nav visible en móvil: enlaces más pequeños, gap reducido. */
  nav.primary { gap: 1.1rem; }
  nav.primary a { font-size: 0.88rem; letter-spacing: 0.05em; }
  .nav-row { padding: 0.85rem 1rem; gap: 0.5rem; }
  .logo .name { font-size: 0.95rem; }
  .theme-toggle { padding: 0.3rem 0.55rem; font-size: 0.95rem; }
}
@media (max-width: 480px) {
  /* En móviles muy estrechos: ocultar texto del logo, mantener glifo. */
  .logo .name { display: none; }
  nav.primary { gap: 0.85rem; }
  nav.primary a { font-size: 0.82rem; }
}

/* ── Hero ───────────────────────────────────────────────────────────── */

.hero {
  max-width: 1280px;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 3rem 1.25rem 2.5rem; gap: 2rem; }
}

.hero-text .eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-soft);
  margin-bottom: 1rem;
}
.hero-text h1 {
  font-family: var(--serif);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
  color: var(--fg);
}
.hero-text h1 .phn {
  display: block;
  font-family: var(--phn-stack);
  font-size: 0.6em;
  color: var(--gold);
  font-weight: 400;
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}
.hero-text p.lead {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--fg-soft);
  max-width: 38ch;
}
.hero-text p.lead em {
  font-style: italic;
  color: var(--fg);
}

.hero-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(4rem, 14vw, 14rem);
  font-family: var(--phn-stack);
  color: var(--gold);
  line-height: 1;
  letter-spacing: 0.05em;
  user-select: none;
  opacity: 0.92;
  /* En móvil el glyph puede desbordar por el letter-spacing × 4 chars.
     Permitir reducción para mantenerse dentro del viewport. */
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .hero-glyph {
    font-size: clamp(3.5rem, 18vw, 6rem);
    letter-spacing: 0.02em;
  }
}

/* ── Section: thesis ────────────────────────────────────────────────── */

section.thesis {
  background: var(--bg-alt);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 4rem 2rem;
}
.thesis-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.thesis h2 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  color: var(--fg);
}
.thesis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.5rem;
}
.thesis-grid .card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.75rem;
}
.thesis-grid .card .num {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent-soft);
  margin-bottom: 0.75rem;
}
.thesis-grid .card h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--fg);
}
.thesis-grid .card h3 .phn {
  font-family: var(--phn-stack);
  color: var(--gold);
  font-weight: 400;
  margin-right: 0.4rem;
}
.thesis-grid .card p {
  color: var(--fg-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── Section: corpus index ──────────────────────────────────────────── */

/* ── Section: libros canónicos ──────────────────────────────────────── */

section.libros {
  max-width: 1280px;
  margin: 0 auto;
  padding: 5rem 2rem 3rem;
}
section.libros h2 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--fg);
}
section.libros .subtitle {
  color: var(--fg-soft);
  margin-bottom: 3rem;
  font-size: 1.05rem;
  max-width: 60ch;
}
.libros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}
.libro {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  transition: border-color 0.15s, transform 0.15s;
}
.libro:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.libro .libro-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
}
.libro .libro-title {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--fg);
}
.libro .libro-title .phn {
  font-family: var(--phn-stack);
  font-weight: 400;
  font-size: 0.85em;
  color: var(--gold);
  margin-right: 0.4em;
}
.libro .libro-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-muted);
}
.libro .libro-blurb {
  color: var(--fg-soft);
  font-size: 0.95rem;
  line-height: 1.55;
  flex-grow: 1;
}
.libro-formats {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.libro-formats a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-soft);
  text-decoration: none;
  transition: all 0.15s;
}
.libro-formats a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(255, 255, 255, 0.03);
}
.libro-formats a.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.libro-formats a.primary:hover {
  background: transparent;
  color: var(--accent);
}

/* Responsive — cards de libros */
@media (max-width: 900px) {
  section.libros { padding: 3.5rem 1.5rem 2rem; }
  .libros-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
  .libro { padding: 1.5rem 1.25rem; }
  .libro .libro-title { font-size: 1.3rem; }
}
@media (max-width: 600px) {
  /* Móvil: una columna que se adapta al viewport real, padding reducido. */
  section.libros { padding: 3rem 1rem 1.5rem; }
  .libros-grid { grid-template-columns: 1fr; gap: 1rem; }
  .libro { padding: 1.25rem 1rem; gap: 0.5rem; }
  .libro .libro-title { font-size: 1.2rem; }
  .libro .libro-meta { font-size: 0.72rem; }
  .libro .libro-blurb { font-size: 0.9rem; }
  .libro-formats a { padding: 0.4rem 0.7rem; font-size: 0.72rem; }
}

/* ── Section: corpus (estudios) ─────────────────────────────────────── */

section.corpus {
  max-width: 1280px;
  margin: 0 auto;
  padding: 5rem 2rem;
}
section.corpus h2 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  color: var(--fg);
}
section.corpus .subtitle {
  color: var(--fg-soft);
  margin-bottom: 3rem;
  font-size: 1.05rem;
}
.corpus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.5rem;
}
.corpus-grid article {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 2rem 1.75rem;
  transition: transform 0.15s, border-color 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.corpus-grid article:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.corpus-grid article .tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-soft);
  margin-bottom: 1rem;
}
.corpus-grid article h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.corpus-grid article p {
  color: var(--fg-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}
.corpus-grid article .read-more {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}

/* ── Section: convergence ───────────────────────────────────────────── */

section.convergence {
  background: var(--bg-alt);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 5rem 2rem;
}
.conv-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 900px) {
  .conv-inner { grid-template-columns: 1fr; }
}
.conv-inner h2 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.conv-inner blockquote {
  font-family: var(--serif);
  font-size: 1.4rem;
  line-height: 1.45;
  font-style: italic;
  color: var(--fg);
  border-left: 3px solid var(--gold);
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}
.conv-inner blockquote cite {
  display: block;
  margin-top: 1rem;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
  letter-spacing: 0.05em;
}
.conv-inner p { color: var(--fg-soft); margin-bottom: 1rem; }
.conv-inner .table {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.5rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.8;
}
.conv-inner .table .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.conv-inner .table .row + .row {
  border-top: 1px dashed var(--rule);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}
.conv-inner .table .key { color: var(--fg-muted); }
.conv-inner .table .val { color: var(--fg); }

/* ── Footer ─────────────────────────────────────────────────────────── */

footer.site {
  border-top: 1px solid var(--rule);
  padding: 3rem 2rem 2rem;
  background: var(--bg);
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr; }
}
.footer-inner h4 {
  font-family: var(--serif);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--fg-muted);
  margin-bottom: 1rem;
}
.footer-inner p, .footer-inner li {
  font-size: 0.9rem;
  color: var(--fg-soft);
  line-height: 1.7;
}
.footer-inner ul { list-style: none; }
.footer-inner a { color: var(--fg-soft); text-decoration: none; transition: color 0.15s; }
.footer-inner a:hover { color: var(--accent); }
.colophon {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}
.colophon .phn { font-family: var(--phn-stack); font-size: 1.1em; color: var(--gold); }

/* Language switcher pill (ES/EN) */
.lang-switch {
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.1rem 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--fg-muted) !important;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent) !important; }

/* Phoenician term layer — subrayado punteado + tooltip (pronunciación + significado) */
.phn-term {
  text-decoration: underline dotted var(--gold);
  text-underline-offset: 3px;
  cursor: help;
  outline: none;
}
.phn-term:hover, .phn-term:focus { text-decoration-color: var(--accent); }
.phn-tip {
  position: absolute;
  z-index: 200;
  max-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  padding: 0.5rem 0.7rem;
  font-family: var(--sans);
  line-height: 1.4;
  pointer-events: none;
}
.phn-tip-pron {
  display: block;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.15rem;
}
.phn-tip-sig {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-soft);
}
.phn-tip-sigs {
  margin: 0.1rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--fg-soft);
}
.phn-tip-sigs li { margin: 0.15rem 0; }
.phn-tip-strong {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--fg-muted);
  opacity: 0.7;
}

@media (max-width: 600px) {
  .colophon { flex-direction: column; gap: 0.5rem; }
}

/* ── Artículos / libros (HTML generado por pandoc) ──────────────────── */

main.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--fg);
}
main.article h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 2rem 0 1rem;
  color: var(--fg);
}
main.article h1:first-child { margin-top: 0; }
main.article h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 2.5rem 0 0.75rem;
  color: var(--fg);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.4rem;
}
main.article h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2rem 0 0.5rem;
  color: var(--fg);
}
main.article h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
  color: var(--fg);
}
main.article p { margin-bottom: 1.1rem; }
main.article blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--fg-soft);
  background: var(--bg-alt);
  border-radius: 0 4px 4px 0;
}
main.article blockquote p:last-child { margin-bottom: 0; }
main.article ul, main.article ol { margin: 1rem 0 1.1rem 1.5rem; }
main.article li { margin-bottom: 0.4rem; }
main.article code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--bg-alt);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}
main.article pre {
  font-family: var(--mono);
  font-size: 0.88rem;
  background: var(--bg-alt);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--rule);
}
main.article pre code { background: transparent; padding: 0; }
main.article hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}
main.article table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
main.article th, main.article td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
main.article th {
  background: var(--bg-alt);
  font-weight: 700;
}
main.article a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
main.article a:hover { color: var(--accent-soft); }
main.article strong { font-weight: 700; color: var(--fg); }
main.article em { font-style: italic; }

/* El sistema-at y fenicio en cuerpo de artículo */
main.article .phn,
main.article :is(p, li, h1, h2, h3, h4, h5, h6, blockquote, td, th) {
  font-feature-settings: "kern" 1;
}

/* Header & footer para páginas de artículo */
.article-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.article-header .nav-row {
  max-width: 760px;
}
.article-footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-align: center;
}
.article-footer a {
  color: var(--accent);
  text-decoration: none;
}
.article-footer a:hover { text-decoration: underline; }
.article-footer .phn { font-family: var(--phn-stack); color: var(--gold); }

/* ── Corpus index — listado de documentos ───────────────────────────── */
.page-head {
  max-width: 1100px;
  margin: 4rem auto 2.75rem;
  padding: 0 2rem;
}
.page-head .eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-soft);
  margin-bottom: 1rem;
}
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 1rem;
}
.page-head p {
  color: var(--fg-soft);
  max-width: 60ch;
  font-size: 1.05rem;
}

.group {
  max-width: 1100px;
  margin: 0 auto 3.5rem;
  padding: 0 2rem;
}
.group h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 0.6rem;
}
.group .gd {
  color: var(--fg-muted);
  font-size: 0.95rem;
  max-width: 72ch;
  margin-bottom: 1.5rem;
}

.list { display: flex; flex-direction: column; gap: 0.75rem; }
.entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.1rem 1.35rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.entry:hover { border-color: var(--accent-soft); transform: translateY(-1px); }
.entry .body { flex: 1; min-width: 0; }
.entry .title {
  display: inline-block;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}
.entry .title:hover { text-decoration: underline; text-underline-offset: 2px; }
.entry .summary { color: var(--fg-soft); font-size: 0.9rem; line-height: 1.55; }
.entry .pdf {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.entry .pdf:hover { color: var(--accent); border-color: var(--accent-soft); }

@media (max-width: 600px) {
  .page-head { margin-top: 2.5rem; }
  .entry { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
}

/* ── Página /sobre/ — clases que faltaban (causaban el CSS roto) ──────── */
.table-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.table-2col > div {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--fg-soft);
}
.table-2col > div strong {
  display: block;
  font-family: var(--serif);
  color: var(--fg);
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.table-2col > div strong .phn,
.table-2col > div .phn { font-family: var(--phn-stack); color: var(--gold); }

.refs {
  margin: 2.5rem 0 1rem;
  padding: 1.5rem 1.75rem;
  background: var(--bg-alt);
  border-radius: 8px;
  border: 1px solid var(--rule);
}
.refs h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--fg);
}
.refs ul { list-style: none; padding: 0; margin: 0; }
.refs li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--fg-soft);
  line-height: 1.55;
}
.refs li:last-child { border-bottom: none; }
.refs li a { color: var(--accent); text-decoration: none; font-weight: 600; }
.refs li a:hover { text-decoration: underline; }

/* ── Estudios seleccionados: título enlazado + acceso a 3 formatos ────── */
.corpus-grid article h3 a { color: inherit; text-decoration: none; }
.corpus-grid article h3 a:hover { color: var(--accent); }
.corpus-grid article .libro-formats { margin-top: 1.1rem; }

/* ── Menú hamburguesa (checkbox-hack, sin JS) ────────────────────────── */
.nav-toggle-cb { display: none; }
.nav-toggle {
  display: none;
  cursor: pointer;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--fg);
  user-select: none;
}
/* La colapsada solo aplica donde HAY hamburguesa (:has). Las páginas sin
   checkbox (p.ej. artículos generados aún sin la plantilla nueva) conservan
   su nav visible — sin regresión. */
@media (max-width: 700px) {
  .nav-row:has(.nav-toggle-cb) { flex-wrap: wrap; }
  .nav-toggle { display: inline-block; order: 3; }
  .nav-row:has(.nav-toggle-cb) .theme-toggle { order: 4; margin-left: 0.4rem; }
  .nav-row:has(.nav-toggle-cb) nav.primary {
    order: 5;
    flex-basis: 100%;
    display: none;
    flex-direction: column;
    gap: 0.1rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--rule);
  }
  .nav-row:has(.nav-toggle-cb) nav.primary a { padding: 0.55rem 0.2rem; font-size: 0.95rem; }
  .nav-row:has(.nav-toggle-cb) .nav-toggle-cb:checked ~ nav.primary { display: flex; }
}

/* ── Buscador del corpus + sub-grupos + formatos por entrada ─────────── */
.corpus-search { margin-top: 1.25rem; display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
#corpus-q {
  flex: 1; min-width: min(100%, 320px);
  background: var(--bg-card); border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.7rem 1rem; color: var(--fg); font-size: 1rem; font-family: var(--sans);
}
#corpus-q:focus { outline: none; border-color: var(--accent); }
.corpus-count { color: var(--fg-muted); font-size: 0.85rem; font-family: var(--mono); }
.group h3.subgroup {
  font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--accent-soft); margin: 1.6rem 0 0.75rem;
}
.entry-fmts { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.entry-fmts .fmt {
  font-family: var(--mono); font-size: 0.72rem; color: var(--fg-muted);
  text-decoration: none; white-space: nowrap; padding: 0.3rem 0.55rem;
  border: 1px solid var(--rule); border-radius: 6px; transition: color .15s, border-color .15s;
}
.entry-fmts .fmt:hover { color: var(--accent); border-color: var(--accent-soft); }

/* ═══════════════════════════════════════════════════════════════════════
   Accesibilidad · responsive · RTL · pulido — auditoría 2026-07-16 · 𐤇𐤒𐤓𐤉𐤄𐤅
   ═══════════════════════════════════════════════════════════════════════ */

/* Selector de idioma — el HTML usa .lang-select (antes solo existía .lang-switch → sin estilar) */
.lang-select {
  background: var(--bg-card);
  color: var(--fg-soft);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.lang-select:hover { border-color: var(--accent); color: var(--accent); }

/* Foco visible global para teclado (WCAG 2.4.7) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.phn-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#corpus-q:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Skip-link — saltar al contenido (WCAG 2.4.1) */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--bg-card); color: var(--accent);
  border: 2px solid var(--accent); border-radius: 0 0 6px 0;
  padding: 0.6rem 1rem; font-family: var(--mono); font-size: 0.9rem;
  font-weight: 600; text-decoration: none; z-index: 100;
}
.skip-link:focus { left: 0; position: fixed; }

/* Targets táctiles ≥44px en móvil (WCAG 2.5.5) */
@media (max-width: 700px) {
  .theme-toggle, .lang-select,
  .libro-formats a, .entry-fmts .fmt, .entry .pdf,
  .nav-row:has(.nav-toggle-cb) nav.primary a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .nav-row:has(.nav-toggle-cb) .lang-select { order: 2; }
}

/* Contraste tema claro: gold y muted quedaban por debajo de 4.5:1 (WCAG 1.4.3) */
[data-theme="light"] { --gold: #8a6d1f; --fg-muted: #5c6472; }
@media (prefers-color-scheme: light) {
  :root { --gold: #8a6d1f; --fg-muted: #5c6472; }
}

/* Movimiento reducido (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .libro:hover, .entry:hover, .corpus-grid article:hover { transform: none; }
}

/* Hover de chips de formato — token válido en los dos temas (antes blanco fijo, invisible en claro) */
.libro-formats a:hover { background: var(--bg-alt); }

/* Tablas de artículo (pandoc no las envuelve) — no desbordar la página en móvil */
@media (max-width: 640px) {
  main.article table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Tabla de convergencia: colapsar a 1 columna en móvil estrecho */
@media (max-width: 520px) {
  .conv-inner .table .row { grid-template-columns: 1fr; gap: 0.15rem; }
  .conv-inner .table .val { color: var(--accent-soft); }
}

/* RTL (árabe) — espejar propiedades direccionales físicas */
[dir="rtl"] .conv-inner blockquote { border-left: none; border-right: 3px solid var(--gold); padding-left: 0; padding-right: 1.5rem; }
[dir="rtl"] main.article blockquote { border-left: none; border-right: 3px solid var(--accent); border-radius: 4px 0 0 4px; }
[dir="rtl"] main.article ul, [dir="rtl"] main.article ol { margin-left: 0; margin-right: 1.5rem; }
[dir="rtl"] main.article th, [dir="rtl"] main.article td { text-align: right; }
[dir="rtl"] .thesis-grid .card h3 .phn,
[dir="rtl"] .libro .libro-title .phn { margin-right: 0; margin-left: 0.4em; }
[dir="rtl"] .phn-tip-sigs { padding-left: 0; padding-right: 1.1rem; }
