/* ==========================================================================
   DIGITAL PROJECTS — REALISTIC 3D INTERACTIVE BOOK PORTFOLIO
   Scoped exclusively to .projects-book-section
   ========================================================================== */

.projects-book-section {
  position: relative;
  overflow: hidden;
  padding: 4.5rem 0 5.5rem 0;
  z-index: 10;
}

/* Container Spacing */
.projects-book-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Section Header */
.projects-book-header {
  text-align: center;
  margin-bottom: 2.2rem;
  max-width: 720px;
}

/* ==========================================================================
   3D BOOK STAGE & HARDCOVER ARCHITECTURE (DESKTOP)
   Target: min(68vw, 1020px), Proportion: ~1.75 : 1
   ========================================================================== */

.book-stage-wrapper {
  position: relative;
  width: min(68vw, 1020px);
  max-width: 1020px;
  perspective: 2200px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Realistic Contact Floor Shadow */
.book-ambient-shadow {
  position: absolute;
  bottom: -22px;
  left: 5%;
  width: 90%;
  height: 40px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 75%);
  filter: blur(12px);
  pointer-events: none;
  z-index: 1;
}

/* Main Hardcover Framing */
.book-hardcover {
  position: relative;
  width: 100%;
  aspect-ratio: 1.75 / 1;
  min-height: 440px;
  max-height: 540px;
  background: linear-gradient(135deg, #050e20 0%, #020712 100%);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 
    0 20px 40px -8px rgba(0, 0, 0, 0.9),
    0 0 25px rgba(0, 210, 255, 0.05),
    inset 0 1px 1px rgba(255, 255, 255, 0.12),
    inset 0 -2px 4px rgba(0, 0, 0, 0.85);
  border: 1.5px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: stretch;
  z-index: 2;
  transform-style: preserve-3d;
  box-sizing: border-box;
}

/* Gold Edge Trim on Hardcover */
.book-hardcover::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 10px;
  border: 1px solid rgba(223, 183, 67, 0.3);
  pointer-events: none;
}

/* Stacked Multi-Layered Paper Edges (Left & Right Flanks) */
.book-edge-stack-left,
.book-edge-stack-right {
  position: absolute;
  top: 12px;
  bottom: 12px;
  width: 10px;
  background: repeating-linear-gradient(
    to bottom,
    #fcfaf6 0px,
    #ede5d5 1px,
    #d8cebc 2px,
    #fcfaf6 3px
  );
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
  z-index: 3;
  pointer-events: none;
}

.book-edge-stack-left {
  left: 6px;
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

.book-edge-stack-right {
  right: 6px;
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
}

/* Bottom Stacked Paper Edge */
.book-edge-stack-bottom {
  position: absolute;
  bottom: 4px;
  left: 20px;
  right: 20px;
  height: 6px;
  background: repeating-linear-gradient(
    to right,
    #fcfaf6 0px,
    #ede5d5 1px,
    #d8cebc 2px,
    #fcfaf6 3px
  );
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
  z-index: 3;
  pointer-events: none;
  border-radius: 2px;
}

/* ==========================================================================
   OPEN BOOK PAGES SPREAD (2-Page Stable Layout)
   ========================================================================== */

.book-spread-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #f7f3ea;
  border-radius: 7px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform-style: preserve-3d;
  z-index: 4;
}

/* Center Spine Binding & Realistic Fold Crease */
.book-spine-binding {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 28px;
  transform: translateX(-50%);
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.08) 32%,
    rgba(223, 183, 67, 0.22) 50%,
    rgba(0, 0, 0, 0.08) 68%,
    rgba(0, 0, 0, 0.25) 100%
  );
  z-index: 10;
  pointer-events: none;
}

.book-spine-binding::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  background: rgba(0, 0, 0, 0.4);
  transform: translateX(-50%);
}

