/* ============================================================
   Codia · Secciones y componentes
   Dirección C — «Moderno»: tarjetas redondeadas, sombras con
   color, insignias de ícono, y una foto (código de colores)
   detrás de cada banda oscura en vez del plano dibujado.

   La página sigue alternando dos mundos:
   · CAMPO OSCURO  (.site-header, .hero, .page-head, .cta,
     .site-footer) — bandas a sangre completa con la foto y el
     gradiente de marca.
   · PAPEL         (todo lo demás) — casi blanco, con tarjetas.
   ============================================================ */

/* ============ ENCABEZADO ================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--field);
  color: var(--on-field);
  border-bottom: 1px solid var(--field-rule);
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  min-height: 74px;
  padding-top: var(--s-3);
  padding-bottom: var(--s-3);
}

/* La línea bajo la palabra es el gesto de marca: un enlace
   subrayado en cian, por «Codia». */
.brand {
  font-family: var(--f-display);
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--on-field);
  text-decoration: none;
  line-height: 1;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--field-accent);
  flex-shrink: 0;
}
.brand:hover { color: var(--on-field); border-bottom-color: var(--on-field); }

.nav { display: none; }
.nav ul { display: flex; align-items: center; gap: var(--s-6); list-style: none; margin: 0; padding: 0; }
.nav a {
  font-size: var(--t-base);
  color: var(--on-field-2);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--on-field); }
.nav a[aria-current="page"] { color: var(--on-field); border-bottom-color: var(--field-accent); }

.header-actions { display: flex; align-items: center; gap: var(--s-3); }
.header-actions .btn { display: none; padding: 12px 20px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  background: var(--field-2);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius-sm);
  color: var(--on-field-2);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.icon-btn:hover { border-color: var(--field-accent); color: var(--field-accent); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:focus-visible { outline-color: var(--field-accent); }

@media (min-width: 940px) {
  .nav { display: block; }
  .header-actions .btn { display: inline-flex; }
  .menu-btn { display: none; }
}

.menu-panel { background: var(--field); border-top: 1px solid var(--field-rule); }
.menu-panel ul { list-style: none; margin: 0; padding: var(--s-2) 0 var(--s-5); }
.menu-panel li { border-bottom: 1px solid var(--field-rule); }
.menu-panel li:last-child { border-bottom: 0; }
.menu-panel a { display: block; padding: 16px 0; font-size: var(--t-md); color: var(--on-field); text-decoration: none; }
.menu-panel .btn { margin-top: var(--s-4); width: 100%; justify-content: center; }
@media (min-width: 940px) { .menu-panel { display: none !important; } }

/* ============ FOTO DE FONDO COMPARTIDA ======================
   Portada, cabeceras internas y cierre usan la misma foto
   (código de colores) con el gradiente de marca encima. Mismo
   tratamiento en las tres: es lo que hace que el sitio se
   sienta como un solo lugar. */
.hero, .page-head, .cta {
  position: relative;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--field) 78%, transparent) 0%, color-mix(in srgb, var(--field-2) 88%, transparent) 55%, color-mix(in srgb, var(--field) 92%, transparent) 100%),
    url("../img/hero-modern.jpg") center / cover no-repeat;
  color: var(--on-field);
  padding: var(--s-9) 0 var(--s-8);
  overflow: hidden;
}

/* ============ PORTADA ======================================= */
.hero { text-align: center; }
.hero > .wrap { position: relative; }
.hero-inner { max-width: 920px; margin: 0 auto; }

/* Cintillo de la portada */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--field-rule);
  background: color-mix(in srgb, var(--field-2) 60%, transparent);
  border-radius: 999px;
  padding: 8px 17px;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--on-field-2);
  margin: 0 0 var(--s-6);
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--field-accent); flex-shrink: 0; }

