/* =========================================
   ASSETS/CSS/BLOG/BLOGSECTION.CSS
   Pixel Perfect Replica from React
   ========================================= */

/* --- 0. UTILITIES & RESET --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background-color: var(--blog-bg-dark); /* #1c1917 */
  font-family: var(--font-secondary);
  overflow-x: hidden;
  margin: 0;
}

/* Utilities di Visibilità */
.mobile-only {
  display: block;
}
.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
  .desktop-only {
    display: block;
  }
}

/* --- 1. BACKGROUND SCENE (Tavolo) --- */
.notebook-scene {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 3rem 0.5rem 5rem 0.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  z-index: 1;
}

/* Sfondo fisso (Tavolo di legno) */
.notebook-scene::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: #463a32;
  z-index: -3;
}
.notebook-scene::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--tex-wood);
  opacity: 0.3;
  z-index: -2;
  pointer-events: none;
}

/* Aggiungiamo un overlay al main per la vignettatura */
.notebook-scene .vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.5) 100%);
  z-index: -1;
  pointer-events: none;
}

/* =========================================
   2. NOTEBOOK WRAPPERS & ANIMATIONS
   ========================================= */

/* Mobile Container */
#notebook-mobile {
  width: 100%;
  /* max-width: 32rem; */
  margin-top: 2rem;
  position: relative;
  z-index: 10;
  /* Entrance Animation Mobile */
  animation: slideUpFade 0.8s ease-out forwards;
}

/* Desktop Container */
#notebook-desktop {
  width: 100%;
  max-width: 80rem; /* max-w-7xl */
  min-height: 85vh;
  margin: 2rem 0;
  perspective: 1000px; /* Abilita il 3D */
}

/* Entrance Animation Desktop (Simula Framer Motion) */
#notebook-desktop .leather-cover {
  animation: openBook3D 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: center bottom;
  opacity: 0;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes openBook3D {
  from {
    opacity: 0;
    transform: translateY(100px) rotateX(10deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
  }
}

/* =========================================
   3. LEATHER COVER (Copertina)
   ========================================= */
.leather-cover {
  background-color: var(--blog-cover); /* #1f1a17 */
  position: relative;
  /* Shadow gestita per mobile/desktop separatamente */
}

/* Mobile Cover Style */
#notebook-mobile .leather-cover {
  padding: 1rem 1.5rem 1rem 1rem;
  border-radius: 0.375rem 1rem 1rem 0.375rem; /* rounded-l-md rounded-r-2xl */
  box-shadow: var(--shadow-notebook-mobile);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

/* Desktop Cover Style */
#notebook-desktop .leather-cover {
  width: 100%;
  padding: 2rem;
  border-radius: 24px;
  box-shadow: var(--shadow-notebook-desktop);
  display: flex;
  align-items: stretch;
}

/* Texture Pelle (Comune) */
.leather-cover .texture-overlay.scales-opt {
  position: absolute;
  inset: 0;
  background-image: var(--tex-scales);
  opacity: 0.3;
  border-radius: inherit;
  pointer-events: none;
}

/* Cuciture (Stitching) */
.stitching-border {
  position: absolute;
  inset: 0.75rem; /* mobile */
  border: 1px dashed rgba(92, 64, 51, 0.5);
  border-radius: inherit;
  pointer-events: none;
}
@media (min-width: 768px) {
  .stitching-border {
    inset: 1rem;
    border-color: rgba(92, 64, 51, 0.4);
  }
}

/* =========================================
   4. PAPER STACK (Pagine sotto)
   ========================================= */
.paper-stack {
  display: none;
  position: absolute;
  z-index: 0;
  border: 1px solid #d4d4d4;
  background-color: #e5e5e5; /* Fallback */
}

@media (min-width: 768px) {
  .paper-stack {
    display: block;
  }
}

