/* Foundry Forge — estilos compartidos (tema neón de la marca: índigo, cian y magenta) */
:root { color-scheme: dark;
  --bg: #07060d; --bg2: #0d0b18; --card: #12101f; --card2: #181530; --line: #2a2647; --line2: #3a3463;
  --ink: #f4f2ff; --muted: #a39fc2; --dim: #6f6a93;
  --cyan: #00f0ff; --mag: #ff2bd6; --indigo: #4438c8; --indigo2: #6c5cff; --ok: #2ee6a6; --warn: #ffb020; --bad: #ff4d6d;
  --r: 18px; --r-sm: 11px;
  --display: "Bebas Neue", "Anton", Impact, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --glow-c: 0 0 24px rgba(0, 240, 255, .35); --glow-m: 0 0 24px rgba(255, 43, 214, .35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body); overflow-x: hidden; }
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--mag); color: #fff; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }

/* fondo: rejilla + resplandores */
.fondo { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 43, 214, .16), transparent 60%),
    radial-gradient(800px 500px at -10% 20%, rgba(0, 240, 255, .12), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(68, 56, 200, .25), transparent 60%),
    var(--bg); }
.fondo::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(108, 92, 255, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(108, 92, 255, .08) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 75%); }

/* cabecera */
.nav { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px); background: rgba(7, 6, 13, .72); border-bottom: 1px solid rgba(58, 52, 99, .5); }
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 66px; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.marca svg { width: 30px; height: 36px; }
.marca b { font: 400 25px/1 var(--display); letter-spacing: 1.5px; }
.marca b i { font-style: normal; color: var(--cyan); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500; }
.nav-links a:hover, .nav-links a.on { color: var(--ink); background: rgba(108, 92, 255, .14); }
.nav-user { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--cyan); object-fit: cover; background: var(--card2); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.menu-btn { display: none; background: none; border: 1px solid var(--line2); border-radius: 10px; width: 40px; height: 40px; cursor: pointer; }
@media (max-width: 860px) {
  .nav-links { position: fixed; top: 66px; left: 0; right: 0; flex-direction: column; background: rgba(7, 6, 13, .97); padding: 10px 16px 18px; border-bottom: 1px solid var(--line); display: none; }
  .nav-links.abierto { display: flex; }
  .nav-links a { padding: 12px; font-size: 16px; }
  .menu-btn { display: grid; place-items: center; margin-left: auto; }
  .nav-user .btn-txt { display: none; }
}

