/* ===== FLIPBOOK STYLES ===== */

/* Custom Properties for Theming */
:root {
  --flipbook-primary: #2c3e50;
  --flipbook-secondary: #e74c3c;
  --flipbook-accent: #f39c12;
  --flipbook-light: #ecf0f1;
  --flipbook-dark: #34495e;
  --flipbook-shadow: rgba(0, 0, 0, 0.3);
  --flipbook-border-radius: 15px;
  --animation-duration: 0.4s;
  --animation-easing: cubic-bezier(0.4, 0.0, 0.2, 1);
  --perspective: 1400px;
}

/* Typography - Retro Modern Mix */
.flipbook-title {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.5rem, 5vw, 4rem);
  color: var(--flipbook-primary);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  position: relative;
}

.flipbook-title::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--flipbook-secondary), var(--flipbook-accent));
  border-radius: 2px;
}

.flipbook-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--flipbook-dark);
  margin-bottom: 3rem;
  font-weight: 400;
}

/* Main Flipbook Section */
.flipbook-section {
  padding: 60px 0 80px;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  position: relative;
}

.flipbook-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(255,255,255,0.3) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,0.2) 0%, transparent 50%);
  pointer-events: none;
}

/* Flipbook Container */
.flipbook-container {
  max-width: 1400px;
  margin: 0 auto;
  position: relative;
  perspective: var(--perspective);
  padding: 0 20px;
}

/* Book Spine Effect - Now handled by .flipbook-pages::before */

/* Flipbook Pages Container */
.flipbook-pages {
  position: relative;
  width: 100%;
  max-width: 1200px;
  height: 800px;
  margin: 0 auto;
  transform-style: preserve-3d;
}

.flipbook-pages::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
  width: 8px;
  height: 100%;
  background: linear-gradient(to bottom, 
    var(--flipbook-dark) 0%, 
    var(--flipbook-primary) 50%, 
    var(--flipbook-dark) 100%);
  border-radius: 4px;
  box-shadow: 0 0 25px rgba(0,0,0,0.4);
  z-index: 10;
}