.hero h1 { color: var(--on-field); max-width: 17ch; margin: 0 auto var(--s-5); }
.hero .lead { color: var(--on-field-2); max-width: 54ch; margin: 0 auto var(--s-7); }
.hero .btn-row { justify-content: center; margin-bottom: 0; }

/* ---- Banda de cifras ------------------------------------
   Tres tarjetas, no una franja: cada una con su insignia de
   ícono y su propia sombra. */
.stats {
  position: relative;
  display: grid;
  gap: var(--s-4);
  list-style: none;
  margin: var(--s-9) 0 0;
  padding: 0;
  text-align: left;
  max-width: none;
}
@media (min-width: 820px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stats > li {
  background: color-mix(in srgb, var(--field-2) 70%, transparent);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  padding: var(--s-6) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 42px; height: 42px;
  box-sizing: border-box;
  padding: 9px;
  color: var(--field-accent);
  background: color-mix(in srgb, var(--field-accent) 16%, transparent);
  border-radius: var(--radius-sm);
}
.stat-n {
  font-family: var(--f-display);
  font-size: clamp(2.5rem, 4.4vw, 3.5rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.03em;
  color: var(--field-accent);
  font-variant-numeric: lining-nums tabular-nums;
}
.stats b {
  font-family: var(--f-body);
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--on-field);
  line-height: 1.35;
}
.hero .btn--ghost { color: var(--on-field); border-color: var(--field-rule); background: color-mix(in srgb, var(--field-2) 60%, transparent); }
.hero .btn--ghost:hover { border-color: var(--field-accent); color: var(--field-accent); }

/* ============ CABECERA DE PÁGINA INTERNA ================== */
.page-head > .wrap { position: relative; }
.page-head .label { color: var(--field-accent); margin-bottom: var(--s-5); }
.page-head h1 { color: var(--on-field); max-width: 16ch; margin-bottom: var(--s-5); }
.page-head .lead { color: var(--on-field-2); margin: 0; }
.page-head .note { border-left-color: var(--field-accent); background: color-mix(in srgb, var(--field-2) 70%, transparent); border-color: var(--field-rule); }
.page-head .note p { color: var(--on-field-2); }
.page-head .note strong { color: var(--on-field); }
.page-head .note .label { color: var(--field-accent); margin-bottom: var(--s-2); }
.page-head .note a { color: var(--field-accent); }

/* ============ SECCIONES ==================================== */
.section { padding: var(--s-9) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section--tight { padding: var(--s-8) 0; }

.section-head { margin-bottom: var(--s-8); }
.section-head h2 { max-width: 18ch; margin-bottom: var(--s-4); }
.section-head p { color: var(--ink-2); max-width: 50ch; margin: 0; font-size: var(--t-md); }

@media (min-width: 1000px) {
  .section-head--split {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: var(--s-8);
    align-items: start;
  }
  .section-head--split .label { padding-top: 6px; }
}
.section-icon {
  display: flex; align-items: center; justify-content: center;
  width: 50px; height: 50px;
  box-sizing: border-box;
  padding: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  margin-bottom: var(--s-3);
}

/* ============ DOS COLUMNAS ================================= */
.split { display: grid; gap: var(--s-6); }
@media (min-width: 820px) { .split { grid-template-columns: 1fr 1fr; } }

/* ---- Tarjetas -----------------------------------------------
   El panel dejó de ser solo una línea superior: ahora es una
   tarjeta con fondo, borde y sombra suave. */
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
}
.panel--muted { background: var(--surface-2); }
.panel h3 { font-size: var(--t-lg); margin-bottom: var(--s-4); }
.panel p { font-size: var(--t-md); color: var(--ink-2); }
.panel .list li { font-size: var(--t-md); color: var(--ink-2); }

/* ============ PASOS ======================================== */
.steps { list-style: none; margin: 0; padding: 0; max-width: none; position: relative; }
.steps > li {
  display: grid;
  gap: var(--s-3);
  padding: var(--s-6) 0;
  border-top: 1px solid var(--rule);
}
.steps > li:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 800px) {
  .steps > li { grid-template-columns: 90px minmax(0, 1fr) 160px; gap: var(--s-7); align-items: baseline; }

  /* Línea que conecta un paso con el siguiente: acá el orden es
     real (cuatro pasos de un proceso). Solo tiene sentido cuando
     los números viven en su propia columna; en una sola columna
     (celular) cruzaría el texto. */
  .steps::before {
    content: "";
    position: absolute;
    top: calc(var(--s-6) + 20px);
    bottom: calc(var(--s-6) + 20px);
    left: 24px;
    width: 2px;
    border-radius: 2px;
    background: var(--gradient-brand);
    opacity: .35;
  }
  .step-num {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    position: relative;
    background: var(--paper);
    padding: 4px var(--s-3) 4px 0;
  }
}
.step-num { display: flex; align-items: center; gap: var(--s-3); }
.step-icon {
  width: 40px; height: 40px;
  box-sizing: border-box;
  padding: 9px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.step-n {
  font-family: var(--f-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink-3);
  font-variant-numeric: lining-nums tabular-nums;
}
.steps h3 { font-size: var(--t-xl); margin-bottom: var(--s-3); }
.steps p { font-size: var(--t-md); color: var(--ink-2); margin: 0; max-width: 54ch; }
.step-when {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
@media (min-width: 800px) { .step-when { text-align: right; } }

/* ============ PREGUNTAS FRECUENTES ========================= */
.faq { border-top: 1px solid var(--rule); max-width: 840px; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-5);
  padding: var(--s-5) 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex-shrink: 0;
  width: 34px; height: 34px;
  box-sizing: border-box;
  margin-top: 4px;
  border-radius: var(--radius-sm);
  background:
    var(--accent-soft)
    linear-gradient(var(--accent), var(--accent)) center/14px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center/2px 14px no-repeat;
  transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--accent); }
