/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --edge: clamp(20px, 5vw, 72px);
  --measure: 62ch;
  --brand-red: #b8222f; /* sampled from the Emaús logotype's red, dialed down
     ~8% for AA contrast on --color-bg (the raw #db2533 sits under 4.5:1) */
}

/* ============================================================
   BASE
   ============================================================ */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; text-wrap: pretty; background: #FAF9F5; }
image-slot { transition: box-shadow 0.3s ease; }

/* ============================================================
   LAYOUT
   — contenedores y mecánica de grillas/flex reutilizables.
   El tratamiento del contenido que va adentro vive en COMPONENTES o PÁGINAS. —
   ============================================================ */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--edge); }

.section { padding: clamp(48px, 7vw, 80px) 0; }
.section-alt { background: var(--color-surface); }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* filosofía: grilla de 3 columnas con divisores */
.cols { display: grid; grid-template-columns: repeat(3, 1fr); --gap: var(--space-8); gap: var(--gap); position: relative; }
.cols::before, .cols::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--color-divider); }
.cols::before { left: calc((100% - 2 * var(--gap)) / 3 + var(--gap) / 2 - 0.5px); }
.cols::after { left: calc(2 * (100% - 2 * var(--gap)) / 3 + 1.5 * var(--gap) - 0.5px); }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; gap: var(--space-6); } .cols::before, .cols::after { content: none; } }

/* contacto: grilla de 2 columnas (form + info) */
.contact-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.contact-grid form { display: grid; gap: var(--space-4); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

/* ============================================================
   COMPONENTES
   — piezas de UI reutilizables: header/footer, botones, cards,
   tags, formulario, etc. —
   ============================================================ */

/* — primitivas chicas — */
.rule { height: 1px; border: 0; margin: 0; background: var(--color-divider); }
.kicker {
  display: block; font-size: 12.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--color-accent-700); margin: 0 0 var(--space-2);
}
.section-head { max-width: 68ch; margin-bottom: var(--space-8); }
.section-head h2 { font-size: clamp(28px, 3.4vw, 38px); font-weight: 700; margin: 0 0 var(--space-4); position: relative; padding-top: var(--space-4); }
.section-head h2::before { content: ""; position: absolute; top: 0; left: 0; width: 46px; height: 2px; background: var(--brand-red); }
.section-head p { font-size: 15.5px; line-height: 1.65; text-align: left; hyphens: auto;
  color: color-mix(in srgb, var(--color-text) 82%, transparent); margin: 0; }

/* — header / nav — */
header.site-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--color-bg) 92%, transparent); backdrop-filter: blur(6px); }
.nav { padding-inline: max(var(--edge), calc((100% - 1180px) / 2 + var(--edge))); position: relative; flex-wrap: wrap; }
.nav a { transition: color 0.2s ease; }
.nav a:hover { color: var(--brand-red); }
.nav a[aria-current='location'] { color: var(--brand-red); }
.nav-links { display: contents; }
.nav-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px;
  background: none; border: 1px solid var(--color-divider); border-radius: var(--radius-md); cursor: pointer; color: var(--color-text); }
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; order: 3; }
  .nav .btn-primary { order: 2; padding-inline: var(--space-2); font-size: 12px; }
  .nav-links {
    display: none; order: 4; width: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: var(--space-2) var(--edge) var(--space-3);
    border-top: 1px solid var(--color-divider);
  }
  /* .nav ya es position:relative (ver arriba); el panel se ancla a su borde
     inferior en vez de depender de que .nav crezca — .nav tiene height:100px
     fijo inline (del editor visual) y overflow:visible, así que el contenido
     que no quepa ahí renderiza suelto, sin fondo, encima de lo que sigue. */
  .nav-links.is-open {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--color-bg); box-shadow: 0 16px 28px -12px rgba(0, 0, 0, 0.22);
  }
  .nav-links a { font-size: 14px; padding: var(--space-3) 0; }
  .nav-links a:not(:last-child) { border-bottom: 1px solid var(--color-divider); }
}
.nav-brand { display: flex; align-items: center; margin-right: auto; }
.nav-brand img { display: block; width: clamp(96px, 16vw, 151px); height: auto; aspect-ratio: 1186 / 1002; }