/* Mobile Stack (Bottom) */
.stack-bottom {
  top: 100%;
  left: 4px;
  right: 4px;
  height: 8px;
  background: repeating-linear-gradient(to bottom, #e5e5e5, #e5e5e5 1px, #fcfcfc 1px, #fcfcfc 2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Desktop Stacks (Sides) */
.stack-left {
  top: 8px;
  bottom: 8px;
  right: auto;
  left: -8px;
  width: 8px;
  background: repeating-linear-gradient(to right, #e5e5e5, #e5e5e5 1px, #fcfcfc 1px, #fcfcfc 2px);
  box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.3);
}
.stack-right {
  top: 8px;
  bottom: 8px;
  left: auto;
  right: -8px;
  width: 8px;
  background: repeating-linear-gradient(to right, #e5e5e5, #e5e5e5 1px, #fcfcfc 1px, #fcfcfc 2px);
  box-shadow: 4px 0 6px -1px rgba(0, 0, 0, 0.3);
}

/* =========================================
   5. PAGE SURFACE (Area scrivibile)
   ========================================= */
.page-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.left-wrapper,
.right-wrapper {
  width: 50%;
}

.page-surface {
  background-color: var(--blog-paper);
  position: relative;
  overflow: hidden; /* Mobile overflow hidden */
}

/* Mobile Page */
#notebook-mobile .page-surface {
  min-height: 85vh;
  border-radius: 0.125rem 0.5rem 0.5rem 0.125rem;
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  border-right: 1px solid #d1d5db;
  overflow: visible; /* Per i tabs che escono */
}

/* Desktop Pages */
#notebook-desktop .page-surface {
  flex-grow: 1;
  width: 100%;
  height: auto;
  min-height: 100%;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.surface-left {
  border-radius: 0.5rem 0 0 0.5rem;
  box-shadow: inset -10px 0 40px rgba(0, 0, 0, 0.1);
  border-right: 1px solid rgba(209, 213, 219, 0.3);
}
.surface-right {
  border-radius: 0 0.5rem 0.5rem 0;
  box-shadow: inset 10px 0 40px rgba(0, 0, 0, 0.1);
  border-left: 1px solid rgba(209, 213, 219, 0.3);
}

/* Texture Carta */
.page-surface .texture-overlay.cardboard-opt {
  position: absolute;
  inset: 0;
  background-image: var(--tex-cardboard);
  opacity: 0.4; /* Mobile default */
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}
@media (min-width: 768px) {
  .page-surface .texture-overlay.cardboard-opt {
    opacity: 0.3;
  }
}

/* Glow Radiale */
.radial-glow {
  position: absolute;
  inset: 0;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
  opacity: 0.8;
}
#notebook-mobile .radial-glow {
  background: radial-gradient(circle at center, #fff 0%, #f0ebe0 100%);
}
.glow-left {
  background: radial-gradient(circle at 30% 50%, #fff 0%, #ebe5d5 100%);
  opacity: 0.9;
}
.glow-right {
  background: radial-gradient(circle at 70% 50%, #fff 0%, #ebe5d5 100%);
  opacity: 0.9;
}

/* Doodles (Scarabocchi sfondo) */
.doodles-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.15;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.doodles-svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  color: #3e342b;
}
.flip-x {
  transform: scaleX(-1);
}

/* Spine Shadows (Desktop) */
.spine-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 4rem;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.shadow-left {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.15), transparent);
}
.shadow-right {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.15), transparent);
}

/* =========================================
   6. SPIRAL BINDING (Spirale)
   ========================================= */
.spiral-binding {
  display: none;
  position: absolute;
  z-index: 50;
  pointer-events: none;
  /* display: flex; */
  flex-direction: column;
  justify-content: space-between;
}

@media (min-width: 768px) {
  .spiral-binding {
    display: flex;
  }
}

/* Mobile: Left Binding */
.mode-left {
  left: 0;
  top: 0;
  bottom: 0;
  width: 3rem;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  padding: 2.5rem 0;
}

/* Desktop: Center Binding */
.mode-center {
  left: 50%;
  top: 0;
  height: 100%;
  width: 4rem;
  transform: translateX(-50%);
  padding: 2.5rem 0;
}

/* Generati da JS: .binding-row, .hole-dot, .wire-loop */
.binding-row {
  position: relative;
  width: 100%;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hole-dot {
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  background: #1a1614;
  border-radius: 50%;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.9);
}
.mode-left .hole-left {
  display: none;
} /* Solo un buco su mobile */
.mode-left .hole-right {
  right: 2px;
}