/* Individual Pages Base */
.book-page {
  position: relative;
  padding: clamp(1.4rem, 2.2vw, 2.2rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Left Page — Warm Ivory with Soft Spine Shadow */
.book-page-left {
  background: linear-gradient(to right, #fdfbf7 0%, #f7f3ea 82%, #e5dcce 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 8px 0 16px -6px rgba(0, 0, 0, 0.08);
}

/* Right Page — Warm Ivory with Soft Spine Shadow */
.book-page-right {
  background: linear-gradient(to right, #e5dcce 0%, #f7f3ea 18%, #fdfbf7 100%);
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset -8px 0 16px -6px rgba(0, 0, 0, 0.08);
}

/* Subtle Paper Texture Fiber */
.book-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: 0.5;
  pointer-events: none;
}

/* Bottom Corner Paper Curl on Right Page */
.book-page-curl {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, transparent 50%, rgba(223, 183, 67, 0.25) 50%, #eae1cf 100%);
  box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.12);
  border-top-left-radius: 4px;
  pointer-events: none;
  z-index: 5;
}

/* Hide Mobile Elements on Desktop by Default */
.mobile-book-spine-strip,
.mobile-embedded-screenshot {
  display: none !important;
}

/* ==========================================================================
   LEFT PAGE CONTENT STYLING (Project Information Only)
   ========================================================================== */

.page-left-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.project-number-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.book-project-num {
  font-family: var(--font-body);
  font-size: clamp(1.6rem, 2.2vw, 2.1rem);
  font-weight: 900;
  color: var(--accent-gold);
  line-height: 1;
  letter-spacing: 0.05em;
  display: block;
}

.book-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 800;
  color: #b48c26;
  background: rgba(223, 183, 67, 0.12);
  border: 1px solid rgba(223, 183, 67, 0.5);
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-status-pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #dfb743;
}

.book-gold-divider {
  width: 32px;
  height: 2.5px;
  background: var(--accent-gold);
  border-radius: 2px;
  margin: 0.35rem 0 0.65rem 0;
}

.book-project-title {
  font-family: var(--font-body);
  font-size: clamp(1.35rem, 1.9vw, 1.85rem);
  font-weight: 900;
  color: #061126;
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.book-category-line {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.book-category-line .cat-dot {
  color: var(--accent-gold);
  font-size: 0.75rem;
}

.book-project-desc {
  font-size: clamp(0.82rem, 0.95vw, 0.9rem);
  color: #334155;
  line-height: 1.58;
  margin-bottom: 0.75rem;
  max-width: 98%;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  margin-bottom: 0.4rem;
}

.book-tag {
  font-size: 0.64rem;
  font-weight: 700;
  color: #0f274a;
  background: rgba(6, 17, 38, 0.07);
  border: 1px solid rgba(6, 17, 38, 0.15);
  padding: 0.12rem 0.48rem;
  border-radius: 4px;
}

.book-page-footer-left {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 0.5rem;
}

.book-page-number {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.08em;
}

/* ==========================================================================
   RIGHT PAGE CONTENT STYLING (Framed Screenshot & CTA)
   ========================================================================== */

.page-right-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.book-screenshot-window {
  position: relative;
  width: 86%;
  aspect-ratio: 16 / 10;
  margin: auto auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 
    0 10px 22px rgba(0, 0, 0, 0.18),
    0 0 0 1.5px rgba(223, 183, 67, 0.4);
  background: #020610;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.book-screenshot-window:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 14px 26px rgba(0, 0, 0, 0.22),
    0 0 0 1.5px rgba(223, 183, 67, 0.7);
}

.book-screenshot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #061126;
  display: block;
  transition: transform 0.5s ease;
}

.book-screenshot-window:hover .book-screenshot-img {
  transform: scale(1.02);
}

.book-screenshot-glare {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

/* Right Page Footer & Visit CTA */
.book-page-footer-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 0.5rem;
}

.book-visit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 800;
  color: #061126;
  text-decoration: none;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.3s ease;
}

.book-visit-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gold);
  transition: transform 0.3s ease, background 0.3s ease;
  transform-origin: left center;
}

.book-visit-link:hover {
  color: #b48c26;
}

.book-visit-link:hover::after {
  transform: scaleX(1.06);
  background: #b48c26;
}

.book-visit-link svg {
  transition: transform 0.3s ease;
  stroke: var(--accent-gold);
}

.book-visit-link:hover svg {
  transform: translate(2.5px, -2.5px);
  stroke: #b48c26;
}

/* ==========================================================================
   3D FLIPPING PAGE SHEET ARCHITECTURE
   ========================================================================== */

.book-flipper-layer {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  z-index: 20;
  pointer-events: none;
  display: none;
}

.book-flip-front,
.book-flip-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: clamp(1.4rem, 2.2vw, 2.2rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.book-flip-front {
  background: linear-gradient(to right, #e5dcce 0%, #f7f3ea 18%, #fdfbf7 100%);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.2);
}

.book-flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(to right, #fdfbf7 0%, #f7f3ea 82%, #e5dcce 100%);
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
}

.flip-shadow-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: 5;
}

/* ==========================================================================
   ATTACHED CIRCULAR BOOK NAVIGATION CONTROLS (DESKTOP)
   ========================================================================== */

.book-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #061126;
  border: 2px solid var(--accent-gold);
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  box-shadow: 
    0 6px 18px rgba(0, 0, 0, 0.75),
    0 0 12px rgba(223, 183, 67, 0.25);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.book-nav-btn:hover {
  background: #020712;
  border-color: #f7d774;
  color: #f7d774;
  box-shadow: 
    0 10px 22px rgba(0, 0, 0, 0.9),
    0 0 18px rgba(223, 183, 67, 0.5);
  transform: translateY(-50%) scale(1.08);
}

.book-nav-btn svg {
  transition: transform 0.3s ease;
}

.book-nav-next {
  right: -22px;
}

.book-nav-next:hover svg {
  transform: translateX(2.5px);
}

.book-nav-prev {
  left: -22px;
  display: none;
}

.book-nav-prev:hover svg {
  transform: translateX(-2.5px);
}

/* Bottom Spread Progress Counter Bar */
.book-progress-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.5rem;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 800;
  color: #94a3b8;
  letter-spacing: 0.1em;
}

