/* CivisAgents — estilos compartidos ES/EN. Fuentes alojadas en el propio sitio, sin dependencias externas. */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Public Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/public-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Paleta del logotipo */
  --teja: #C4552D;
  --teja-dark: #B34A28;        /* botones */
  --teja-text: #9D3F28;        /* etiquetas, enlaces, numeración */
  --teja-hover: #8C351F;
  --teja-light: #D36A3C;
  --green: #2F7D5B;
  --green-text: #28704F;       /* texto verde pequeño */
  --green-light: #5DB58A;
  --ink: #2A211C;
  --ink-soft: #5B4E45;
  --white: #FFFFFF;

  /* Superficies cálidas */
  --paper: #FAF6F1;
  --band: #F5EDE3;
  --card: #FFFDFA;
  --group-line: #BCA99A;
  --doc-line: #D2C2B3;
  --line: #D7C9BC;
  --line-strong: #85766A;

  /* Texto sobre fondo oscuro */
  --on-dark: #FAF6F1;
  --on-dark-soft: #D9CCBF;
  --line-dark: #5A4B41;

  --font-sans: "Public Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --wrap: 1120px;
  --measure: 680px;
  --header-h: 72px;
  --section-y: 88px;
  --radius: 4px;
  --gutter: 24px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--teja-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--teja-hover); }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--on-dark);
  text-decoration: none;
  font-weight: 650;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: min(calc(100% - 2 * var(--gutter)), var(--wrap));
  margin-inline: auto;
}

/* ---------- Tipografía ---------- */

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

h1, h2 { font-family: var(--font-serif); }
h2 { font-size: 34px; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-size: 17px; line-height: 1.35; font-weight: 600; letter-spacing: -0.012em; }
h4 { font-size: 18px; line-height: 1.35; font-family: var(--font-sans); font-weight: 700; }

.eyebrow,
.label {
  margin: 0 0 16px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teja-text);
}

p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

.lead { max-width: var(--measure); font-size: 18px; color: var(--ink); }

.icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  color: var(--ink);
}

/* ---------- Cabecera ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.brand-logo { width: 158px; height: 32px; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.lang-switch a,
.lang-switch span:not(.sep) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  color: var(--ink-soft);
  text-decoration: none;
}
.lang-switch a:hover { color: var(--ink); text-decoration: underline; }
.lang-switch [aria-current="page"] {
  color: var(--ink);
  background: linear-gradient(var(--teja-text), var(--teja-text)) no-repeat 50% calc(50% + 12px) / 20px 2px;
}
.lang-switch .sep { color: var(--line-strong); font-weight: 400; }

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 15px;
  font-weight: 650;
}
.nav-link:hover { color: var(--teja-hover); text-decoration: underline; }

.nav-contact {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: 8px;
  padding: 0 20px;
  background: var(--teja-dark);
  color: var(--white);
  border: 1.5px solid var(--teja-dark);
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 15px;
  font-weight: 650;
}
.nav-contact:hover { background: var(--teja-hover); border-color: var(--teja-hover); color: var(--white); }

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--teja-dark); border-color: var(--teja-dark); color: var(--white); }
.btn-primary:hover { background: var(--teja-hover); border-color: var(--teja-hover); color: var(--white); }
.btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--on-dark); }
.btn-light { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.btn-light:hover { background: transparent; color: var(--on-dark); border-color: var(--on-dark); }
.btn .icon { color: currentColor; }

/* ---------- Secciones (tres tipos: papel, banda, oscura) ---------- */

.section {
  padding: var(--section-y) 0;
  border-bottom: 1px solid var(--line);
}
.section--paper { background: var(--paper); }
.section--band { background: var(--band); }
.section--dark {
  background: var(--ink);
  color: var(--on-dark);
  border-bottom: 0;
}

.section-head { max-width: var(--measure); margin-bottom: 32px; }
.section-head h2 { margin-bottom: 16px; }
.section-head .eyebrow, .context-grid .eyebrow, .block .eyebrow { margin-bottom: 14px; }
.section-head .lead:last-child { margin-bottom: 0; }

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 var(--section-y);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(0, 1fr);
  gap: 64px;
  align-items: center;
}

