/* Custom CSS for "How to Hide a Hippo" Website */

:root {
  /* Color palette extracted directly from the actual book illustration */
  --primary-color: #254996; /* Vibrant Cobalt Blue (from title text/image) */
  --secondary-color: #3a5e8d; /* Elephant Blue-Grey (from watercolor elephants) */
  --accent-color: #4CAF50; /* Watercolor Grass Green (from tree & grass) */
  --amber-gold: #E5B73C; /* Watercolor Butterfly Gold (from origami butterfly) */
  --bg-cream: #FCFAF4; /* Warm Watercolor Paper Cream background */
  --text-dark: #1E2833; /* Dark Charcoal felt-tip ink color */
  --text-muted: #56687A; /* Muted Pen-Ink Gray */
  --white: #FFFFFF;
  --card-bg: rgba(255, 255, 255, 0.95);
  
  --font-display: 'Patrick Hand', cursive, sans-serif;
  --font-body: 'Lora', Georgia, serif; /* Sophisticated serif font matching book page spreads */
  
  --transition-smooth: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  --shadow-soft: 0 10px 30px rgba(30, 40, 51, 0.03);
  --shadow-medium: 0 15px 35px rgba(30, 40, 51, 0.06);
}

/* Base Styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-cream);
  color: var(--text-dark);
  font-size: 1.15rem;
  line-height: 1.8;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: normal;
  color: var(--primary-color);
  letter-spacing: 0.5px;
}

a {
  text-decoration: none;
  transition: var(--transition-smooth);
}

/* Prevent image selection and native dragging */
img {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Irregular Hand-Drawn Horizontal Divider (Soft Pencil Guidelines look) */
.hand-drawn-line {
  height: 8px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 6" preserveAspectRatio="none"><path d="M0,3 C15,2.2 30,3.8 50,3 C70,2.2 85,3.8 100,3" fill="none" stroke="%231E2833" stroke-width="1.2" stroke-linecap="round" stroke-opacity="0.3"/></svg>') repeat-x;
  background-size: 100% 100%;
  border: none;
  margin: 1.5rem auto;
  width: 50%;
  max-width: 400px;
}

/* Reduce spacing below horizontal rule dividers */
.hand-drawn-line + section {
  padding-top: 3.5rem !important;
}

/* Scroll Animation classes */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Glassmorphism Navigation Bar */
.navbar-custom {
  background: rgba(252, 250, 244, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(30, 40, 51, 0.08);
  padding: 1rem 0;
  transition: var(--transition-smooth);
}

.navbar-custom.scrolled {
  padding: 0.6rem 0;
  box-shadow: var(--shadow-soft);
  border-bottom: 1px solid rgba(30, 40, 51, 0.15);
}

.navbar-brand {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--primary-color) !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand img {
  border-radius: 4px;
}

.nav-link {
  font-family: var(--font-display);
  color: var(--text-dark) !important;
  font-size: 1.3rem;
  padding: 0.5rem 1.2rem !important;
  border-radius: 50px;
  margin: 0 0.2rem;
  transition: var(--transition-smooth);
}

.nav-link:hover {
  color: var(--secondary-color) !important;
  background-color: rgba(58, 94, 141, 0.08);
}

.nav-link.active {
  color: var(--white) !important;
  background-color: var(--secondary-color) !important;
  box-shadow: 2px 2px 0px rgba(30, 40, 51, 0.12);
  border: 1px solid rgba(30, 40, 51, 0.25);
}

/* Hero / Header Section */
.hero-section {
  position: relative;
  padding: 8rem 0 6rem 0;
  background-color: var(--secondary-color); /* Matches the footer blue-grey: #3a5e8d */
  border-bottom: 2px solid rgba(30, 40, 51, 0.15);
  overflow: hidden;
  color: var(--white);
}

/* Adjust secondary button, book shadow, and hover states for dark blue hero section */
.hero-section .btn-secondary-custom {
  border-color: rgba(255, 255, 255, 0.5);
  color: var(--white);
}

.hero-section .btn-secondary-custom:hover {
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 4px 4px 0px rgba(255, 255, 255, 0.25);
  color: var(--white);
}

.hero-section .book-container {
  box-shadow: 10px 12px 30px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-section .book-container:hover {
  box-shadow: 15px 20px 40px rgba(255, 255, 255, 0.15);
}

.hero-bg-shapes .shape {
  position: absolute;
  z-index: -1;
  opacity: 0.3;
  animation: floatShape 8s infinite ease-in-out alternate;
}

.hero-bg-shapes .shape-1 {
  top: 15%;
  left: 5%;
  color: var(--accent-color);
  font-size: 1.8rem;
}

.hero-bg-shapes .shape-3 {
  top: 25%;
  right: 8%;
  color: var(--primary-color);
  font-size: 1.5rem;
  animation-delay: 4s;
}

.hero-bg-shapes .shape-2 {
  top: 70%;
  left: 8%;
  color: var(--primary-color);
  font-size: 1.5rem;
  animation-delay: 2s;
}

.hero-bg-shapes .shape-4 {
  top: 65%;
  right: 15%;
  color: var(--accent-color);
  font-size: 1.6rem;
  animation-delay: 6s;
}

.hero-bg-shapes .shape-5 {
  top: 15%;
  left: 45%;
  color: var(--secondary-color);
  font-size: 1.2rem;
  animation-delay: 1.5s;
}

.hero-title {
  font-size: 4rem;
  line-height: 1.2;
  margin-bottom: 0.8rem;
  font-family: var(--font-display);
  color: var(--white);
}

.hero-subtitle {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2.5rem;
  max-width: 580px;
}

/* Button Custom Styles (Fine pencil/pen lines) */
.btn-primary-custom {
  background-color: var(--accent-color);
  border: 1px solid rgba(30, 40, 51, 0.3);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.3rem;
  padding: 0.8rem 2.2rem;
  border-radius: 10px 40px 12px 35px / 35px 12px 40px 10px; /* Hand-drawn shape */
  box-shadow: 3px 3px 0px rgba(30, 40, 51, 0.12);
  transition: var(--transition-smooth);
}

.btn-primary-custom:hover {
  background-color: var(--bg-cream);
  color: var(--text-dark) !important;
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px rgba(30, 40, 51, 0.2);
}

.btn-secondary-custom {
  background-color: transparent;
  border: 1px solid rgba(30, 40, 51, 0.4);
  color: var(--text-dark);
  font-family: var(--font-display);
  font-size: 1.3rem;
  padding: 0.8rem 2.2rem;
  border-radius: 35px 12px 40px 10px / 10px 40px 12px 35px;
  box-shadow: 3px 3px 0px rgba(30, 40, 51, 0.08);
  transition: var(--transition-smooth);
}

.btn-secondary-custom:hover {
  background-color: rgba(26, 84, 168, 0.05);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px rgba(30, 40, 51, 0.15);
}

.btn-secondary-custom:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Book Layout & Cover Style (Subtle realist borders) */
.book-wrapper {
  perspective: 1200px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-container {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1.3; /* Precise Portrait aspect ratio of 1.3 */
  transform-style: preserve-3d;
  transform: rotateY(-10deg) rotateX(10deg);
  transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 10px 12px 25px rgba(30, 40, 51, 0.12);
  border-radius: 3px 6px 6px 3px; /* Subtle book rounding (not too rounded) */
  border: 1px solid rgba(30, 40, 51, 0.15); /* Soft outer line */
}

.book-container:hover {
  transform: rotateY(-3deg) rotateX(5deg) scale(1.03);
  box-shadow: 15px 20px 35px rgba(37, 73, 150, 0.15);
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px 5px 5px 2px;
  display: block;
}

/* Simulated Spine Effect */
.book-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 15px;
  height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,0.15) 0%, rgba(255,255,255,0.1) 60%, rgba(0,0,0,0.03) 100%);
  border-radius: 2px 0 0 2px;
  z-index: 10;
  pointer-events: none;
}

/* Pages Container (Light sketch lines & soft shadows) */
.spread-card {
  background: var(--white);
  border: 1px solid rgba(30, 40, 51, 0.25); /* Finer felt-tip outline */
  border-radius: 12px 18px 10px 14px / 14px 10px 18px 12px; /* Irregular border-radius */
  padding: 1.5rem;
  box-shadow: 4px 5px 0px rgba(30, 40, 51, 0.08); /* Lighter Uniball offset shadow */
  transition: var(--transition-smooth);
}

.spread-card:hover {
  transform: translateY(-5px);
  box-shadow: 6px 8px 0px rgba(30, 40, 51, 0.12);
}

.spread-img-container {
  width: 100%;
  aspect-ratio: 16.5 / 10.75; /* Precise landscape aspect ratio of 16.5:10.75 */
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(30, 40, 51, 0.15);
}

.spread-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.spread-card:hover .spread-img {
  transform: scale(1.02);
}

.spread-caption {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--primary-color);
  margin-top: 1.2rem;
  text-align: center;
}

