@import url("https://fonts.googleapis.com/css2?family=Trocchi&family=Comfortaa:wght@300..700&display=swap");

@keyframes loader-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes loader-inner-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(-360deg);
  }
}

@keyframes fly-out {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-100%);
    opacity: 0;
  }
}

@keyframes turtle-float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-5px) rotate(2deg);
  }
  75% {
    transform: translateY(5px) rotate(-2deg);
  }
}

@keyframes pulse {
  0%,
  25% {
    transform: scale(0.01);
  }
  45%,
  75% {
    transform: scale(1);
  }
  95%,
  100% {
    transform: scale(0.01);
  }
}

@keyframes fade {
  0%,
  25% {
    background: #ddd6fe;
  }
  45%,
  75% {
    background: #c4b5fd;
  }
  95%,
  100% {
    background: #ddd6fe;
  }
}

.background-honeycomb {
  --hex-w: 120px;
  --hex-h: calc(var(--hex-w) * 0.57);
  --anim-speed: 8s;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.15;
}

.socket {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.hex-brick {
  background: #ddd6fe;
  width: var(--hex-w);
  height: var(--hex-h);
  position: absolute;
  top: calc((var(--hex-w) - var(--hex-h)) / 2);
  animation: fade var(--anim-speed) infinite;
}

.h2 {
  transform: rotate(60deg);
}
.h3 {
  transform: rotate(-60deg);
}

.gel {
  height: var(--hex-w);
  width: var(--hex-w);
  transition: all 0.3s;
  position: absolute;
  transform: scale(0.01);
  animation: pulse var(--anim-speed) infinite;
}

body {
  font-family: "Comfortaa", sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-serif {
  font-family: "Trocchi", serif;
}

.nav-link.active {
  color: #7e22ce;
  font-weight: bold;
}
.nav-link.active svg {
  color: #7e22ce;
}

/* --- Purple Swimming Turtle Loader --- */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #a78bfa; /* Light purple sky */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}

.loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

/* The Water / Sea Surface */
.turtle-container {
  position: relative;
  width: 100%;
  height: 50vh;
  background: #7e22ce; /* Dark purple water */
  border-top: 8px solid #2e1065; /* The "Center Line" / Surface */
}

.turtle {
  position: absolute;
  left: -250px;
  top: -8px; /* Sit on the surface line */
  width: 218px;
  height: 92px;
  transform: translateX(-50%);
  animation: turtle-bob 3s ease-in-out infinite;
}

@keyframes turtle-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

/* Page Load Animation: Swim to center */
.loader.is-entering .turtle {
  animation: swim-to-center 1.5s ease-out forwards;
}

@keyframes swim-to-center {
  from { left: -250px; }
  to { left: 50%; }
}

/* Page Exit Animation: Swim to right */
.loader.is-exiting .turtle {
  animation: swim-to-right 1.2s ease-in forwards;
}

@keyframes swim-to-right {
  from { left: 50%; }
  to { left: 110%; }
}

.leg {
  width: 46px;
  height: 46px;
  background: #a78bfa;
  border: 8px solid #2e1065;
  border-bottom-right-radius: 9999px;
  border-bottom-left-radius: 1500px;
  box-shadow: inset 0 3px 0 0 rgba(255, 255, 255, 0.2);
  position: absolute;
  top: 0;
}

.leg::after {
  content: "";
  position: absolute;
  left: 90px;
  top: -8px;
  width: 46px;
  height: 46px;
  background: #a78bfa;
  border: 8px solid #2e1065;
  border-bottom-right-radius: 9999px;
  border-bottom-left-radius: 1500px;
  box-shadow: inset 0 3px 0 0 rgba(255, 255, 255, 0.2);
}

.body {
  position: absolute;
  left: 48px;
  top: -50px;
  width: 88px;
  height: 42px;
  background: #7e22ce;
  border: 8px solid #2e1065;
  border-top-right-radius: 9999px;
  border-top-left-radius: 9999px;
  box-shadow: inset 0 -3px 0 0 rgba(0, 0, 0, 0.2);
  overflow: hidden; /* Clips the spots to the shell */
}

.body::after {
  content: "";
  position: absolute;
  left: 35px;
  top: 6px;
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  box-shadow: 12px 0 0 0 rgba(255, 255, 255, 0.3),
    -12px 12px 0 0 rgba(255, 255, 255, 0.3),
    5px 12px 0 0 rgba(255, 255, 255, 0.3),
    23px 12px 0 0 rgba(255, 255, 255, 0.3),
    -22px 22px 0 0 rgba(255, 255, 255, 0.3),
    -5px 22px 0 0 rgba(255, 255, 255, 0.3),
    15px 22px 0 0 rgba(255, 255, 255, 0.3),
    30px 22px 0 0 rgba(255, 255, 255, 0.3);
}

.head {
  position: absolute;
  left: 151px;
  top: -50px;
  width: 88px;
  height: 42px;
  background: #a78bfa;
  border: 8px solid #2e1065;
  border-top-right-radius: 9999px;
  border-top-left-radius: 9999px;
}

/* Happy Chill Eye */
.head::after {
  display: none;
}

.head::before {
  content: "";
  position: absolute;
  left: 55%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 10px;
  border: 4px solid #2e1065;
  border-top: 0;
  border-radius: 0 0 16px 16px;
  z-index: 100;
  animation: chill-squint 3s ease-in-out infinite;
}

@keyframes chill-squint {
  0%, 100% { transform: translate(-50%, -50%) scaleY(1); }
  50% { transform: translate(-50%, -50%) scaleY(0.7); }
}

.loader-text {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-family: "Trocchi", serif;
  font-size: 3rem;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  animation: text-glow 1.5s ease-in-out infinite alternate;
  z-index: 10;
  white-space: nowrap;
}

@keyframes text-glow {
  from { opacity: 0.8; transform: translateX(-50%) scale(0.98); }
  to { opacity: 1; transform: translateX(-50%) scale(1.02); }
}

/* --- Navigation Animations --- */

/* Hamburger Button */
.hamburger-btn {
  width: 30px;
  height: 20px;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background-color: #4b5563; /* text-gray-600 */
  border-radius: 3px;
  transition: all 0.3s ease-in-out;
}

.is-active .line-1 {
  transform: translateY(8.5px) rotate(45deg);
}

.is-active .line-2 {
  opacity: 0;
}

.is-active .line-3 {
  transform: translateY(-8.5px) rotate(-45deg);
}

/* Full Screen Menu Animation */
#mobile-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobile-menu.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Underline Hover Animation */
.nav-link {
  position: relative;
  display: inline-block;
}

.nav-link::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: #7e22ce; /* purple-700 */
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease-out;
}

.nav-link:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

/* Hide desktop nav underline if needed */
@media (max-width: 768px) {
  #mobile-menu .nav-link {
    font-size: 2.5rem;
  }
}

