/* ============================================================
   Balam — sistema de diseño (dark techy / neón naranja)
   ============================================================ */

:root {
  /* Base */
  --bg:        #070B0C;
  --bg-2:      #0A0F11;
  --surface:   #0E1518;
  --surface-2: #121B1F;
  --line:      #1C2A2E;
  --line-soft: #162226;

  /* Texto */
  --fg:        #E9F1EF;
  --fg-muted:  #8DA09B;
  --fg-dim:    #5F726E;

  /* Marca — jaguar / naranja neón */
  --jade:      #FF7A1A;
  --cyan:      #FFB020;
  --amber:     #F4B740;
  --grad:      linear-gradient(100deg, var(--jade), var(--cyan));
  --grad-soft: linear-gradient(100deg, rgba(255,122,26,.16), rgba(255,176,32,.16));

  --glow-jade: 0 0 0 1px rgba(255,122,26,.35), 0 8px 40px -8px rgba(255,122,26,.45);

  --radius:    16px;
  --radius-sm: 10px;
  --maxw:      1120px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Glow ambiental de fondo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60rem 40rem at 78% -10%, rgba(255,176,32,.10), transparent 60%),
    radial-gradient(50rem 40rem at 8% 0%, rgba(255,122,26,.10), transparent 55%),
    radial-gradient(40rem 30rem at 50% 120%, rgba(255,122,26,.06), transparent 60%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

img, svg { max-width: 100%; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
}

/* ---------- Tipografía ---------- */
h1, h2, h3 { line-height: 1.1; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: 1.25rem; letter-spacing: -.01em; }
p  { margin: 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--jade);
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--grad);
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead { font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--fg-muted); max-width: 56ch; }
.muted { color: var(--fg-muted); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.02em; font-size: 1.15rem; }
.brand__mark { width: 30px; height: 30px; filter: drop-shadow(0 0 10px rgba(255,122,26,.5)); }
.brand small { font-family: var(--mono); font-size: .62rem; letter-spacing: .2em; color: var(--fg-dim); text-transform: uppercase; }
.nav__links { display: flex; align-items: center; gap: 1.75rem; }
.nav__links a { color: var(--fg-muted); font-size: .95rem; transition: color .2s; }
.nav__links a:hover { color: var(--fg); }
/* El CTA del nav es un botón con fondo naranja: texto oscuro para que se lea. */
.nav__links a.btn--primary,
.nav__links a.btn--primary:hover { color: #0A0A0A; }
.nav__toggle { display: none; background: none; border: 0; color: var(--fg); cursor: pointer; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 600; font-size: .95rem;
  padding: .72rem 1.25rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .25s ease, background .2s, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--grad); color: #041014; box-shadow: 0 8px 30px -10px rgba(255,122,26,.7); }
.btn--primary:hover { box-shadow: 0 10px 42px -8px rgba(255,176,32,.75); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--jade); color: var(--fg); background: rgba(255,122,26,.06); }
.btn--block { width: 100%; justify-content: center; }

/* ---------- Secciones ---------- */
.section { padding-block: clamp(4rem, 9vw, 7rem); }
.section--tight { padding-block: clamp(3rem, 6vw, 4.5rem); }
.section__head { max-width: 40rem; margin-bottom: 3rem; }
.section__head .lead { margin-top: 1rem; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(4.5rem, 11vw, 9rem) clamp(3rem, 7vw, 5rem); }
.hero__grid {
  position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70% 60% at 50% 30%, #000, transparent 80%);
}
.hero h1 { margin-top: 1.4rem; max-width: 16ch; }
.hero .lead { margin-top: 1.6rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 2.4rem; }
.hero__stats { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 3.5rem; }
.stat b { display: block; font-size: 1.8rem; font-weight: 700; }
.stat span { color: var(--fg-dim); font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  position: relative;
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem;
  transition: transform .2s ease, border-color .2s ease, box-shadow .3s ease;
  overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; background: var(--grad); opacity: 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  transition: opacity .3s;
  pointer-events: none;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 24px 60px -30px rgba(255,122,26,.5); }
.card:hover::after { opacity: .7; }
.card h3 { margin-bottom: .6rem; }
.card p { color: var(--fg-muted); font-size: .96rem; }

.icon-badge {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--grad-soft);
  border: 1px solid var(--line);
  color: var(--jade);
  margin-bottom: 1.1rem;
}
.icon-badge svg { width: 24px; height: 24px; }

