/* ═══════════════════════════════════════════════════════════
   CEJILLA — Diseño CDI-ITCR
   Versión consolidada con bordes redondeados corregidos
   ═══════════════════════════════════════════════════════════ */

: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
   ══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   1. CEJILLA (solo borde amarillo de GCEJILLA)
   ══════════════════════════════════════════════════════════ */


.cejilla-wrapper {
  position: relative;
  border-radius: var(--cj-r);
  overflow: hidden;
  background: white;
  margin: 1rem 0;
  border: 1.5px solid #ffc523; /* ← AÑADE: borde amarillo general */
  /* OPCIÓN: quita o mantén box-shadow */
  box-shadow: 0 2px 14px rgba(26,46,74,.09); /* ← puedes quitarlo si quieres */
}

.cejilla-wrapper::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #ffc523; /* ← CAMBIA: de var(--cj-gold) a #ffc523 */
  z-index: 2;
  pointer-events: none;
}
/* ── Botón ── */
.cejilla-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .4rem 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;
  border-radius: var(--cj-r);
}

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

.cejilla-toggle[aria-expanded="true"] {
  background: #fffcf6;
  color: #1a2e4a;
  border-radius: var(--cj-r) var(--cj-r) 0 0;
}

.cejilla-toggle[aria-expanded="false"] {
  border-radius: var(--cj-r);
}

/* ── Í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 ── */
.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;
  background: white;
  border-radius: 0 0 var(--cj-r) var(--cj-r);
}

/* 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;
  background: white;
  border-radius: 0 0 var(--cj-r) var(--cj-r);
}

/* 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);
}


/* ══════════════════════════════════════════════════════════
   4. GCEJILLA  (ventana grande, borde #ffc523, anidable)
   ══════════════════════════════════════════════════════════ */

.gcejilla-wrapper {
  border-radius: 8px;
  overflow: hidden;
  background: white;
  margin: 1.2rem 0;
  border: 1.5px solid #ffc523;
}

/* ── Botón ── */
.gcejilla-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: 0.2em 0.5em;   /* ← reducido al mínimo, igual que cejillasm */
  background: white;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background .2s, color .2s;
  border-radius: 8px;
  min-height: 44px;        /* ← asegura altura mínima para que el ícono no se corte */
}

.gcejilla-toggle:hover {
  background: #fff8e1;
}

.gcejilla-toggle[aria-expanded="true"] {
  background: #029185;
  border-radius: 8px 8px 0 0;
}

.gcejilla-toggle[aria-expanded="false"] {
  border-radius: 8px;
}

/* ── Texto del título ── */
.gcejilla-label {
  color: #6e6943 !important;
  font-weight: bold;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 1.3em;
  font-family: 'Playfair Display', 'PT Serif', serif;
  line-height: 1.3;
}

.gcejilla-toggle[aria-expanded="true"] .gcejilla-label {
  color: white !important;
}

/* ── Disco con flecha gruesa ── */
.gcejilla-icon {
  flex-shrink: 0;
  width: 22px;            /* ← reducido de 30px a 22px */
  height: 22px;           /* ← reducido de 30px a 22px */
  border-radius: 50%;
  background: #ffc523;
  display: grid;
  place-items: center;
  transition: transform .32s ease;
}

/* Chevron grueso apuntando hacia abajo */
.gcejilla-icon::after {
  content: '';
  display: block;
  width: 8px;             /* ← reducido de 11px */
  height: 8px;            /* ← reducido de 11px */
  border-right: 3px solid white;   /* ← ligeramente más delgado */
  border-bottom: 3px solid white;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Al abrir: disco gira 180° → flecha apunta hacia arriba */
.gcejilla-toggle[aria-expanded="true"] .gcejilla-icon {
  background: white;
  transform: rotate(180deg);
}

.gcejilla-toggle[aria-expanded="true"] .gcejilla-icon::after {
  border-color: #ffc523;
}

/* ── Contenido ── */
.cejillasm-content {
  overflow: hidden;
  max-height: 0;
  visibility: hidden;
  padding: 0;
  border-top: none;
  background: white;
  border-radius: 0 0 6px 6px;
  transition: max-height .25s ease;
}

.cejillasm-content[hidden] {
  display: block !important;
  max-height: 0 !important;
  visibility: hidden;
}

.cejillasm-content.open {
  max-height: 2000px;
  visibility: visible;
  padding: 0.5em 0.8em;
}
/* ── Contenido GCEJILLA ── */
.gcejilla-content {
  overflow: hidden;
  max-height: 0;
  visibility: hidden;
  padding: 0;
  border-top: none;
  background: white;
  border-radius: 0 0 8px 8px;
  transition: max-height .35s ease;
}

.gcejilla-content[hidden] {
  display: block !important;
  max-height: 0 !important;
  visibility: hidden;
}

.gcejilla-content.open {
  max-height: 12000px;   /* grande: puede anidar cejillamk */
  visibility: visible;
  padding: 1.4rem 1.6rem 1.6rem;
  background: white;
  border-radius: 0 0 8px 8px;
}


.gcejilla-content > *:first-child {
  margin-top: 0 !important;
}

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

/* ══════════════════════════════════════════════════════════
   5. CEJILLASM  (cejilla pequeña)
   ══════════════════════════════════════════════════════════ */

.cejillasm-wrapper {
  margin: 0.4rem 0;
  border-radius: 6px;
  overflow: hidden;
  background: white;
  width: fit-content; /* ← NUEVO: Hace que todo el bloque se ajuste al contenido */
}

.cejillasm-toggle {
  display: flex;
  align-items: center;
  gap: 0.4em;
  /* width: 100%; ← ELIMINADO: Ya no forzamos el ancho completo */
  background: #f0ede8;
  border: none;
  border-top: 1px solid #008c82ff;
  border-radius: 6px;
  padding: 0.2em 0.5em;
  font-size: 0.88rem;
  font-family: inherit;
  color: #3a2e1e;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  white-space: nowrap; /* ← OPCIONAL: Evita que el texto del botón salte a otra línea si hay poco espacio */
}