.loader-logo {
  width: 150px;
  height: auto;
  margin-bottom: 2rem;
  filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5));
  animation: turtle-float 4s ease-in-out infinite;
}

@media (max-width: 768px) {
  .loader-text {
    font-size: 2rem;
    text-align: center;
  }
}

/* --- Global Styles --- */
main {
  transition: opacity 0.5s ease-in;
  flex-grow: 1;
}

.animate-fade-in {
  opacity: 1;
}

.transform {
  transition: transform 0.3s ease-out;
}

.transform:hover {
  transform: scale(1.05);
}

.turtle-card {
  border-radius: 40px 15px 40px 15px;
  border: 1px solid rgba(126, 34, 206, 0.1);
  background: white;
}

.turtle-float {
  animation: turtle-float 6s ease-in-out infinite;
}

@keyframes turtle-backflip {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-25deg) scale(1.1); } /* Wind-up */
  100% { transform: rotate(360deg) scale(1); } /* Smooth spin right */
}

.is-flipping {
  animation: turtle-backflip 0.8s cubic-bezier(0.45, 0.05, 0.55, 0.95) !important;
}

.turtle-icon-bg {
  background: radial-gradient(
    circle,
    rgba(167, 139, 250, 0.2) 0%,
    rgba(167, 139, 250, 0) 70%
  );
}
