/* ==========================================================================
   www.mastronardi.xyz — hoja de estilos única y compartida
   Diseño editorial minimalista, serif, con acento terracota.
   Edita aquí una sola vez y cambia en todo el sitio (Opción A).
   ========================================================================== */

:root {
  /* Paleta */
  --bg:          #faf8f4; /* crema cálido */
  --bg-alt:      #f2efe8; /* secciones/tarjetas */
  --text:        #1f1b16; /* casi negro cálido */
  --text-soft:   #5c554c; /* texto secundario */
  --rule:        #e3ddd2; /* líneas finas */
  --accent:      #c04a2c; /* terracota */
  --accent-dark: #9d3b20; /* terracota hover */

  /* Tipografía */
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Medidas */
  --measure: 42rem;   /* ancho de lectura */
  --wide:    66rem;   /* ancho de banda */
  --space:   1.5rem;
}

/* ------- Reset suave ------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--accent-dark); text-decoration: underline; }

h1, h2, h3 { font-weight: 600; line-height: 1.2; }

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

/* Salto de accesibilidad */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--text);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* Oculto visualmente pero accesible para lectores de pantalla y SEO */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------- Contenedor ------- */
.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ==========================================================================
   Encabezado: banda superior (nombre + redes) y barra de navegación
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem;
}

.brand { display: inline-block; line-height: 1.25; }
.brand:hover { text-decoration: none; }
.brand-name {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}
.brand-tagline {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text-soft);
  margin-top: 0.3rem;
}
.brand-tagline .tagline-accent { color: var(--accent); }

.header-social {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.header-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--text-soft);
  border: 1px solid var(--rule);
  border-radius: 50%;
}
.header-social a:hover {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}
.header-social svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }

/* ------- Navegación ------- */
.site-nav {
  border-top: 1px solid var(--rule);
}
.nav-inner {
  display: flex;
  align-items: center;
  position: relative;
}

.nav-toggle {
  display: none;
  font-family: var(--sans);
  font-size: 0.9rem;
  background: none;
  border: 0;
  color: var(--text);
  padding: 0.9rem 0;
  cursor: pointer;
  align-items: center;
  gap: 0.4rem;
}
.nav-toggle::before {
  content: "";
  width: 1.1rem;
  height: 0.8rem;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  position: relative;
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}
.nav-menu > li { position: relative; }
.nav-menu a {
  display: inline-block;
  padding: 0.95rem 0;
  color: var(--text);
  border-bottom: 2px solid transparent;
}
.nav-menu a:hover { color: var(--accent); text-decoration: none; }
.nav-menu a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Menú alineado a la derecha en desktop */
@media (min-width: 46.01rem) {
  .nav-menu { margin-left: auto; }
}

/* ------- Submenú "Libros" ------- */
.has-dropdown > .nav-link-row {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
}
.dropdown-toggle {
  font: inherit;
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 0.95rem 0.3rem;
  line-height: 1;
}
.dropdown-toggle:hover { color: var(--accent); }
.dropdown-caret { transition: transform 0.15s ease; display: inline-block; }

.dropdown-menu {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
  position: absolute;
  top: 100%;
  left: -0.9rem;
  min-width: 16rem;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 12px 28px rgba(31, 27, 22, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 20;
}
.dropdown-menu a { padding: 0.5rem 1.1rem; width: 100%; border-bottom: 0; }
.dropdown-menu a:hover { background: var(--bg-alt); color: var(--accent); }

/* Mostrar submenú: hover/foco (escritorio) o estado abierto (JS/táctil) */
.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu,
.has-dropdown.is-open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.has-dropdown.is-open .dropdown-caret { transform: rotate(180deg); }

/* ==========================================================================
   Contenido
   ========================================================================== */
main { flex: 1 0 auto; }

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.section + .section { border-top: 1px solid var(--rule); }
/* Achica el espacio entre el hero y el bloque siguiente (solo si hay uno detrás) */
.hero:has(+ .section) { padding-bottom: 1.5rem; }
.hero + .section { padding-top: 0; }

.prose { max-width: var(--measure); }
.prose--wide { max-width: none; } /* ocupa el ancho completo del contenedor */
.prose--wide .epigraph { max-width: none; }
.prose p { margin-block: 0 1.1rem; }
.prose h2 { font-size: 1.6rem; margin-top: 2.4rem; }
.prose h3 { font-size: 1.25rem; margin-top: 1.8rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }

.lead {
  font-size: 1.3rem;
  line-height: 1.55;
  color: var(--text-soft);
}

/* Epígrafe / cita destacada */
.epigraph {
  max-width: var(--measure);
  margin: 1.8rem 0 0;
  padding-left: 1.3rem;
  border-left: 3px solid var(--accent);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--text-soft);
}
.epigraph cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.epigraph cite::before { content: "— "; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

/* ------- Hero (home) ------- */
.hero { padding-block: clamp(3rem, 8vw, 5.5rem); }
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin: 0 0 1rem;
  max-width: 20ch;
}
.hero .lead { max-width: var(--measure); }

