/* Tu certificado (#certificado). Texto, campo y botón a la izquierda (5/12); la tarjeta del certificado a la derecha
   (7/12), horizontal como un A4 apaisado. En tableta y móvil, todo en una columna con la tarjeta justo debajo del campo
   (así se ve mientras se escribe). La tarjeta es de tinta, con el logotipo, un marco fino y la A como sello: nada de
   papel ni de letra con serifa. Sus letras se miden con el ancho de la tarjeta (cqi).
   Fondo: lo pone base.css (data-tone="surface-2"). Todos los selectores empiezan por #certificado. */

#certificado .cer {
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "field" "stage" "end";
  gap: clamp(24px, 3vw, 36px);
}
#certificado .cer-head { grid-area: head; display: grid; gap: clamp(12px, 1.6vw, 18px); }
#certificado .cer-field { grid-area: field; }
#certificado .cer-stage { grid-area: stage; }
#certificado .cer-end { grid-area: end; }

#certificado .cer-title { max-width: 18ch; }
#certificado .cer-lead { max-width: 48ch; font-size: 1.0625rem; line-height: 1.6; color: var(--text-2); text-wrap: pretty; }

/* ---------- Campo ---------- */
#certificado .cer-field { display: grid; gap: 8px; max-width: 460px; }
#certificado .cer-label { font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; }
#certificado .cer-input {
  display: block; width: 100%; height: 60px; margin: 0; padding: 0 18px;
  border: 0; border-radius: 14px;
  background: rgba(7, 8, 15, 0.5); box-shadow: inset 0 0 0 1px var(--line-2);
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text);
  caret-color: var(--human);
  -webkit-appearance: none; appearance: none;
  transition: box-shadow 0.2s var(--ease-out), background-color 0.2s var(--ease-out);
}
#certificado .cer-input::placeholder { color: var(--text-3); font-weight: 400; opacity: 1; }
#certificado .cer-input:focus {
  outline: none; background: rgba(7, 8, 15, 0.75);
  box-shadow: inset 0 0 0 2px var(--human), 0 0 0 5px rgba(125, 219, 140, 0.14);
}
#certificado .cer-hint { font-size: var(--fs-small); color: var(--text-2); }

/* ---------- Nivel y botón ---------- */
#certificado .cer-end { display: grid; justify-items: start; gap: 18px; align-content: start; }
#certificado .cer-pick { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font-size: 1rem; }
#certificado .cer-pick-k { color: var(--text-2); }
#certificado .cer-pick-v { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; color: var(--human); }
#certificado .cer-pick-change {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0;
  font-size: 0.9375rem; color: var(--text); background: none;
  text-decoration: underline; text-decoration-color: var(--line-2); text-decoration-thickness: 1px; text-underline-offset: 5px;
  transition: text-decoration-color 0.25s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  #certificado .cer-pick-change:hover { text-decoration-color: currentColor; }
}

/* ---------- La tarjeta ---------- */
#certificado .cer-stage { position: relative; container-type: inline-size; }
/* El polvo de la tarjeta (lo pone certificado.js): sobresale de la tarjeta y no coge clics. */
#certificado .cer-dust { position: absolute; inset: -36px -28px; width: calc(100% + 56px); height: calc(100% + 72px); pointer-events: none; z-index: 2; }
#certificado .cer-card {
  position: relative; margin: 0;
  aspect-ratio: 297 / 210;
  border-radius: clamp(12px, 2.4cqi, 20px);
  background-color: #0b0d17;
  background-image:
    radial-gradient(70% 90% at 100% 0%, rgba(239, 58, 29, 0.10), rgba(239, 58, 29, 0) 60%),
    radial-gradient(60% 80% at 0% 100%, rgba(125, 219, 140, 0.06), rgba(125, 219, 140, 0) 60%);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 40px 80px -40px rgba(0, 0, 0, 0.9);
}
#certificado .cer-frame {
  position: absolute; inset: clamp(8px, 1.8cqi, 14px);
  display: grid; grid-template-rows: auto 1fr auto;
  padding: clamp(14px, 4.2cqi, 36px) clamp(16px, 4.8cqi, 42px);
  border: 1px solid rgba(238, 240, 247, 0.1); border-radius: clamp(8px, 1.6cqi, 12px);
}
#certificado .cer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#certificado .cer-logo { flex: none; height: clamp(14px, 3.2cqi, 24px); width: auto; aspect-ratio: 4921.24 / 849.04; }
/* La A de la marca, muy tenue, como sello de fondo (su relleno casi transparente no entra en el polvo). */
#certificado .cer-wm { position: absolute; right: 4%; bottom: 10%; width: auto; height: 62%; aspect-ratio: 793.36 / 816; pointer-events: none; }
#certificado .cer-tag {
  padding: 3px 9px; border-radius: 999px;
  font-size: clamp(0.6875rem, 1.6cqi, 0.8125rem); font-weight: 500; color: var(--text-2); white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
