/* CABECERA, CAJÓN DEL MÓVIL Y PIE DE TODAS LAS PÁGINAS (11/11/2026).

   Copiado de la cabecera.css de QuixoteSpanish: cabecera fija de cristal con
   desplegables, cajón lateral por debajo de 1020 px, pie de cuatro columnas.
   Cambia la piel: la paleta Belle Époque de style.css (tinta de noche,
   marfil, burdeos, latón) y el filete tricolor de los programas de teatro
   encima de la cabecera.

   El HTML lo escribe tools/plantilla.mjs (topbar y foot) y lo monta
   assets/js/cabecera.js. Todo va colgado de .site-head, .drawer o .site-foot
   y precedido de «html body», porque convive con leccion.css y ejercicios.css,
   que tienen reglas sueltas para nav, ul o .wrap. Las variables de color son
   las de :root en style.css: el modo oscuro llega solo. */

.site-head,.drawer,.site-foot{
  --hd-ink:var(--ink,#16161D); --hd-ink2:var(--ink2,#3B3A40); --hd-muted:var(--muted,#6D6658);
  --hd-bg:var(--bg,#F5EFE3); --hd-surface:var(--surface,#FFFCF5); --hd-sunk:var(--sunk,#ECE4D3);
  --hd-line:var(--line,#DDD3BF); --hd-btn:var(--lc-btn,#7B1E2C); --hd-on-btn:var(--lc-on-btn,#FBF4E8);
  --hd-acc:var(--velours,#7B1E2C); --hd-oro:var(--oro,#B08A3E);
  --hd-frost:color-mix(in srgb,var(--hd-surface) 78%,transparent);
  --hd-hair:rgba(22,22,29,.08);
}
:root[data-theme="dark"] :is(.site-head,.drawer,.site-foot){--hd-acc:var(--oro);--hd-hair:rgba(255,255,255,.1)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) :is(.site-head,.drawer,.site-foot){--hd-acc:var(--oro);--hd-hair:rgba(255,255,255,.1)}}

html body :is(.site-head,.drawer,.site-foot),
html body :is(.site-head,.drawer,.site-foot) *{box-sizing:border-box}
html body :is(.site-head,.drawer,.site-foot){font-family:var(--lc-sans,"Public Sans",system-ui,sans-serif);font-size:16px;line-height:1.55;color:var(--hd-ink);letter-spacing:normal;text-transform:none;-webkit-font-smoothing:antialiased}
html body :is(.site-head,.drawer,.site-foot) a{color:inherit;border:0}
html body :is(.site-head,.drawer,.site-foot) :is(h4,p,ul,li){margin:0;padding:0;max-width:none}
html body :is(.site-head,.drawer,.site-foot) button{font:inherit;color:inherit;margin:0}
html body :is(.site-head,.drawer,.site-foot) :focus-visible{outline:2px solid var(--hd-oro);outline-offset:2px}
html body :is(.site-head,.site-foot) .wrap{max-width:1160px;margin:0 auto;padding:0 24px;width:auto;display:block}
@media (max-width:560px){html body :is(.site-head,.site-foot) .wrap{padding:0 16px}}
html body :is(.site-head,.drawer,.site-foot) .frost{background:var(--hd-frost);-webkit-backdrop-filter:blur(10px) saturate(1.4);backdrop-filter:blur(10px) saturate(1.4);box-shadow:0 1px 2px rgba(0,0,0,.07),0 4px 14px rgba(0,0,0,.08),inset 0 0 0 1px rgba(255,255,255,.5);border:0}
:root[data-theme="dark"] body :is(.site-head,.drawer,.site-foot) .frost{box-shadow:0 1px 2px rgba(0,0,0,.3),0 4px 14px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.08)}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) body :is(.site-head,.drawer,.site-foot) .frost{box-shadow:0 1px 2px rgba(0,0,0,.3),0 4px 14px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.08)}}