/* botones */
.btn { --c: var(--cyan); display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 0; cursor: pointer; text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: .2px; padding: 13px 22px; border-radius: 13px; transition: transform .15s, box-shadow .2s, background .2s; white-space: nowrap; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-pri { color: #07060d; background: linear-gradient(100deg, var(--cyan), #7af8ff 45%, var(--cyan)); box-shadow: 0 6px 30px rgba(0, 240, 255, .35), inset 0 -3px 0 rgba(0, 0, 0, .15); }
.btn-pri:hover { box-shadow: 0 8px 40px rgba(0, 240, 255, .55); transform: translateY(-1px); }
.btn-mag { color: #fff; background: linear-gradient(100deg, var(--mag), #ff6be6); box-shadow: 0 6px 30px rgba(255, 43, 214, .35); }
.btn-mag:hover { box-shadow: 0 8px 40px rgba(255, 43, 214, .55); transform: translateY(-1px); }
.btn-sec { background: rgba(108, 92, 255, .12); border: 1px solid var(--line2); color: var(--ink); }
.btn-sec:hover { border-color: var(--indigo2); background: rgba(108, 92, 255, .22); }
.btn-gh { background: none; color: var(--muted); padding: 9px 12px; }
.btn-gh:hover { color: var(--ink); }
.btn-sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-blk { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* tipografía */
.display { font-family: var(--display); font-weight: 400; letter-spacing: .5px; line-height: .95; margin: 0; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; letter-spacing: 2.2px; text-transform: uppercase; color: var(--cyan); }
.kicker::before { content: ""; width: 22px; height: 2px; background: currentColor; box-shadow: var(--glow-c); }
.grad { background: linear-gradient(90deg, var(--cyan), var(--indigo2) 45%, var(--mag)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--muted); }
h2.sec { font: 400 clamp(40px, 6vw, 68px)/.95 var(--display); margin: 12px 0 14px; letter-spacing: .5px; }
.sec-sub { color: var(--muted); max-width: 620px; font-size: 17px; margin: 0 0 34px; }
section { padding: 84px 0; position: relative; }

/* glitch del título */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after { content: attr(data-t); position: absolute; inset: 0; pointer-events: none; }
.glitch::before { color: var(--cyan); transform: translate(-3px, -2px); mix-blend-mode: screen; opacity: .7; animation: gl1 4s infinite steps(1); }
.glitch::after { color: var(--mag); transform: translate(3px, 2px); mix-blend-mode: screen; opacity: .7; animation: gl2 4s infinite steps(1); }
@keyframes gl1 { 0%, 92%, 100% { clip-path: inset(0 0 0 0); } 93% { clip-path: inset(20% 0 60% 0); transform: translate(-6px, 0); } 95% { clip-path: inset(70% 0 5% 0); transform: translate(5px, 0); } }
@keyframes gl2 { 0%, 90%, 100% { clip-path: inset(0 0 0 0); } 91% { clip-path: inset(50% 0 30% 0); transform: translate(6px, 0); } 96% { clip-path: inset(10% 0 80% 0); transform: translate(-5px, 0); } }
@media (prefers-reduced-motion: reduce) { .glitch::before, .glitch::after { animation: none; } * { scroll-behavior: auto !important; } }

/* tarjetas */
.card { background: linear-gradient(180deg, rgba(24, 21, 48, .85), rgba(18, 16, 31, .85)); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: rgba(108, 92, 255, .15); border: 1px solid var(--line2); color: var(--ink); white-space: nowrap; }
.chip.c { border-color: rgba(0, 240, 255, .45); color: var(--cyan); background: rgba(0, 240, 255, .08); }
.chip.m { border-color: rgba(255, 43, 214, .45); color: #ff8bea; background: rgba(255, 43, 214, .08); }
.chip.ok { border-color: rgba(46, 230, 166, .45); color: var(--ok); background: rgba(46, 230, 166, .08); }
.chip.w { border-color: rgba(255, 176, 32, .45); color: var(--warn); background: rgba(255, 176, 32, .08); }

/* tarjeta de curso (póster vertical) */
.cursos { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 22px; }
.curso { --a: var(--cyan); position: relative; display: flex; flex-direction: column; text-decoration: none; border-radius: 22px; overflow: hidden; background: var(--card); border: 1px solid var(--line); transition: transform .25s, border-color .25s, box-shadow .25s; }
.curso:hover { transform: translateY(-6px); border-color: var(--a); box-shadow: 0 20px 60px -20px var(--a); }
.curso .poster { aspect-ratio: 4 / 4.4; position: relative; overflow: hidden; background: #000; }
.curso .poster img, .curso .poster svg { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .5s; }
.curso:hover .poster img, .curso:hover .poster svg { transform: scale(1.05); }
.curso .poster::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, var(--card) 99%); }
.curso .estado { position: absolute; top: 12px; left: 12px; z-index: 2; }
.curso .body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.curso h3 { font: 400 29px/1 var(--display); margin: 0; letter-spacing: .4px; }
.curso p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.curso .pie { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px dashed var(--line2); font-size: 13px; color: var(--muted); }
.curso .precio { white-space: nowrap; } .curso .precio b { font: 400 26px/1 var(--display); color: var(--ink); letter-spacing: .5px; }

/* modal */
.modal-fondo { position: fixed; inset: 0; z-index: 100; background: rgba(4, 3, 9, .78); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: aparece .2s; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--bg2); border: 1px solid var(--line2); border-radius: 22px; padding: 26px; position: relative; box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 240, 255, .08); }
.modal h3 { font: 400 34px/1 var(--display); margin: 0 0 6px; letter-spacing: .4px; }
.modal .x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line2); background: none; cursor: pointer; font-size: 18px; }
@keyframes aparece { from { opacity: 0; } }