.faq .answer { padding: 0 0 var(--s-6); max-width: 62ch; }
.faq .answer p { font-size: var(--t-md); color: var(--ink-2); }

/* ============ TABLAS ======================================= */
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 660px; }
caption {
  text-align: left;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: var(--s-4) var(--s-5) var(--s-3);
  background: var(--surface-2);
  caption-side: top;
}
th {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  padding: var(--s-4) var(--s-5) var(--s-4) var(--s-5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  vertical-align: bottom;
}
th:first-child { padding-left: var(--s-5); }
td {
  padding: var(--s-5) var(--s-5) var(--s-5) var(--s-5);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  font-size: var(--t-base);
  line-height: 1.58;
  color: var(--ink-2);
}
td:first-child {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  width: 1%;
}
.when { font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: .06em; color: var(--ink-3); white-space: nowrap; }

/* ============ NOTA ========================================= */
.note {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: var(--s-5) var(--s-6);
  max-width: var(--measure);
}
.note p { font-size: var(--t-base); line-height: 1.6; color: var(--ink); }
.note .label { margin-bottom: var(--s-3); color: var(--accent); }

/* ============ FORMULARIO =================================== */
.form { max-width: 620px; }
.field { margin-bottom: var(--s-5); }
.field label {
  display: block;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: var(--s-3);
}
.field .hint { font-family: var(--f-body); font-size: var(--t-sm); color: var(--ink-3); margin: var(--s-2) 0 0; text-transform: none; letter-spacing: 0; }

.field input, .field select, .field textarea {
  width: 100%;
  font-family: var(--f-body);
  font-size: var(--t-md);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 14px 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
.field select {
  appearance: none; cursor: pointer; padding-right: 44px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 21px) calc(50% + 2px), calc(100% - 16px) calc(50% + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }

.field--error input, .field--error select, .field--error textarea { border-color: var(--alert); }
.field .error { display: none; font-family: var(--f-body); font-size: var(--t-sm); color: var(--alert); margin: var(--s-2) 0 0; text-transform: none; letter-spacing: 0; }
.field--error .error { display: block; }

.field-row { display: grid; gap: var(--s-5); }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

.form-status { margin-top: var(--s-4); font-size: var(--t-base); }
.form-status[data-state="error"] { color: var(--alert); }
.form-status[data-state="ok"] { color: var(--ok); }

.honey { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* ============ CIERRE ======================================== */
.cta > .wrap { position: relative; }
.cta .label { color: var(--field-accent); margin-bottom: var(--s-5); }
.cta h2 { color: var(--on-field); max-width: 15ch; margin-bottom: var(--s-5); }
.cta p { color: var(--on-field-2); max-width: 46ch; margin-bottom: var(--s-7); font-size: var(--t-lg); }
.cta .btn--ghost { color: var(--on-field); border-color: var(--field-rule); background: color-mix(in srgb, var(--field-2) 60%, transparent); }
.cta .btn--ghost:hover { border-color: var(--field-accent); color: var(--field-accent); }

/* ============ PIE (campo oscuro) =========================== */
.site-footer {
  background: var(--field);
  color: var(--on-field-2);
  border-top: 1px solid var(--field-rule);
  padding: var(--s-8) 0 var(--s-7);
}
.footer-grid { display: grid; gap: var(--s-7); }
@media (min-width: 800px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; gap: var(--s-8); } }
.footer-grid h3 {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--on-field-2);
  margin-bottom: var(--s-5);
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.footer-grid a { color: var(--on-field); text-decoration: none; font-size: var(--t-base); }
.footer-grid a:hover { color: var(--field-accent); }
.footer-grid p { font-size: var(--t-base); color: var(--on-field-2); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-6);
  align-items: center;
  justify-content: space-between;
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--field-rule);
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.08em;
  color: var(--on-field-2);
}
.footer-bottom a { color: var(--on-field-2); text-decoration-color: var(--field-rule); }
.footer-bottom a:hover { color: var(--on-field); }

