/* AFPBTC — estilos del sitio */
:root {
  --bg: #0D0E0C;
  --panel: #121310;
  --card: #151613;
  --line: #262823;
  --line-2: #3A3D36;
  --ink: #EDEAE3;
  --ink-2: #C9C4B8;
  --mute: #A39E93;
  --mute-2: #8C877D;
  --btc: #F7931A;
  --btc-hover: #FFB255;
  --btc-tint: #2A2116;
  --accent: #F7931A;
  --header-bg: rgba(13,14,12,.92);
  --footer-bg: #0A0B09;
  --ok: #6FCF97;
  --err: #EB8A6B;
  --live: #4CAF7A;
  --cream: #EDEAE3;
  --cream-ink: #141412;
  --cream-ink-2: #45433D;
  --cream-accent: #9A4F00;
  --cream-line: #C9C4B8;
  --cap: #1F4E79;
  --acu: #2E7DAF;
  --opt: #8A8F7A;
  --cre: #D9822B;
  --eu: #B8441E;
  --sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --wrap: 1240px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.5; }
img, svg { max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--btc-hover); }
:focus-visible { outline: 2px solid var(--btc); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btc); color: var(--bg); padding: 10px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 16px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }
.kicker { margin: 0 0 12px; font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.h2 { margin: 0; font-size: clamp(32px, 4.4vw, 44px); line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.lead { margin: 18px 0 0; font-size: 17px; line-height: 1.6; color: var(--ink-2); max-width: 640px; }
.section { padding-top: 96px; padding-bottom: 96px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 6px; font: 600 16px/1 var(--sans); text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--btc); color: var(--bg); }
.btn-primary:hover { background: var(--btc-hover); color: var(--bg); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink-2); color: var(--ink); }
.btn-outline { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-outline:hover { background: var(--btc-tint); color: var(--accent); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 15px; }

/* Cabecera */
.site-header { border-bottom: 1px solid var(--line); background: var(--header-bg); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; background: var(--btc); color: var(--bg); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; border-radius: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.brand-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin-top: 3px; }
@media (max-width: 1100px) { .brand-sub { display: none; } }
@media (max-width: 380px) { .brand-tag { display: none; } }
.brand-sub { font-family: var(--mono); font-size: 12px; color: var(--mute); margin-left: 4px; }
.nav { display: flex; align-items: center; gap: 26px; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 15px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a.btn-primary, .nav a.btn-primary:hover { color: var(--bg); }
.nav-toggle { display: none; background: transparent; border: 1px solid var(--line-2); color: var(--ink); border-radius: 6px; min-height: 44px; min-width: 44px; cursor: pointer; }
.header-cta { white-space: nowrap; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 24px 20px; }
  .nav.open { display: flex; }
  .nav a { padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 17px; }
  .nav .header-cta { margin-top: 16px; border-bottom: 0; color: var(--bg); }
}

/* Hero */
.hero { padding: 96px 0 56px; }
.hero h1 { margin: 0; font-size: clamp(44px, 7.2vw, 92px); line-height: .98; font-weight: 800; letter-spacing: -.03em; max-width: 980px; }
.hero .lead { font-size: 20px; margin-top: 28px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 40px; }

/* Ticker */
.ticker { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); }
.ticker .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tick { padding: 22px 16px 22px 0; border-right: 1px solid var(--line); min-width: 0; }
.tick:last-child { border-right: 0; }
.tick-label { font-family: var(--mono); font-size: 12px; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; }
.tick-value { font-family: var(--mono); font-size: 26px; font-weight: 500; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tick-src { font-size: 12px; color: var(--mute-2); margin-top: 6px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--live); margin-right: 6px; vertical-align: 1px; }
@media (max-width: 640px) { .tick { border-right: 0; border-bottom: 1px solid var(--line); } .tick-value { font-size: 22px; } }

/* Termómetro */
.thermo { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 64px; border-radius: 8px; overflow: visible; margin-top: 48px; }
.thermo span:nth-child(1) { background: var(--cap); border-radius: 8px 0 0 8px; }
.thermo span:nth-child(2) { background: var(--acu); }
.thermo span:nth-child(3) { background: var(--opt); }
.thermo span:nth-child(4) { background: var(--cre); }
.thermo span:nth-child(5) { background: var(--eu); border-radius: 0 8px 8px 0; }
.thermo-mark { position: absolute; top: -12px; bottom: -12px; width: 4px; margin-left: -2px; background: var(--ink); border-radius: 2px; left: 50%; transition: left .8s ease; box-shadow: 0 0 0 3px var(--bg); }
.thermo-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 14px; font-size: 14px; color: var(--ink-2); }
.thermo-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 24px; margin-top: 28px; }
.thermo-value { font-family: var(--mono); font-size: 48px; font-weight: 500; line-height: 1; }
.thermo-phase { font-size: 24px; font-weight: 600; }
.thermo-meta { font-family: var(--mono); font-size: 13px; color: var(--mute); }
.cycle-hist { margin-top: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 8px; }
.cycle-hist svg { display: block; width: 100%; height: 140px; }
.cycle-hist-label { font-family: var(--mono); font-size: 12px; color: var(--mute); display: flex; justify-content: space-between; padding-bottom: 8px; }
.thermo-legend .s { display: none; }
@media (max-width: 640px) { .thermo-legend { font-size: 12px; } .thermo-legend .l { display: none; } .thermo-legend .s { display: inline; } .thermo { height: 48px; } .thermo-value { font-size: 40px; } }

