/* ============================================================
   TIMER ISOMETRICS · usa el tema de Isometrics (books.css)
   La intensidad se lee en azul: de menos a más, como las tres
   columnas de la portada (1957 → 2013 → 2026).
   ============================================================ */
body.book-iso {
  --tm-30: #b4cddf; --tm-50: #4f87aa; --tm-70: #015077; --tm-100: #01324d;
  --tm-rest: #6f8f80; --tm-alert: #b81d31;
}

.tm-hero { padding: calc(var(--header-h) + clamp(28px, 5vw, 64px)) 0 clamp(20px, 3vw, 36px); }
.tm-hero .bk-h2 { margin-bottom: .5rem; }
.tm-hero p { max-width: 60ch; color: var(--bk-muted); margin: 0; }

.tm { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: clamp(24px, 4vw, 56px); align-items: start; padding-bottom: clamp(56px, 8vw, 110px); }
@media (max-width: 900px) { .tm { grid-template-columns: minmax(0, 1fr); } }
.tm-side { min-width: 0; }

/* ---------- Lista de protocolos ---------- */
.tm-side h2 { font: 700 .78rem var(--f-body); letter-spacing: .24em; text-transform: uppercase; color: var(--bk-accent); margin: 0 0 1rem; }
.tm-protos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tm-group { font-size: .78rem; font-weight: 700; letter-spacing: .08em; color: var(--bk-muted); padding: 10px 2px 2px; }
.tm-group:first-child { padding-top: 0; }
.tm-protos button {
  width: 100%; display: grid; grid-template-columns: 54px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  text-align: left; padding: 12px 14px; border: 1px solid var(--bk-line); border-radius: 14px; background: transparent; color: var(--bk-ink);
  cursor: pointer; transition: background .2s, border-color .2s;
}
.tm-protos button:hover { background: rgba(1, 80, 119, .06); }
.tm-protos button[aria-pressed="true"] { background: var(--tm-70); border-color: var(--tm-70); color: #fff; }
.tm-proto__spark { grid-row: 1 / 3; display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.tm-proto__spark i { flex-basis: 0; min-width: 3px; border-radius: 2px 2px 0 0; background: var(--tm-50); }
.tm-protos button[aria-pressed="true"] .tm-proto__spark i { background: #cfe0ec; }
.tm-proto__name { font: 700 1rem/1.2 var(--bk-display); }
.tm-proto__meta { font-size: .82rem; color: var(--bk-muted); font-variant-numeric: tabular-nums; }
.tm-protos button[aria-pressed="true"] .tm-proto__meta { color: #cfe0ec; }
@media (max-width: 900px) {
  .tm-protos { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scroll-padding-inline: 2px; }
  .tm-protos li { flex: 0 0 min(78%, 280px); scroll-snap-align: start; }
  .tm-protos .tm-group { display: none; }
}

/* ---------- Instrumento ---------- */
.tm-main { display: grid; gap: clamp(18px, 2.4vw, 28px); min-width: 0; }
.tm-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.tm-head h2 { font: 800 clamp(1.5rem, 2.6vw, 2.1rem)/1.1 var(--bk-display); margin: 0; }
.tm-head p { margin: 0; color: var(--bk-muted); font-size: .95rem; }

.tm-stage { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 48px); align-items: center; }
@media (max-width: 1100px) { .tm-stage { grid-template-columns: 1fr; justify-items: center; } }

.tm-dial {
  --p: 0; --lvl: 0; --c: var(--tm-50);
  position: relative; width: min(82vw, 400px); aspect-ratio: 1; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1turn), rgba(1, 80, 119, .13) 0);
  display: grid; place-items: center; transition: box-shadow .4s;
}
.tm-dial::before { /* nivel de tensión: sube con la intensidad */
  content: ""; position: absolute; inset: 16px; border-radius: 50%;
  background: linear-gradient(to top, color-mix(in srgb, var(--c) 26%, var(--bk-bg)) calc(var(--lvl) * 100%), var(--bk-bg) 0);
  transition: background .6s var(--ease);
}
.tm-dial[data-max="true"]::before { background: var(--tm-100); }
.tm-dial[data-max="true"] { box-shadow: 0 0 0 6px rgba(184, 29, 49, .0), 0 0 0 0 rgba(184, 29, 49, .35); animation: tm-pulse 1s infinite; }
@keyframes tm-pulse { 0% { box-shadow: 0 0 0 0 rgba(184, 29, 49, .45); } 100% { box-shadow: 0 0 0 22px rgba(184, 29, 49, 0); } }
.tm-read { position: relative; z-index: 1; text-align: center; color: var(--tm-70); }
.tm-dial[data-max="true"] .tm-read { color: #fff; }
.tm-sec { display: block; font: 800 clamp(5rem, 22vw, 8.5rem)/1 "Poppins", sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.tm-phase { display: block; margin-top: .3rem; font: 700 .86rem var(--f-body); letter-spacing: .2em; text-transform: uppercase; }
.tm-pct { display: block; margin-top: .35rem; font-family: var(--bk-serif); font-size: 1.12rem; font-style: italic; opacity: .85; }
@media (prefers-reduced-motion: reduce) { .tm-dial[data-max="true"] { animation: none; box-shadow: 0 0 0 6px rgba(184, 29, 49, .35); } }

/* Escalera de la repetición: ancho = segundos, alto = intensidad */
.tm-stack { display: grid; gap: 18px; width: 100%; min-width: 0; }
.tm-label { font: 700 .78rem var(--f-body); letter-spacing: .22em; text-transform: uppercase; color: var(--bk-muted); margin: 0; }
.tm-ladder { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; height: 150px; }
.tm-step { flex-basis: 0; min-width: 50px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.tm-step__bar { position: relative; height: var(--h); border-radius: 6px 6px 2px 2px; overflow: hidden; background: color-mix(in srgb, var(--c) 26%, transparent); }
.tm-step__bar i { position: absolute; inset: 0; background: var(--c); transform: scaleX(0); transform-origin: left; }
.tm-step[data-state="done"] .tm-step__bar i { transform: scaleX(1); }
.tm-step[data-state="now"] .tm-step__bar { outline: 2px solid var(--c); outline-offset: 2px; }
.tm-step__txt { display: flex; flex-direction: column; font-size: .8rem; line-height: 1.2; color: var(--bk-muted); font-variant-numeric: tabular-nums; }
.tm-step__txt b { color: var(--bk-ink); font-size: .9rem; }

.tm-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--bk-line); border: 1px solid var(--bk-line); border-radius: 14px; overflow: hidden; margin: 0; }
@media (max-width: 560px) { .tm-stats { grid-template-columns: repeat(2, 1fr); } }
.tm-stats div { background: var(--bk-bg); padding: 12px 14px; }
.tm-stats dt { font-size: .78rem; color: var(--bk-muted); letter-spacing: .04em; }
.tm-stats dd { margin: 2px 0 0; font: 700 1.35rem "Poppins", sans-serif; font-variant-numeric: tabular-nums; color: var(--bk-ink); }

.tm-adjust { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.tm-stepper { display: inline-flex; align-items: center; gap: 6px; }
.tm-stepper__label { font-size: .88rem; color: var(--bk-muted); margin-right: 4px; min-width: 6.2em; }
.tm-stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--bk-accent); background: transparent; color: var(--bk-accent); font: 700 1.2rem/1 "Poppins", sans-serif; cursor: pointer; }
.tm-stepper button:hover:not(:disabled) { background: var(--bk-accent); color: #fff; }
.tm-stepper button:disabled { opacity: .3; cursor: default; }
.tm-stepper output { min-width: 3.4ch; text-align: center; font: 700 1.1rem "Poppins", sans-serif; font-variant-numeric: tabular-nums; }
.tm-range { width: 100%; margin: 0; font-size: .82rem; color: var(--bk-muted); }

.tm-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.tm-controls .bk-btn { min-width: 170px; min-height: 60px; font-size: 1rem; }
.tm[data-running="true"] #tm-start { background: var(--bk-ink); border-color: var(--bk-ink); }
.tm-toggles { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-left: auto; }
.tm-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; min-height: 44px; }
.tm-toggle input { width: 20px; height: 20px; accent-color: var(--tm-70); }

.tm-cue { border-left: 3px solid var(--tm-50); padding: 4px 0 4px 18px; min-height: 5.2em; }
.tm-cue p { margin: 0; }
.tm-cue__title { font: 700 .78rem var(--f-body); letter-spacing: .2em; text-transform: uppercase; color: var(--tm-70); }
.tm-cue__text { font-family: var(--bk-serif); font-size: 1.2rem; line-height: 1.4; margin-top: .3rem !important; max-width: 60ch; }
.tm-note { font-size: .88rem; color: var(--bk-muted); max-width: 70ch; margin: 0; }

/* ---------- Guía debajo del timer ---------- */
.tm-guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(20px, 3vw, 40px); }
.tm-guide article h3 { margin-bottom: .5rem; }
.tm-guide article p { margin: 0 0 .8em; color: var(--bk-ink); }
.tm-guide blockquote { margin: .6rem 0 0; font-family: var(--bk-serif); font-style: italic; font-size: 1.1rem; color: var(--bk-muted); }