.mode-center .hole-left {
  left: 6px;
}
.mode-center .hole-right {
  right: 6px;
}

.wire-loop {
  position: absolute;
  height: 3px;
  background: linear-gradient(90deg, #2d2d2d 0%, #8c8c8c 40%, #e6e6e6 50%, #8c8c8c 60%, #2d2d2d 100%);
  border-radius: 99px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  z-index: 20;
}

/* --- MOBILE (Mode Left - Single Loop) --- */
.mode-left .loop-1 {
  width: 28px;
  right: -4px;
  transform: rotate(-15deg) translateY(-4px);
}
.mode-left .loop-2 {
  display: none; /* Su mobile ne teniamo uno solo per pulizia, come React */
}

/* --- DESKTOP (Mode Center - Twin Loop) --- */
/* Loop Superiore */
.mode-center .loop-1 {
  width: 40px;
  left: 50%;
  /* Spostato in alto di 4px */
  transform: translateX(-50%) rotate(-5deg) translateY(-4px);
}

/* Loop Inferiore */
.mode-center .loop-2 {
  width: 40px;
  left: 50%;
  /* Spostato in basso di 4px */
  transform: translateX(-50%) rotate(-5deg) translateY(4px);
}

/* =========================================
   7. MESSY TABS
   ========================================= */
.messy-tab {
  position: absolute;
  height: 32px;
  width: var(--tab-w, 45px);
  background-color: var(--tab-color, #c0392b);
  transform: rotate(var(--rot, 0deg));
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.2s;
}
.messy-tab:hover {
  transform: scale(1.1) rotate(var(--rot, 0deg));
}

.messy-tab::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--tex-cardboard);
  opacity: 0.2;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* Washi Tape effect on Tabs */
.messy-tab::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 32px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(0.5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  top: 0;
}

.tab-left {
  left: calc(-1 * var(--tab-w) + 8px);
  border-radius: 2px 0 0 2px;
}
.tab-left::after {
  right: -10px;
  transform: rotate(6deg);
}

.tab-right {
  right: calc(-1 * var(--tab-w) + 8px);
  border-radius: 0 2px 2px 0;
}
.tab-right::after {
  left: -10px;
  transform: rotate(-6deg);
}

.messy-tab span {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: #1a1614;
  text-transform: uppercase;
  transform: scaleY(1.1);
}

/* =========================================
   8. CONTENT, HEADER & TYPOGRAPHY
   ========================================= */
.content-padding {
  position: relative;
  z-index: 20;
  width: 100%;
}
#notebook-mobile .content-padding {
  padding: 0;
}
.desktop-padding {
  padding: 1rem;
  width: 100%;
  max-width: 600px;
}

/* Header */
.stamped-header {
  position: relative;
  margin-bottom: 4rem;
  border-bottom: 2px solid rgba(44, 36, 31, 0.1);
  padding-bottom: 1.5rem;
  mix-blend-mode: multiply;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.sub-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #5c4033;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 400;
  display: block;
  margin-bottom: 0.25rem;
  opacity: 0.7;
  text-align: center;
}

.main-title {
  font-family: var(--font-primary);
  font-size: 3rem;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: -0.15em;
  color: var(--blog-ink);
  margin: 0;
  opacity: 0.9;
  text-align: center;
}

@media (min-width: 768px) {
  .stamped-header {
    flex-direction: row;
    align-items: flex-start;
    gap: 0rem;
  }
  .sub-label {
    text-align: start;
  }
  .main-title {
    text-align: start;
    white-space: nowrap;
  }
}

.stamp-box {
  border: 4px solid rgba(127, 29, 29, 0.4);
  padding: 0.5rem;
  border-radius: 0.25rem;
  transform: rotate(-12deg);
  opacity: 0.7;
}
.stamp-box span {
  font-family: var(--font-secondary); /* Fallback for Stencil */
  font-size: 1.25rem;
  color: #7f1d1d;
}

/* =========================================
   9. POSTS & CARDS (CORRETTO)
   ========================================= */

