/* =========================================================================
 * Page magazine (single) + liseuse PDF (feuilletage en ligne).
 * Chargé sur is_singular('magazine'). Utilise les tokens globaux (app.css).
 * ========================================================================= */

.magazine-single { padding: 56px 24px 80px; }
.magazine-single__inner { max-width: 1200px; margin: 0 auto; }

/* --- En-tête : couverture + informations ------------------------------- */
.magazine-single__head {
  display: flex;
  gap: 48px;
  align-items: center;
  margin-bottom: 48px;
}
.magazine-single__cover {
  flex: 0 0 auto;
  width: 300px;
  max-width: 40vw;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(8, 13, 22, 0.18);
}
.magazine-single__cover img { display: block; width: 100%; height: auto; }

.magazine-single__meta { flex: 1 1 auto; min-width: 0; }
.magazine-single__kicker {
  font-family: var(--font-serif-light, serif);
  color: var(--color-gold, #a38755);
  font-size: 20px;
  margin: 0 0 8px;
}
.magazine-single__title {
  font-family: var(--font-serif, serif);
  color: var(--color-text, #080d16);
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.08;
  margin: 0 0 16px;
}
.magazine-single__infos {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-condensed, sans-serif);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-warm-gray, #928577);
  font-size: 18px;
  margin: 0 0 22px;
}
.magazine-single__dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--color-gold, #a38755);
}
.magazine-single__hint {
  font-family: var(--font-body, sans-serif);
  color: var(--color-text, #080d16);
  font-size: 15px;
  margin: 0 0 18px;
}
.magazine-single__download { min-width: 200px; }

.magazine-single__soon {
  background: var(--color-beige, #f6f1ec);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
}
.magazine-single__soon p {
  font-family: var(--font-serif-light, serif);
  font-size: 22px;
  color: var(--color-text, #080d16);
  margin: 0;
}

/* --- Liseuse ------------------------------------------------------------ */
.th-reader {
  position: relative;
  background: #111722;
  border-radius: 12px;
  padding: 18px 18px 28px;
  overflow: hidden;
}
.th-reader:focus { outline: none; }

.th-reader__toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.th-reader__counter {
  font-family: var(--font-condensed, sans-serif);
  letter-spacing: 0.04em;
  color: #fff;
  font-size: 17px;
  min-width: 78px;
  text-align: center;
}
.th-reader__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition-default, .3s ease), color var(--transition-default, .3s ease);
}
.th-reader__btn:hover { background: var(--color-gold, #a38755); color: #fff; }
.th-reader__btn--fs { margin-left: 8px; }

.th-reader__stage {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.th-reader__book {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  touch-action: pan-y;
}
.th-reader__book .stf__parent { margin: 0 auto; }

/* Chargement */
.th-reader__progress {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.th-reader__progress-track {
  width: min(280px, 70%);
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.th-reader__progress-bar {
  width: 0;
  height: 100%;
  background: var(--color-gold, #a38755);
  transition: width .2s ease;
}
.th-reader__progress-label {
  font-family: var(--font-condensed, sans-serif);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}
.th-reader.is-error .th-reader__progress-label { color: #ffb4a8; }

/* Plein écran */
.th-reader.is-fullscreen,
.th-reader:fullscreen {
  border-radius: 0;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.th-reader:fullscreen .th-reader__stage { flex: 1 1 auto; min-height: 0; }

/* Responsive */
@media (max-width: 768px) {
  .magazine-single { padding: 32px 16px 56px; }
  .magazine-single__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  .magazine-single__cover { width: 220px; max-width: 60vw; }
  .th-reader__stage { min-height: 68vh; }
}


/* --- Pages de la liseuse : rendu progressif à la demande --------------- */
.th-reader__book .th-reader__page {
  background: #fff;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.th-reader__page canvas { display: block; width: 100%; height: 100%; }
.th-reader__page:not(.is-loaded)::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 3px solid rgba(8, 13, 22, 0.12);
  border-top-color: var(--color-gold, #a38755);
  animation: thr-spin .8s linear infinite;
}
@keyframes thr-spin { to { transform: rotate(360deg); } }

/* Barre d'ouverture indéterminée (on ne connaît plus le total à l'avance) */
.th-reader__progress-track { position: relative; }
.th-reader__progress-bar.is-indeterminate {
  width: 40%;
  animation: thr-indet 1.1s ease-in-out infinite;
}
@keyframes thr-indet {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