/* Sections Common Styling */
.section-padding {
  padding: 6rem 0;
}

.section-title {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 1.2rem;
  position: relative;
  display: inline-block;
  color: var(--primary-color);
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 15%;
  right: 15%;
  height: 6px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 6" preserveAspectRatio="none"><path d="M0,3 C20,2 40,4.5 60,3 C80,1.5 90,3.5 100,3" fill="none" stroke="%233a5e8d" stroke-width="3" stroke-linecap="round" stroke-opacity="0.6"/></svg>') repeat-x;
  background-size: 100% 100%;
}

.section-subtitle {
  text-align: center;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 4rem auto;
  font-size: 1.2rem;
}

/* About Author Section */
.author-image-wrapper {
  position: relative;
  display: inline-block;
}

.author-image-wrapper::before {
  content: '';
  position: absolute;
  top: -12px;
  left: -12px;
  width: calc(100% + 24px);
  height: calc(100% + 24px);
  border: 1.5px dashed var(--secondary-color);
  border-radius: 50%;
  animation: rotateClockwise 25s linear infinite;
  z-index: 1;
}

.author-img {
  width: 280px;
  height: 280px;
  object-fit: cover;
  object-position: center top; /* Shifts image content down to show top of head */
  border-radius: 50%;
  border: 3px solid rgba(30, 40, 51, 0.3); /* Softer felt-tip style */
  box-shadow: 4px 6px 0px rgba(30, 40, 51, 0.06);
  position: relative;
  z-index: 2;
  transition: var(--transition-smooth);
}