.book-progress-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.book-dot-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.4);
  transition: all 0.3s ease;
  cursor: pointer;
}

.book-dot-indicator.active {
  width: 18px;
  border-radius: 9px;
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  box-shadow: 0 0 8px rgba(223, 183, 67, 0.5);
}

/* ==========================================================================
   MOBILE REALISTIC PORTRAIT HARDCOVER BOOK (< 768px)
   STRICTLY PRESERVED AS APPROVED — DO NOT MODIFY
   ========================================================================== */

@media (max-width: 767px) {
  .projects-book-section {
    padding: 3.5rem 0 4.5rem 0;
  }

  .projects-book-header {
    margin-bottom: 2rem;
  }

  .book-stage-wrapper {
    width: min(92vw, 440px);
    max-width: 440px;
  }

  /* Physical Single-Page Portrait Hardcover */
  .book-hardcover {
    aspect-ratio: auto;
    min-height: auto;
    max-height: none;
    padding: 10px 10px 14px 10px;
    border-radius: 14px;
    box-shadow: 
      0 18px 36px rgba(0, 0, 0, 0.9),
      0 0 20px rgba(0, 210, 255, 0.05);
    background: linear-gradient(135deg, #050e20 0%, #020712 100%);
    position: relative;
  }

  /* Mobile Stacked Paper Edges on Right and Bottom */
  .book-edge-stack-left {
    display: none;
  }

  .book-edge-stack-right {
    top: 10px;
    bottom: 14px;
    right: 4px;
    width: 6px;
    display: block;
  }

  .book-edge-stack-bottom {
    display: block;
    bottom: 4px;
    left: 14px;
    right: 12px;
    height: 6px;
  }

  .book-spine-binding {
    display: none;
  }

  /* Viewport for Mobile Book */
  .book-spread-viewport {
    grid-template-columns: 1fr;
    border-radius: 8px;
    position: relative;
    padding-left: 14px;
    background: #fdfbf7;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
  }

  /* Visible Narrow Left Bound Spine on Mobile */
  .mobile-book-spine-strip {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 14px;
    background: linear-gradient(
      to right,
      #030814 0%,
      #081736 40%,
      #050e20 80%,
      rgba(0, 0, 0, 0.35) 100%
    );
    border-right: 1px solid rgba(223, 183, 67, 0.4);
    z-index: 8;
    pointer-events: none;
    display: block !important;
  }

  .mobile-book-spine-strip::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 1px;
    background: repeating-linear-gradient(
      to bottom,
      rgba(223, 183, 67, 0.6) 0px,
      rgba(223, 183, 67, 0.6) 4px,
      transparent 4px,
      transparent 8px
    );
  }

  .book-page-right {
    display: none !important;
  }

  .book-page-left {
    padding: 1.4rem 1.1rem 1.1rem 1.1rem;
    background: linear-gradient(to right, #f5efe3 0%, #fdfbf7 8%, #f7f3ea 100%);
    border-right: none;
    box-shadow: none;
  }

  /* Mobile Content Structure */
  .book-project-num {
    font-size: 1.6rem;
  }

  .book-project-title {
    font-size: 1.35rem;
    margin-bottom: 0.3rem;
  }

  .book-category-line {
    font-size: 0.65rem;
    margin-bottom: 0.75rem;
  }

  /* Prominently Mount Screenshot in Mobile Page */
  .mobile-embedded-screenshot {
    display: block !important;
    margin: 0.85rem 0 1rem 0;
  }

  .mobile-embedded-screenshot .book-screenshot-window {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 8px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(223, 183, 67, 0.4);
  }

  .book-project-desc {
    font-size: 0.82rem;
    line-height: 1.55;
    margin-bottom: 0.85rem;
  }

  .book-tags-row {
    margin-bottom: 0.85rem;
  }

  .book-tag {
    font-size: 0.62rem;
    padding: 0.12rem 0.45rem;
  }

  .mobile-visit-link {
    display: inline-flex !important;
    font-size: 0.78rem;
  }

  .book-page-footer-left {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
  }

  /* Attached Mobile Navigation Buttons */
  .book-nav-btn {
    width: 42px;
    height: 42px;
  }

  .book-nav-next {
    right: -16px;
  }

  .book-nav-prev {
    left: -16px;
  }

  .book-flipper-layer {
    width: 100%;
    left: 0;
    right: auto;
  }

  .book-flip-front,
  .book-flip-back {
    padding: 1.4rem 1.1rem;
    padding-left: calc(1.1rem + 14px);
  }
}
