/* ==========================================================================
   NOTEBOOK & CHOREOGRAPHY — styles
   
   A journal page that sits on the right side of the workshop.
   Entries write themselves onto the page during the build sequence.
   ========================================================================== */


/* ---- The notebook ---- */
.notebook {
  position: fixed;
  bottom: 4vh;
  right: -360px;  /* starts off-screen */
  width: min(320px, 38vw);
  max-height: 75vh;
  z-index: 30;
  display: flex;
  flex-direction: column;
  
  /* Solid opaque paper */
  background-color: #f0e6cc !important;
  background-image: url('assets/images/journal-paper.png') !important;
  background-size: cover !important;
  background-position: center !important;
  opacity: 1 !important;
  
  border-radius: 12px;
  box-shadow:
    -4px 4px 20px rgba(0, 0, 0, 0.5),
    0 2px 8px rgba(0, 0, 0, 0.3);
  
  /* Slide in from right */
  transition: right 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
  
  pointer-events: none;
}

.notebook-open {
  right: 2vw;
  pointer-events: auto;
}

.notebook-closed {
  right: -360px;
  pointer-events: none;
  transition: right 0.8s cubic-bezier(0.4, 0, 0.8, 1);
}


/* ---- Notebook header ---- */
.notebook-header {
  display: flex;
  justify-content: flex-end;
  padding: 0.5rem 0.8rem 0.2rem;
  flex-shrink: 0;
}

.notebook-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #9a8a6a;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  line-height: 1;
  border-radius: 2px;
  transition: color 0.2s ease;
  opacity: 0;
  transition: opacity 1s ease 2s;
}

/* Close button only appears after a few entries have been written */
.notebook-open .notebook-close {
  opacity: 0.6;
}

.notebook-close:hover {
  color: #5a4a2a;
  opacity: 1;
}


/* ---- Scrollable page area ---- */
.notebook-page {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 2.5rem 2rem 2.5rem;
  
  /* Smooth scrolling */
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.notebook-page::-webkit-scrollbar {
  width: 4px;
}

.notebook-page::-webkit-scrollbar-track {
  background: transparent;
}

.notebook-page::-webkit-scrollbar-thumb {
  background: rgba(160, 140, 110, 0.3);
  border-radius: 2px;
}


/* ---- Individual entries ---- */
.notebook-entry {
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.notebook-entry.written {
  opacity: 1;
  transform: translateY(0);
}


/* ---- Quote entries ---- */
.notebook-entry--quote {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.notebook-entry--quote .notebook-entry-text {
  font-family: 'Indie Flower', cursive;
  font-weight: 400;
  font-size: 1rem;
  color: #4a4540;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.notebook-entry-attribution {
  font-family: 'Indie Flower', cursive;
  font-weight: 400;
  font-size: 0.8rem;
  color: #7a7268;
  letter-spacing: 0.02em;
  padding-left: 0.5rem;
}


/* ---- Formula entries ---- */
.notebook-entry--formula {
  padding: 0.4rem 0;
}

.notebook-entry--formula .notebook-entry-text {
  font-family: 'Indie Flower', cursive;
  font-weight: 400;
  font-size: 1.15rem;
  color: #3a3530;
  letter-spacing: 0.03em;
}

.notebook-entry--formula .notebook-entry-attribution {
  display: block;
  margin-top: 0.15rem;
}


/* Spacing between entries — just breathing room, no ornament */


/* ---- Choreography: staged visibility ---- */

.page-content .hero-inner {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-content.visible .hero-inner {
  opacity: 1;
  transform: translateY(0);
}

.page-content .workshop-lede {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 2.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s,
              transform 2.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s;
}

.page-content.lede-visible .workshop-lede {
  opacity: 0.85;
  transform: translateY(0);
}


/* ---- Cabinet entrance ---- */

.file-cabinet {
  opacity: 0 !important;
  transform: translateY(20px) !important;
  transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.file-cabinet.cabinet-entering {
  opacity: 0.5 !important;
  transform: translateY(8px) !important;
}

.file-cabinet.cabinet-present,
body.threshold-complete .file-cabinet {
  opacity: 1 !important;
  transform: translateY(0) !important;
  pointer-events: auto !important;
}


/* ---- Responsive ---- */
@media (max-width: 768px) {
  .notebook {
    width: min(280px, 50vw);
    top: 10vh;
    max-height: 70vh;
  }

  .notebook-entry--quote .notebook-entry-text {
    font-size: 0.85rem;
  }

  .notebook-entry--formula .notebook-entry-text {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .notebook {
    width: 85vw;
    top: auto;
    bottom: 0;
    right: -90vw;
    max-height: 50vh;
    border-radius: 2px 2px 0 0;
  }

  .notebook-open {
    right: 0;
  }

  .notebook-closed {
    right: -90vw;
  }
}


/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .notebook {
    transition-duration: 0.1s !important;
  }

  .notebook-entry {
    transition-duration: 0.1s !important;
  }
}