/* ------- Botones / CTA ------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.3rem;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent); color: var(--bg); text-decoration: none; }
.btn--solid { background: var(--accent); color: var(--bg); }
.btn--solid:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* ------- Tarjetas de acceso (home) ------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
  max-width: var(--measure); /* alinea las cards con la columna de texto -> 2x2 */
}
/* Variante a ancho completo, 2 por fila (p. ej. Books); colapsa a 1 en móvil */
.card-grid--wide {
  max-width: none;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}
.card h3 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.card p { margin: 0; color: var(--text-soft); font-size: 1rem; }
.card .card-tagline { font-style: italic; color: var(--text); margin: 0 0 0.6rem; }
.card .card-go {
  margin-top: auto;
  padding-top: 0.9rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--accent);
}

/* ------- Índice de artículos (ASDRG) ------- */
.article-list { list-style: none; margin: 2rem 0 0; padding: 0; }
.article-item { padding-block: 1.4rem; border-top: 1px solid var(--rule); }
.article-item:last-child { border-bottom: 1px solid var(--rule); }
.article-meta {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.article-item h3 { font-size: 1.3rem; margin: 0 0 0.4rem; }
.article-item h3 a { color: var(--text); }
.article-item h3 a:hover { color: var(--accent); }
.article-item p { margin: 0; color: var(--text-soft); font-size: 1.02rem; }

/* ------- Índice de artículos: cards ------- */
.article-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}
/* Variante de 2 columnas (p. ej. Press); colapsa a 1 en pantallas chicas */
.article-cards--2col {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
}
.article-card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.article-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
}
.article-card .article-meta { margin-bottom: 0.45rem; }
.article-card h3 { font-size: 1.18rem; line-height: 1.25; margin: 0 0 0.5rem; }
.article-card > p { margin: 0 0 1rem; color: var(--text-soft); font-size: 0.98rem; flex: 1 0 auto; }
.article-card .card-go { font-family: var(--sans); font-size: 0.85rem; color: var(--accent); }

/* ------- Página de artículo ------- */
.article-doc { max-width: var(--measure); }
.article-back { font-family: var(--sans); font-size: 0.85rem; margin: 0 0 1.4rem; }
.article-title {
  font-size: clamp(1.9rem, 4.5vw, 2.8rem);
  line-height: 1.15;
  margin: 0.3rem 0 2rem;
}
.article-hero {
  display: block;
  max-width: 90%;
  height: auto;
  margin: 0 auto 2.5rem;
  border-radius: 5px;
}
.article-body { font-size: 1.12rem; line-height: 1.75; }
.article-body p { margin: 0 0 1.2rem; }
.article-body h2 { font-size: 1.55rem; margin: 2.6rem 0 0.8rem; }
.article-body h3 { font-size: 1.25rem; margin: 2rem 0 0.6rem; }
.article-body h4 { font-size: 1.08rem; margin: 1.7rem 0 0.5rem; }
.article-body ul, .article-body ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
.article-body li { margin-bottom: 0.55rem; }
.article-body blockquote {
  margin: 1.6rem 0;
  padding-left: 1.2rem;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}
