/* =========================================================
   Caso de estudio (demo) — Colegio Altamira
   Reutiliza la paleta y tipografías del sitio principal
   ========================================================= */

:root {
  --bg: #121212;
  --bg-raised: rgba(18, 18, 18, 0.75);
  --panel: #1c1c1a;
  --border: #3a3830;
  --border-soft: #3a3830;
  --white: #f4f4f6;
  --muted: #909eae;
  --muted-dim: #736f60;
  --accent: #6f9bd1;
  --secondary: #224193;
  --highlight: #df3c5f;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-heading: "Space Grotesk", "Inter", sans-serif;
  --font-logo: "Space Grotesk", "Inter", sans-serif;

  --container: 1100px;
  --pad-x: clamp(14px, 4vw, 50px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(34, 65, 147, 0.22) 0%, rgba(111, 155, 209, 0.14) 55%, rgba(223, 60, 95, 0.06) 100%);
  pointer-events: none;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ---------- top nav ---------- */
.demo-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(25, 25, 25, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.demo-nav__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px var(--pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.demo-nav__logo {
  font-family: var(--font-logo, var(--font-heading));
  font-weight: 700;
  font-size: 22.6px;
  letter-spacing: 0.1em;
}
.demo-nav__back {
  font-size: 14px;
  color: var(--muted);
  border: 1px solid var(--border-soft);
  padding: 8px 16px;
  border-radius: 999px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.demo-nav__back:hover { border-color: var(--accent); color: var(--white); }

.demo-tabs {
  position: sticky;
  top: 57px;
  z-index: 19;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.demo-tabs__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  display: flex;
  gap: 8px;
  white-space: nowrap;
}
.demo-tabs a {
  display: inline-block;
  padding: 14px 4px;
  margin-right: 28px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.demo-tabs a:hover { color: var(--white); }

/* ---------- hero / case header ---------- */
.demo-hero {
  padding: 60px 0 50px;
  border-bottom: 1px solid var(--border-soft);
}
.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--highlight);
  border: 1px solid rgba(223, 60, 95, 0.4);
  background: rgba(223, 60, 95, 0.08);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}
.demo-hero h1 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.15;
  margin: 0 0 16px;
  max-width: 800px;
}
.demo-hero p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 700px;
  margin: 0;
}
/* ---------- shared section styles ---------- */
.demo-section {
  padding: 64px 0;
  border-bottom: 1px solid var(--border-soft);
  scroll-margin-top: 120px;
}
.demo-section__eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted-dim);
  margin-bottom: 12px;
}
.demo-section__eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.demo-section__title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(24px, 3vw, 34px);
  margin: 0 0 12px;
}
.demo-section__desc {
  color: var(--muted);
  max-width: 700px;
  margin: 0 0 36px;
  line-height: 1.6;
}

/* ---------- simulador interactivo ---------- */
.sim-panel {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 32px;
  align-items: start;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 28px;
  background: var(--panel);
  margin-bottom: 48px;
}
.sim-controls { display: flex; flex-direction: column; gap: 22px; }
.sim-control__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sim-control__head label { font-size: 14px; color: var(--white); }
.sim-control__value-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--bg);
}
.sim-control__prefix { font-size: 13px; color: var(--muted); }
.sim-control__num {
  width: 84px;
  border: none;
  background: transparent;
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 15px;
  text-align: right;
  -moz-appearance: textfield;
}
.sim-control__num::-webkit-outer-spin-button,
.sim-control__num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sim-control__hint { font-size: 12px; color: var(--muted-dim); margin: 8px 0 0; }

.sim-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border-soft);
  outline: none;
  cursor: pointer;
}
.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.sim-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

.sim-reset-btn {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--highlight);
  background: transparent;
  border: 1px solid rgba(223, 60, 95, 0.4);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  margin-top: 6px;
  align-self: flex-start;
}
.sim-reset-btn:hover { color: var(--white); border-color: var(--highlight); background-color: rgba(223, 60, 95, 0.08); }

.sim-results { display: flex; flex-direction: column; gap: 20px; }
.kpi-grid.kpi-grid--sim { grid-template-columns: repeat(3, 1fr); margin-bottom: 0; }
.sim-analysis {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 20px 22px;
  background: var(--bg);
}
.sim-analysis__title {
  font-family: var(--font-heading);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: 0 0 14px;
}
.sim-analysis p {
  color: var(--white);
  font-size: 14.5px;
  line-height: 1.6;
  margin: 0 0 12px;
}
.sim-analysis p:last-child { margin-bottom: 0; }
.sim-analysis strong { color: var(--accent); }

.demo-subsection {
  border-top: 1px solid var(--border-soft);
  padding-top: 40px;
}
.demo-subsection__eyebrow {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: 0 0 8px;
}
.demo-subsection__title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(19px, 2vw, 24px);
  margin: 0 0 10px;
}