.author-img:hover {
  transform: scale(1.03) rotate(2deg);
  box-shadow: 6px 8px 0px rgba(30, 40, 51, 0.1);
}

.author-bio {
  background-color: var(--white);
  border: 1.5px solid rgba(30, 40, 51, 0.25); /* Finer pen outline */
  border-radius: 15px 95px 12px 85px / 85px 12px 95px 15px; /* Irregular hand-drawn container */
  padding: 3rem;
  box-shadow: 5px 7px 0px rgba(30, 40, 51, 0.08); /* Softer offset shadow */
}

.author-bio h3 {
  color: var(--secondary-color);
  font-size: 2.1rem;
  margin-bottom: 1rem;
}

/* Where to Buy Section */
.buy-section {
  background: linear-gradient(180deg, var(--bg-cream) 0%, rgba(37, 73, 150, 0.03) 100%);
  position: relative;
}

.buy-card {
  background: var(--white);
  border: 1.5px solid var(--secondary-color); /* Matches footer */
  border-radius: 20px 14px 22px 16px / 16px 22px 14px 20px;
  padding: 2.5rem;
  box-shadow: 4px 5px 0px rgba(58, 94, 141, 0.3); /* Matches footer blue-grey shadow */
  text-align: center;
  transition: var(--transition-smooth);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.buy-card:hover {
  transform: translateY(-8px);
  box-shadow: 6px 8px 0px var(--secondary-color); /* Matches footer color shadow */
}

.buy-card-icon {
  font-size: 2.5rem;
  color: var(--amber-gold);
  background: rgba(229, 183, 60, 0.08); /* Warm gold circle for Amazon */
  border: 1px solid rgba(30, 40, 51, 0.25);
  width: 70px;
  height: 70px;
  line-height: 68px;
  border-radius: 50%;
  margin: 0 auto 1.5rem auto;
}

.buy-card.ingram-card .buy-card-icon {
  color: var(--primary-color);
  background: rgba(37, 73, 150, 0.06); /* Indigo-Blue circle for Ingram */
}

.buy-card-title {
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.buy-card-desc {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 2rem;
  flex-grow: 1;
}

/* Amazon Button: Gold background, Charcoal text */
.btn-buy-amazon {
  background-color: var(--amber-gold);
  border: 1px solid rgba(30, 40, 51, 0.3);
  color: var(--text-dark);
  font-family: var(--font-display);
  font-size: 1.3rem;
  padding: 0.8rem 2rem;
  border-radius: 30px 10px 35px 8px / 8px 35px 10px 30px;
  box-shadow: 3px 3px 0px rgba(30, 40, 51, 0.1);
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-buy-amazon:hover {
  background-color: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px rgba(30, 40, 51, 0.18);
}

/* Ingram Button: matches Explore the Book style and green/blue-grey color scheme */
.btn-buy-ingram {
  background-color: var(--accent-color);
  border: 1px solid rgba(30, 40, 51, 0.3);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 1.3rem;
  padding: 0.8rem 2rem;
  border-radius: 10px 40px 12px 35px / 35px 12px 40px 10px; /* Matches Explore the Book hand-drawn border-radius */
  box-shadow: 3px 3px 0px rgba(30, 40, 51, 0.12); /* Matches Explore the Book shadow */
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-buy-ingram:hover {
  background-color: var(--primary-color);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0px rgba(30, 40, 51, 0.18); /* Matches Amazon hover shadow */
}

/* Zoom Lightbox Modal Custom Styles */
.modal-body-scroll {
  overflow: auto;
  max-height: 80vh;
  position: relative;
  background-color: var(--bg-cream);
  padding: 1.5rem;
}

/* 3D Book Page-Turning Transition Engine */
.modal-book-container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  transition: width 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-book-container.zoomed {
  width: 180%; /* Expands to allow natural scrolling / panning */
  max-width: var(--max-zoom-width, none);
}

.page-flip-container {
  perspective: 2000px; /* High perspective depth for realistic 3D look */
  width: 100%;
  position: relative;
}

.book-page-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16.5 / 10.75;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center center;
}

/* Triggers 3D horizontal page flip rotation */
.book-page-wrapper.turning {
  transform: rotateY(-180deg);
}

.page-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border: 1px solid rgba(30, 40, 51, 0.2);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(30, 40, 51, 0.15);
  background-color: var(--white);
}

.page-face.front {
  z-index: 2;
  transform: rotateY(0deg);
}

.page-face.back {
  transform: rotateY(180deg); /* Render mirror side */
}

.modal-spread-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  display: block;
}

.modal-book-container.zoomed .modal-spread-img {
  cursor: zoom-out;
}

/* Footer Section */
.footer-section {
  background-color: var(--secondary-color); /* Same as active menu button color */
  color: var(--white);
  padding: 4rem 0 2rem 0;
  font-size: 1rem;
  border-top: none !important; /* Removed top border */
  position: relative;
  overflow: hidden;
}

.footer-elephant-float {
  position: absolute;
  bottom: 15px;
  right: 30px;
  width: 90px;
  height: auto;
  opacity: 0.98;
  pointer-events: none;
  z-index: 1;
  transition: var(--transition-smooth);
}

.footer-elephant-float:hover {
  transform: scale(1.05) rotate(-2deg);
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--white);
  margin-bottom: 1rem;
}

