/* Colorines — cuaderno (#cuaderno). Todo bajo .screen--cuaderno. */

.screen--cuaderno {
  background:
    radial-gradient(120% 80% at 50% 0%, #fffaf0 0%, rgba(255, 250, 240, 0) 60%),
    radial-gradient(90% 70% at 100% 100%, #ffe0ec 0%, rgba(255, 224, 236, 0) 70%),
    var(--bg);
}
.screen--cuaderno .nb-bar { position: relative; z-index: 2; }
.screen--cuaderno .nb-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 1.55rem;
  font-weight: 700;
  white-space: nowrap;
}
.screen--cuaderno .nb-title .icon { width: 46px; height: 46px; flex: 0 0 auto; }
@media (max-width: 420px) {
  .screen--cuaderno .nb-home { display: none; }
  .screen--cuaderno .nb-title { font-size: 1.3rem; }
}

/* ---------- El cuaderno: lo más grande que entre, con proporción de A4 apaisado ---------- */
.screen--cuaderno .nb-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  /* a la izquierda, lugar para los anillos que asoman */
  padding: 6px clamp(12px, 3vw, 36px) 12px calc(clamp(12px, 3vw, 36px) + 2.5%);
  container-type: size;
}
.screen--cuaderno .nb-wrap {
  position: relative;
  width: min(100cqw, calc(100cqh * 297 / 210));
  aspect-ratio: 297 / 210;
  cursor: pointer;
}
/* Hojas de abajo: le dan grosor de cuaderno */
.screen--cuaderno .nb-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 2% / 2.83%;
  background: #f6f3fa;
  box-shadow: 3px 4px 0 #ebe6f3, 6px 8px 0 #ddd6ea, 0 14px 30px rgba(43, 34, 64, 0.22);
}
.screen--cuaderno .nb-book { position: absolute; inset: 0; }
/* Cada hoja tiene frente (el dibujo) y dorso (papel liso). Gira sobre el anillado hasta quedar del lado de
   la izquierda, y recién ahí se esconde (visibility con demora); al volver, aparece enseguida. */
.screen--cuaderno .nb-leaf {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.4, 0.15, 0.45, 1), visibility 0s linear 0s;
}
.screen--cuaderno .nb-leaf.turned {
  transform: rotateY(-180deg);
  visibility: hidden;
  pointer-events: none;
  transition: transform 1s cubic-bezier(0.4, 0.15, 0.45, 1), visibility 0s linear 1s;
}
.screen--cuaderno .nb-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 2% / 2.83%;
  box-shadow: inset 0 0 0 1px rgba(43, 34, 64, 0.12);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.screen--cuaderno .nb-front { background: #fff; }
.screen--cuaderno .nb-back { transform: rotateY(180deg); background: linear-gradient(90deg, #f7f4fb, #ebe6f3); }
.screen--cuaderno .nb-front canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Al girar, la hoja se oscurece un poco hacia el borde (como el papel que se levanta) */
.screen--cuaderno .nb-front::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(43, 34, 64, 0) 35%, rgba(43, 34, 64, 0.3));
  opacity: 0;
  transition: opacity 1s;
  pointer-events: none;
}
.screen--cuaderno .nb-leaf.turned .nb-front::after { opacity: 1; }

/* Anillado: asoma por el borde izquierdo, por encima de las hojas */
.screen--cuaderno .nb-rings {
  position: absolute;
  top: 4.5%;
  bottom: 4.5%;
  left: -3.4%;
  width: 6.8%;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}
.screen--cuaderno .nb-rings span {
  display: block;
  height: 3.4%;
  min-height: 6px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #d4cee0 60%, #a9a1bf);
  box-shadow: 0 2px 0 rgba(43, 34, 64, 0.18);
}

/* ---------- Abajo: fechas, pasar de hoja y PDF ---------- */
.screen--cuaderno .nb-foot {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 2px var(--gap) calc(var(--gap) + 2px);
}
.screen--cuaderno .nb-dates { justify-self: start; }
.screen--cuaderno .nb-pdf { justify-self: end; }
.screen--cuaderno .nb-nav { display: flex; align-items: center; gap: 12px; }
.screen--cuaderno .nb-count { min-width: 5.2em; text-align: center; font-size: 1.2rem; font-weight: 700; }
.screen--cuaderno .nb-foot .btn-pill { height: 52px; padding: 0 18px 0 8px; }
.screen--cuaderno .nb-foot .btn-pill .icon { width: 36px; height: 36px; }
.screen--cuaderno .nb-foot .btn-text { font-size: 1.05rem; }
.screen--cuaderno .nb-dates:not(.active) .icon { opacity: 0.4; filter: grayscale(1); }
.screen--cuaderno .nb-dates.active { box-shadow: 0 0 0 3px var(--ink), var(--shadow); transform: none; }
.screen--cuaderno .nb-busy { pointer-events: none; animation: nb-busy 0.9s ease-in-out infinite; }
@keyframes nb-busy { 50% { transform: scale(0.95); opacity: 0.75; } }
@media (max-width: 640px) {
  .screen--cuaderno .nb-foot { grid-template-columns: 1fr 1fr; grid-template-areas: "nav nav" "dates pdf"; row-gap: 8px; }
  .screen--cuaderno .nb-nav { grid-area: nav; justify-self: center; }
  .screen--cuaderno .nb-dates { grid-area: dates; }
  .screen--cuaderno .nb-pdf { grid-area: pdf; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .screen--cuaderno .nb-foot .btn-pill, .screen--cuaderno .nb-nav .btn { height: 46px; }
  .screen--cuaderno .nb-nav .btn { width: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen--cuaderno .nb-leaf, .screen--cuaderno .nb-leaf.turned, .screen--cuaderno .nb-front::after { transition-duration: 0.01s; transition-delay: 0s; }
  .screen--cuaderno .nb-busy { animation: none; }
}
