/* ============================================================
   EL TATA GLOTÓN — Mejoras 2026: modo noche, motion, utilidades
   Hoja compartida (se carga tras la hoja principal)
   ============================================================ */

/* ---------- MODO NOCHE ---------- */
html[data-tema="noche"]{
  --paper:#241b10;--paper-2:#2c2113;--paper-3:#372915;
  --ink:#f0e4c9;--ink-soft:#d4c4a2;--ink-faint:#ab966f;
  --green:#4b8a67;--green-deep:#2f6247;
  --maroon:#cf6a63;--maroon-deep:#a34e47;
  --brass:#c9a24b;--brass-soft:#dabd77;
  --ember:#d07a3c;--ochre:#c39a2e;
  --rule:#5a4628;--rule-soft:#4b3a22;
  --shadow:rgba(0,0,0,.48);
  color-scheme:dark;
}
html[data-tema="noche"] body{
  background:
    radial-gradient(circle at 18% 0%, rgba(201,162,75,.08), transparent 55%),
    radial-gradient(circle at 90% 6%, rgba(75,138,103,.09), transparent 50%),
    var(--paper);
}
html[data-tema="noche"] body::before{opacity:.28}
html[data-tema="noche"] .card,
html[data-tema="noche"] .ing-panel,
html[data-tema="noche"] .cat-btn,
html[data-tema="noche"] .ceja-btn{
  background:linear-gradient(180deg,rgba(255,233,190,.06),rgba(255,233,190,.015));
}
html[data-tema="noche"] .card .thumb{border-bottom-color:var(--rule)}
html[data-tema="noche"] .card:hover{background:linear-gradient(180deg,rgba(255,233,190,.10),rgba(255,233,190,.03))}
html[data-tema="noche"] .callout{background:linear-gradient(180deg,rgba(75,138,103,.10),rgba(255,233,190,.04))}
html[data-tema="noche"] .tab{background:var(--paper-2)}
html[data-tema="noche"] .tab:hover{background:var(--paper-3);color:var(--ink)}
html[data-tema="noche"] .tpanel{background:linear-gradient(180deg,rgba(255,233,190,.06),transparent)}
html[data-tema="noche"] .tp-emblem{background:var(--paper-3)}
html[data-tema="noche"] .step .n{background:var(--paper-2)}
html[data-tema="noche"] .chip{background:var(--paper-2)}
html[data-tema="noche"] .quick-nav{background:linear-gradient(180deg,#2c2113,#241b10)}
html[data-tema="noche"] .quick-nav .qn-group{background:rgba(255,233,190,.06)}
html[data-tema="noche"] .search-panel{background:linear-gradient(180deg,rgba(255,233,190,.06),rgba(255,233,190,.02))}
html[data-tema="noche"] .search-box input{background:#2c2113;color:var(--ink);border-color:var(--rule)}
html[data-tema="noche"] .search-box input::placeholder{color:var(--ink-faint)}
html[data-tema="noche"] .result-card,html[data-tema="noche"] .node-card,html[data-tema="noche"] .alpha-item{background:rgba(255,233,190,.05)}
html[data-tema="noche"] .result-card:hover,html[data-tema="noche"] .node-card:hover,html[data-tema="noche"] .alpha-item:hover{background:#372915;border-color:var(--brass)}
html[data-tema="noche"] .result-card small.deep-match{color:var(--ink-soft);background:rgba(201,162,75,.12)}
html[data-tema="noche"] .alpha-toolbar a{background:var(--paper-2);color:var(--brass-soft)}
html[data-tema="noche"] .branch-panel{background:linear-gradient(180deg,var(--paper-2),rgba(255,233,190,.03))}
html[data-tema="noche"] .no-results{background:rgba(207,106,99,.10);color:var(--maroon)}
html[data-tema="noche"] .qr-side{background:var(--paper-2)}
html[data-tema="noche"] .tree-toolbar{background:linear-gradient(180deg,rgba(60,45,22,.92),rgba(44,33,19,.9))}
html[data-tema="noche"] .tree-canvas-wrap{background:radial-gradient(circle at 12% 8%, rgba(201,162,75,.06), transparent 55%),linear-gradient(180deg,#2c2113,#241b10)}
html[data-tema="noche"] .tree-node .tn-label{stroke:#2c2113;fill:var(--ink)}
html[data-tema="noche"] .tree-node .tn-count{stroke:#2c2113}
html[data-tema="noche"] .tree-btn{background:var(--paper-2);color:var(--ink)}
html[data-tema="noche"] .tree-btn:hover{background:var(--brass);color:#241b10}
html[data-tema="noche"] .visual-map{background:rgba(44,33,19,.55);border-color:rgba(201,162,75,.30)}
html[data-tema="noche"] .zone{background:linear-gradient(180deg,#3a2c17,#2c2113);color:var(--ink)}
html[data-tema="noche"] .zone small{color:var(--ink-soft)}
html[data-tema="noche"] .zone .count{background:rgba(255,233,190,.10);border-color:var(--rule);color:var(--ink-soft)}
html[data-tema="noche"] .micro{background:rgba(60,45,22,.9);color:var(--ink-soft)}
html[data-tema="noche"] .map-title h1{color:var(--brass-soft);text-shadow:0 2px 0 rgba(0,0,0,.4)}
html[data-tema="noche"] .map-title p{color:var(--ink-soft)}
html[data-tema="noche"] .map-hero{background:linear-gradient(180deg,rgba(47,98,71,.14),rgba(36,27,16,.9)),var(--paper)}
html[data-tema="noche"] .story-fig figcaption{background:var(--paper-2)}
html[data-tema="noche"] .festin-row img,
html[data-tema="noche"] .tata-emblem,
html[data-tema="noche"] .hero-logo,
html[data-tema="noche"] .bmark img,
html[data-tema="noche"] .tp-emblem img{filter:brightness(.96)}
html[data-tema="noche"] .cover img,html[data-tema="noche"] .ph-portrait,html[data-tema="noche"] .recipe-head .hero{filter:brightness(.92) saturate(.96)}
html[data-tema="noche"] .festin-ribbon .fr-in{color:#f6ead0}
html[data-tema="noche"] .btn-green{color:#f6ead0}
html[data-tema="noche"] .panel-title,html[data-tema="noche"] .proc-title{color:#f6ead0}
html[data-tema="noche"] .recipe-banner .ribbon,html[data-tema="noche"] .recipe-head .ribbon{color:#f6ead0}
html[data-tema="noche"] .tab[aria-selected="true"]{color:#f6ead0}
html[data-tema="noche"] .site-nav{background:linear-gradient(180deg,#173325,#1d4b35)}
html[data-tema="noche"] .progress{background:linear-gradient(90deg,var(--green),var(--brass),var(--maroon))}

/* ---------- INTERRUPTOR DE TEMA ---------- */
.tema-toggle{
  display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:50%;
  border:none;background:transparent;color:#e9dcb8;cursor:pointer;transition:background .18s,color .18s;flex:0 0 auto;
}
.tema-toggle:hover{background:var(--brass);color:#123626}
.tema-toggle svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.tema-toggle .ic-sol{display:none}
html[data-tema="noche"] .tema-toggle .ic-sol{display:block}
html[data-tema="noche"] .tema-toggle .ic-luna{display:none}

/* ---------- APARICIÓN AL HACER SCROLL ---------- */
.reveal{opacity:0;transform:translateY(14px);transition:opacity .55s ease,transform .55s ease}
.reveal.in{opacity:1;transform:none}
@media (prefers-reduced-motion:reduce){.reveal{opacity:1;transform:none;transition:none}}

/* ---------- VOLVER ARRIBA ---------- */
.volver-arriba{
  position:fixed;right:18px;bottom:18px;z-index:70;width:46px;height:46px;border-radius:50%;
  border:2px solid var(--brass);background:linear-gradient(180deg,var(--green),var(--green-deep));
  color:#f6ead0;cursor:pointer;box-shadow:0 8px 18px var(--shadow);
  display:flex;align-items:center;justify-content:center;
  opacity:0;pointer-events:none;transform:translateY(10px);transition:opacity .25s,transform .25s,filter .18s;
}
.volver-arriba.visible{opacity:1;pointer-events:auto;transform:none}
.volver-arriba:hover{filter:brightness(1.12)}
.volver-arriba svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:560px){.volver-arriba{right:12px;bottom:12px;width:40px;height:40px}}

/* ---------- SKIP LINK ---------- */
.skip-link{
  position:fixed;top:-60px;left:14px;z-index:200;background:var(--maroon);color:#f6ead0;
  font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.4px;font-weight:700;font-size:14px;
  padding:9px 18px;border-radius:0 0 8px 8px;text-decoration:none;transition:top .2s;
}
.skip-link:focus{top:0;color:#f6ead0}

/* ---------- TIEMPO DE LECTURA ---------- */
.rt-badge{
  display:inline-flex;align-items:center;gap:5px;margin-top:8px;
  font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1px;font-weight:600;font-size:12px;
  color:var(--ochre);
}
.rt-badge::before{content:"";width:13px;height:13px;border-radius:50%;border:2px solid var(--ochre);
  background:linear-gradient(to top,transparent 50%,transparent 50%);position:relative}
em.node-date.rt{font-style:normal;color:var(--ochre)}

/* ---------- COMPARTIR ---------- */
.compartir-row{display:flex;justify-content:center;gap:10px;flex-wrap:wrap;margin:6px 0 0}
.compartir-btn{
  display:inline-flex;align-items:center;gap:8px;cursor:pointer;text-decoration:none;
  border:1px solid rgba(246,234,208,.45);background:rgba(12,20,14,.35);color:#ecdfc4;border-radius:999px;
  font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.3px;font-weight:600;font-size:13px;
  padding:8px 16px;transition:background .18s,color .18s,transform .15s;
}
.compartir-btn:hover{background:var(--brass);color:#123626;transform:translateY(-2px)}
.compartir-btn svg{width:15px;height:15px;fill:currentColor}
.toast-copia{
  position:fixed;left:50%;bottom:26px;transform:translateX(-50%) translateY(20px);z-index:210;
  background:var(--green-deep);color:#f6ead0;border:1px solid var(--brass);border-radius:999px;padding:10px 22px;
  font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.4px;font-size:13.5px;font-weight:600;
  opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;box-shadow:0 10px 24px var(--shadow);
}
.toast-copia.on{opacity:1;transform:translateX(-50%) translateY(0)}

/* ---------- LO MÁS RECIENTE (portada) ---------- */
.reciente{margin:34px 0 6px}
.reciente .rec-head{display:flex;align-items:center;gap:12px;margin-bottom:6px}
.reciente .rec-head h2{font-family:'Playfair Display',serif;font-weight:900;color:var(--green-deep);font-size:clamp(24px,4.4vw,34px);margin:0}
.reciente .rec-head .rec-line{flex:1;height:1px;background:var(--rule)}
.reciente .rec-head .rec-nota{font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.6px;font-size:12.5px;color:var(--ink-faint);white-space:nowrap}

/* Móvil: título en una línea y nota debajo, centrado y sin cortes */
@media (max-width:560px){
  .reciente .rec-head{flex-wrap:wrap;justify-content:center;text-align:center;gap:4px 14px}
  .reciente .rec-head .rec-line{display:none}
  .reciente .rec-head h2{flex:1 1 100%;font-size:26px}
  .reciente .rec-head .rec-nota{flex:1 1 100%;white-space:normal;letter-spacing:1.2px}
}
.rec-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:18px;margin-top:16px}
.rec-card{
  position:relative;display:flex;flex-direction:column;gap:8px;text-decoration:none;color:inherit;
  border:1px solid var(--rule);border-radius:10px;padding:18px 20px 20px;
  background:linear-gradient(180deg,rgba(255,255,255,.32),rgba(255,255,255,.06));
  box-shadow:0 3px 12px rgba(37,30,20,.07);transition:transform .2s,box-shadow .2s;border-top:4px solid var(--acc,var(--brass));
}
.rec-card:hover{transform:translateY(-4px);box-shadow:0 12px 26px rgba(37,30,20,.16)}
.rec-card .rc-img{display:block;width:calc(100% + 40px);height:150px;object-fit:cover;margin:-18px -20px 6px;border-radius:9px 9px 0 0;border-bottom:1px solid var(--rule)}
html[data-tema="noche"] .rec-card{background:linear-gradient(180deg,rgba(255,233,190,.06),rgba(255,233,190,.02))}
.rec-card.acc-metiche{--acc:var(--maroon)}.rec-card.acc-escriba{--acc:var(--ochre)}.rec-card.acc-gurme{--acc:var(--green)}
.rec-card .rc-tag{font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.6px;font-weight:700;font-size:12.5px;color:var(--acc,var(--maroon))}
.rec-card h3{font-family:'Playfair Display',serif;font-weight:800;font-size:21px;line-height:1.18;color:var(--green-deep);margin:0}
.rec-card p{margin:0;font-size:15px;color:var(--ink-soft);line-height:1.55}
.rec-card .rc-meta{margin-top:auto;padding-top:8px;display:flex;flex-wrap:wrap;gap:4px 14px;font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1px;font-size:12.5px;color:var(--ink-faint)}
.rec-card .rc-go{font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.5px;font-weight:700;font-size:13px;color:var(--acc,var(--maroon))}

/* Contraste de titulares en modo noche */
html[data-tema="noche"] .card h3,
html[data-tema="noche"] .rec-card h3,
html[data-tema="noche"] .tpanel h2,
html[data-tema="noche"] .reciente .rec-head h2,
html[data-tema="noche"] .recipe-topbar h2,
html[data-tema="noche"] .search-panel h2,
html[data-tema="noche"] .section-index h2,
html[data-tema="noche"] .alpha-index h2,
html[data-tema="noche"] .result-card b,
html[data-tema="noche"] .node-card b,
html[data-tema="noche"] .alpha-item b,
html[data-tema="noche"] .stat .num{color:#9fd3b2}
html[data-tema="noche"] .festin-ribbon .fr-in{background:linear-gradient(180deg,#2f6247,#1d4b35)}

/* ---------- IMPRESIÓN: siempre en modo día ---------- */
@media print{
  html[data-tema="noche"]{
    --paper:#f3ead4;--paper-2:#ece0c2;--paper-3:#e5d7b4;
    --ink:#251e14;--ink-soft:#4d4131;--ink-faint:#766853;
    --green:#1d4b35;--green-deep:#123626;
    --maroon:#6f1d1f;--maroon-deep:#531315;
    --brass:#a9842f;--brass-soft:#c4a55b;
    --ochre:#9a7416;--rule:#c8b386;--rule-soft:#d8c9a4;--shadow:rgba(37,30,20,.16);
  }
  html[data-tema="noche"] body{background:var(--paper)}
  html[data-tema="noche"] body::before{display:none}
  .volver-arriba,.tema-toggle,.toast-copia,.backlink{display:none!important}
}

/* Enlace de regreso al menú de la sección (páginas que no lo definen en línea) */
.backlink{display:inline-flex;align-items:center;gap:7px;font-family:'Barlow Condensed',sans-serif;text-transform:uppercase;letter-spacing:1.4px;font-weight:600;font-size:13.5px;color:var(--ink-faint);text-decoration:none;margin:22px 0 0}
.backlink:hover{color:var(--maroon)}