/* ---------- dashboard ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.kpi-card {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 20px;
  background: var(--panel);
}
.kpi-card__label { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.kpi-card__value { font-family: var(--font-heading); font-size: 26px; margin: 0 0 8px; }
.kpi-card__delta { font-size: 12.5px; margin: 0; }
.kpi-card__delta.is-good { color: var(--secondary); }
.kpi-card__delta.is-bad { color: var(--highlight); }

.chart-panel {
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 24px;
  background: var(--panel);
}
.chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.chart-tab {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border-soft);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}
.chart-tab:hover { color: var(--white); }
.chart-tab.is-active {
  color: var(--white);
  border-color: var(--accent);
  background: rgba(111, 155, 209, 0.1);
}
.chart-svg-wrap { width: 100%; overflow-x: auto; }
#chart-svg { width: 100%; height: auto; min-width: 480px; }
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.chart-legend__item { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.chart-legend__item strong { color: var(--white); font-weight: 500; }
.chart-legend__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- python code ---------- */
.code-panel {
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: #121214;
  overflow: hidden;
}
.code-panel__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.code-panel__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-soft); }
.code-panel__filename { margin-left: 8px; font-size: 13px; color: var(--muted); }
.code-panel pre {
  margin: 0;
  padding: 24px;
  max-height: 420px;
  overflow-x: auto;
  overflow-y: auto;
  scroll-behavior: smooth;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13.5px;
  line-height: 1.8;
  color: rgba(244, 244, 246, 0.8);
  scrollbar-width: thin;
  scrollbar-color: var(--border-soft) transparent;
}
.code-panel pre::-webkit-scrollbar { width: 10px; height: 10px; }
.code-panel pre::-webkit-scrollbar-track { background: transparent; }
.code-panel pre::-webkit-scrollbar-thumb {
  background: var(--border-soft);
  border-radius: 999px;
  border: 2px solid #121214;
  background-clip: padding-box;
  transition: background 0.2s ease;
}
.code-panel pre::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
  background-clip: padding-box;
}
.tok-kw { color: var(--accent); }
.tok-fn { color: #4ade80; }
.tok-str { color: #f4d160; }
.tok-com { color: var(--muted-dim); font-style: italic; }
.tok-num { color: #5fc4e8; }

/* ---------- informe ---------- */
.report {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.report h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 20px;
  margin: 0 0 10px;
}
.report p {
  color: var(--white);
  margin: 0;
  line-height: 1.7;
}
.report ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--white);
  line-height: 1.7;
}
.report li::marker { color: var(--accent); }
.report__block { border-left: 2px solid var(--border-soft); padding-left: 20px; }
.report__block--base { border-left-color: var(--highlight); }
.report__block--present { border-left-color: var(--secondary); }
.report__block--future { border-left-color: var(--accent); }

/* ---------- presentation slides ---------- */
.slides {
  position: relative;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: linear-gradient(160deg, #14204a 0%, #0a0a0a 100%);
  min-height: 380px;
  overflow: hidden;
}
.slide {
  display: none;
  padding: clamp(30px, 5vw, 60px);
  min-height: 380px;
  flex-direction: column;
  justify-content: center;
}
.slide.is-active { display: flex; }
.slide__eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.slide h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(22px, 3vw, 32px);
  margin: 0 0 18px;
  max-width: 600px;
}
.slide p { color: var(--muted); max-width: 560px; line-height: 1.6; margin: 0 0 20px; }
.slide ul { color: var(--white); max-width: 560px; line-height: 1.8; padding-left: 20px; margin: 0; }
.slide li::marker { color: var(--secondary); }
.slide__stats { display: flex; gap: 32px; flex-wrap: wrap; margin-top: 8px; }
.slide__stat p:first-child { font-family: var(--font-heading); font-size: 30px; margin: 0; color: var(--white); }
.slide__stat p:last-child { font-size: 12.5px; color: var(--muted); margin: 4px 0 0; }

.slides__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}
.slide-dots { display: flex; gap: 8px; }
.slide-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: var(--border-soft);
  cursor: pointer;
  padding: 0;
}
.slide-dot.is-active { background: var(--accent); }
.slides__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--white);
  cursor: pointer;
  font-size: 16px;
  transition: border-color 0.2s ease;
}
.slides__btn:hover { border-color: var(--accent); }
.slides__btns { display: flex; gap: 10px; }

/* ---------- footer ---------- */
.demo-footer {
  padding: 40px 0 60px;
  text-align: center;
  color: var(--muted-dim);
  font-size: 13px;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid.kpi-grid--sim { grid-template-columns: repeat(2, 1fr); }
  .sim-panel { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-grid.kpi-grid--sim { grid-template-columns: 1fr; }
  .slides__nav { flex-wrap: wrap; gap: 12px; }
}