.article-body code {
  font-family: ui-monospace, "SFMono-Regular", "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-alt);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.article-body pre {
  background: var(--bg-alt);
  padding: 1rem 1.2rem;
  border-radius: 5px;
  overflow-x: auto;
  margin: 0 0 1.2rem;
}
.article-body pre code { background: none; padding: 0; font-size: 0.92em; }
.article-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.6rem 0; }
.article-origin {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* ------- Ficha de libro ------- */
.book-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.book-cover { margin: 4rem 0 0; } /* baja un poco la tapa respecto del texto */
.book-cover img {
  width: 17rem;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 18px 44px rgba(31, 27, 22, 0.24);
}
@media (max-width: 46rem) {
  .book-hero { grid-template-columns: 1fr; justify-items: start; }
  .book-cover { order: -1; margin-top: 0; }
  .book-cover img { width: 14rem; }
}

.book-header { max-width: var(--measure); }
.book-status {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.25rem 0.8rem;
  margin-bottom: 1.2rem;
}
.book-title { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.5rem; }
.book-subtitle {
  font-size: 1.35rem;
  font-style: italic;
  color: var(--text-soft);
  margin: 0 0 1.5rem;
}
.book-prologue {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text-soft);
  margin: 0 0 1.5rem;
}
.book-prologue strong { color: var(--text); }
.book-subtitle:has(+ .book-prologue) { margin-bottom: 0.6rem; }
.book-toc { max-width: var(--measure); }
.book-toc h3 { margin-bottom: 0.3rem; }
.book-toc ul { margin-top: 0.3rem; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.5rem; }

/* ------- Aviso "próximamente" ------- */
.notice {
  max-width: var(--measure);
  padding: 1.5rem 1.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.notice p:last-child { margin-bottom: 0; }

/* ------- Contacto ------- */
.contact-links { list-style: none; padding: 0; margin: 1.5rem 0 0; max-width: var(--measure); }
.contact-links li { padding-block: 1rem; border-top: 1px solid var(--rule); }
.contact-links li:last-child { border-bottom: 1px solid var(--rule); }
.contact-links .label {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
  display: block;
}
.contact-links .value { font-size: 1.2rem; }

/* ==========================================================================
   Pie
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--bg-alt);
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text-soft);
  padding-block: 2rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-inner a { color: var(--text-soft); }
.footer-inner a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 0.75rem; }
.footer-social svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }

/* ==========================================================================
   Responsive — menú colapsable en pantallas chicas
   ========================================================================== */
@media (max-width: 46rem) {
  .nav-toggle { display: inline-flex; }

  .nav-menu {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
    padding-bottom: 0.5rem;
  }
  .nav-menu.is-open { display: flex; }
  .nav-menu > li { width: 100%; border-top: 1px solid var(--rule); }
  .nav-menu a { padding: 0.8rem 0; }

  .has-dropdown > .nav-link-row { justify-content: space-between; width: 100%; }
  .dropdown-toggle { padding: 0.8rem 0; }

  /* En móvil el submenú fluye en el documento (sin overlay) */
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    padding: 0 0 0.4rem 1rem;
    min-width: 0;
    display: none;
  }
  .has-dropdown.is-open .dropdown-menu { display: block; }
  .has-dropdown:hover .dropdown-menu,
  .has-dropdown:focus-within .dropdown-menu {
    /* en móvil solo abre con el botón, no con hover/foco */
    display: none;
  }
  .has-dropdown.is-open .dropdown-menu { display: block; }
}

@media (max-width: 30rem) {
  body { font-size: 1.06rem; }
  .header-top { flex-direction: column; gap: 0.9rem; }
}

/* Respeta reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ------- Banner de cookies (Silktide) — tematizado a la paleta del sitio -------
   El prefijo `html` sube la especificidad por encima de las reglas
   `#stcm-wrapper` del vendor, así estos overrides ganan SIN editar
   silktide-consent-manager.css ni cambiar el orden de carga de los <link>. */
html #stcm-wrapper {
  --primaryColor: var(--accent);          /* botones / links / ícono: terracota (era #F9D000 amarillo) */
  --backgroundColor: #000;                /* fondo negro (era #050505) */
  --textColor: var(--bg);                 /* texto crema sobre negro */
  --iconBackgroundColor: var(--accent);   /* ícono flotante: fondo terracota */
  --iconColor: var(--bg);                 /* glifo crema sobre terracota */
}

/* Texto claro en los botones primarios: la terracota es más oscura que el
   amarillo, y el texto oscuro por defecto quedaría con poco contraste.
   Coincide con los .btn del sitio (acento de fondo, crema de texto). */
html #stcm-wrapper .stcm-button-primary {
  color: var(--bg);
}

/* Ocultar el crédito de Silktide (logo en el banner + link en el modal).
   Self-hosted y open source: la atribución se conserva en el encabezado del
   archivo fuente, solo se quita de la UI. */
html #stcm-banner a.stcm-logo,
html #stcm-modal footer a.stcm-credit-link {
  display: none;
}