/* Lista con checks */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; }
.checklist li { display: flex; gap: .7rem; align-items: flex-start; color: var(--fg-muted); font-size: .96rem; }
.checklist li::before {
  content: ""; flex: none; margin-top: .35rem; width: 16px; height: 16px;
  background: var(--grad); border-radius: 5px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center/72% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center/72% no-repeat;
}

/* ---------- Curso card ---------- */
.curso-card { display: flex; flex-direction: column; gap: 1rem; }
.curso-card .tags { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .04em;
  padding: .28rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--fg-muted);
}
.tag--accent { color: var(--jade); border-color: rgba(255,122,26,.4); background: rgba(255,122,26,.06); }
.curso-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .5rem; }

/* ---------- CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(120deg, rgba(255,122,26,.10), rgba(255,176,32,.08));
  padding: clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}
.cta-band h2 { max-width: 24ch; margin-inline: auto; }
.cta-band .lead { margin: 1rem auto 2rem; }
.cta-band .hero__cta { justify-content: center; }

/* ---------- Formularios ---------- */
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .45rem; }
.field label { font-size: .85rem; color: var(--fg-muted); font-weight: 500; }
.field label .req { color: var(--jade); }
.input, .textarea, select.input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: var(--radius-sm);
  padding: .8rem .95rem;
  font: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, select.input:focus {
  outline: none; border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(255,122,26,.15);
}
.textarea { min-height: 130px; resize: vertical; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }

.field-error { color: #ff8a8a; font-size: .82rem; }
.alert {
  border-radius: var(--radius-sm); padding: .9rem 1.1rem; font-size: .95rem;
  border: 1px solid transparent;
}
.alert--ok { background: rgba(255,122,26,.10); border-color: rgba(255,122,26,.4); color: var(--jade); }
.alert--err { background: rgba(255,90,90,.08); border-color: rgba(255,90,90,.35); color: #ff9d9d; }

/* ---------- Módulos temario ---------- */
.temario { display: grid; gap: .75rem; counter-reset: mod; }
.mod {
  display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start;
  padding: 1.1rem 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface);
}
.mod__n {
  counter-increment: mod;
  font-family: var(--mono); font-size: .8rem; color: var(--jade);
  border: 1px solid var(--line); border-radius: 8px; padding: .2rem .5rem; min-width: 2.2rem; text-align: center;
}
.mod__n::before { content: counter(mod, decimal-leading-zero); }
.mod h4 { margin: 0 0 .25rem; font-size: 1rem; }
.mod p { color: var(--fg-muted); font-size: .92rem; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line-soft); padding-block: 3rem; margin-top: 4rem; }
.footer__grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.footer__brand { max-width: 26rem; }
.footer__brand p { color: var(--fg-muted); margin-top: .8rem; font-size: .92rem; }
.footer__cols { display: flex; gap: 3.5rem; flex-wrap: wrap; }
.footer__col h5 { font-family: var(--mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-dim); margin: 0 0 .9rem; }
.footer__col a { display: block; color: var(--fg-muted); font-size: .92rem; margin-bottom: .5rem; transition: color .2s; }
.footer__col a:hover { color: var(--jade); }
.footer__legal { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line-soft); color: var(--fg-dim); font-size: .82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer__legal .badge-x { font-family: var(--mono); }
.footer__legal .badge-x b { color: var(--fg-muted); }

/* ---------- Detalle layout ---------- */
.detalle { display: grid; grid-template-columns: 1fr 340px; gap: 2.5rem; align-items: start; }
/* Contacto: la columna del formulario va más ancha que en el detalle de curso. */
.detalle--contacto { grid-template-columns: 1fr 480px; }
.detalle__aside { position: sticky; top: 92px; }

/* ---------- Metodología ---------- */
.method { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; list-style: none; padding: 0; margin: 0; }
.method li { display: flex; align-items: center; gap: .75rem; }
.method li span {
  font-family: var(--mono);
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .55rem 1.1rem;
}
.method li:not(:last-child)::after { content: "→"; color: var(--jade); font-family: var(--mono); }
.method li:last-child span { background: var(--grad-soft); border-color: var(--jade); }

/* ---------- Casos de éxito ---------- */
.caso__label {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--jade);
  margin: 0 0 .5rem;
}

/* ---------- Utilidades ---------- */
.stack > * + * { margin-top: 1.1rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.hidden { display: none; }
.htmx-request .btn__label { opacity: .5; }
.spinner { display: none; }
.htmx-request .spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(4,16,20,.4); border-top-color: #041014; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .detalle { grid-template-columns: 1fr; }
  .detalle__aside { position: static; }
}
@media (max-width: 640px) {
  .nav__links { display: none; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .field--row { grid-template-columns: 1fr; }
  .footer__grid { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