/* Tarjetas */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; min-width: 0; }
a.card { text-decoration: none; color: var(--ink); transition: border-color .2s; }
a.card:hover { border-color: var(--line-2); color: var(--ink); }
.card-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 12px; }
.card-top .n { color: var(--mute); }
.card-top .tag { color: var(--accent); }
.card h3 { margin: 0; font-size: 24px; font-weight: 600; }
.card p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.card-value { font-family: var(--mono); font-size: 22px; }
.card-value small { font-size: 13px; color: var(--mute); margin-left: 8px; }
.spark { width: 100%; height: 52px; display: block; }
.card-metrics { font-family: var(--mono); font-size: 13px; color: var(--mute-2); }

/* Aprende (crema) */
.cream { background: var(--cream); color: var(--cream-ink); }
.cream .kicker { color: var(--cream-accent); }
.cream .lead { color: var(--cream-ink-2); }
.cream a { color: var(--cream-accent); }
.learn { display: flex; flex-wrap: wrap; gap: 56px; }
.learn-intro { flex: 1 1 340px; }
.glossary { flex: 2 1 560px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); border-top: 1px solid var(--cream-line); margin: 0; }
.glossary div { padding: 22px 20px 22px 0; border-bottom: 1px solid var(--cream-line); }
.glossary dt { font-weight: 600; font-size: 18px; }
.glossary dt a { color: var(--cream-ink); text-decoration: none; }
.glossary dt a:hover { color: var(--cream-accent); }
.glossary dd { margin: 6px 0 0; font-size: 15px; line-height: 1.5; color: var(--cream-ink-2); }

/* Servicios */
.service ul { margin: 0; padding-left: 18px; font-size: 15px; line-height: 1.8; color: var(--ink-2); }
.service-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.note { margin: 28px 0 0; font-size: 13px; line-height: 1.6; color: var(--mute-2); max-width: 860px; }