.hero h1 {
  font-size: 50px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

/* Esquema documental (vista previa de interfaz) */

.scheme {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.scheme-stage {
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.scheme-stage .label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.scheme-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0;
}

.scheme-doc {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding: 2px 0;
}
.ln { display: block; height: 3px; background: var(--doc-line); border-radius: 1px; }
.ln-w40 { width: 40%; } .ln-w60 { width: 60%; } .ln-w80 { width: 80%; } .ln-w90 { width: 90%; } .ln-w100 { width: 100%; }

.scheme-text {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
}
.scheme-text + .scheme-text { margin-top: 10px; }
.scheme-text .icon { margin-top: 1px; }

.scheme-ref {
  margin: 0 0 12px;
  padding: 7px 9px;
  background: var(--band);
  border-left: 3px solid var(--teja-dark);
}
.scheme-ref + .scheme-doc { margin-top: 0; }

.scheme-doc--after { margin: 6px 0 2px; }
.scheme-link { display: flex; justify-content: center; padding: 6px 0; }
.scheme-link .icon { color: var(--line-strong); }

.scheme-stage--person .label,
.scheme-stage--person .scheme-status { color: var(--green-text); }
.scheme-stage--person .scheme-status { font-weight: 650; }
.scheme-stage--person .icon { color: var(--green); }

/* ---------- Tarjetas (dos variantes) ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 24px;
}
.card--feature {
  border: 1.5px solid var(--ink);
  padding: 40px;
}

.card .icon--lead { margin-bottom: 14px; }
.card h3 { margin-bottom: 8px; }
.card p:not(.eyebrow) { color: var(--ink-soft); font-size: 16px; line-height: 1.55; }

.cards {
  list-style: none;
  margin-block: 0;
  padding: 0;
  display: grid;
  gap: 20px;
}
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cards-metrics > li { grid-column: span 2; min-height: 180px; }
.cards-metrics > li:nth-child(4) { grid-column: 2 / span 2; }
.cards-metrics > li:nth-child(5) { grid-column: 4 / span 2; }
.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.note { margin: 32px 0 0; max-width: var(--measure); color: var(--ink-soft); }

/* ---------- Contexto ---------- */

.context-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 64px;
  align-items: center;
}
.context-grid h2 { margin-bottom: 16px; }
.prose p { max-width: var(--measure); }

.pullquote {
  margin: 0;
  padding: 4px 0 4px 28px;
  border-left: 3px solid var(--teja);
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}

/* ---------- Ejemplos ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  margin-bottom: 48px;
}
.feature-intro .eyebrow { margin-bottom: 12px; }
.feature-intro h3 { margin-bottom: 16px; font-family: var(--font-serif); font-size: 26px; line-height: 1.25; letter-spacing: -0.01em; }
.feature-intro p:last-child { color: var(--ink-soft); }

.feature-parts { display: grid; align-content: start; gap: 0; }
.feature-part {
  display: grid;
  grid-template-columns: 20px 1fr;
  column-gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.feature-part:first-child { padding-top: 0; border-top: 0; }
.feature-part:last-child { padding-bottom: 0; }
.feature-part .icon { grid-row: 1 / span 2; margin-top: 2px; }
.feature-part h4 { margin-bottom: 4px; }
.feature-part p { margin: 0; color: var(--ink-soft); font-size: 16px; }

.cats { border-bottom: 1px solid var(--group-line); }
.example-group { border-top: 1px solid var(--group-line); }
.example-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 16px 0;
  cursor: pointer;
  list-style: none;
}
.example-group summary::-webkit-details-marker { display: none; }
.example-group summary:hover .cat-title { color: var(--teja-hover); }
.cat-title { font-size: 17px; }
.chev { transition: transform 0.15s ease; }
.example-group[open] .chev { transform: rotate(180deg); }

.ex-list {
  list-style: none;
  margin: 0;
  padding: 0 0 20px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 48px;
}
.ex-list li { padding: 14px 0; border-top: 1px solid var(--line); }
.ex-list strong { display: block; margin-bottom: 2px; font-weight: 700; }
.ex-list p { margin: 0; color: var(--ink-soft); font-size: 16px; }

/* ---------- Disposición en dos columnas ---------- */

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 64px;
  align-items: start;
}
.layout-split .section-head { margin-bottom: 0; }

.steps {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
}
.steps li {
  display: grid;
  grid-template-columns: 56px 1fr;
  column-gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--line-strong);
}
.steps li:last-child { border-bottom: 1px solid var(--line-strong); }
.step-num {
  grid-row: 1 / span 2;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--teja-text);
}
.steps h3 { margin-bottom: 4px; }
.steps p { color: var(--ink-soft); font-size: 16px; }

.grant-note {
  padding: 24px 28px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
}
.grant-note p { margin: 0; }

.principles { list-style: none; margin: 0; padding: 0; }
.principles li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--line-strong);
}
.principles li:last-child { border-bottom: 1px solid var(--line-strong); }
.principles .icon { margin-top: 3px; }
.principles h3 { margin-bottom: 4px; }
.principles p { color: var(--ink-soft); font-size: 16px; }

.method { max-width: var(--measure); margin-top: 40px; }

/* ---------- Equipo y socios (compacto) ---------- */

.cards-2 .card { padding: 24px 28px; }
.cards-2 .card .icon--lead { margin-bottom: 14px; }
.cards-2 .card .eyebrow { margin-bottom: 8px; }
.h-compact { font-family: var(--font-sans); font-size: 17px; line-height: 1.35; letter-spacing: -0.012em; margin-bottom: 8px; }


