/* ==========================================================================
   sucesiones.css — Lección lineal interactiva de Sucesiones (Khan Academy)
   Estética de pizarrón: verde pizarra, trazos de tiza, tokens semánticos:
   --ink (base), --muted (guías), --blue (controles/arcos), --yellow (mirá acá),
   --pink (error/desfasaje), --green (exclusivamente acierto en ejercicios).
   ========================================================================== */

/* ---------- Layout de Lección: Sidebar e Índice ---------- */
.seq-layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  margin: 1.5rem 0 0;
  padding: 0 0 48px;
}

@media (max-width: 900px) {
  .seq-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin: 1rem 0 0;
    padding: 0 0 32px;
  }
}

.seq-sidebar {
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  padding: 0;
  background-color: transparent;
  border: none;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .seq-sidebar {
    position: static;
    max-height: none;
  }
}

.seq-sidebar__title {
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--yellow);
}

.seq-sidebar__progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: none;
}

.seq-progress-bar {
  flex: 1;
  height: 6px;
  background-color: rgba(236, 232, 220, 0.12);
  border: none;
  border-radius: 3px;
  overflow: hidden;
}

.seq-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--green);
  transition: width 0.3s ease;
}

.seq-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.seq-sidebar__chapter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seq-sidebar__chapter-title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.seq-sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  min-height: 44px;
  box-sizing: border-box;
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  border: none;
  transition: color 0.15s;
}

.seq-sidebar__link:hover,
.seq-sidebar__link:focus-visible {
  color: var(--yellow);
}

.seq-sidebar__link.is-active {
  color: var(--yellow);
  font-weight: 700;
  border: none;
}

.seq-sidebar__status {
  font-size: 0.9rem;
  color: var(--muted);
}

.seq-sidebar__status.is-done {
  color: var(--green);
  font-weight: bold;
}

/* ---------- Modo Pizarrón y Pizarra Escolar ---------- */
.seq-content {
  min-width: 0;
  max-width: 100%;
}

.seq-content.mode-blackboard .seq-section:not(.is-active) {
  display: none !important;
}

.seq-content.mode-blackboard .seq-section.is-active {
  display: block;
  animation: chalkFadeIn 0.22s ease-out;
}

@keyframes chalkFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.seq-blackboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
  margin-bottom: 24px;
  background-color: transparent;
  border: none;
  border-radius: 0;
}

.seq-blackboard-toolbar__info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--yellow);
}

.seq-blackboard-toolbar__badge {
  font-size: 0.95rem;
  font-family: var(--font-hand);
  background-color: transparent;
  color: var(--yellow);
  padding: 0;
  border: none;
}

.seq-blackboard-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.seq-section {
  background-color: transparent;
  border: none;
  box-shadow: none;
  padding: 12px 0 32px;
  margin-bottom: 32px;
  position: relative;
  box-sizing: border-box;
  scroll-margin-top: 24px;
}

@media (max-width: 768px) {
  .seq-section {
    padding: 20px 14px;
    margin-bottom: 24px;
  }
}

.seq-section__header {
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border-strong);
}

.seq-section__tag {
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: var(--font-hand);
}

.seq-section__title {
  font-family: var(--font-hand);
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  line-height: 1.25;
  margin: 6px 0 8px;
  color: var(--ink);
}

/* Plantilla Invariante de 5 Bloques (con aire y espaciado amplio) */
.seq-block {
  margin: 28px 0;
}

.seq-block__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hand);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--yellow);
  margin-bottom: 10px;
}

.seq-block--phrase .seq-phrase-text {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--ink);
  font-style: italic;
  border-left: 3px solid var(--yellow);
  padding-left: 16px;
  margin: 0;
}

.seq-block--caution {
  background-color: transparent;
  border: none;
  padding: 8px 0;
  margin: 24px 0;
  transform: rotate(-1deg);
}

.seq-block--caution:nth-of-type(even) {
  transform: rotate(1deg);
}

.seq-block--caution .seq-block__label {
  color: var(--pink);
}

/* Bandeja de Tizas Escolar Inferior */
.seq-chalk-tray {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 40px;
  padding-top: 16px;
  border-top: none;
  position: relative;
}

.seq-chalk-tray::before {
  display: none;
}

.seq-chalk-tray__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hand);
  font-size: 1.15rem;
}

.seq-chalk-tray__info {
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--muted);
  text-align: center;
  flex: 1;
}

/* ---------- Cinta SVG (createRibbon) ---------- */
.seq-ribbon-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 16px 0;
  padding: 8px 0;
}

.seq-ribbon-svg {
  max-width: none;
  flex-shrink: 0;
  display: block;
  overflow: visible;
}

.seq-ribbon__circle {
  fill: var(--bg);
  stroke: var(--ink);
  stroke-width: 2.2;
  transition: stroke 0.15s, fill 0.15s, transform 0.15s;
}

.seq-ribbon__post {
  cursor: pointer;
  outline: none;
}