/* ===== cabecera, fija arriba, de cristal ===== */
html body .site-head{position:sticky;top:0;z-index:60;margin:0;padding:0;max-width:none;width:auto;display:block;
  background:color-mix(in srgb,var(--hd-bg) 78%,transparent);-webkit-backdrop-filter:saturate(180%) blur(20px);backdrop-filter:saturate(180%) blur(20px);
  border:0;border-bottom:1px solid var(--hd-hair)}
/* El filete de los programas de teatro: burdeos, latón, azul de París. */
html body .site-head::before{content:"";display:block;height:3px;background:linear-gradient(90deg,var(--velours,#7B1E2C) 0 33%,var(--oro,#B08A3E) 33% 66%,var(--paris,#1E2A3C) 66%)}
html body .site-head .wrap{display:flex;align-items:center;gap:24px;min-height:66px}
html body :is(.site-head,.drawer,.site-foot) .logo{display:inline-flex;align-items:center;gap:9px;font-family:var(--display,"Playfair Display",Georgia,serif);font-size:22px;font-weight:700;text-decoration:none;letter-spacing:-.01em;flex:none;color:var(--hd-ink)}
html body :is(.site-head,.drawer,.site-foot) .logo svg{width:28px;height:28px;color:var(--hd-ink)}
html body :is(.site-head,.drawer,.site-foot) .logo i{font-style:italic;color:var(--hd-acc)}
html body .site-head .mainnav{display:flex;align-items:center;gap:2px;list-style:none;margin:0;padding:0}
html body .site-head .mainnav>li{position:relative;list-style:none}
html body .site-head .navbtn{display:inline-flex;align-items:center;gap:6px;padding:9px 12px;border:0;background:none;border-radius:999px;font-size:15px;font-weight:500;color:var(--hd-ink2);text-decoration:none;cursor:pointer;white-space:nowrap;transition:background .15s,color .15s}
html body .site-head .navbtn:hover,html body .site-head .navbtn[aria-expanded="true"],html body .site-head .navbtn[aria-current="page"]{background:var(--hd-sunk);color:var(--hd-ink)}
html body .site-head .navbtn .chev{width:14px;height:14px;transition:transform .2s}
html body .site-head .navbtn[aria-expanded="true"] .chev{transform:rotate(180deg)}
html body .site-head .navbtn.books{color:var(--hd-ink);font-weight:600}
html body .site-head .navbtn .tag{font-size:11px;font-weight:700;padding:2px 7px;border-radius:999px;background:var(--hd-btn);color:var(--hd-on-btn)}
html body .site-head .util{margin-left:auto;display:flex;align-items:center;gap:10px}
html body :is(.site-head,.drawer) .lang{display:inline-flex;gap:2px;padding:3px;border-radius:999px}
html body :is(.site-head,.drawer) .lang button{border:0;background:none;min-width:40px;height:34px;padding:0 12px;border-radius:999px;font-size:13px;font-weight:600;color:var(--hd-muted);cursor:pointer}
html body :is(.site-head,.drawer) .lang button[aria-pressed="true"]{background:var(--paris,#1E2A3C);color:#F3ECDD;cursor:default}
html body :is(.site-head,.drawer) .iconbtn{width:40px;height:40px;padding:0;border-radius:50%;display:grid;place-items:center;cursor:pointer;color:var(--hd-ink);transition:background .2s,color .2s,transform .2s}
html body :is(.site-head,.drawer) .iconbtn:hover{background:var(--hd-btn);color:var(--hd-on-btn);transform:scale(1.06)}
html body :is(.site-head,.drawer) .iconbtn svg{width:18px;height:18px}
html body .site-head .menu{display:none}

/* los desplegables */
html body .site-head .drop{position:absolute;top:calc(100% + 10px);left:-8px;min-width:300px;background:var(--hd-surface);border-radius:16px;box-shadow:0 2px 6px rgba(0,0,0,.06),0 24px 60px rgba(0,0,0,.16);padding:10px;opacity:0;transform:translateY(-6px);pointer-events:none;transition:opacity .18s,transform .18s;z-index:61}
html body .site-head .drop.open{opacity:1;transform:none;pointer-events:auto}
html body .site-head .drop.wide{width:min(660px,90vw);display:grid;grid-template-columns:1fr 1.25fr;gap:6px}
html body .site-head .drop h4{font-size:11.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--hd-muted);padding:8px 12px 4px}
html body .site-head .dl{display:grid;gap:2px;padding:10px 12px;border-radius:12px;text-decoration:none;transition:background .15s}
html body .site-head a.dl:hover{background:var(--hd-sunk)}
html body .site-head .dl b{font-weight:600;font-size:14.5px;color:var(--hd-ink)}
html body .site-head .dl span{font-size:13px;color:var(--hd-muted)}
html body .site-head .dl .lv{font:500 12px var(--mono,"IBM Plex Mono",monospace);font-style:normal;color:var(--hd-acc);min-width:30px}
html body .site-head .dl.row{grid-template-columns:auto 1fr;align-items:baseline;column-gap:10px}
html body .site-head .dl.row span{grid-column:2}
html body .site-head .dl.soon{opacity:.55;cursor:default}
html body .site-head .drop .foot{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:4px;padding:12px;border-radius:12px;background:var(--hd-sunk);font-size:14px}
html body .site-head .drop .foot a{font-weight:600;text-decoration:none}

/* el cajón del móvil */
html body .drawer{display:none}
@media (max-width:1020px){
  html body .site-head .mainnav{display:none}
  html body .site-head .menu{display:grid}
  html body .drawer{display:block;position:fixed;inset:0;z-index:80;pointer-events:none}
  html body .drawer .scrim{position:absolute;inset:0;background:rgba(22,22,29,.4);opacity:0;transition:opacity .2s}
  html body .drawer .sheet{position:absolute;top:0;right:0;bottom:0;width:min(380px,88vw);background:var(--hd-surface);padding:calc(18px + env(safe-area-inset-top,0px)) 18px calc(24px + env(safe-area-inset-bottom,0px));overflow:auto;transform:translateX(100%);transition:transform .25s;display:grid;align-content:start;gap:6px}
  html body .drawer.open{pointer-events:auto}
  html body .drawer.open .scrim{opacity:1}
  html body .drawer.open .sheet{transform:none}
}
@media (max-width:560px){html body .site-head .util .lang{display:none}html body .site-head .wrap{gap:12px}html body .site-head .util{gap:8px}}
html body .drawer .sheet .top{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
html body .drawer .sheet .top .logo{font-size:19px}
html body .drawer .sheet .langrow{display:flex;justify-content:space-between;align-items:center;padding:14px 4px;border-bottom:1px solid var(--hd-line);font-weight:600}
html body .drawer .sheet details{border:0;border-bottom:1px solid var(--hd-line);margin:0;padding:0;background:none}
html body .drawer .sheet summary{list-style:none;cursor:pointer;padding:14px 4px;font-weight:600;font-size:16px;display:flex;justify-content:space-between}
html body .drawer .sheet summary::-webkit-details-marker{display:none}
html body .drawer .sheet summary::after{content:"+";color:var(--hd-muted);font-weight:400;font-size:20px;line-height:1}
html body .drawer .sheet details[open] summary::after{content:"\2013"}
html body .drawer .sheet .sl{display:block;padding:9px 4px 9px 12px;text-decoration:none;color:var(--hd-ink2);font-size:15px}
html body .drawer .sheet .sl.soon{opacity:.55}
html body .drawer .sheet .plain{display:block;padding:14px 4px;font-weight:600;font-size:16px;text-decoration:none;border-bottom:1px solid var(--hd-line)}
html body .drawer .sheet .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:46px;margin-top:14px;padding:0 20px;border-radius:999px;font-weight:600;font-size:15px;text-decoration:none;border:1.5px solid transparent}
html body .drawer .sheet .btn-primary{background:var(--hd-btn);color:var(--hd-on-btn)}
html body .drawer .sheet .btn-secondary{background:transparent;border-color:var(--hd-ink);color:var(--hd-ink)}

/* ===== pie ===== */
html body .site-foot{display:block;max-width:none;width:auto;margin:0;border:0;border-top:1px solid var(--hd-hair);padding:56px 0 28px;background:var(--hd-bg);text-align:left}
html body .site-foot .fgrid{display:grid;grid-template-columns:1.4fr repeat(4,1fr);gap:32px}
html body .site-foot .fgrid>*{min-width:0}
html body .site-foot .fbrand p{color:var(--hd-ink2);font-size:14.5px;margin:14px 0 18px;max-width:34ch}
html body .site-foot .socials{display:flex;gap:8px;flex-wrap:wrap}
html body .site-foot .socials a{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;color:var(--hd-ink);transition:background .2s,color .2s,transform .2s}
html body .site-foot .socials a:hover{background:var(--hd-btn);color:var(--hd-on-btn);transform:scale(1.06)}
html body .site-foot .socials svg{width:18px;height:18px}
html body .site-foot .fcol h4{font-size:12px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--hd-muted);margin-bottom:12px}
html body .site-foot .fcol ul{list-style:none;margin:0;padding:0;display:grid;gap:9px}
html body .site-foot .fcol li{list-style:none;margin:0}
html body .site-foot .fcol a{text-decoration:none;font-size:14.5px;color:var(--hd-ink2)}
html body .site-foot .fcol a:hover{color:var(--hd-ink);text-decoration:underline}
html body .site-foot .fbar{margin-top:44px;padding-top:22px;display:flex;flex-wrap:wrap;justify-content:space-between;gap:10px 24px;font-size:13px;color:var(--hd-muted)}
html body .site-foot .fbar>span:first-child{max-width:70ch}
html body .site-foot .fbar a{color:var(--hd-ink2)}
@media (max-width:980px){html body .site-foot .fgrid{grid-template-columns:1fr 1fr}html body .site-foot .fbrand{grid-column:1/-1}}
@media (max-width:480px){html body .site-foot .fgrid{grid-template-columns:1fr}}

/* volver arriba */
.totop{position:fixed;right:20px;bottom:calc(20px + env(safe-area-inset-bottom,0px));z-index:40;width:50px;height:50px;border-radius:50%;border:0;display:grid;place-items:center;cursor:pointer;color:var(--ink);background:color-mix(in srgb,var(--surface) 80%,transparent);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 1px 2px rgba(0,0,0,.07),0 4px 14px rgba(0,0,0,.1);opacity:0;transform:translateY(12px);pointer-events:none;transition:opacity .25s,transform .25s,background .2s,color .2s}
.totop.show{opacity:1;transform:none;pointer-events:auto}
.totop:hover{background:var(--lc-btn);color:var(--lc-on-btn)}
.totop svg{width:22px;height:22px}

/* Con la cabecera fija, un ancla no puede quedar tapada debajo de ella, y el
   índice lateral de la lección se pega por debajo de la cabecera. */
html{scroll-padding-top:88px}
html body #chapterRoot .lc-rail{top:92px}
@media (max-width:1000px){html body #chapterRoot .lc-rail{top:69px}html{scroll-padding-top:124px}}

/* entre 1021 y 1180 px se aprieta el aire entre enlaces para que quepa todo */
@media (min-width:1021px) and (max-width:1180px){
  html body .site-head .wrap{gap:14px}
  html body .site-head .navbtn{padding:9px 8px}
}
@media (prefers-reduced-motion:reduce){html body :is(.site-head,.drawer,.site-foot) *,.totop{transition:none!important}}
@media print{html body :is(.site-head,.drawer,.site-foot),.totop{display:none!important}}
