/**
 * Milo 3D Book Styles
 * Modern CSS for interactive 3D book interface
 */

/* === HOME PAGE 3D BOOK SECTION === */
.home-3d-book-section {
  background: #c8e2fb;
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

.book-section-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.book-section-content-fullwidth {
  width: 100%;
  height: 80vh;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-section-text {
  color: white;
  z-index: 10;
  position: relative;
}

.book-section-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  margin-bottom: 1.5rem;
  background: linear-gradient(45deg, #fff, #f0f0f0, #fff);
  background-size: 200% 200%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.book-section-description {
  font-size: 1.25rem;
  line-height: 1.6;
  margin-bottom: 2.5rem;
  opacity: 0.9;
  max-width: 500px;
}

.book-section-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

.book-fullscreen-btn {
  background: linear-gradient(45deg, #4f46e5, #7c3aed);
  color: white;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
  position: relative;
  overflow: hidden;
}

.book-fullscreen-btn:before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.book-fullscreen-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
  color: white;
  text-decoration: none;
}

.book-fullscreen-btn:hover:before {
  left: 100%;
}

.book-or-text {
  font-size: 0.875rem;
  opacity: 0.7;
  font-style: italic;
}

.book-section-3d {
  position: relative;
  height: 70vh;
  min-height: 500px;
}

/* Adjust 3D book for home page integration */
.home-3d-book-section .milo-book-container {
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: 1rem;
  overflow: visible;
}

/* Adjust UI for home page */
.home-3d-book-section .book-ui-header {
  display: none; /* Hide header logo on home page */
}

.home-3d-book-section .book-ui-navigation {
  padding: 1.5rem;
}

.home-3d-book-section .book-nav-buttons {
  justify-content: center;
}

.home-3d-book-section .book-page-indicator {
  bottom: 1rem;
  top: auto;
  right: 50%;
  transform: translateX(50%);
}

/* Responsive adjustments for home page */
@media (max-width: 1024px) {
  .book-section-content-fullwidth {
    height: 70vh;
    min-height: 500px;
  }
}

@media (max-width: 768px) {
  .home-3d-book-section {
    padding: 2rem 0;
  }

  .book-section-container {
    padding: 0 1rem;
  }

  .book-section-content-fullwidth {
    height: 60vh;
    min-height: 400px;
  }
}

/* === MAIN CONTAINER === */
.milo-book-container {
  position: relative;
  width: 100%;
  height: 100vh;
  background: #000;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

.milo-book-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* === UI OVERLAY === */
.milo-book-ui {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.book-ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
}

/* === HEADER SECTION === */
.book-ui-header {
  padding: 2.5rem;
  pointer-events: auto;
  z-index: 30;
}

.book-logo-link {
  display: inline-block;
  transition: transform 0.3s ease;
}

.book-logo-link:hover {
  transform: scale(1.1);
}

.book-logo {
  width: 5rem;
  height: auto;
  filter: brightness(0) invert(1);
  transition: filter 0.3s ease;
}

.book-logo-link:hover .book-logo {
  filter: brightness(0) invert(1) drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

/* === NAVIGATION SECTION === */
.book-ui-navigation {
  width: 100%;
  padding: 2.5rem;
  pointer-events: auto;
  z-index: 30;
}

.book-nav-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

.book-nav-buttons {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 100%;
  padding: 1rem;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.book-nav-buttons::-webkit-scrollbar {
  display: none;
}

.book-nav-button {
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  font-size: 1.125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.book-nav-button:hover {
  border-color: white;
  background: rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.book-nav-button.active {
  background: rgba(255, 255, 255, 0.9);
  color: #000;
  border-color: white;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.book-nav-button.active:hover {
  background: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.3);
}

/* === PAGE INDICATOR === */
.book-page-indicator {
  position: absolute;
  top: 50%;
  right: 2.5rem;
  transform: translateY(-50%);
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.4);
  color: white;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* === BACKGROUND ANIMATIONS === */
.book-ui-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  overflow: hidden;
  transform: rotate(-2deg);
  pointer-events: none;
}

.book-bg-text-layer {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  white-space: nowrap;
  width: max-content;
}

.book-bg-text-layer.layer-1 {
  animation: horizontalScroll 40s linear infinite;
}

.book-bg-text-layer.layer-2 {
  animation: horizontalScroll2 40s linear infinite;
  animation-delay: 20s;
}

.book-bg-text-container {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
}

.book-bg-text {
  color: white;
  font-weight: 900;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.book-bg-text.text-0 {
  font-size: clamp(4rem, 10vw, 10rem);
  font-weight: 900;
}

.book-bg-text.text-1 {
  font-size: clamp(3rem, 8vw, 8rem);
  font-weight: 300;
  font-style: italic;
}

.book-bg-text.text-2 {
  font-size: clamp(4.5rem, 12vw, 12rem);
  font-weight: 700;
}

.book-bg-text.text-3 {
  font-size: clamp(4.5rem, 12vw, 12rem);
  font-weight: 700;
  font-style: italic;
  -webkit-text-stroke: 2px white;
  -webkit-text-fill-color: transparent;
  text-stroke: 2px white;
  text-fill-color: transparent;
}

/* === ANIMATIONS === */
@keyframes horizontalScroll {
  0% {
    transform: translateY(-50%) translateX(0);
  }
  100% {
    transform: translateY(-50%) translateX(-100%);
  }
}

@keyframes horizontalScroll2 {
  0% {
    transform: translateY(-50%) translateX(100%);
  }
  100% {
    transform: translateY(-50%) translateX(0);
  }
}

/* Fade in animation for UI elements */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.book-ui-header,
.book-ui-navigation,
.book-page-indicator {
  animation: fadeIn 1s ease-out;
}

/* === LOADING STATE === */
.milo-book-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 1.25rem;
  font-weight: 500;
  z-index: 100;
}

.book-loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 1rem;
}

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

/* === RESPONSIVE DESIGN === */

/* Tablet styles */
@media (max-width: 1024px) {
  .book-ui-header {
    padding: 2rem;
  }

  .book-ui-navigation {
    padding: 2rem;
  }

  .book-logo {
    width: 4rem;
  }

  .book-nav-button {
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
  }

  .book-page-indicator {
    right: 2rem;
    font-size: 0.8rem;
  }

  .book-bg-text.text-0 {
    font-size: clamp(3rem, 8vw, 8rem);
  }

  .book-bg-text.text-1 {
    font-size: clamp(2.5rem, 6vw, 6rem);
  }

  .book-bg-text.text-2,
  .book-bg-text.text-3 {
    font-size: clamp(3.5rem, 9vw, 9rem);
  }
}

/* Mobile styles */
@media (max-width: 768px) {
  .milo-book-ui.mobile .book-ui-header {
    padding: 1.5rem;
  }

  .milo-book-ui.mobile .book-ui-navigation {
    padding: 1.5rem;
  }

  .milo-book-ui.mobile .book-logo {
    width: 3rem;
  }

  .milo-book-ui.mobile .book-nav-button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    gap: 0.5rem;
  }

  .milo-book-ui.mobile .book-nav-buttons {
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .milo-book-ui.mobile .book-page-indicator {
    position: static;
    transform: none;
    margin: 1rem auto 0;
    text-align: center;
    width: fit-content;
  }

  .milo-book-ui.mobile .book-bg-text.text-0 {
    font-size: clamp(2rem, 6vw, 6rem);
  }

  .milo-book-ui.mobile .book-bg-text.text-1 {
    font-size: clamp(1.5rem, 4vw, 4rem);
  }

  .milo-book-ui.mobile .book-bg-text.text-2,
  .milo-book-ui.mobile .book-bg-text.text-3 {
    font-size: clamp(2.5rem, 7vw, 7rem);
  }

  /* Adjust background animation for mobile */
  .milo-book-ui.mobile .book-ui-background {
    transform: rotate(-1deg);
  }

  .milo-book-ui.mobile .book-bg-text-layer.layer-1 {
    animation-duration: 30s;
  }

  .milo-book-ui.mobile .book-bg-text-layer.layer-2 {
    animation-duration: 30s;
    animation-delay: 15s;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .book-nav-buttons {
    padding: 0.5rem;
  }

  .book-nav-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    min-width: auto;
  }

  .book-page-indicator {
    font-size: 0.75rem;
    padding: 0.5rem 0.75rem;
  }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
  .book-bg-text-layer.layer-1,
  .book-bg-text-layer.layer-2 {
    animation: none;
  }

  .book-nav-button,
  .book-logo-link {
    transition: none;
  }

  .book-ui-header,
  .book-ui-navigation,
  .book-page-indicator {
    animation: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .book-nav-button {
    border-width: 3px;
    background: rgba(0, 0, 0, 0.8);
  }

  .book-nav-button.active {
    background: white;
    color: black;
  }

  .book-page-indicator {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid white;
  }
}

/* Focus states for accessibility */
.book-nav-button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.book-logo-link:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 4px;
  border-radius: 0.25rem;
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
  /* Already optimized for dark backgrounds */
}

/* === PRINT STYLES === */
@media print {
  .milo-book-ui {
    display: none;
  }
}

/* === CUSTOM SCROLLBARS === */
.book-nav-buttons {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.book-nav-buttons::-webkit-scrollbar {
  height: 4px;
}

.book-nav-buttons::-webkit-scrollbar-track {
  background: transparent;
}

.book-nav-buttons::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.book-nav-buttons::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
