/* ═══════════════════════════════════════════════════════════
   CEJILLA — Diseño CDI-ITCR  (versión corregida)
   ═══════════════════════════════════════════════════════════ */

:root {
  --cj-navy:   #1a2e4a;
  --cj-teal:   #2a7f7f;
  --cj-gold:   #c8922a;
  --cj-cream:  #f8f4ed;
  --cj-cream2: #ede8df;
  --cj-cream3: #e4ddd3;
  --cj-text:   #2c2c2c;
  --cj-muted:  #6b6b6b;
  --cj-r:      10px;
}

/* ══════════════════════════════════════════════════════════
   1. CEJILLA
   ══════════════════════════════════════════════════════════ */

.cejilla-wrapper {
  border-radius: var(--cj-r);
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(26,46,74,.09);
  background: white;
  margin: 1rem 0;
  border-left: 4px solid var(--cj-gold);
}

/* ── Botón ── */
.cejilla-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .95rem 1.2rem;
  background: white;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: 'Playfair Display', 'PT Serif', serif;
  font-size: 1.02rem;
  color: var(--cj-navy);
  line-height: 1.3;
  transition: background .2s, color .2s;
}

.cejilla-toggle:hover {
  background: var(--cj-cream);
}

.cejilla-toggle[aria-expanded="true"] {
  background: var(--cj-navy);
  color: var(--cj-cream);
}

/* ── Ícono ── */
.cejilla-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--cj-cream2);
  color: var(--cj-navy);
  transition: transform .32s ease;
}

.cejilla-toggle[aria-expanded="true"] .cejilla-icon {
  background: var(--cj-gold);
  color: white;
  transform: rotate(180deg);
}

/* ── CONTENIDO (CORREGIDO) ── */
.cejilla-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height .4s cubic-bezier(.4,0,.2,1);
  border-top: 1px solid var(--cj-cream2);
  padding: 0;
}

/* mantener animación */
.cejilla-content[hidden] {
  display: block !important;
  max-height: 0 !important;
  visibility: hidden;
}

.cejilla-content.open {
  max-height: 4000px;
  visibility: visible;
  padding: 1.2rem 1.4rem 1.4rem;
}

/* 🔧 CLAVE: eliminar padding repetido */
.cejilla-content > * {
  padding: 0 !important;
}

/* controlar párrafos */
.cejilla-content p {
  margin-top: 0.35em;
  margin-bottom: 0.35em;
  line-height: 1.45;
}

.cejilla-content p:first-child {
  margin-top: 0;
}

.cejilla-content p:last-child {
  margin-bottom: 0;
}

/* evitar márgenes colapsados de make4ht */
.cejilla-content > *:first-child {
  margin-top: 0 !important;
}

.cejilla-content > *:last-child {
  margin-bottom: 0 !important;
}

/* ══════════════════════════════════════════════════════════
   2. HEJERSOL
   ══════════════════════════════════════════════════════════ */

.ejercicio-solucion {
  margin: .8rem 0 1.2rem 0;
}

.solucion-container {
  display: flex;
  flex-direction: column;
}

/* botón */
.solucion-container > button {
  align-self: flex-start;
  padding: .38rem 1rem;
  background: var(--cj-teal);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: .82rem;
}

.solucion {
  overflow: hidden;
  max-height: 0;
  visibility: hidden;
  transition: max-height .38s;
}

.solucion.sol-visible {
  max-height: 3000px;
  visibility: visible;
  margin-top: .65rem;
}

.solucion > * {
  background: var(--cj-cream);
  border-left: 4px solid var(--cj-teal);
  padding: .9rem 1.1rem;
}

/* ══════════════════════════════════════════════════════════
   3. BTN-TUTOR
   ══════════════════════════════════════════════════════════ */

.btn-tutor {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .42rem 1.1rem;
  background: var(--cj-navy);
  color: var(--cj-cream);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  box-shadow: 0 2px 8px rgba(26,46,74,.18);
}

.btn-tutor:hover {
  background: var(--cj-teal);
}
