/* =========================================================
   TOKENS
========================================================= */
:root{
  --bg: #0B0F14;
  --bg-alt: #0E141C;
  --panel: #131A22;
  --panel-border: #232E3A;
  --text: #E8EDF2;
  --text-muted: #8A97A6;
  --accent: #D4A64A;
  --accent-dim: #7A6532;
  --bull: #2FBF83;
  --bear: #E5484D;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 10px;
  --max-w: 1180px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after{ box-sizing: border-box; }

html{ scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *, *::before, *::after{ animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3{
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

a{ color: inherit; }
button{ font-family: var(--font-body); cursor: pointer; }

.eyebrow{
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

/* =========================================================
   RISK BANNER
========================================================= */
.risk-banner{
  background: #1A1310;
  border-bottom: 1px solid var(--accent-dim);
  color: #E8CB8F;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.75rem 1.5rem;
  font-size: 0.85rem;
  position: relative;
  z-index: 100;
}
.risk-banner p{ margin: 0; max-width: 900px; }
.risk-banner button{
  background: var(--accent);
  color: #1A1310;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 1rem;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.risk-banner.is-dismissed{ display: none; }

/* =========================================================
   TOPBAR
========================================================= */
.topbar{
  position: sticky;
  top: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(11,15,20,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.topbar__brand{ display: flex; align-items: center; gap: 0.6rem; }
.brand-mark{
  width: 10px; height: 10px;
  background: var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
}
.brand-name{ font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.brand-name em{ color: var(--accent); font-style: normal; }
.topbar__nav{ display: flex; gap: 1.75rem; font-size: 0.9rem; }
.topbar__nav a{ text-decoration: none; color: var(--text-muted); transition: color 0.2s var(--ease); }
.topbar__nav a:hover{ color: var(--text); }
.topbar__status{
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted);
}
.status-dot{ width: 7px; height: 7px; border-radius: 50%; background: var(--bull); box-shadow: 0 0 6px var(--bull); }

@media (max-width: 800px){
  .topbar__nav{ display: none; }
}

/* =========================================================
   HERO
========================================================= */
.hero{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 2rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
}
.hero__copy h1{ font-size: clamp(2rem, 4.2vw, 3.2rem); margin-bottom: 1.25rem; }
.hero__lede{ color: var(--text-muted); font-size: 1.05rem; max-width: 46ch; margin-bottom: 2rem; }
.hero__cta{ display: flex; gap: 1rem; flex-wrap: wrap; }

.btn{
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.85rem 1.6rem;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn--primary{ background: var(--accent); color: #1A1310; }
.btn--primary:hover{ transform: translateY(-2px); }
.btn--ghost{ background: transparent; border-color: var(--panel-border); color: var(--text); }
.btn--ghost:hover{ border-color: var(--accent); }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; transform: none !important; }

.hero__chart{ position: relative; }
.hero__chart svg{ width: 100%; height: auto; display: block; }
.hero__chart-caption{
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

@media (max-width: 900px){
  .hero{ grid-template-columns: 1fr; }
}

/* =========================================================
   SECTION HEAD (shared)
========================================================= */
.section-head{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  margin-bottom: 2.5rem;
}
.section-head h2{ font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-lede{ color: var(--text-muted); max-width: 60ch; margin-top: 0.75rem; }

section{ padding: 4rem 0; }

/* =========================================================
   DASHBOARD
========================================================= */
.dashboard__grid{
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}
.panel{
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.panel h3{ font-size: 1rem; margin-bottom: 1rem; color: var(--text-muted); font-weight: 500; }
.panel--progress{ grid-column: span 2; display: flex; gap: 1.5rem; align-items: center; }

.progress-ring-wrap{ position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.progress-ring{ width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring__bg, .progress-ring__fill{
  fill: none; stroke-width: 10;
}
.progress-ring__bg{ stroke: var(--panel-border); }
.progress-ring__fill{
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
  transition: stroke-dashoffset 0.6s var(--ease);
}
.progress-ring__label{
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 1.3rem; font-weight: 600;
}

.module-status-list{ list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.module-status-list li{ display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0; color: var(--text-muted); }
.module-status-list .dot{ width: 8px; height: 8px; border-radius: 50%; background: var(--panel-border); flex-shrink: 0; }
.module-status-list li.is-complete .dot{ background: var(--bull); box-shadow: 0 0 6px var(--bull); }
.module-status-list li.is-complete{ color: var(--text); }
.module-status-list li.is-current .dot{ background: var(--accent); box-shadow: 0 0 6px var(--accent); }

.stat-big{ font-family: var(--font-mono); font-size: 2.2rem; font-weight: 700; margin: 0 0 0.5rem; color: var(--accent); }
.stat-sub{ color: var(--text-muted); font-size: 0.85rem; margin: 0; }

.quick-links{ display: flex; flex-direction: column; gap: 0.6rem; }
.quick-links a{
  text-decoration: none; font-size: 0.9rem; color: var(--text);
  padding: 0.5rem 0.75rem; border: 1px solid var(--panel-border); border-radius: 6px;
  transition: border-color 0.2s var(--ease);
}
.quick-links a:hover{ border-color: var(--accent); }

@media (max-width: 900px){
  .dashboard__grid{ grid-template-columns: 1fr 1fr; }
  .panel--progress{ grid-column: span 2; flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px){
  .dashboard__grid{ grid-template-columns: 1fr; }
  .panel--progress{ grid-column: span 1; }
}

/* =========================================================
   MODULES — scroll reveal
========================================================= */
.modules{ max-width: var(--max-w); margin: 0 auto; padding: 4rem 2rem; }

.module{
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 0;
}
.module__marker{
  display: flex; flex-direction: column; align-items: center;
}
.module__index{
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted);
  padding-top: 0.4rem;
}
.module__line{
  width: 1px; flex: 1; background: var(--panel-border); margin-top: 0.5rem;
}
.module:last-child .module__line{ background: transparent; }

.module__body{
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2.5rem;
  background: var(--panel);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.module__body.is-visible{ opacity: 1; transform: translateY(0); }

.module__badge{
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem; border-radius: 4px;
  background: rgba(47,191,131,0.12); color: var(--bull);
  margin-bottom: 1rem;
}
.module__badge.is-locked{ background: rgba(138,151,166,0.12); color: var(--text-muted); }
.module__badge.is-complete{ background: rgba(212,166,74,0.15); color: var(--accent); }

.module h3{ font-size: 1.4rem; margin-bottom: 0.4rem; }
.module__meta{
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); margin: 0 0 1.25rem;
}
.lesson-list{ list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.lesson-list li{ padding-left: 1.1rem; position: relative; color: var(--text-muted); font-size: 0.95rem; }
.lesson-list li::before{
  content: ''; position: absolute; left: 0; top: 0.5em;
  width: 5px; height: 5px; background: var(--accent); border-radius: 50%;
}
.lesson-list strong{ color: var(--text); }

.module.is-locked .module__content,
.module.is-locked .lesson-list{ filter: blur(3px); pointer-events: none; user-select: none; }
.module.is-locked .module__body{ position: relative; }
.module.is-locked .module__body::after{
  content: '🔒 Completa el módulo anterior para desbloquear';
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(11,15,20,0.55); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted); text-align: center; padding: 2rem;
}

.btn--exam{ background: var(--panel-border); color: var(--text); }
.btn--exam:hover:not(:disabled){ background: var(--accent); color: #1A1310; }

@media (max-width: 640px){
  .module{ grid-template-columns: 1fr; }
  .module__marker{ flex-direction: row; gap: 0.75rem; margin-bottom: 0.75rem; }
  .module__line{ display: none; }
}

/* =========================================================
   TOOLS
========================================================= */
.tools{ max-width: var(--max-w); margin: 0 auto; padding: 4rem 2rem; }
.tool-card{
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 2rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 2.5rem;
}
.tool-card__intro h3{ font-size: 1.3rem; margin-bottom: 0.75rem; }
.tool-card__intro p{ color: var(--text-muted); font-size: 0.95rem; }

@media (max-width: 900px){
  .tool-card{ grid-template-columns: 1fr; }
}

/* --- Risk calculator --- */
.risk-calc__inputs{ display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 1.5rem; }
.risk-calc__inputs label{ display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.risk-calc__inputs input[type="number"]{
  background: var(--bg-alt); border: 1px solid var(--panel-border); border-radius: 6px;
  padding: 0.65rem 0.8rem; color: var(--text); font-family: var(--font-mono); font-size: 1rem;
}
.risk-calc__inputs input[type="number"]:focus{ outline: 2px solid var(--accent); outline-offset: 1px; }
.risk-calc__inputs input[type="range"]{ accent-color: var(--accent); }
.range-value{ font-family: var(--font-mono); color: var(--accent); font-size: 0.85rem; }

.risk-calc__figure{
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 1rem 0; border-bottom: 1px solid var(--panel-border);
}
.risk-calc__figure-label{ font-size: 0.85rem; color: var(--text-muted); max-width: 60%; }
.risk-calc__figure-value{ font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.risk-calc__figure--secondary .risk-calc__figure-value{ font-size: 1.05rem; color: var(--text); }
.risk-calc__warning{
  margin-top: 1rem; font-size: 0.85rem; color: var(--bear); min-height: 1.2em;
}
.risk-calc__warning.is-ok{ color: var(--bull); }

/* --- Simulator --- */
.simulator__scenario svg{ width: 100%; height: auto; background: var(--bg-alt); border-radius: 8px; border: 1px solid var(--panel-border); }
.simulator__counter{ font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: 0.6rem; }
.simulator__controls{ display: flex; gap: 0.75rem; margin-top: 1rem; flex-wrap: wrap; }
.btn--buy{ background: rgba(47,191,131,0.15); color: var(--bull); border-color: rgba(47,191,131,0.4); }
.btn--buy:hover{ background: var(--bull); color: #06251A; }
.btn--sell{ background: rgba(229,72,77,0.15); color: var(--bear); border-color: rgba(229,72,77,0.4); }
.btn--sell:hover{ background: var(--bear); color: #2B0708; }
.btn--wait{ background: transparent; color: var(--text-muted); border-color: var(--panel-border); }
.btn--wait:hover{ border-color: var(--text-muted); color: var(--text); }
.simulator__feedback{
  margin-top: 1.25rem; padding: 1rem; border-radius: 8px; font-size: 0.9rem;
  background: var(--bg-alt); border: 1px solid var(--panel-border); min-height: 1.5em;
}
.simulator__feedback.is-correct{ border-color: var(--bull); }
.simulator__feedback.is-incorrect{ border-color: var(--bear); }
.simulator__feedback:empty{ display: none; }

/* =========================================================
   EXAM MODAL
========================================================= */
.exam-overlay{
  position: fixed; inset: 0; background: rgba(6,8,11,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity 0.25s var(--ease);
}
.exam-overlay.is-open{ opacity: 1; pointer-events: auto; }
.exam-modal{
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
  max-width: 560px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 2rem;
  position: relative;
  transform: translateY(10px); transition: transform 0.25s var(--ease);
}
.exam-overlay.is-open .exam-modal{ transform: translateY(0); }
.exam-modal__close{
  position: absolute; top: 1rem; right: 1rem; background: none; border: none;
  color: var(--text-muted); font-size: 1.5rem; line-height: 1; padding: 0.25rem 0.5rem;
}
.exam-modal__close:hover{ color: var(--text); }
.exam-modal h3{ font-size: 1.3rem; margin: 0.25rem 0 0.75rem; }
.exam-modal__rule{ color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1.5rem; }

.exam-question{ margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--panel-border); }
.exam-question p{ font-weight: 600; margin: 0 0 0.75rem; }
.exam-option{ display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; font-size: 0.9rem; }
.exam-option input{ accent-color: var(--accent); }

.exam-modal__result{ font-size: 0.9rem; padding: 0.75rem; border-radius: 6px; margin-bottom: 1rem; }
.exam-modal__result:empty{ display: none; padding: 0; }
.exam-modal__result.is-pass{ background: rgba(47,191,131,0.12); color: var(--bull); }
.exam-modal__result.is-fail{ background: rgba(229,72,77,0.12); color: var(--bear); }
.exam-modal__actions{ display: flex; gap: 0.75rem; }

/* =========================================================
   FOOTER
========================================================= */
.site-footer{
  border-top: 1px solid var(--panel-border);
  padding: 2rem; text-align: center;
  color: var(--text-muted); font-size: 0.8rem;
}

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible{
  outline: 2px solid var(--accent); outline-offset: 2px;
}