/* Asesor */
.advisor { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.avatar { width: 72px; height: 72px; flex: 0 0 72px; border-radius: 50%; background: var(--btc-tint); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 24px; }
.advisor-body { flex: 1 1 320px; }
.advisor h3 { margin: 0; font-size: 24px; font-weight: 600; }
.advisor .role { margin: 6px 0 0; font-family: var(--mono); font-size: 13px; color: var(--accent); }
.advisor p { margin: 12px 0 0; font-size: 15px; line-height: 1.55; color: var(--ink-2); max-width: 620px; }

/* Newsletter */
.newsletter .wrap { padding-top: 72px; padding-bottom: 72px; display: flex; flex-wrap: wrap; gap: 32px; justify-content: space-between; align-items: center; }
.newsletter h2 { margin: 0; font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.newsletter form { display: flex; flex-wrap: wrap; gap: 10px; flex: 0 1 460px; }
.input { flex: 1 1 240px; min-height: 48px; padding: 0 16px; background: var(--card); border: 1px solid var(--line-2); border-radius: 6px; color: var(--ink); font: 16px var(--sans); }
.input::placeholder { color: var(--mute-2); }

/* Pie */
.site-footer { border-top: 1px solid var(--line); background: var(--footer-bg); }
.site-footer .wrap { padding-top: 48px; padding-bottom: 48px; display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; font-size: 14px; color: var(--mute); line-height: 1.7; }
.site-footer strong { color: var(--ink); font-weight: 600; display: block; }
.site-footer a { color: var(--ink-2); }
.site-footer a:hover { color: var(--accent); }
.border-top { border-top: 1px solid var(--line); }

/* ---------- Panel de métricas ---------- */
.panel { display: flex; flex-wrap: wrap; min-height: calc(100vh - 64px); }
.panel-side { flex: 1 1 260px; max-width: 100%; border-right: 1px solid var(--line); padding: 20px 12px 32px; }
.panel-main { flex: 999 1 560px; min-width: 0; padding: 32px 32px 64px; }
.side-search { width: 100%; margin: 0 0 18px; }
.side-group { margin-bottom: 18px; }
.side-group h2 { margin: 0; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; padding: 0 12px 8px; }
.side-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px; font: 15px var(--sans); cursor: pointer; background: transparent; color: var(--ink-2); }
.side-item:hover { background: var(--card); color: var(--ink); }
.side-item[aria-current="true"] { background: var(--btc-tint); color: var(--btc); font-weight: 600; }
.side-item .src { font-family: var(--mono); font-size: 10px; color: var(--mute-2); font-weight: 400; }
@media (max-width: 860px) {
  .panel-side { border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .side-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
  .side-group { display: contents; }
  .side-group h2 { display: none; }
  .side-item { width: auto; white-space: nowrap; border: 1px solid var(--line-2); flex: 0 0 auto; }
  .side-item .src { display: none; }
  .panel-main { padding: 24px 16px 48px; }
}
.metric-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 20px; }
.metric-head h1 { margin: 8px 0 0; font-size: clamp(30px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.metric-head p { margin: 10px 0 0; font-size: 17px; color: var(--ink-2); max-width: 640px; line-height: 1.5; }
.metric-now { text-align: right; }
.metric-now .v { font-family: var(--mono); font-size: 34px; font-weight: 500; margin-top: 4px; }
.metric-now .d { font-family: var(--mono); font-size: 13px; margin-top: 6px; }
.up { color: #6FCF97; } .down { color: #EB8A6B; }
@media (max-width: 640px) { .metric-now { text-align: left; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; align-items: center; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 6px; font: 13px var(--mono); cursor: pointer; background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); text-decoration: none; display: inline-flex; align-items: center; }
.chip:hover { color: var(--ink); border-color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.toolbar .spacer { flex: 1 1 auto; }
.chart-box { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px 12px; }
.chart { width: 100%; min-height: 380px; }
.chart-cap { font-size: 13px; color: var(--mute-2); margin-top: 10px; padding: 0 6px; }
.chart-msg { padding: 120px 20px; text-align: center; color: var(--mute); font-family: var(--mono); font-size: 13px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.info-grid .card { padding: 22px; gap: 10px; }
.info-grid h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--btc); }
.info-grid .formula { font-family: var(--mono); font-size: 14px; line-height: 1.6; color: var(--ink); }
.cta-cream { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; background: var(--cream); color: var(--cream-ink); border-radius: var(--radius); padding: 24px 26px; }
.cta-cream strong { font-size: 20px; font-weight: 800; display: block; }
.cta-cream span { font-size: 15px; color: var(--cream-ink-2); }
.cta-cream .btn { background: var(--cream-ink); color: var(--cream); }

/* uPlot sobre fondo oscuro */
.uplot { font-family: var(--mono); }
.u-legend { color: var(--ink-2); font-size: 12px; text-align: left; margin-top: 6px; }
.u-legend .u-marker { border-radius: 2px; }
.u-legend th { font-weight: 400; }
.u-select { background: rgba(247,147,26,.12); }

/* ---------- Contacto ---------- */
.contact { display: flex; flex-wrap: wrap; gap: 56px; align-items: flex-start; }
.contact-intro { flex: 1 1 340px; }
.contact-points { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 18px; }
.contact-points li { border-top: 1px solid var(--line); padding-top: 16px; }
.contact-points strong { display: block; font-size: 17px; }
.contact-points span { color: var(--ink-2); font-size: 15px; }
.contact-form { flex: 1 1 420px; gap: 18px; padding: 30px; }
.field { display: flex; flex-direction: column; gap: 8px; flex: 0 0 auto; min-width: 0; }
.field-row .field { flex: 1 1 200px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink); }
.field-row { display: flex; flex-wrap: wrap; gap: 18px; }
.contact-form .input { width: 100%; flex: 0 0 auto; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 40px; }
textarea.input { padding: 14px 16px; min-height: 140px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--btc); outline: none; }
.contact-form .input:user-invalid { border-color: var(--err); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--ink-2); line-height: 1.5; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--btc); flex: 0 0 auto; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .btn { align-self: flex-start; }
.contact-form .btn:disabled { opacity: .7; cursor: default; }
.form-status { margin: 0; font-size: 15px; min-height: 1.5em; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--err); }

/* ---------- Tema claro (inicio, contacto) ----------
   El panel de métricas sigue en oscuro: es la "herramienta".
   Todos los colores de texto cumplen contraste AA (≥ 4,5:1). */
.theme-light {
  --bg: #FAF8F3;
  --panel: #F1EDE4;
  --card: #FFFFFF;
  --line: #E3DED2;
  --line-2: #CFC8B8;
  --ink: #141412;
  --ink-2: #45433D;
  --mute: #66625A;
  --mute-2: #706B62;
  --accent: #9A4F00;
  --btc-tint: #FCEBD5;
  --header-bg: rgba(250,248,243,.92);
  --footer-bg: #F1EDE4;
  --ok: #1E7A4C;
  --err: #B23C1C;
  --live: #1E9A5C;
  /* La sección "Aprende" pasa a ser la franja oscura del ritmo de la página. */
  --cream: #141412;
  --cream-ink: #EDEAE3;
  --cream-ink-2: #C9C4B8;
  --cream-accent: #F7931A;
  --cream-line: #3A3D36;
}
.theme-light .btn-primary, .theme-light .nav a.btn-primary { color: #141412; }
.theme-light .btn-primary:hover { background: #E8850F; }
.theme-light .card { box-shadow: 0 1px 2px rgba(20,20,18,.04); }
.theme-light a.card:hover { border-color: var(--line-2); box-shadow: 0 4px 16px rgba(20,20,18,.06); }
.theme-light .thermo-mark { background: #141412; }
.theme-light .input { background-color: #FFFFFF; }