/* Individual Page Styles */
.flipbook-page {
  position: absolute;
  width: 50%;
  height: 100%;
  background: white;
  border-radius: var(--flipbook-border-radius);
  box-shadow: 0 15px 40px var(--flipbook-shadow);
  overflow: hidden;
  transition: transform var(--animation-duration) var(--animation-easing);
  backface-visibility: hidden;
  border: 1px solid rgba(0,0,0,0.1);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Left and Right Page Positioning */
.flipbook-page.left {
  right: 50%;
  transform-origin: right center;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.flipbook-page.right {
  left: 50%;
  transform-origin: left center;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Page States */
.flipbook-page.visible {
  opacity: 1;
  pointer-events: auto;
}

.flipbook-page.current-left {
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
  transform: rotateY(0deg);
}

.flipbook-page.current-right {
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
  transform: rotateY(0deg);
}

.flipbook-page.flipping-next {
  z-index: 4;
  transform: rotateY(-180deg);
}

.flipbook-page.flipping-prev {
  z-index: 4;
  transform: rotateY(180deg);
}

/* Page Content */
.page-content {
  height: 100%;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: visible;
}

/* Center shorter content */
.page-content:not(.page-content-with-image):not(.page-content-full-image) {
  padding-top: 60px;
}

/* Long content pages need minimal top padding and scrollable content */
.page-content.page-long-content {
  padding-top: 30px !important;
  padding-bottom: 30px !important;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Adjust content spacing when images are present */
.page-content-with-image {
  justify-content: flex-start;
  padding: 35px;
}

.page-content-with-image .page-year {
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  margin-bottom: 1rem;
}

.page-content-with-image .page-title {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  margin-bottom: 1.2rem;
  line-height: 1.1;
}

.page-content-with-image .page-body {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  line-height: 1.5;
}

/* Page Background Images - No longer used, images now inline */

/* Content elements are now properly layered without z-index conflicts */

/* Year Display */
.page-year {
  font-family: 'Playfair Display', serif;
  font-size: clamp(3.5rem, 10vw, 7rem);
  font-weight: 900;
  line-height: 0.8;
  margin-bottom: 1.5rem;
  opacity: 0.8;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

/* Page Title */
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 2rem;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Page Image */
.page-image {
  max-width: 180px;
  max-height: 200px;
  height: auto;
  margin: 15px 0;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  display: block;
  object-fit: cover;
}

/* Multiple Images Container */
.page-images-container {
  display: flex;
  gap: 15px;
  margin: 20px 0;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.page-image-multiple {
  max-width: 150px;
  margin: 0;
  flex: 0 0 auto;
}

/* Full Image Page */
.page-content-full-image {
  padding: 0;
  justify-content: center;
  align-items: center;
}

.page-full-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--flipbook-border-radius);
}

/* Specific styling for TGS Family of Companies Merger image */
.page-full-image.merger-image {
  object-fit: contain;
  padding: 30px;
  box-sizing: border-box;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* Page with Background Image and Overlay */
.page-content-with-background {
  position: relative;
  border-radius: var(--flipbook-border-radius);
  overflow: hidden;
}

.page-overlay-image {
  position: relative;
  z-index: 2;
  width: 60%;
  height: 60%;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* Page Body Text */
.page-body {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.1rem, 2.2vw, 1.3rem);
  line-height: 1.6;
  font-weight: 400;
  opacity: 0.9;
}



/* Page Flip Animations */
.flipbook-page.flipped-left {
  transform: rotateY(180deg);
}

.flipbook-page.flipped-right {
  transform: rotateY(-180deg);
}

/* Controls */
.flipbook-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 50px;
  padding: 0 20px;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 30px;
  background: linear-gradient(135deg, var(--flipbook-primary), var(--flipbook-dark));
  color: white;
  border: none;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s var(--animation-easing);
  box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
  will-change: transform;
}

.control-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(44, 62, 80, 0.4);
}

.control-btn:active:not(:disabled) {
  transform: translateY(-1px) scale(0.98);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.page-indicator {
  display: none;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--flipbook-primary);
  background: white;
  padding: 12px 20px;
  border-radius: 25px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Timeline Navigation */
.timeline-nav {
  margin-top: 40px;
  display: none;
  justify-content: center;
}

.timeline-dots {
  display: flex;
  gap: 18px;
  align-items: center;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(44, 62, 80, 0.3);
  cursor: pointer;
  transition: all 0.3s var(--animation-easing);
  position: relative;
  will-change: transform;
}

.timeline-dot.active {
  background: var(--flipbook-secondary);
  transform: scale(1.4);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

.timeline-dot:hover {
  background: var(--flipbook-accent);
  transform: scale(1.3);
}

/* Progress Bar */
.reading-progress {
  margin-top: 50px;
  height: 12px;
  background: rgba(44, 62, 80, 0.1);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: all 0.3s var(--animation-easing);
}

.reading-progress:hover {
  height: 16px;
  margin-top: 48px;
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.2);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--flipbook-secondary), var(--flipbook-accent));
  width: 0%;
  transition: width 0.4s var(--animation-easing);
  border-radius: 6px;
  position: relative;
  z-index: 2;
}

/* Progress Bar Segments */
.progress-segments {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  z-index: 3;
}

.progress-segment {
  flex: 1;
  height: 100%;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-segment:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Progress Segment Dots */
.progress-segment::before {
  content: '';
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  opacity: 0;
  transition: all 0.2s ease;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.reading-progress:hover .progress-segment::before {
  opacity: 1;
}

.progress-segment:hover::before {
  opacity: 1;
  background: rgba(255, 255, 255, 0.8);
  width: 6px;
  height: 6px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.3);
}

/* Active/Current Segment */
.progress-segment.active::before {
  opacity: 1;
  background: var(--flipbook-accent);
  width: 5px;
  height: 5px;
  box-shadow: 0 0 6px rgba(231, 76, 60, 0.4);
}

.progress-segment.active:hover::before {
  background: var(--flipbook-accent);
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.6);
}

.progress-segment:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: rgba(255, 255, 255, 0.3);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.reading-progress:hover .progress-segment:not(:last-child)::after {
  opacity: 1;
}

/* Progress Bar Tooltip */
.progress-tooltip {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(44, 62, 80, 0.95);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.progress-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(44, 62, 80, 0.95);
}

.progress-segment:hover .progress-tooltip {
  opacity: 1;
  bottom: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .flipbook-container {
    padding: 0 15px;
  }
  
  .flipbook-pages {
    height: 600px;
    max-width: 95vw;
  }
  
  .page-content {
    padding: 25px;
  }
  
  /* Progress bar mobile optimizations */
  .reading-progress {
    height: 14px;
    margin-top: 48px;
  }
  
  .reading-progress:hover {
    height: 18px;
    margin-top: 46px;
  }
  
  /* Larger dots for touch interaction */
  .progress-segment::before {
    width: 5px;
    height: 5px;
  }
  
  .reading-progress:hover .progress-segment::before {
    opacity: 1;
  }
  
  .progress-segment:hover::before,
  .progress-segment.active::before {
    width: 7px;
    height: 7px;
  }
  
  /* Tooltip adjustments for mobile */
  .progress-tooltip {
    font-size: 0.8rem;
    padding: 6px 10px;
    bottom: 22px;
  }
  
  .progress-segment:hover .progress-tooltip {
    bottom: 26px;
  }
  
  /* Reduce top padding for mobile text-only pages */
  .page-content:not(.page-content-with-image):not(.page-content-full-image) {
    padding-top: 35px;
  }
  
  /* Long content on mobile - scrollable within page */
  .page-content.page-long-content {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
  }
  
  /* Base text responsiveness for mobile */
  .page-year {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    margin-bottom: 1rem;
  }
  
  .page-title {
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin-bottom: 1.2rem;
  }
  
  .page-body {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    line-height: 1.5;
  }
  
  .page-image {
    max-width: 130px;
    max-height: 150px;
    margin: 12px 0;
  }
  
  .page-content-with-image {
    padding: 30px;
  }
  
  .page-content-with-image .page-year {
    font-size: clamp(2.2rem, 6vw, 4rem);
    margin-bottom: 0.8rem;
  }
  
  .page-content-with-image .page-title {
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    margin-bottom: 1rem;
  }
  
  .page-content-with-image .page-body {
    font-size: clamp(0.9rem, 1.8vw, 1rem);
    line-height: 1.4;
  }
  
  .page-images-container {
    gap: 10px;
    margin: 15px 0;
  }
  
  .page-image-multiple {
    max-width: 120px;
  }
  
  .page-full-image {
    border-radius: 12px;
  }
  
  .page-full-image.merger-image {
    padding: 25px;
    max-width: 95%;
    max-height: 95%;
  }
  
  /* Responsive overlay image */
  .page-overlay-image {
    width: 70%;
    height: 70%;
  }
  

  

  
  .flipbook-controls {
    flex-direction: column;
    gap: 25px;
  }
  
  .control-btn {
    padding: 12px 24px;
    font-size: 0.95rem;
  }
  
  .flipbook-pages::before {
    width: 6px;
  }
}

@media (max-width: 480px) {
  .flipbook-pages {
    height: 500px;
  }
  
  .page-content {
    padding: 20px;
  }
  
  /* Minimal top padding for small mobile text-only pages */
  .page-content:not(.page-content-with-image):not(.page-content-full-image) {
    padding-top: 25px;
  }
  
  /* Long content on small mobile */
  .page-content.page-long-content {
    padding-top: 15px !important;
    padding-bottom: 15px !important;
  }
  
  /* Base text responsiveness for small mobile */
  .page-year {
    font-size: clamp(2rem, 7vw, 3.5rem);
    margin-bottom: 0.8rem;
    line-height: 0.9;
  }
  
  .page-title {
    font-size: clamp(1.1rem, 3.5vw, 1.6rem);
    margin-bottom: 1rem;
    line-height: 1.1;
  }
  
  .page-body {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    line-height: 1.4;
  }
  
  .page-image {
    max-width: 110px;
    max-height: 120px;
    margin: 10px 0;
  }
  
  .page-content-with-image {
    padding: 25px;
  }
  
  .page-content-with-image .page-year {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 0.6rem;
  }
  
  .page-content-with-image .page-title {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    margin-bottom: 0.8rem;
  }
  
  .page-content-with-image .page-body {
    font-size: clamp(0.85rem, 1.5vw, 0.95rem);
    line-height: 1.3;
  }
  
  .page-images-container {
    gap: 8px;
    margin: 12px 0;
    flex-direction: column;
  }
  
  .page-image-multiple {
    max-width: 100px;
  }
  
  .page-full-image {
    border-radius: 10px;
  }
  
  .page-full-image.merger-image {
    padding: 20px;
    max-width: 90%;
    max-height: 90%;
  }
  
  /* Extra small mobile overlay image */
  .page-overlay-image {
    width: 80%;
    height: 80%;
  }
  

  
  .page-year {
    font-size: 2.8rem;
  }
  
  .timeline-dots {
    gap: 12px;
  }
  
  .timeline-dot {
    width: 12px;
    height: 12px;
  }
  
  .flipbook-pages::before {
    width: 5px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .page-content {
    padding: 15px;
  }
  
  /* Very minimal top padding for extra small screens */
  .page-content:not(.page-content-with-image):not(.page-content-full-image) {
    padding-top: 20px;
  }
  
  /* Long content on extra small screens */
  .page-content.page-long-content {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }
  
  .page-year {
    font-size: clamp(1.8rem, 6vw, 2.8rem);
    margin-bottom: 0.6rem;
    line-height: 0.85;
  }
  
  .page-title {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin-bottom: 0.8rem;
    line-height: 1.05;
  }
  
  .page-body {
    font-size: clamp(0.85rem, 1.8vw, 1rem);
    line-height: 1.35;
  }
  
  .page-content-with-image {
    padding: 15px;
  }
  
  .page-content-with-image .page-year {
    font-size: clamp(1.6rem, 5vw, 2.5rem);
    margin-bottom: 0.5rem;
  }
  
  .page-content-with-image .page-title {
    font-size: clamp(0.95rem, 2.2vw, 1.3rem);
    margin-bottom: 0.6rem;
  }
  
  .page-content-with-image .page-body {
    font-size: clamp(0.8rem, 1.4vw, 0.9rem);
    line-height: 1.25;
  }
}

/* Loading Animation */
.flipbook-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 800px;
  font-family: 'Inter', sans-serif;
  color: var(--flipbook-primary);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(44, 62, 80, 0.1);
  border-left-color: var(--flipbook-secondary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Performance Optimizations */
.flipbook-page {
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  -moz-backface-visibility: hidden;
  -ms-backface-visibility: hidden;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .flipbook-page {
    transition: none;
  }
  
  .control-btn {
    transition: none;
  }
  
  .timeline-dot {
    transition: none;
  }
  
  .loading-spinner {
    animation: none;
  }
  
  :root {
    --animation-duration: 0.1s;
  }
}

/* Print Styles */
@media print {
  .flipbook-controls,
  .timeline-nav,
  .reading-progress {
    display: none;
  }
  
  .flipbook-pages {
    height: auto;
  }
  
  .flipbook-page {
    position: static;
    width: 100%;
    height: auto;
    margin-bottom: 2rem;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
} 