.posts-column {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center; /* Centra le card nella colonna */
}

#mobile-posts-container {
  gap: 3rem;
}
.mt-desktop-space {
  margin-top: 3rem;
}
#desktop-right-posts {
  gap: 6rem;
}

#desktop-left-posts {
  gap: 4rem;
}

.note-date-stamp {
  position: absolute;
  top: 0.25rem;
  right: 1rem;
  background-color: #f0eee6;
  border: 2px solid rgba(153, 27, 27, 0.3);
  padding: 0 0.5rem;
  transform: rotate(-3deg);
  border-radius: 0.125rem;
  z-index: 10;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.note-date-stamp span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(153, 27, 27, 0.6);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.4;
}

/* --- CARD WRAPPER GENERALE --- */
.blog-card {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center;
  z-index: 10;
  margin: 0 auto;
  width: 100%;
  max-width: 30rem;
}
@media (min-width: 768px) {
  .blog-card {
    max-width: 24rem;
  }
}

.blog-card:hover {
  z-index: 50;
  transform: scale(1.05) rotate(0deg) !important;
  transition: transform 0.3s ease-out;
}

/* --- TAPE (SCOTCH) --- */
/* Lo stile dello scotch che mancava */
.tape {
  position: absolute;
  z-index: 30;
  background-color: rgba(253, 246, 227, 0.6); /* Colore carta gommata */
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(0.5px);
  opacity: 0.9;
  mix-blend-mode: multiply;
  /* Zig-zag cut effect con clip-path */
  clip-path: polygon(
    2% 0,
    98% 0,
    100% 5%,
    98% 10%,
    100% 15%,
    98% 20%,
    100% 25%,
    98% 30%,
    100% 35%,
    98% 40%,
    100% 45%,
    98% 50%,
    100% 55%,
    98% 60%,
    100% 65%,
    98% 70%,
    100% 75%,
    98% 80%,
    100% 85%,
    98% 90%,
    100% 95%,
    98% 100%,
    2% 100%,
    0% 95%,
    2% 90%,
    0% 85%,
    2% 80%,
    0% 75%,
    2% 70%,
    0% 65%,
    2% 60%,
    0% 55%,
    2% 50%,
    0% 45%,
    2% 40%,
    0% 35%,
    2% 30%,
    0% 25%,
    2% 20%,
    0% 15%,
    2% 10%,
    0% 5%
  );
}

/* --- STILE POLAROID --- */
.post-polaroid {
  background-color: #fff;
  padding: 0.75rem; /* p-3 */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* IL FIX FONDAMENTALE PER LE FOTO */
.polaroid-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #f3f4f6;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.75rem;
}

.polaroid-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(10%) contrast(105%);
  display: block;
}

.polaroid-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

/* Testi Polaroid */
.tk-title {
  font-family: var(--font-primary);
  font-size: 1rem;
  letter-spacing: -0.15em;
  color: #1f2937;
  line-height: 1;
  opacity: 0.9;
  mix-blend-mode: multiply;
  margin: 0;
  margin-top: 0;
}

