/* JJ Adventure · Escuela online
   Identidad: noche de monte (carbón), texto hueso, rojo JJ del logotipo,
   rosa de los vientos y curvas de nivel como motivo. Stencil solo en el titular principal. */
:root {
  --night: #121311;
  --bark: #1a1c19;
  --bark-2: #22251f;
  --ridge: #33372f;
  --bone: #ece7da;
  --ash: #a3a698;
  --jj: #d42027;
  --jj-hi: #ec3a40;
  --jj-deep: #a5161c;
  --moss: #93ad72;
  --radius: 10px;
  --font: "Barlow", system-ui, sans-serif;
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --stencil: "Saira Stencil One", "Barlow Condensed", sans-serif;
  --contours: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='700' height='300' viewBox='0 0 700 300'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.06' stroke-width='1.2'%3E%3Cpath d='M-20 240C90 160 180 270 300 200S520 110 720 210'/%3E%3Cpath d='M-20 270C100 200 190 300 310 235S530 150 720 245'/%3E%3Cpath d='M-20 205C80 120 170 235 290 165S510 70 720 175'/%3E%3Cpath d='M-20 170C70 85 160 200 280 130S500 30 720 140'/%3E%3Cpath d='M-20 135C60 50 150 165 270 95S490 -10 720 105'/%3E%3Cpath d='M440 290c40-60 130-60 170-12s15 60-60 45'/%3E%3Cpath d='M470 285c25-35 85-35 110-8s10 35-40 26'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body { margin: 0; font: 400 1.0625rem/1.6 var(--font); color: var(--bone); background: var(--night) var(--contours) top center / 1400px auto repeat-y; }
a { color: var(--bone); text-decoration-color: rgba(236, 231, 218, .35); text-underline-offset: 3px; }
a:hover { color: #fff; text-decoration-color: var(--jj); }
:focus-visible { outline: 3px solid var(--jj-hi); outline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
code { font-size: .88em; background: var(--bark-2); border: 1px solid var(--ridge); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--jj); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }
.muted { color: var(--ash); }

h1, h2, h3, h4 { font-family: var(--cond); font-weight: 700; line-height: 1.05; letter-spacing: .01em; margin: 0 0 .5rem; }
h1 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); }
.stencil { font-family: var(--stencil); font-weight: 400; letter-spacing: .01em; line-height: .98; }
.h3 { font-size: 1.45rem; }
.h4 { font-size: 1.15rem; margin-top: 1.2rem; }
.lead { font-size: 1.18rem; color: #d9d4c6; max-width: 52ch; }
.section-title { font-size: 1.9rem; margin: 3rem 0 1.1rem; display: flex; align-items: center; gap: .8rem; }
.section-title::before { content: ""; width: 26px; height: 26px; flex: none; background: var(--emblem, none) center / contain no-repeat; filter: invert(1); opacity: .85; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-row .section-title { margin-bottom: 1rem; }

/* ---------- Cabecera ---------- */
.top { background: rgba(10, 11, 10, .92); border-bottom: 1px solid var(--ridge); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px); }
.top__inner { max-width: 1240px; margin: 0 auto; padding: .7rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .9rem; text-decoration: none; }
.brand__logo { height: 46px; width: auto; mix-blend-mode: screen; }
.brand__text { font-family: var(--cond); font-size: 1.7rem; font-weight: 700; color: var(--bone); }
.brand__text b { color: var(--jj); }
.brand__tag { font-family: var(--cond); font-weight: 600; font-size: 1rem; color: var(--ash); border-left: 1px solid var(--ridge); padding-left: .9rem; }
.top__nav { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.top__nav a { text-decoration: none; font-weight: 500; color: #d7d2c4; padding: .3rem 0; border-bottom: 2px solid transparent; }
.top__nav a:hover, .top__nav a[aria-current] { color: #fff; border-bottom-color: var(--jj); }

.main { max-width: 1240px; margin: 0 auto; padding: 2.2rem 1.5rem 5rem; min-height: 65vh; }
.foot { border-top: 1px solid var(--ridge); background: #0d0e0c; }
.foot__inner { max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.5rem 2.4rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--ash); font-size: .93rem; }
.foot p { margin: 0; }

/* ---------- Botones y formularios ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 600 1rem/1 var(--font); padding: .9rem 1.3rem; border-radius: 8px; border: 1.5px solid var(--ridge); background: var(--bark-2); color: var(--bone); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--ash); color: #fff; }
.btn--red { background: var(--jj); border-color: var(--jj); color: #fff; }
.btn--red:hover { background: var(--jj-hi); border-color: var(--jj-hi); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.btn--small { padding: .45rem .7rem; font-size: .85rem; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--ash); text-decoration: underline; cursor: pointer; }
label { display: block; font-weight: 600; margin: 1rem 0 .35rem; font-size: .97rem; }
input, select, textarea { width: 100%; font: inherit; padding: .72rem .85rem; border: 1.5px solid var(--ridge); border-radius: 8px; background: #0f100e; color: var(--bone); }
input::placeholder, textarea::placeholder { color: #6f7368; }
input:focus, select:focus, textarea:focus { border-color: var(--jj); outline: none; box-shadow: 0 0 0 3px rgba(212, 32, 39, .25); }
input[type=checkbox] { width: auto; accent-color: var(--jj); }
input[type=file] { padding: .55rem; }
.check { display: flex; gap: .55rem; align-items: center; font-weight: 400; }
.field-error { color: #ff8a80; margin: .6rem 0 0; }
.hint { color: var(--ash); font-size: .94rem; }
.tiny { display: block; font-size: .82rem; margin-top: .25rem; }
.flash { padding: .95rem 1.15rem; border-radius: 8px; margin-bottom: 1.6rem; border: 1px solid #4b6136; background: #1c2416; word-break: break-word; }
.flash--error { border-color: #7a2a24; background: #2a1514; }
.panel { background: var(--bark); border: 1px solid var(--ridge); border-radius: var(--radius); padding: 1.4rem 1.5rem 1.6rem; }
.panel--narrow { max-width: 520px; }
.panel--form .btn { margin-top: 1.2rem; }
.panel--danger { border-color: #4d2321; }
.panel .btn { margin-top: 1rem; }
.stack { display: grid; gap: 1.2rem; align-content: start; }

/* ---------- Badges y progreso ---------- */
.badge { position: absolute; top: .7rem; left: .7rem; font: 600 .78rem/1 var(--font); padding: .38rem .55rem; border-radius: 5px; background: rgba(12, 13, 11, .85); color: var(--bone); border: 1px solid var(--ridge); }
.badge--done { background: var(--jj); border-color: var(--jj); color: #fff; }
.badge--inline { position: static; display: inline-block; }
.progress { margin: .9rem 0 1.1rem; }
.progress__bar { height: 6px; background: var(--ridge); border-radius: 3px; overflow: hidden; }
.progress__bar span { display: block; height: 100%; width: var(--pct); background: linear-gradient(90deg, var(--jj-deep), var(--jj-hi)); border-radius: 3px; }
.progress__label { margin: .45rem 0 0; font-size: .9rem; color: var(--ash); }

/* ---------- Acceso ---------- */
.gate { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3.5rem; align-items: center; padding: 2.5rem 0 1rem; position: relative; }
.gate::before { content: ""; position: absolute; right: -6%; top: -4%; width: 520px; height: 520px; background: var(--emblem, none) center / contain no-repeat; filter: invert(1); opacity: .05; pointer-events: none; }
.gate--single { grid-template-columns: minmax(0, 640px); }
.gate--single::before { display: none; }
.gate__copy h1 { font-size: clamp(2.8rem, 6.4vw, 5rem); max-width: 11ch; margin-bottom: 1.2rem; }
.gate__copy h1 + p, .gate__copy .lead { margin-bottom: 2rem; }
.gate__covers { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; max-width: 640px; }
.gate__covers li { aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; border: 1px solid var(--ridge); }
.gate__covers img { width: 100%; height: 100%; object-fit: cover; }
.gate__form { position: relative; z-index: 1; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .8); }
.gate__form .btn { margin-top: 1.3rem; }
.pw { margin-top: .9rem; }
.pw summary { cursor: pointer; color: var(--ash); font-size: .95rem; }
.pw[open] summary { color: var(--bone); }

/* ---------- Mis cursos ---------- */
.hello h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); }
.hello p { color: var(--ash); margin: 0; }
.resume { margin-top: 2rem; }
.resume__card { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bark); border: 1px solid var(--ridge); border-radius: 14px; overflow: hidden; text-decoration: none; color: inherit; }
.resume__card:hover { border-color: #4a4f44; }
.resume__media { aspect-ratio: 16 / 10; background: #000; }
.resume__media img { width: 100%; height: 100%; object-fit: cover; }
.resume__body { padding: 2rem 2.2rem; display: flex; flex-direction: column; justify-content: center; }
.resume__kicker { color: var(--jj-hi); font-weight: 600; margin: 0 0 .4rem; }
.resume__body h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.resume__body .btn { align-self: flex-start; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.4rem; }
.card { background: var(--bark); border: 1px solid var(--ridge); border-radius: 12px; overflow: hidden; }
.card > a { display: flex; flex-direction: column; height: 100%; text-decoration: none; color: inherit; }
.card:hover { border-color: #4a4f44; }
.card:hover .card__media img { transform: scale(1.03); }
.card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #000; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card__body { padding: 1.05rem 1.15rem 1.2rem; flex: 1; display: flex; flex-direction: column; }
.card__body h3 { font-size: 1.35rem; }
.card__body .progress { margin-bottom: 0; margin-top: auto; padding-top: .6rem; }
.card__body p { margin: 0 0 .4rem; font-size: .95rem; }
.card__cta { margin-top: auto !important; color: var(--ash); }
.card__cta span { color: var(--jj-hi); font-weight: 600; }
.card--shop .card__media img { filter: saturate(.85); }
.cover-fallback { display: flex; align-items: flex-end; width: 100%; height: 100%; padding: 1.1rem; font: 700 1.6rem/1 var(--cond); color: var(--bone);
  background: var(--emblem, none) right -20px top -20px / 55% no-repeat, radial-gradient(circle at 30% 20%, #2c3127, #121311); }
.empty { max-width: 680px; margin-top: 1.5rem; }
.more .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---------- Curso ---------- */
.course-hero { position: relative; margin: -2.2rem -1.5rem 0; padding: 2.6rem 1.5rem 2.8rem; border-bottom: 1px solid var(--ridge); overflow: hidden; }
.course-hero::before { content: ""; position: absolute; inset: 0; background: var(--cover, none) center / cover; filter: blur(28px) brightness(.35) saturate(.8); transform: scale(1.15); }
.course-hero__inner { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 2.5rem; align-items: center; max-width: 1240px; margin: 0 auto; }
.course-hero__media { border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 10; border: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 25px 50px -20px rgba(0, 0, 0, .9); }
.course-hero__media img { width: 100%; height: 100%; object-fit: cover; }
.course-hero__body .progress { max-width: 460px; }
.course-hero__body .btn { margin: .2rem .5rem .2rem 0; }
.crumb { margin: 0 0 .6rem; font-weight: 500; font-size: .95rem; color: var(--ash); }
.crumb a { color: var(--ash); }
.course-body { max-width: 860px; margin: 0 auto; }
.course-desc { margin-top: 2.4rem; }

/* Sendero de lecciones */
.trail { margin-top: 2.4rem; }
.trail__section { font-size: 1.35rem; margin: 2.2rem 0 .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--ridge); color: var(--bone); }
.trail__list { list-style: none; margin: 0; padding: 0; position: relative; }
.trail__list::before { content: ""; position: absolute; left: 16px; top: 20px; bottom: 20px; border-left: 2px dashed var(--ridge); }
.stop a { position: relative; display: flex; align-items: center; gap: 1rem; padding: .6rem .7rem .6rem 0; color: var(--bone); text-decoration: none; border-radius: 8px; }
.stop a:hover { background: var(--bark); }
.stop__n { position: relative; z-index: 1; flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--night); border: 2px solid var(--ridge); font: 600 .85rem/1 var(--font); color: var(--ash); }
.stop.is-done .stop__n { background: var(--jj); border-color: var(--jj); color: #fff; }
.stop.is-current .stop__n { border-color: var(--bone); color: var(--bone); }
.stop.is-current a { background: var(--bark); font-weight: 600; }
.stop.is-done.is-current .stop__n { background: var(--jj); color: #fff; }
.stop.is-empty .stop__t { color: #7d8174; }

/* ---------- Lección ---------- */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2.5rem; align-items: start; }
.lesson h1 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; margin: 1rem 0 1.6rem; border: 1px solid var(--ridge); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { max-width: 70ch; color: #dcd7ca; }
.prose h2, .prose h3 { font-size: 1.55rem; margin: 1.6em 0 .4em; color: var(--bone); }
.prose img { border-radius: 8px; margin: 1rem 0; }
.prose iframe { max-width: 100%; }
.prose a { color: var(--jj-hi); }
.lesson-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 2rem 0 1rem; padding-top: 1.5rem; border-top: 1px solid var(--ridge); }
.lesson-actions form { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.lesson-nav { display: flex; gap: .6rem; }
.done-badge { font-weight: 600; color: var(--bone); display: inline-flex; align-items: center; gap: .5rem; }
.done-badge::before { content: "✓"; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--jj); color: #fff; font-size: .8rem; }
.empty--lesson { margin: 1rem 0 1.6rem; background: var(--bark); border: 1px dashed var(--ridge); border-radius: 12px; padding: 2.2rem; text-align: center; color: var(--ash); }
.lesson-side { position: sticky; top: 5.5rem; max-height: calc(100vh - 7rem); overflow: auto; background: var(--bark); border-radius: 12px; padding: 1.1rem 1.1rem .6rem; border: 1px solid var(--ridge); }
.side-progress { margin: 0 0 .5rem; color: var(--ash); }
.side-progress strong { color: var(--bone); font-size: 1.1rem; }
.trail--side { margin-top: 0; }
.trail--side .trail__section { font-size: 1.05rem; margin-top: 1.1rem; }
.trail--side .stop a { font-size: .93rem; padding: .35rem .3rem .35rem 0; gap: .65rem; }
.trail--side .stop__n { width: 27px; height: 27px; font-size: .74rem; }
.trail--side .trail__list::before { left: 12.5px; }
.admin-hint { font-size: .9rem; }

/* ---------- Gestión ---------- */
.subnav { display: flex; gap: 1.4rem; flex-wrap: wrap; font-weight: 500; }
.page-head { margin-bottom: 1.6rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin: 0 0 1rem; }
.stats div { background: var(--bark); border: 1px solid var(--ridge); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stats dt { color: var(--ash); font-size: .93rem; }
.stats dd { margin: .2rem 0 0; font: 700 2.5rem/1 var(--cond); }
.stats dd.warn { color: var(--jj-hi); }
.grid--admin { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-top: 2.4rem; }
.two-col--wide-left { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.tbl { width: 100%; border-collapse: collapse; background: var(--bark); border: 1px solid var(--ridge); border-radius: var(--radius); font-size: .96rem; }
.tbl th { text-align: left; font-weight: 600; padding: .65rem .7rem; border-bottom: 1px solid var(--ridge); color: var(--ash); }
.tbl td { padding: .55rem .7rem; border-bottom: 1px solid var(--ridge); vertical-align: top; }
.tbl small { color: var(--ash); }
.tbl--compact td { font-size: .86rem; }
.tbl--lessons input, .tbl--lessons select { padding: .45rem .55rem; font-size: .92rem; }
.tbl--lessons tr.is-missing td:first-child { box-shadow: inset 3px 0 0 var(--jj); }
.num { width: 4.5rem !important; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: .8rem 0 0; }
.kv dt { font-weight: 600; } .kv dd { margin: 0; }
.search { display: flex; gap: .6rem; }
.inline-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: .9rem; }
.inline-form input { flex: 1; min-width: 200px; width: auto; }
.inline-form select { width: auto; max-width: 100%; }
.inline-form .btn { margin-top: 0; }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr .6fr; gap: 1rem; }
.form-cover { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; }
.cover-preview { border-radius: 8px; margin-bottom: .6rem; aspect-ratio: 16 / 10; object-fit: cover; width: 100%; border: 1px solid var(--ridge); }
.mod-row { display: flex; gap: .5rem; margin-bottom: .5rem; }
.editor-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.editor-head label { margin: 0; }
.editor-tools { display: flex; gap: .4rem; flex-wrap: wrap; }
.editor-tools .btn { margin: 0; }
textarea#c, textarea#d { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.5; }

@media (max-width: 960px) {
  .gate, .lesson-layout, .two-col, .two-col--wide-left, .course-hero__inner, .resume__card, .form-cover { grid-template-columns: 1fr; }
  .gate { gap: 2rem; padding-top: 1rem; }
  .gate::before { width: 320px; height: 320px; }
  .lesson-side { position: static; max-height: none; }
  .resume__body { padding: 1.4rem; }
  .row3 { grid-template-columns: 1fr; }
  .brand__tag { display: none; }
  .tbl--lessons thead { display: none; }
  .tbl--lessons td { display: block; border: 0; padding: .3rem .7rem; }
  .tbl--lessons tr { display: block; border-bottom: 1px solid var(--ridge); padding: .5rem 0; }
}
@media (max-width: 560px) {
  .main { padding: 1.4rem 1rem 4rem; }
  .course-hero { margin: -1.4rem -1rem 0; padding: 1.6rem 1rem 2rem; }
  .gate__covers { grid-template-columns: repeat(2, 1fr); }
  .brand__logo { height: 36px; }
  .top__nav { gap: 1rem; font-size: .95rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