.tm-cta { display: grid; grid-template-columns: auto 1fr; gap: clamp(20px, 4vw, 48px); align-items: center; }
.tm-cta img { width: clamp(120px, 18vw, 200px); height: auto; box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .5); }
@media (max-width: 600px) { .tm-cta { grid-template-columns: 1fr; } }
.tm-controls .bk-btn--ghost { min-width: 0; }
/* Móvil: los controles se quedan a la mano, pegados abajo mientras el timer está en pantalla */
@media (max-width: 900px) {
  .tm-controls { position: sticky; bottom: 0; z-index: 5; background: var(--bk-bg); padding: 10px 0 calc(10px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -12px 20px -14px rgba(16, 35, 46, .35); }
  .tm-controls .bk-btn { min-width: 0; min-height: 52px; padding: 0 .7em; flex: 1; font-size: .86rem; letter-spacing: .03em; }
  .tm-controls #tm-start { flex: 1.6; }
  .tm-toggles { width: 100%; margin-left: 0; justify-content: center; }
  .tm-toggle { min-height: 36px; }
}
.tm-install { margin-top: 1.2rem; }
.tm-install__help { margin-top: 14px; max-width: 62ch; padding: 16px 18px; border: 1px solid var(--bk-line); border-radius: 14px; background: var(--bk-surface); font-size: .95rem; }
.tm-install__help ol { margin: 0 0 .8em; padding-left: 1.2em; display: grid; gap: .6em; }
.tm-install__help p { margin: 0; }
.tm-install__warn { margin-bottom: .8em !important; padding: 10px 12px; border-left: 3px solid var(--tm-alert); background: rgba(184, 29, 49, .07); }
.tm-share { width: 1.15em; height: 1.15em; vertical-align: -.2em; color: var(--tm-70); }