/* formularios */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--muted); }
.inp { width: 100%; background: rgba(7, 6, 13, .7); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
.inp:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 240, 255, .15); }
textarea.inp { resize: vertical; min-height: 96px; line-height: 1.5; }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); z-index: 200; background: var(--card2); border: 1px solid var(--line2); padding: 12px 18px; border-radius: 14px; font-weight: 600; transition: transform .3s; max-width: calc(100% - 32px); box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
#toast.on { transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--bad); }

/* markdown de la IA */
.md { font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.md h2, .md h3, .md h4 { font-family: var(--body); font-weight: 800; margin: 18px 0 8px; line-height: 1.25; }
.md h2 { font-size: 19px; color: var(--cyan); } .md h3 { font-size: 17px; } .md h4 { font-size: 15.5px; }
.md p { margin: 8px 0; } .md ul, .md ol { padding-left: 22px; margin: 8px 0; } .md li { margin: 4px 0; }
.md strong { color: #fff; }
.md code { background: rgba(108, 92, 255, .18); padding: 1px 6px; border-radius: 6px; font-size: .92em; }
.md pre { position: relative; background: #050409; border: 1px solid var(--line2); border-radius: 12px; padding: 14px; overflow: auto; font: 13px/1.55 ui-monospace, Consolas, monospace; }
.md pre code { background: none; padding: 0; }
.md pre .copiar { position: absolute; top: 8px; right: 8px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 10px 0; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line2); padding: 7px 9px; text-align: left; vertical-align: top; }
.md table { overflow-wrap: normal; } .md th { white-space: nowrap; } .md th { background: rgba(108, 92, 255, .14); }
.md hr { border: 0; border-top: 1px dashed var(--line2); margin: 16px 0; }

/* pie */
footer { border-top: 1px solid var(--line); padding: 40px 0 50px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: center; }

/* utilidades */
.fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.oculto { display: none !important; }
.cargando { display: inline-block; width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .25); border-top-color: currentColor; border-radius: 50%; animation: gira .7s linear infinite; vertical-align: -3px; }
@keyframes gira { to { transform: rotate(360deg); } }
.revelar { opacity: 0; transform: translateY(26px); transition: opacity .7s, transform .7s; }
.revelar.visto { opacity: 1; transform: none; }

/* Forja IA */
.forja-modos { display: flex; flex-wrap: wrap; gap: 8px; } @media (max-width: 860px) { .forja-modos { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; } }
.forja-modo { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 10px 15px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(18, 16, 31, .8); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted); transition: all .2s; }
.forja-modo span { font-size: 17px; }
.forja-modo:hover { color: var(--ink); border-color: var(--indigo2); }
.forja-modo.on { color: var(--ink); border-color: var(--mag); background: linear-gradient(180deg, rgba(255, 43, 214, .18), rgba(68, 56, 200, .18)); box-shadow: var(--glow-m); }
.forja-panel { margin-top: 12px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px; }
.forja-entrada { display: flex; flex-direction: column; gap: 12px; }
.forja-entrada textarea { min-height: 170px; flex: 1; font-size: 15.5px; }
.forja-salida { min-height: 300px; max-height: 560px; overflow: auto; background: rgba(5, 4, 9, .75); border: 1px solid var(--line2); border-radius: 16px; padding: 18px 20px; position: relative; }
.forja-vacio { color: var(--muted); text-align: center; padding: 70px 10px; }
.forja-vacio b { color: var(--ink); }
.forja-pensando { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 10px; color: var(--muted); }
.forja-pensando .yunque { width: 54px; animation: martillo .6s ease-in-out infinite alternate; filter: drop-shadow(0 0 18px rgba(255, 43, 214, .6)); }
@keyframes martillo { from { transform: translateY(-6px) rotate(-4deg); } to { transform: translateY(4px) rotate(3deg); filter: drop-shadow(0 0 30px rgba(0, 240, 255, .8)); } }
.cursor { color: var(--cyan); animation: parpadeo .8s steps(1) infinite; }
@keyframes parpadeo { 50% { opacity: 0; } }
details.hist { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; background: rgba(18, 16, 31, .6); }
details.hist summary { cursor: pointer; display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); }
@media (max-width: 860px) { .forja-panel { grid-template-columns: 1fr; } .forja-entrada textarea { min-height: 110px; } .forja-salida { min-height: 200px; } }