#certificado .cer-mid { display: grid; align-content: center; gap: clamp(6px, 1.4cqi, 12px); padding-block: clamp(10px, 2.4cqi, 20px); }
#certificado .cer-type {
  font-size: clamp(0.6875rem, 1.75cqi, 0.875rem); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--human);
}
#certificado .cer-name {
  font-family: var(--font-display); font-weight: 700;
  font-size: calc(clamp(1.625rem, 7.4cqi, 3.75rem) * var(--name-k, 1));
  line-height: 1.02; letter-spacing: -0.03em; color: var(--text);
  overflow-wrap: anywhere; min-height: 1.02em;
}
#certificado .cer-name.is-empty { color: var(--text-3); }
#certificado .cer-body { max-width: 52ch; font-size: clamp(0.8125rem, 2.15cqi, 1.0625rem); line-height: 1.45; color: var(--text-2); text-wrap: pretty; }
#certificado .cer-bottom {
  display: flex; align-items: flex-end; justify-content: space-between; gap: clamp(12px, 3cqi, 28px);
  padding-top: clamp(10px, 2.2cqi, 18px); border-top: 1px solid rgba(238, 240, 247, 0.1);
}
#certificado .cer-topics { min-width: 0; }
#certificado .cer-topics-k { font-size: clamp(0.625rem, 1.5cqi, 0.75rem); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
#certificado .cer-topic { white-space: nowrap; }
#certificado .cer-topics-v { margin-top: 3px; font-size: clamp(0.75rem, 1.75cqi, 0.875rem); line-height: 1.4; color: var(--text-2); text-wrap: pretty; }
#certificado .cer-sign { flex: none; display: grid; justify-items: end; gap: 4px; }
#certificado .cer-seal { width: auto; height: clamp(22px, 5.4cqi, 40px); }
#certificado .cer-place { font-size: clamp(0.6875rem, 1.6cqi, 0.8125rem); color: var(--text-3); white-space: nowrap; }

/* ---------- Escritorio: texto a la izquierda y la tarjeta a la derecha ---------- */
@media (min-width: 1024px) {
  #certificado .cer {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas: "head stage" "field stage" "end stage";
    grid-template-rows: auto auto 1fr;
    column-gap: clamp(40px, 5vw, 80px); row-gap: 28px;
    align-items: start;
  }
  #certificado .cer-stage { align-self: center; }
}

/* ---------- Móvil: la tarjeta, sin proporción fija (el texto necesita su sitio) ---------- */
@media (max-width: 599px) {
  #certificado .cer-card { aspect-ratio: auto; }
  #certificado .cer-frame { position: relative; inset: auto; margin: 8px; min-height: 240px; }
  #certificado .cer-bottom { flex-direction: column; align-items: stretch; gap: 12px; }
  #certificado .cer-sign { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; }
  #certificado .cer-wm { top: 14%; bottom: auto; height: 42%; }
  #certificado .cer-cta { justify-self: stretch; }
  #certificado .cer-dust { inset: -24px -12px; width: calc(100% + 24px); height: calc(100% + 48px); }
}