.seq-ribbon__post:hover .seq-ribbon__circle,
.seq-ribbon__post:focus-visible .seq-ribbon__circle {
  stroke: var(--yellow);
  stroke-width: 3.5;
}

.seq-ribbon__post.is-selected .seq-ribbon__circle {
  fill: var(--yellow);
  stroke: var(--yellow);
}

.seq-ribbon__val {
  fill: var(--ink);
  font-family: var(--font-hand);
  font-size: var(--svg-scale-caveat, 1.25rem);
  font-weight: 700;
  pointer-events: none;
}

.seq-ribbon__post.is-selected .seq-ribbon__val {
  fill: var(--bg);
}

.seq-ribbon__pos-label {
  fill: var(--muted);
  font-family: var(--font-hand);
  font-size: var(--svg-scale-caveat, 0.95rem);
  pointer-events: none;
}

.seq-ribbon__arc {
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  transition: stroke 0.2s, stroke-width 0.2s;
}

.seq-ribbon__arc.is-travelled {
  stroke: var(--blue);
  stroke-width: 3.2;
}

.seq-ribbon__arc-label {
  fill: var(--muted);
  font-family: var(--font-hand);
  font-size: var(--svg-scale-caveat, 1.1rem);
  font-weight: 600;
}

.seq-ribbon__arc-label.is-travelled {
  fill: var(--blue);
}

.seq-ribbon__input {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed var(--yellow);
  background: var(--bg);
  color: var(--yellow);
  font-family: var(--font-hand);
  font-size: 1.15rem;
  font-weight: bold;
  text-align: center;
  padding: 0;
  box-sizing: border-box;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s;
}

.seq-ribbon__input::-webkit-outer-spin-button,
.seq-ribbon__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.seq-ribbon__input:focus {
  border-color: var(--blue);
  color: var(--ink);
  background: color-mix(in srgb, var(--blue) 15%, var(--bg));
}

.seq-ribbon__input.is-correct {
  border: 2px solid var(--green) !important;
  color: var(--green) !important;
  background: color-mix(in srgb, var(--green) 18%, var(--bg)) !important;
}

.seq-ribbon__input.is-error {
  border: 2px solid var(--pink) !important;
  color: var(--pink) !important;
  background: color-mix(in srgb, var(--pink) 18%, var(--bg)) !important;
}


/* ---------- Fórmula Anotada (annotatedFormula) ---------- */
.seq-annotated {
  margin: 16px 0;
  padding: 8px 0;
  border: none;
}