/* — footer — */
footer.site-footer { padding: var(--space-8) 0; }
.footer-grid { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.footer-grid nav { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.footer-grid nav a { font-family: "Montserrat", system-ui, sans-serif; font-size: 14px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent); text-decoration: none; transition: color 0.2s ease; }
.footer-grid nav a:hover { color: var(--color-accent); }
.footer-copy { font-size: 13px; color: color-mix(in srgb, var(--color-text) 60%, transparent); }

/* — botones — */
.btn { transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.btn:active { transform: scale(0.97); }
.btn-primary { color: var(--brand-red); border-color: var(--brand-red); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand-red) 12%, transparent); }
.btn-primary:active { background: color-mix(in srgb, var(--brand-red) 22%, transparent); }
.btn-ghost { color: var(--brand-red); }
.btn-ghost:hover { background: color-mix(in srgb, var(--brand-red) 10%, transparent); }
.btn-sans { font-family: "Montserrat", system-ui, sans-serif; font-size: 14px; }
/* estados de carga (usado por el submit del formulario de contacto) */
.btn .btn-icon-spinner { display: none; }
.btn.is-loading .btn-icon-send { display: none; }
.btn.is-loading .btn-icon-spinner { display: block; animation: btn-spin 0.8s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-loading .btn-icon-spinner { animation: none; } }