.footer-logo img {
  border-radius: 4px;
}

.footer-links a {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9); /* Lighter links on blue-grey */
  margin: 0 1rem;
  transition: var(--transition-smooth);
}

.footer-links a:hover {
  color: var(--primary-color);
}

/* List Style overrides */
.list-styled-icon {
  color: var(--accent-color);
  font-size: 1.25rem;
}

/* Animations */
@keyframes floatShape {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-20px) rotate(15deg);
  }
}

@keyframes rotateClockwise {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes wave {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
  100% { transform: rotate(0deg); }
}

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .hero-title {
    font-size: 3rem;
  }
  .section-padding {
    padding: 4rem 0;
  }
  .author-image-wrapper {
    margin-bottom: 3rem;
  }
}

@media (max-width: 575.98px) {
  .hero-title {
    font-size: 2.2rem;
  }
  .navbar-brand {
    font-size: 1.35rem;
  }
  .section-title {
    font-size: 2rem;
  }
  .author-bio {
    padding: 1.5rem;
  }
}

/* Floating cartoon illustrations integrated into the design layout */
.froggie-float {
  position: absolute;
  top: -45px;
  right: -45px;
  width: 120px; /* Slightly bigger */
  height: auto;
  opacity: 0.98;
  pointer-events: none;
  z-index: 10;
  transform: scaleX(-1) rotate(-45deg); /* Mirrored and rotated 45 degrees counter-clockwise */
  transition: var(--transition-smooth);
}

.froggie-float:hover {
  transform: scaleX(-1) scale(1.05) rotate(-40deg);
}

@media (max-width: 991.98px) {
  .froggie-float {
    top: -35px;
    right: 5px;
    left: auto;
    width: 100px;
  }
}

@media (max-width: 767.98px) {
  .footer-elephant-float {
    position: relative;
    display: block;
    margin: 1.5rem auto 0 auto;
    bottom: 0;
    right: 0;
    width: 75px;
  }
}