/* ============ SERVICIOS DESPLEGABLES ======================
   Cada servicio es ahora una tarjeta propia (fondo, borde,
   sombra) en vez de una fila con línea inferior. */
.svc { max-width: none; display: flex; flex-direction: column; gap: var(--s-4); }
.svc details {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.svc summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3) var(--s-5);
  padding: var(--s-5);
  cursor: pointer;
  list-style: none;
}
.svc summary::-webkit-details-marker { display: none; }
.svc summary:hover .svc-name { color: var(--accent); }

.svc-icon {
  flex: 0 0 44px;
  width: 44px; height: 44px;
  box-sizing: border-box;
  padding: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}
.svc-head { flex: 1 1 260px; }
.svc-name {
  display: block;
  font-family: var(--f-display);
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
  transition: color .15s ease;
}
.svc-line { display: block; font-size: var(--t-base); line-height: 1.5; color: var(--ink-2); margin-top: 6px; max-width: 46ch; }
.svc-when {
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: right;
}
.svc-mark {
  flex: 0 0 34px;
  align-self: center;
  width: 34px; height: 34px;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  background:
    var(--surface-2)
    linear-gradient(var(--accent), var(--accent)) center/14px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) center/2px 14px no-repeat;
  transition: transform .2s ease;
}
.svc details[open] .svc-mark { transform: rotate(45deg); }
.svc-body { padding: 0 var(--s-5) var(--s-5); }
@media (min-width: 780px) { .svc-body { padding-left: calc(44px + var(--s-5) + var(--s-5)); } }
.svc-body .split { gap: var(--s-6); }

/* ============ DOCUMENTO LARGO ============================== */
.doc { padding: var(--s-8) 0 var(--s-9); max-width: var(--narrow); }
.doc h2 { font-size: var(--t-xl); margin: var(--s-8) 0 var(--s-4); }
.doc h2:first-of-type { margin-top: var(--s-6); }
.doc p, .doc li { font-size: var(--t-md); color: var(--ink-2); }
.doc .updated { font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