/* ---------- Contacto (bloque oscuro) ---------- */

.section--dark { padding: 72px 0; }
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 64px;
  align-items: center;
}
.section--dark h2 { color: var(--on-dark); margin-bottom: 16px; }
.section--dark p { color: var(--on-dark-soft); max-width: var(--measure); }
.section--dark a { color: var(--on-dark); }
.section--dark :focus-visible { outline-color: var(--green-light); }
.contact-grid a.email {
  display: inline-block;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration-color: var(--green-light);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  word-break: break-word;
}
.contact-grid a.email:hover { color: var(--green-light); }
.contact-cta { margin-top: 24px; }
.contact-grid .btn-light { color: var(--ink); }
.contact-grid .btn-light:hover { color: var(--on-dark); }

/* ---------- Pie ---------- */

.site-footer {
  padding: 32px 0 36px;
  background: var(--ink);
  color: var(--on-dark-soft);
  border-top: 1px solid var(--line-dark);
  font-size: 14px;
  line-height: 1.6;
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 40px;
  align-items: start;
}
.footer-brand { margin: 0 0 12px; }
.footer-logo { width: 158px; height: 32px; }
.site-footer p { color: var(--on-dark-soft); }
.privacy { margin-top: 8px; max-width: var(--measure); }
.footer-nav { display: flex; flex-direction: column; align-items: flex-end; }
.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--on-dark);
  text-decoration: none;
}
.footer-nav a:hover { text-decoration: underline; color: var(--green-light); }
.site-footer :focus-visible { outline-color: var(--green-light); }

/* ---------- Adaptación ---------- */

@media (max-width: 1040px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .scheme { max-width: 560px; }
  .cards-3 { grid-template-columns: minmax(0, 1fr); }
  .layout-split, .context-grid, .contact-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .layout-split .section-head { margin-bottom: 8px; }
  .feature { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

@media (max-width: 800px) {
  .cards-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-metrics > li,
  .cards-metrics > li:nth-child(4),
  .cards-metrics > li:nth-child(5) { grid-column: auto; }
}

@media (max-width: 720px) {
  :root { --section-y: 60px; --gutter: 20px; --header-h: 64px; }

  h2 { font-size: 27px; }

  /* Hero compacto */
  .hero { padding: 48px 0 56px; }
  .hero-grid { gap: 28px; }
  .hero .eyebrow { margin-bottom: 14px; }
  .hero h1 { font-size: 32px; font-weight: 400; line-height: 1.13; letter-spacing: -0.025em; }
  .hero-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 24px; }
  .hero-actions .btn { min-height: 46px; }
  .scheme-stage { padding: 14px 16px; }
  .scheme-stage .label { margin-bottom: 10px; }
  .scheme-link { padding: 2px 0; }
  .scheme-doc { gap: 6px; margin-bottom: 10px; }
  .scheme-doc .ln:nth-child(n+4) { display: none; }
  .scheme-doc--after { margin: 10px 0 2px; }

  /* Cabecera */
  .header-inner { min-height: var(--header-h); height: auto; }
  .brand-logo { width: 140px; height: 28px; }
  .header-tools { gap: 0; }
  .nav-contact { display: none; }
  .lang-switch { font-size: 13px; font-weight: 600; }
  .lang-switch .sep { display: none; }
  .lang-switch a,
  .lang-switch span:not(.sep) { min-width: 40px; }
  .nav-link { display: inline-flex; min-height: 44px; padding-inline: 5px; font-size: 13px; font-weight: 600; }

  /* Tarjetas */
  .cards { gap: 12px; }
  .card, .card--feature { padding: 20px; }
  .card .icon--lead { margin-bottom: 12px; }
  .card h3 { margin-bottom: 6px; }
  .cards-metrics > li { min-height: 0; }
  .cards-2 { grid-template-columns: minmax(0, 1fr); }
  .section-head { margin-bottom: 28px; }
  .pullquote { font-size: 22px; padding-left: 20px; }
  .feature-intro h3 { font-size: 22px; }
  .ex-list { grid-template-columns: minmax(0, 1fr); }
  .example-group summary { min-height: 60px; }
  .steps li { grid-template-columns: 44px 1fr; }

  /* Contacto y pie */
  .section--dark { padding: 56px 0; }
  .contact-grid a.email { font-size: 19px; line-height: 1.4; overflow-wrap: anywhere; word-break: normal; }
  .contact-cta .btn { width: 100%; }
  .site-footer { padding: 44px 0; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .footer-nav { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 8px 20px; }
  .footer-nav a { min-height: 44px; font-size: 14px; }
}

@media (max-width: 600px) {
  .cards-metrics { grid-template-columns: minmax(0, 1fr); gap: 12px; }
}

@media print {
  .site-header { position: static; }
  .nav-contact, .hero-actions, .contact-cta { display: none; }
  .section, .hero { break-inside: avoid; }
  details.example-group > * { display: block; }
}