/* — cards — */
.card { transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease; }
.card:hover { border-color: var(--brand-red); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-title { font-weight: 700; }
.card-cta { margin-top: var(--space-2); align-self: flex-start; padding-inline: 0; font-weight: 600; }
.tag-accent { background: color-mix(in srgb, var(--brand-red) 12%, transparent); color: var(--brand-red); }
.tag-outline { border-color: var(--brand-red); color: var(--brand-red); }
.event-card, .retiro-card, .news-card { height: 100%; }
.retiro-card svg, .event-card svg, .news-card svg { flex: none; }

/* — formulario de contacto: validación y estados — */
.field-error {
  display: block; min-height: 15px; margin-top: 4px;
  font-family: "Montserrat", system-ui, sans-serif; font-size: 12px;
  color: var(--brand-red);
}
.field.has-error .input { border-color: var(--brand-red); }

/* honeypot: oculto visualmente y para lectores de pantalla, pero presente en el DOM para bots */
.field-honeypot {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.field-consent { margin-top: 2px; }
.consent-label {
  display: flex; align-items: flex-start; gap: 8px; cursor: pointer;
  font-family: "Montserrat", system-ui, sans-serif; font-size: 12.5px; line-height: 1.5;
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
}
.consent-label input[type="checkbox"] {
  margin-top: 2px; width: 16px; height: 16px; flex: none; accent-color: var(--brand-red);
}
.consent-label a { color: var(--brand-red); }

/* zona de resultado del envío (aria-live) */
.form-status { border-radius: var(--radius-md); font-family: "Montserrat", system-ui, sans-serif;
  font-size: 13.5px; line-height: 1.5; }
.form-status:empty { padding: 0; }
.form-status.is-success { margin-top: var(--space-2); padding: 10px 12px;
  background: color-mix(in srgb, var(--color-accent) 14%, transparent); color: var(--color-accent-700); }
.form-status.is-error { margin-top: var(--space-2); padding: 10px 12px;
  background: color-mix(in srgb, var(--brand-red) 12%, transparent); color: var(--brand-red); }

/* — social / mapa (usados en contacto y footer) — */
.social-row { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.social-row a { display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  color: var(--color-text); text-decoration: none; }
.social-row a:hover { border-color: var(--brand-red); color: var(--brand-red);
  background: color-mix(in srgb, var(--brand-red) 10%, transparent); }

.mini-map { position: relative; display: block; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--color-divider); text-decoration: none; }
.mini-map iframe { display: block; width: 100%; height: 200px; border: 0; pointer-events: none; }
.mini-map-label { position: absolute; left: var(--space-3); bottom: var(--space-3);
  display: inline-flex; align-items: center; gap: 6px; background: var(--color-bg);
  border: 1px solid var(--color-divider); border-radius: var(--radius-sm);
  padding: 5px 10px; font-family: "Montserrat", system-ui, sans-serif; font-size: 12.5px;
  color: var(--color-text); transition: color 0.2s ease, border-color 0.2s ease; }
.mini-map:hover .mini-map-label { color: var(--brand-red); border-color: var(--brand-red); }

/* ============================================================
   PÁGINAS
   — estilos atados al contenido específico de una sección o página. —
   ============================================================ */

/* — home / hero — */
.hero { display: grid; grid-template-columns: minmax(0, 6.5fr) minmax(0, 5.5fr);
  gap: clamp(24px, 5vw, 64px); align-items: center;
  padding: clamp(48px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); }
.hero h1 {
  font-size: clamp(38px, 5.4vw, 62px); font-weight: 400; line-height: 1.1; margin: 0 0 var(--space-4);
}
.hero .sub { font-size: 17px; line-height: 1.65; max-width: var(--measure);
  color: color-mix(in srgb, var(--color-text) 82%, transparent); margin: 0 0 var(--space-6); }
.hero .row { display: flex; gap: var(--space-3); flex-wrap: wrap; }
.hero-figure { margin: 0; }
/* Es un logo, no una foto: sin aspect-ratio forzado ni object-fit,
   así se ve completo y sin recortes. */
.hero-figure img { width: 100%; height: auto; display: block; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-figure { order: -1; max-width: 360px; margin-inline: auto; } }

/* — home / filosofía (contenido de cada columna; la grilla vive en LAYOUT) — */
.col svg { color: var(--brand-red); margin-bottom: var(--space-3); }
.col h3 { font-size: 20px; font-weight: 700; color: var(--color-text); margin: 0 0 var(--space-2); }
.col p { font-size: 14.5px; line-height: 1.6; text-align: left; hyphens: auto;
  color: color-mix(in srgb, var(--color-text) 80%, transparent); margin: 0; }

/* — home / retiros, beneficios, novedades (variantes de contenido sobre .card) — */
.retiro-card .card-title { font-size: 21px; }
.retiro-card .row { display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: color-mix(in srgb, var(--color-text) 65%, transparent); }
.event-card .card-title { font-size: 18px; }
.news-card .card-meta { margin-top: auto; }

/* — home / contacto (contenido; la grilla vive en LAYOUT) — */
.contact-info { display: flex; flex-direction: column; gap: var(--space-4); }
.contact-info .row { display: flex; align-items: flex-start; gap: var(--space-3); }
.contact-info .row svg { flex: none; margin-top: 3px; color: var(--brand-red); }
.contact-info .row p { margin: 0; font-size: 12px; line-height: 1.55;
  color: color-mix(in srgb, var(--color-text) 82%, transparent); }

/* — páginas estáticas (faq / historia / privacidad) — */
.page-head { padding: clamp(40px, 6vw, 72px) 0 var(--space-6); max-width: 68ch; }
.page-head h1 { font-family: "Alegreya", var(--font-heading), serif; font-weight: 700;
  font-size: clamp(32px, 4.4vw, 48px); line-height: 1.12; margin: 0 0 var(--space-4);
  position: relative; padding-top: var(--space-4); }
.page-head h1::before { content: ""; position: absolute; top: 0; left: 0; width: 46px; height: 2px; background: var(--brand-red); }
.page-head p { font-size: 16.5px; line-height: 1.65; margin: 0;
  color: color-mix(in srgb, var(--color-text) 82%, transparent); }
.breadcrumb { display: flex; align-items: center; gap: 6px; padding-top: var(--space-6);
  font-size: 13px; color: color-mix(in srgb, var(--color-text) 60%, transparent); }
.breadcrumb a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
.breadcrumb a:hover { color: var(--brand-red); }
.prose { max-width: 72ch; padding-bottom: clamp(40px, 6vw, 72px); }
.prose h2 { font-family: "Alegreya", var(--font-heading), serif; font-weight: 700;
  font-size: clamp(22px, 2.6vw, 28px); line-height: 1.2; margin: var(--space-8) 0 var(--space-3); }
.prose h3 { font-family: "Alegreya", var(--font-heading), serif; font-weight: 600;
  font-size: 19px; margin: var(--space-6) 0 var(--space-2); }
.prose p, .prose li { font-size: 15.5px; line-height: 1.7;
  color: color-mix(in srgb, var(--color-text) 84%, transparent); }
.prose p { margin: 0 0 var(--space-4); }
.prose ul { margin: 0 0 var(--space-4); padding-left: 1.15em; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--color-accent-700); }
.prose strong { font-weight: 600; }
.prose .lead { font-size: 17px; }
.updated { font-size: 13px; color: color-mix(in srgb, var(--color-text) 58%, transparent);
  border-top: 1px solid var(--color-divider); padding-top: var(--space-4); margin-top: var(--space-8); }

.page-cta { margin: 0 calc(-1 * var(--edge)); padding: clamp(40px, 6vw, 64px) var(--edge);
  background: var(--color-surface); }
.page-cta-inner { display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-6); flex-wrap: wrap; max-width: 1180px; margin: 0 auto; }
.page-cta h2 { font-family: "Alegreya", var(--font-heading), serif; font-weight: 700;
  font-size: clamp(22px, 2.6vw, 30px); margin: 0 0 var(--space-2); }
