/* ═══════════════════════════════════════════════════
   ESSAM · Iteración 6 — Tema del Certificado y verificación
   Coherente con la identidad: marfil, verde profundo, dorado.
   ═══════════════════════════════════════════════════ */

:root {
  --ct-bg: #EDF4EF;
  --ct-text: #1C2E22;
  --ct-muted: #476857
  --ct-gold: #7A6440
  --ct-gold2: #967F55
  --ct-dark: #1A3D28;
  --ct-border: rgba(42, 90, 58, 0.18);
  --ct-vio4: #0F2A1A;
  --ct-shadow: rgba(26, 61, 40, 0.15);
}

body {
  margin: 0;
  background-color: var(--ct-bg);
  background-image: url('assets/texture.jpg');
  color: var(--ct-text);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1rem;
  line-height: 1.65;
}

h1, h2, h3, .ct-brand { font-family: 'Cinzel', serif; }

main { max-width: 980px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* ── Cabecera ── */
.ct-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.8rem;
  padding: 0.8rem 0; margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--ct-border);
}
.ct-brand {
  font-family: 'Cinzel', serif; font-size: 1.05rem; letter-spacing: 0.14em;
  color: var(--ct-dark); text-transform: uppercase;
}
.ct-back a {
  color: var(--ct-muted); text-decoration: none; font-size: 0.9rem;
  border: 1px solid var(--ct-border); border-radius: 4px; padding: 0.3rem 0.8rem;
  transition: color 0.2s, border-color 0.2s;
}
.ct-back a:hover { color: var(--ct-gold); border-color: var(--ct-gold2); }

/* ── Tarjeta ── */
.ct-card {
  background: linear-gradient(160deg, rgba(234, 244, 238, 0.75), rgba(244, 250, 246, 0.85));
  border: 1px solid var(--ct-border); border-radius: 12px;
  padding: 1.8rem 2rem; margin-bottom: 2rem;
  box-shadow: 0 6px 28px var(--ct-shadow);
}
.ct-card h2 { margin: 0 0 0.4rem; color: var(--ct-dark); }
.ct-sub { color: var(--ct-muted); margin: 0 0 1rem; font-size: 0.98rem; }

/* ── Formulario del nombre ── */
.ct-field { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 1rem 0; }
.ct-input {
  flex: 1 1 280px; padding: 0.55rem 0.8rem; border: 1px solid var(--ct-border);
  border-radius: 6px; background: #fff; font-family: 'EB Garamond', serif; font-size: 1rem;
  color: var(--ct-text);
}
.ct-btn {
  font-family: 'Cinzel', serif; font-size: 0.85rem; letter-spacing: 0.08em;
  text-transform: uppercase; cursor: pointer; border-radius: 6px; padding: 0.55rem 1.2rem;
  background: var(--ct-dark); color: #F5F0E0; border: 1px solid var(--ct-dark);
  transition: background 0.2s, border-color 0.2s;
}
.ct-btn:hover { background: #224d33; }
.ct-btn.secondary {
  background: transparent; color: var(--ct-dark); border: 1px solid var(--ct-muted);
}
.ct-btn.secondary:hover { border-color: var(--ct-gold2); color: var(--ct-gold); }
.ct-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── El certificado (div imprimible) ── */
.ct-cert {
  position: relative; width: 900px; max-width: 100%; aspect-ratio: 1.414 / 1;
  margin: 1.5rem auto;
  background: #FDFBEE;
  border: 3px double var(--ct-gold2); outline: 1px solid var(--ct-border);
  box-shadow: 0 10px 40px var(--ct-shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 2.6rem 3.4rem; box-sizing: border-box; text-align: center;
}
.ct-cert::before {
  content: ''; position: absolute; inset: 12px;
  border: 1px solid rgba(138, 115, 75, 0.4); pointer-events: none;
}
.ct-cert-inner { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.ct-yin { width: 46px; height: 46px; opacity: 0.9; }
.ct-cert-institucion {
  font-family: 'Cinzel', serif; letter-spacing: 0.22em; text-transform: uppercase;
  font-size: 1rem; color: var(--ct-gold); margin-top: 0.3rem;
}
.ct-cert-titulo {
  font-family: 'Cinzel', serif; font-size: 2rem; color: var(--ct-dark); margin: 0.2rem 0 0.6rem;
}
.ct-cert-texto { font-size: 1.05rem; max-width: 640px; }
.ct-cert-nombre {
  font-family: 'Cinzel', serif; font-size: 1.7rem; color: var(--ct-dark);
  border-bottom: 1px solid var(--ct-gold2); padding: 0 1.4rem 0.1rem; margin: 0.8rem auto;
  display: inline-block;
}
.ct-cert-notas { font-size: 0.95rem; color: var(--ct-muted); max-width: 560px; }
.ct-cert-pie {
  width: 100%; display: flex; justify-content: space-between; align-items: flex-end;
  font-size: 0.9rem; color: var(--ct-text);
}
.ct-cert-firma { text-align: center; }
.ct-cert-firma .ct-firma-linea {
  font-family: 'EB Garamond', serif; font-style: italic; font-size: 1.15rem;
  color: var(--ct-dark); border-bottom: 1px solid var(--ct-text);
  padding: 0 1rem 0.05rem; margin-bottom: 0.2rem; display: inline-block;
}
.ct-cert-codigo { font-size: 0.8rem; color: var(--ct-muted); max-width: 280px; text-align: right; }

/* ── Avisos ── */
.ct-aviso {
  padding: 0.7rem 1rem; border-radius: 6px; background: rgba(138, 115, 75, 0.12);
  border: 1px solid rgba(138, 115, 75, 0.3); margin: 1rem 0; font-size: 0.95rem;
  display: none;
}
.ct-aviso.on { display: block; }
.ct-aviso.err { background: rgba(150, 60, 50, 0.10); border-color: rgba(150, 60, 50, 0.35); }

.ct-lista { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.ct-lista li { padding: 0.3rem 0; border-bottom: 1px dashed var(--ct-border); }
.ct-lista li:last-child { border-bottom: none; }
.ct-tag {
  display: inline-block; font-family: 'Cinzel', serif; font-size: 0.7rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ct-gold);
  border: 1px solid var(--ct-gold2); border-radius: 999px; padding: 0.1rem 0.7rem; margin-right: 0.4rem;
}

/* ── Botones de acción del certificado ── */
.ct-acciones { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.2rem 0; justify-content: center; }

/* ── Verificación ── */
.ct-verif-ok {
  text-align: center; padding: 2rem 1rem;
}
.ct-verif-ok .ct-yin { width: 64px; height: 64px; }
.ct-verif-ok h2 { color: var(--ct-dark); }
.ct-verif-err { color: #8a3a2a; font-style: italic; }

/* ── Impresión ── */
@media print {
  body { background: #fff; background-image: none; }
  .ct-header, .ct-card:not(.ct-capa-print), .ct-acciones, .ct-footer-note, main > *:not(.ct-capa-print) { display: none !important; }
  main { max-width: none; padding: 0; }
  .ct-capa-print { display: block !important; margin: 0; box-shadow: none; padding: 1rem 0.5rem; }
  .ct-capa-print::before { inset: 8px; }
  @page { size: landscape; margin: 0.8cm; }
}