.seq-annotated__formula {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.seq-token {
  background: transparent;
  color: var(--yellow);
  border: 1px dashed var(--yellow);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  min-width: 44px;
  padding: 4px 10px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.seq-token:hover,
.seq-token:focus-visible {
  background-color: var(--yellow);
  color: var(--bg);
  outline: none;
}

.seq-annotated__note-box {
  min-height: 82px;
  display: flex;
  align-items: flex-start;
  padding: 6px 0;
  box-sizing: border-box;
  background-color: transparent;
  border: none;
}

.seq-annotated__hint-text {
  margin: 0;
  padding: 6px 10px;
  line-height: 1.45;
  box-sizing: border-box;
}

@keyframes note-fade-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.seq-annotated__note {
  margin: 0;
  font-family: var(--font-hand);
  font-size: 1.25rem;
  color: var(--yellow);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  transform: rotate(-1deg);
  animation: note-fade-in 0.16s ease-out;
}

.seq-annotated__note:nth-of-type(even) {
  transform: rotate(1deg);
}

@media (max-width: 600px) {
  .seq-annotated__note-box {
    min-height: 96px;
  }
}

.seq-annotated__brace-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-hand);
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.seq-annotated__brace {
  font-size: 3.5rem;
  line-height: 1;
  color: var(--ink);
  user-select: none;
}

.seq-annotated__cases {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------- Bloque de Chequeo (createCheckBlock) ---------- */
.seq-check-block {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 18px 0;
}

.seq-check__card {
  padding: 16px 4px;
  border: none;
  border-top: 1px dashed var(--border);
  border-radius: 0;
  background: transparent;
  box-sizing: border-box;
  transition: background-color 0.2s;
}

.seq-check__card:first-child {
  border-top: none;
}

.seq-check__card.is-resolved {
  background: color-mix(in srgb, var(--green) 3%, transparent);
}

.seq-rosetta__panel {
  flex: 1;
  min-width: 220px;
  padding: 6px 14px;
  background: transparent;
  border: none;
  border-left: 2px solid var(--border);
  font-family: var(--font-hand);
}

.seq-check__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.seq-check__badge {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.seq-check__check-icon {
  width: 1.2em;
  height: 1.2em;
  display: inline-block;
  color: var(--green);
}

.seq-check__prompt {
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 12px;
}

.seq-check__row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.seq-check__input {
  min-width: 140px;
  flex: 1;
  max-width: 320px;
}

.seq-check__input-sm {
  width: 90px;
  min-width: 80px;
}

.seq-check__pair-grid {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.seq-check__pair-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.seq-check__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.seq-check__opt-btn,
button[data-answer] {
  text-align: left;
  justify-content: flex-start;
  padding: 8px 12px;
  font-size: 0.95rem;
  width: 100%;
  border: 0;
  border-image: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  box-sizing: border-box;
}

.seq-check__opt-btn:hover,
button[data-answer]:hover {
  border: 0;
  border-image: none;
  color: var(--yellow);
}

.seq-check__opt-btn.is-selected,
.seq-check__opt-btn.is-correct,
button[data-answer].is-selected,
button[data-answer].is-correct {
  border: 0;
  border-image: none;
}

.seq-check__opt-btn.is-correct .seq-check__opt-tag {
  color: var(--green);
}

.seq-check__opt-btn.is-selected .seq-check__opt-tag {
  color: var(--yellow);
}

.seq-check__match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.seq-check__match-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.seq-check__match-left {
  font-weight: 700;
  min-width: 140px;
}

.seq-check__match-select {
  flex: 1;
  max-width: 340px;
}

.seq-check__tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.seq-check__hints-box {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.seq-check__hint-item {
  padding: 8px 12px;
  background-color: color-mix(in srgb, var(--yellow) 8%, transparent);
  border-left: 2px solid var(--yellow);
}

.seq-check__solution-box,
.seq-steps-box {
  margin-top: 12px;
  padding: 12px;
  background-color: color-mix(in srgb, var(--blue) 8%, transparent);
  border-left: 3px solid var(--blue);
}

.seq-check__all-done {
  margin-top: 12px;
}

/* Ocultamiento estricto de cajas auxiliares sin contenido (evita rectángulos azules vacíos) */
.seq-check__solution-box:empty,
.seq-check__hints-box:empty,
.seq-check__feedback:empty,
.seq-check__tools:empty,
.seq-annotated__note-box:empty,
.seq-widget-feedback:empty {
  display: none !important;
}

/* ---------- Widgets Específicos ---------- */
.seq-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}

.seq-widget-inputs {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}

.seq-widget-feedback {
  margin-top: 8px;
}

/* Detective */
.seq-detective__grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}

.seq-detective__row {
  padding: 8px 0;
  border: none;
  transition: border-color 0.2s, background-color 0.2s;
}

.seq-detective__row.is-constant {
  background-color: transparent;
}

.seq-detective__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.seq-detective__values {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.seq-detective__cell {
  padding: 4px 6px;
  border: none;
  font-family: var(--font-hand);
  font-size: 1.15rem;
}

.seq-detective__cell.is-highlight {
  color: var(--yellow);
  font-weight: bold;
}

.seq-detective__sub {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Función */
.seq-fn-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 14px 0;
}

@media (max-width: 720px) {
  .seq-fn-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.seq-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 12px 0;
}

.seq-table {
  width: 100%;

  border-collapse: collapse;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.15rem;
}

.seq-table th,
.seq-table td {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
}

.seq-table tr.is-active {
  background-color: color-mix(in srgb, var(--yellow) 15%, transparent);
  color: var(--yellow);
  font-weight: bold;
}

.seq-plot-card {
  width: 100%;
  max-width: 100%;
}

.seq-plot {
  width: 100%;
  height: auto;
  min-height: 220px;
  display: block;
}

.notice--domain {
  margin-top: 8px;
}

/* ---------- Hoja de Repaso Imprimible ---------- */
.seq-summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.seq-summary-table th,
.seq-summary-table td {
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  vertical-align: top;
}

.seq-summary-table th {
  background-color: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--yellow);
  font-family: var(--font-hand);
  font-size: 1.3rem;
}

@media print {
  body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  body::before {
    display: none !important;
  }

  .site-nav,
  .seq-sidebar,
  .seq-blackboard-toolbar,
  .seq-chalk-tray,
  .seq-controls,
  .btn,
  .btn-print,
  .chip,
  .seq-check,
  .seq-check__tools,
  .seq-check__feedback,
  .seq-check__hints,
  .seq-widget-inputs,
  .seq-retos__header,
  .seq-retos__seed-box,
  .seq-retos__tabs,
  .seq-seed-row {
    display: none !important;
  }

  .seq-layout {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .seq-content {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .seq-content.mode-blackboard .seq-section,
  .seq-section {
    display: block !important;
    page-break-inside: avoid;
    border: none !important;
    border-bottom: 1px solid #cccccc !important;
    box-shadow: none !important;
    padding: 16px 0 !important;
  }

  .seq-summary-table {
    page-break-inside: avoid;
    width: 100% !important;
  }

  .seq-summary-table tr {
    page-break-inside: avoid;
  }

  .seq-summary-table th,
  .seq-summary-table td {
    border: 1px solid #333333 !important;
    color: #000000 !important;
    background: transparent !important;
  }

  .seq-summary-table th {
    background-color: #f0f0f0 !important;
    color: #111111 !important;
  }

  code {
    background: #f4f4f4 !important;
    color: #111111 !important;
    border: 1px solid #dddddd !important;
  }
}

