:root {
  --bg-light: linear-gradient(135deg, #0b3d91 0%, #1261a6 48%, #19a7ce 100%);
  --bg-accent: linear-gradient(180deg, #f4f9ff 0%, #eaf4ff 100%);
  --item-bg: #ffffff;
  --item-hover: #e8f4ff;
  --link: #0b4f8a;
  --shadow: 0 20px 54px rgba(17, 55, 93, .16);
  --radius-lg: 20px;
  --text-soft: #eaf7ff;
  --card-border: rgba(18, 97, 166, .16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  line-height: 1.65;
  color: #17324d;
  background:
    radial-gradient(circle at top right, rgba(25, 167, 206, .16), transparent 28%),
    radial-gradient(circle at left center, rgba(18, 97, 166, .09), transparent 32%),
    linear-gradient(180deg, #f7fbff 0%, #eaf4ff 100%);
}

/* Portada: Circuitos Secuenciales y Memoria para Programadores */
.index-page {
  --ink: #10201d;
  --ink-soft: #5a6f6b;
  --navy: #0b2e2a;
  --violet: #0e7c6b;
  --violet-dark: #0a5c4f;
  --coral: #ff8a3d;
  --gold: #d4f542;
  --paper: #fafdf8;
  --paper-blue: #e9f5ef;
  --line: #d2e5dc;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(14, 124, 107, .14), transparent 24rem),
    radial-gradient(circle at 94% 40%, rgba(255, 138, 61, .12), transparent 22rem),
    #e6f0eb;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.index-page [hidden] { display: none !important; }
.index-page .container#contenedor {
  width: min(1180px, calc(100% - 2rem));
  max-width: none;
  margin: 2rem auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(11, 46, 42, .12);
  border-radius: 26px;
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(11, 46, 42, .16);
}

.index-page :is(a, button, input):focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.index-page .course-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(2rem, 6vw, 5rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 83% 12%, rgba(56, 225, 198, .45), transparent 28rem),
    linear-gradient(135deg, #0b2e2a 0%, #10473f 54%, #0e6e5e 100%);
}
.index-page #fila1 { background:
    radial-gradient(circle at 83% 12%, rgba(56, 225, 198, .45), transparent 28rem),
    linear-gradient(135deg, #0b2e2a 0%, #10473f 54%, #0e6e5e 100%);
}

.index-page .course-hero::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  left: -120px;
  bottom: -150px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255, 255, 255, .025), 0 0 0 84px rgba(255, 255, 255, .02);
}

.index-page .hero-copy,
.index-page .hero-visual { position: relative; z-index: 1; }

.index-page .eyebrow {
  margin: 0 0 1.2rem;
  padding: .42rem .8rem;
  border-color: rgba(212, 245, 66, .4);
  color: var(--gold);
  background: rgba(212, 245, 66, .1);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .1em;
}

.index-page h1.title {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: clamp(2.4rem, 5.7vw, 4.85rem);
  line-height: .98;
  letter-spacing: -.055em;
  text-wrap: balance;
  text-shadow: none;
}

.index-page h1.title span {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.04em;
}

.index-page .hero-text {
  max-width: 690px;
  margin: 1.5rem 0 0;
  color: #d9d9ed;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-top: 1.8rem;
}

.hero-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .7rem 1.15rem;
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none;
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.primary-action {
  color: var(--navy);
  background: var(--gold);
  box-shadow: 0 12px 25px rgba(212, 245, 66, .25);
}

.secondary-action {
  gap: .55rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .06);
}

.hero-actions a:hover { transform: translateY(-2px); }
.primary-action:hover { color: var(--navy); background: #e6ff70; }
.secondary-action:hover { color: #fff; background: rgba(255, 255, 255, .12); }

.course-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.3rem;
  margin: 2.4rem 0 0;
}

.course-facts div {
  position: relative;
  padding-left: 1rem;
  border-left: 2px solid rgba(212, 245, 66, .6);
}

.course-facts dt { color: #fff; font-size: 1.05rem; line-height: 1.1; }
.course-facts dd { margin: .25rem 0 0; color: #aeb0d1; font-size: .78rem; }

.hero-visual {
  min-height: 390px;
  align-self: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 22px;
  background: rgba(7, 32, 28, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 26px 50px rgba(4, 26, 22, .25);
  backdrop-filter: blur(8px);
}

.hero-visual svg { display: block; width: 100%; height: 330px; margin-top: 25px; }
.grid-lines { fill: none; stroke: rgba(255, 255, 255, .09); stroke-width: 1; }
.axis { fill: none; stroke: rgba(255, 255, 255, .42); stroke-width: 1.5; }
.curve { fill: none; stroke: url(#curveGradient); stroke-width: 6; stroke-linecap: round; }
.tangent { fill: none; stroke: #ff8a3d; stroke-width: 2; stroke-dasharray: 8 8; }
.curve-point { fill: var(--gold); stroke: #fff; stroke-width: 3; }

.formula {
  position: absolute;
  z-index: 2;
  padding: .45rem .7rem;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  color: #fff;
  background: rgba(11, 46, 42, .85);
  font-family: Georgia, serif;
  font-style: italic;
  box-shadow: 0 10px 22px rgba(4, 26, 22, .25);
}

.formula-one { top: 38px; right: 30px; }
.formula-two { left: 28px; bottom: 58px; color: var(--gold); }
.visual-caption {
  position: absolute;
  right: 24px;
  bottom: 15px;
  margin: 0;
  color: #afb0d0;
  font-size: .73rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.visual-caption span { display: inline-block; width: 6px; height: 6px; margin-right: .35rem; border-radius: 50%; background: var(--coral); }

.course-intro,
.learning-path,
.course-program { padding: clamp(2.3rem, 5vw, 4.5rem); }

.course-intro {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: clamp(2rem, 6vw, 6rem);
  background: var(--paper);
}
.index-page #fila2 { background: var(--paper); }

.section-kicker {
  margin: 0 0 .6rem;
  color: var(--violet);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.index-page h2 {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 3.6vw, 3rem);
  line-height: 1.12;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.intro-copy > p {
  margin: 0 0 1rem;
  color: #424b5b;
  font-size: 1.05rem;
  line-height: 1.8;
}

.prerequisite {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem 1.1rem;
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid #cfe3d8;
  border-radius: 10px;
  background: #effaf4;
}

.prerequisite strong { color: #0a5c4f; white-space: nowrap; }
.prerequisite span { color: #4c635d; }

.learning-path { border-block: 1px solid var(--line); background: var(--paper-blue); }
.section-heading,
.program-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}
.section-heading > p { max-width: 420px; margin: 0; color: var(--ink-soft); }

.concept-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.concept-grid article {
  min-height: 210px;
  padding: 1.25rem;
  border: 1px solid #cfe0d7;
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.concept-grid article:hover { transform: translateY(-4px); border-color: #7cc4ae; box-shadow: 0 14px 30px rgba(11, 46, 42, .12); }
.concept-grid article > span { color: var(--violet); font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.concept-grid h3 { margin: 2.6rem 0 .5rem; color: var(--navy); font-family: Georgia, serif; font-size: 1.45rem; }
.concept-grid p { margin: 0; color: var(--ink-soft); font-size: .92rem; line-height: 1.55; }

.course-program { background: #fff; }
.index-page #fila3 { background: #fff; }
.program-header { align-items: center; }
.program-summary { margin: .7rem 0 0; color: var(--ink-soft); }
.program-summary span { color: var(--violet); font-weight: 750; }

.topic-search { width: min(100%, 330px); }
.topic-search label { display: block; margin-bottom: .4rem; color: var(--ink-soft); font-size: .77rem; font-weight: 700; }
.search-control {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 48px;
  padding: 0 .8rem;
  border: 1px solid #d9dbe8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(23, 27, 69, .05);
}
.search-control:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(14, 124, 107, .15); }
.search-control svg { width: 19px; fill: none; stroke: #777e8e; stroke-width: 2; stroke-linecap: round; }
.search-control input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font: inherit; }
.search-control input::placeholder { color: #9a9eaa; }
.search-control kbd { padding: .15rem .42rem; border: 1px solid #dedfe8; border-radius: 5px; color: #777e8e; background: #f5f5f8; font: .72rem/1.3 inherit; box-shadow: none; }

.progress-panel {
  margin-bottom: 1rem;
  padding: .85rem 1rem;
  border: 1px solid #e4e4ed;
  border-radius: 10px;
  background: #f8f8fb;
}
.progress-panel > div:first-child { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; color: var(--ink-soft); font-size: .78rem; }
.progress-panel strong { color: var(--navy); }
.progress-track { height: 6px; overflow: hidden; border-radius: 999px; background: #e1e1eb; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--coral)); transition: width .35s ease; }

.index-page .list-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  overflow: visible;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.index-page .list-group#menu { font-size: 1rem; }

.index-page .list-group-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
  min-height: 94px;
  padding: 1rem;
  border: 1px solid #d8e6de !important;
  border-radius: 12px !important;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 5px 16px rgba(11, 46, 42, .05);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.index-page .list-group-item:hover {
  z-index: 1;
  padding-left: 1rem;
  border-color: #7cc4ae !important;
  color: var(--ink);
  background: #f2faf6;
  box-shadow: 0 12px 26px rgba(11, 46, 42, .12);
  transform: translateY(-2px);
}

.topic-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  color: var(--violet);
  background: #ddf3ea;
  font-size: .78rem;
  font-weight: 850;
  transition: color .18s ease, background-color .18s ease;
}
.topic-copy { min-width: 0; }
.topic-copy strong { display: block; margin-bottom: .28rem; color: var(--navy); font-size: .97rem; line-height: 1.25; }
.topic-copy small { display: block; color: var(--ink-soft); font-size: .78rem; line-height: 1.4; }
.topic-arrow { color: #a3a5b1; font-size: 1.15rem; transition: transform .18s ease, color .18s ease; }
.list-group-item:hover .topic-arrow { color: var(--violet); transform: translateX(3px); }
.list-group-item.is-visited .topic-number { color: #fff; background: var(--violet); }
.list-group-item.is-visited .topic-number::after { content: "✓"; position: absolute; margin: 33px 0 0 33px; display: grid; width: 16px; height: 16px; place-items: center; border: 2px solid #fff; border-radius: 50%; color: #fff; background: #28a27a; font-size: .58rem; }
.no-results { margin: 1rem 0 0; padding: 1.2rem; border: 1px dashed #cfd0df; border-radius: 10px; color: var(--ink-soft); text-align: center; background: #f8f8fb; }

.index-page .course-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(2rem, 5vw, 4.5rem);
  color: #b8b9d0;
  background: var(--navy);
  font-size: .82rem;
}
.index-page .course-footer p { margin: 0; }
.index-page .course-footer a { color: var(--gold); text-decoration: none; }

@media (max-width: 900px) {
  .index-page .course-hero { grid-template-columns: 1fr; }
  .hero-visual { min-height: 300px; }
  .hero-visual svg { height: 260px; }
  .course-intro { grid-template-columns: 1fr; gap: 1.5rem; }
  .concept-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  .index-page .container#contenedor { width: 100%; margin: 0; border: 0; border-radius: 0; }
  .index-page .course-hero { padding: 2rem 1.25rem 2.5rem; }
  .index-page h1.title { font-size: clamp(2.3rem, 13vw, 3.5rem); }
  .hero-visual { display: none; }
  .course-facts { gap: 1rem; }
  .course-intro, .learning-path, .course-program { padding: 2.5rem 1.25rem; }
  .section-heading, .program-header { align-items: stretch; flex-direction: column; gap: 1rem; }
  .topic-search { width: 100%; }
  .concept-grid, .index-page .list-group { grid-template-columns: 1fr; }
  .concept-grid article { min-height: 170px; }
  .concept-grid h3 { margin-top: 1.8rem; }
  .prerequisite { grid-template-columns: 1fr; }
  .index-page .course-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .course-facts div { width: calc(50% - .5rem); }
  .index-page .list-group-item { grid-template-columns: 38px minmax(0, 1fr); }
  .topic-number { width: 38px; height: 38px; }
  .topic-arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .index-page *, .index-page *::before, .index-page *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
