/* ==========================================================================
   diseno-tendencia.css · /tendencia/{slug} con el diseño nuevo
   (templates/diseno/tendencia.php). Se apoya en sistema.css y diseno-lugar.css.
   Color con significado fijo: cálido / frío (rampa de temperatura), más lluvia /
   más seco. Lo neutro, en tinta.
   ========================================================================== */
.d2-tend { --tn-calido: #d4432a; --tn-frio: #2769b7; --tn-humedo: #318be6; --tn-seco: #a8743a; --tn-neutro: var(--ink-2); }
:root[data-theme="dark"] .d2-tend { --tn-calido: #ff8a6b; --tn-frio: #7fb5ff; --tn-humedo: #6fb6ff; --tn-seco: #d9a668; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .d2-tend { --tn-calido: #ff8a6b; --tn-frio: #7fb5ff; --tn-humedo: #6fb6ff; --tn-seco: #d9a668; } }
.d2-tend .tn-calido { --c: var(--tn-calido); } .d2-tend .tn-frio { --c: var(--tn-frio); }
.d2-tend .tn-humedo { --c: var(--tn-humedo); } .d2-tend .tn-seco { --c: var(--tn-seco); } .d2-tend .tn-neutro { --c: var(--tn-neutro); }

/* Cifras de arriba: el valor lleva el color de la anomalía */
.tn-cifras { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
@media (min-width: 1040px) { .tn-cifras { grid-template-columns: repeat(auto-fit, minmax(0, 280px)); } }
.tn-cifras .l-cifra { border-top: 3px solid var(--c, var(--line)); }
.tn-v { color: var(--c, var(--ink)); }

/* Tira de 6 semanas */
.tn-sems { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); overflow: hidden; }
.tn-sem { display: grid; gap: 4px; align-content: start; padding: 12px; border-top: 1px solid var(--line); min-width: 0; }
.tn-sem:nth-child(-n+2) { border-top: 0; }
.tn-sem:nth-child(2n) { border-left: 1px solid var(--line); }
@media (min-width: 700px) {
  .tn-sems { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tn-sem:nth-child(-n+3) { border-top: 0; }
  .tn-sem { border-left: 1px solid var(--line); } .tn-sem:nth-child(3n+1) { border-left: 0; }
}
@media (min-width: 1040px) {
  .tn-sems { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tn-sem { border-top: 0 !important; border-left: 1px solid var(--line); } .tn-sem:first-child { border-left: 0; }
}
.tn-sem__n { font-size: var(--t-1); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-sem__n b { color: var(--ink); font-weight: 700; margin-right: 2px; }
.tn-sem__a { font-family: var(--f-titular); font-variation-settings: "wdth" 84; font-weight: 700; font-size: var(--t-5); line-height: 1.05; color: var(--c, var(--ink)); font-variant-numeric: tabular-nums; }
.tn-sem__a small { font-size: .6em; }
.tn-sem__l { font-size: var(--t-1); color: var(--ink-2); line-height: 1.3; min-height: 2.6em; }
.tn-sem__ll { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-1); color: var(--ink-2); font-variant-numeric: tabular-nums; flex-wrap: wrap; }
.tn-sem__ll .ico { color: var(--tn-humedo); }
.tn-sem__ll small { color: var(--muted); }
.tn-sem__p { justify-self: start; margin-top: 2px; font-size: var(--t-1); font-weight: 500; color: var(--muted); padding: 2px 8px; border-radius: var(--r-pill, 999px); background: var(--sunk); }
.tn-sem__p--calida { color: #fff; background: var(--tn-calido); } .tn-sem__p--fria { color: #fff; background: var(--tn-frio); }
:root[data-theme="dark"] .tn-sem__p--calida, :root[data-theme="dark"] .tn-sem__p--fria { color: #10161e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tn-sem__p--calida, :root:not([data-theme="light"]) .tn-sem__p--fria { color: #10161e; } }

/* Barra divergente centrada en 0 */
.tn-div { position: relative; display: block; height: 8px; border-radius: 2px; background: var(--sunk); overflow: hidden; }
.tn-div::after { content: ""; position: absolute; left: 50%; top: -1px; bottom: -1px; width: 1px; background: var(--ink-2); }
.tn-div i { position: absolute; top: 0; bottom: 0; background: var(--c, var(--line-2)); }

/* Aviso «tendencia, no previsión» */
.tn-aviso { display: flex; gap: 8px; align-items: flex-start; max-width: 80ch; color: var(--ink-2); }
.tn-aviso .ico { margin-top: 2px; color: var(--muted); }
.tn-aviso b { color: var(--ink); }

/* Clave de los gráficos */
.tn-clave { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.tn-clave > span { display: inline-flex; align-items: center; gap: 6px; }
.tn-m { display: inline-block; width: 18px; height: 10px; border-radius: 2px; flex: none; }
.tn-m--t { height: 0; border-top: 2.5px solid var(--ink); border-radius: 0; }
.tn-m--n { height: 0; border-top: 1.5px dashed var(--muted); border-radius: 0; }
.tn-m--c { background: var(--tn-calido); opacity: .35; } .tn-m--f { background: var(--tn-frio); opacity: .35; }
.tn-m--ll, .tn-m--bh { background: var(--tn-humedo); } .tn-m--lln { border: 1.5px dashed var(--muted); }
.tn-m--bc { background: var(--tn-calido); } .tn-m--bf { background: var(--tn-frio); } .tn-m--bs { background: var(--tn-seco); }

/* Series de los gráficos (App\Grafico) */
.d2-tend .tn-banda-calido { --c: var(--tn-calido); opacity: .3; }
.d2-tend .tn-banda-frio { --c: var(--tn-frio); opacity: .3; }
.d2-tend .tn-l-normal { --c: var(--muted); stroke-dasharray: 5 4; }
.d2-tend .tn-semfondo { fill: var(--ink); opacity: .045; }
.d2-tend .g-barra-wf.tn-b-normal { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 2; }
.d2-tend .g-barra-wf.tn-b-calido { fill: var(--tn-calido); } .d2-tend .g-barra-wf.tn-b-frio { fill: var(--tn-frio); }
.d2-tend .g-barra-wf.tn-b-humedo { fill: var(--tn-humedo); } .d2-tend .g-barra-wf.tn-b-seco { fill: var(--tn-seco); }
.graf--tnll, .graf--tnm + .graf--tnm { margin-top: var(--e-2); }

/* Plegado de las dos normales */
.tn-pleg summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; list-style: none; }
.tn-pleg summary::-webkit-details-marker { display: none; }
.tn-pleg p { margin-top: var(--e-2); color: var(--ink-2); max-width: 80ch; }

/* Probabilidades por semana */
.tn-probs { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
.tn-pr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 14px; border-top: 1px solid var(--line); align-items: center; }
.tn-pr__s { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
.tn-pr__s small { color: var(--muted); font-size: var(--t-1); }
.tn-pr__l { grid-column: 1 / -1; }
.tn-pr--cab { display: none; }
.tn-pc { display: grid; gap: 4px; min-width: 0; }
.tn-pc__t { font-size: var(--t-1); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tn-pc__v { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); font-size: var(--t-1); }
.tn-pc--senal .tn-pc__v { color: var(--c); font-size: var(--t-2); }
.tn-pc__b { position: relative; display: block; height: 6px; border-radius: 2px; background: var(--sunk); }
.tn-pc__b i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--c); opacity: .45; }
.tn-pc--senal .tn-pc__b i { opacity: 1; }
.tn-pc__b s { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink-2); }
@media (min-width: 900px) {
  .tn-pr { grid-template-columns: 150px repeat(3, minmax(0, 150px)) minmax(0, 1fr); }
  .tn-pr__s, .tn-pr__l { grid-column: auto; }
  .tn-pr__s { flex-direction: column; gap: 0; }
  .tn-pr--cab { display: grid; border-top: 0; font-size: var(--t-1); color: var(--muted); font-weight: 600; padding-block: 10px; }
  .tn-pr--cab + .tn-pr { border-top: 1px solid var(--line); }
  .tn-pc__t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.tn-probs > .tn-pr:first-child + .tn-pr { border-top: 0; }
@media (min-width: 900px) { .tn-probs > .tn-pr:first-child + .tn-pr { border-top: 1px solid var(--line); } }

/* Meses: lectura de cada uno */
.tn-meses { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: var(--e-2); }
.tn-mes { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--c, var(--line)); border-radius: var(--r-2); background: var(--surface); }
.tn-mes__n small { color: var(--muted); font-size: var(--t-1); }
.tn-mes__a { font-weight: 700; color: var(--c, var(--ink)); font-variant-numeric: tabular-nums; }
.tn-mes__a small { font-weight: 500; font-size: var(--t-1); margin-left: 2px; }
.tn-mes .nota { grid-column: 1 / -1; color: var(--ink-2); }