/* --- STILE NOTE (FOGLIO A RIGHE) --- */
.post-note {
  background-color: #f0eee6;
  padding: 2.2rem 1.5rem 1.5rem 1.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* --- STILE POLAROID --- */
.post-polaroid {
  background-color: #fff;
  padding: 0.6rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  text-align: center;
}

/* --- TITOLI POLAROID --- */
.post-polaroid h3 {
  font-family: var(--font-primary);
  font-size: 2rem;
  line-height: 0.9;
  font-weight: 400; /* Era bold di default, ora è normale */
  color: #1f2937;
  margin: 0.5rem 0 0.2rem 0;
  mix-blend-mode: multiply;
  opacity: 0.9;
}

.post-polaroid span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: #9ca3af;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- TESTI POLAROID --- */
.post-polaroid p {
  font-family: var(--font-secondary);
  font-size: 0.75rem;
  font-weight: 400;
  color: #6b7280;
  margin-top: 0.5rem;
  line-height: 1.2;
  font-style: italic;
}

/* --- STILE NOTE (FOGLIO A RIGHE) --- */
.post-note {
  background-color: #f0eee6;
  padding: 1.8rem 1.25rem 1.25rem 1.25rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* --- TITOLI NOTE (Foglio a righe) --- */
.note-title {
  font-family: var(--font-primary);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.15em;
  color: #1f2937;
  line-height: 1;
  margin: 0.25rem 0 0.25rem 0;
  mix-blend-mode: multiply;
  opacity: 0.9;
}

/* --- CONTENUTO NOTE --- */
.note-content {
  font-family: var(--font-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  color: #374151;
  line-height: 1.6rem;
  white-space: pre-line;
  margin-top: 0;
  opacity: 0.9;
}

/* Highlight Effect */
.highlight-marker {
  position: absolute;
  inset: 0;
  background: rgba(253, 224, 71, 0.4);
  transform: skewX(-12deg) scale(1.05);
  filter: blur(8px);
  border-radius: 100%;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* =========================================
   10. FOOTER & TICKET CTA
   ========================================= */
/* --- NOTEBOOK FOOTER (Ticket Section) --- */

.notebook-footer-desktop, /* Mantengo per sicurezza se non hai aggiornato l'html desktop */
.notebook-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(92, 64, 51, 0.1);
  display: flex;
  flex-direction: column-reverse; /* Mantiene la riga come chiesto */
  align-items: center;
  width: 100%;
  gap: 3rem;
}

/* Pulsante Chiudi Diario */
.btn-close-diary {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* gap-3 */
  font-family: var(--font-primary); /* font-dongle */
  font-size: 1rem;
  letter-spacing: -0.15em;
  color: #5c4033;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
  line-height: 1;
  align-self: flex-start;
  margin-left: 1rem;
  margin-bottom: 1rem;
}

.btn-close-diary:hover {
  color: #7a9939;
}

.icon-arrow-left {
  width: 1.5rem; /* w-6 */
  height: 1.5rem; /* h-6 */
  transition: transform 0.3s ease;
}

.btn-close-diary:hover .icon-arrow-left {
  transform: translateX(-4px);
}

/* Gruppo Ticket (Contenitore destro) */
.ticket-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem; /* gap-6 */
  transform: rotate(-2deg);
  margin-bottom: -1rem; /* -mb-4 */
  margin-right: 1rem; /* mr-4 */
}

/* Il Biglietto (Boarding Pass) */
.boarding-pass {
  position: relative;
  width: 16rem; /* w-64 */
  height: 7rem; /* h-28 */
  background-color: #e3dacb;
  border-radius: 2px; /* rounded-sm */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  display: flex;
  overflow: hidden;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.boarding-pass-p {
  text-decoration: none;
  cursor: pointer;
}

/* Texture overlay biglietto */
.ticket-texture {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: url("https://www.transparenttextures.com/patterns/cardboard-flat.png");
  pointer-events: none;
  z-index: 0;
}

/* Stub Sinistro (Parte strappabile) */
.ticket-stub {
  position: relative;
  z-index: 1;
  width: 4rem; /* w-16 */
  height: 100%;
  border-right: 2px dashed rgba(156, 163, 175, 0.5); /* border-gray-400/50 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.05); /* bg-black/5 */
}

.stub-id {
  display: block;
  transform: rotate(-90deg);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgb(107, 114, 128); /* text-gray-500 */
  letter-spacing: 0.1em; /* tracking-widest */
  opacity: 0.7;
}

/* Corpo Ticket */
.ticket-body {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 1rem; /* p-4 */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Il buco nero decorativo */
.ticket-hole {
  position: absolute;
  top: 50%;
  right: 0.5rem; /* right-2 */
  width: 1rem; /* w-4 */
  height: 1rem; /* h-4 */
  background-color: #1c1917;
  border-radius: 50%;
  transform: translateY(-50%);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Header Ticket */
.ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ticket-label-sm {
  /* Font Stencil - Usiamo Black Ops One se disponibile, o fallback */
  font-family: var(--font-secondary);
  font-size: 0.75rem; /* text-xs */
  color: #7a9939;
  text-transform: uppercase;
  letter-spacing: 0.05em; /* tracking-wider */
  display: block;
  margin-bottom: 0.25rem;
}

.ticket-h3 {
  font-family: var(--font-primary);
  font-size: 17.7px; /* text-4xl */
  color: #3e342b;
  line-height: 1;
  margin: 0;
}

.ticket-icon-box {
  width: 2rem; /* w-8 */
  height: 2rem; /* h-8 */
  border-radius: 50%;
  border: 1px solid rgba(62, 52, 43, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.ticket-icon-svg {
  width: 1rem; /* w-4 */
  height: 1rem; /* h-4 */
  color: #3e342b;
}

/* Footer Ticket */
.ticket-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid rgba(62, 52, 43, 0.1);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.ticket-info-col {
  display: flex;
  flex-direction: column;
}

.right-align {
  align-items: flex-end;
}

.ticket-meta-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgb(156, 163, 175); /* text-gray-400 */
  display: block;
  text-transform: uppercase;
}

.ticket-meta-val {
  font-family: var(--font-secondary);
  font-size: 0.75rem; /* text-xs */
  color: #3e342b;
  font-weight: 700;
}

/* Timbro Valid Entry */
.ticket-stamp {
  position: absolute;
  top: 0.5rem; /* top-2 */
  right: 3rem; /* right-12 */
  width: 4rem; /* w-16 */
  height: 4rem; /* h-16 */
  border: 2px solid rgba(153, 27, 27, 0.4); /* border-red-800/40 */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-12deg);
  opacity: 0.6;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 2;
}

.ticket-stamp span {
  font-family: var(--font-secondary);
  font-size: 10px;
  color: rgb(127, 29, 29); /* text-red-900 */
  text-align: center;
  line-height: 1.2;
}

/* Caption sotto il biglietto */
.ticket-caption {
  font-family: var(--font-primary);
  font-size: 1rem;
  color: #5c4033;
  letter-spacing: -0.15em;
  opacity: 0.8;
  transition: color 0.3s ease;
}

/* Hover effects sul gruppo */
.ticket-group:hover .ticket-caption {
  color: #7a9939;
}

/* =========================================
   11. PENCIL DECORATION
   ========================================= */
.pencil-container {
  position: absolute;
  bottom: 3rem;
  right: -2rem;
  width: 18rem;
  transform: rotate(-5deg);
  filter: drop-shadow(5px 8px 8px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  z-index: 50;
}
.pencil-img {
  width: 100%;
  height: auto;
}

/* =========================================
   12. ANIMAZIONE CHIUSURA (PICKUP)
   ========================================= */
/* 1. AGGIUNGI LA PROSPETTIVA AL CONTENITORE PADRE */
/* Senza questo, il libro non sembra ruotare 3D ma solo schiacciarsi */
.notebook-scene {
  perspective: 1500px;
  /* Assicurati che il main abbia width/height definiti (es. h-screen o 100vh) */
  overflow: hidden;
}

/* 2. CLASSE DI ANIMAZIONE AGGIORNATA */
.book-exit-anim {
  /* Durata leggermente ridotta per essere più scattante (0.7s) */
  animation: liftAndTilt 0.7s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;

  /* Importante: Ruotiamo facendo perno sul basso, così la cima si avvicina a noi */
  transform-origin: center 80%;
  will-change: transform, opacity, filter;
}

/* 3. NUOVI KEYFRAMES "ALZATA E ROTAZIONE" */
@keyframes liftAndTilt {
  0% {
    transform: scale(1) rotateX(0deg) translateY(0);
    opacity: 1;
    filter: blur(0px);
  }
  100% {
    opacity: 0;
    /* scale(1.2)      -> Diventa più grande (si avvicina agli occhi)
       rotateX(-25deg) -> Valore NEGATIVO fa ruotare la cima verso fuori (verso di noi)
       translateY(100px)-> Scende un po' mentre ruota (simula il prenderlo in mano verso il basso/petto)
    */
    transform: scale(1.2) rotateX(-25deg) translateY(100px);
    filter: blur(4px); /* Sfocatura di movimento */
  }
}