.page-cta p { margin: 0; font-size: 15px; max-width: 52ch;
  color: color-mix(in srgb, var(--color-text) 78%, transparent); }

/* — faq: acordeón — */
.faq { border-top: 1px solid var(--color-divider); max-width: 78ch; }
.faq details { border-bottom: 1px solid var(--color-divider); }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  cursor: pointer; list-style: none; padding: var(--space-4) 0;
  font-family: "Alegreya", var(--font-heading), serif; font-weight: 600; font-size: 18.5px;
  transition: color 0.2s ease; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--brand-red); }
.faq summary svg { flex: none; color: var(--brand-red); transition: transform 0.3s ease; }
.faq details[open] summary svg { transform: rotate(45deg); }
.faq .answer { overflow: hidden; }
.faq .answer p { margin: 0 0 var(--space-4); font-size: 15.5px; line-height: 1.7; max-width: 66ch;
  color: color-mix(in srgb, var(--color-text) 82%, transparent); }
.faq details[open] .answer { animation: faq-open 0.35s ease both; }
@keyframes faq-open { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .faq details[open] .answer { animation: none; } }

/* — historia: timeline — */
.timeline { position: relative; max-width: 74ch; padding-left: var(--space-8); }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 1px; background: var(--color-divider); }
.timeline-item { position: relative; padding-bottom: var(--space-8); }
.timeline-item::before { content: ""; position: absolute; left: calc(-1 * var(--space-8) + 1px);
  top: 7px; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--brand-red); background: var(--color-bg); }
.timeline-year { display: block; font-family: "Montserrat", system-ui, sans-serif; font-size: 12.5px;
  font-weight: 600; letter-spacing: 0.12em; color: var(--brand-red); margin-bottom: 4px;
  font-variant-numeric: tabular-nums; }
.timeline-item h3 { font-family: "Alegreya", var(--font-heading), serif; font-weight: 600;
  font-size: 20px; margin: 0 0 var(--space-2); }
.timeline-item p { margin: 0; font-size: 15px; line-height: 1.65; max-width: 62ch;
  color: color-mix(in srgb, var(--color-text) 82%, transparent); }

/* — heading typeface trial: Alegreya — a literary serif by Huerta
   Tipográfica (Argentina): moderate stroke contrast (no hairlines),
   calligraphic warmth, sturdy bolds. Body copy stays Lora.
   OJO: este bloque debe ir DESPUÉS de .hero h1 / .section-head h2 / .col h3 / .card-title
   (arriba) — misma especificidad, y estas declaraciones ganan por orden de cascada. — */
.hero h1, .section-head h2, .col h3, .card-title, .dialog-title {
  font-family: "Alegreya", var(--font-heading), serif;
  letter-spacing: -0.005em;
}
.hero h1 { font-weight: 700; }
.section-head h2 { font-weight: 700; }
.col h3 { font-weight: 600; }
.card-title { font-weight: 600; }

/* ============================================================
   UTILIDADES
   ============================================================ */

/* animación de entrada, activada por JS via IntersectionObserver */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-1.is-visible { transition-delay: 0.06s; }
.reveal-2.is-visible { transition-delay: 0.14s; }
.reveal-3.is-visible { transition-delay: 0.22s; }
.reveal-4.is-visible { transition-delay: 0.3s; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* links usados como botón / marca */
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
a.nav-brand { text-decoration: none; }
