/* Logo Component - Optimized and Modular */

/* === LOGO CONTAINER === */
.logo-container {
  width: 300px;
  height: 200px;
  margin-bottom: var(--space-8);
  margin-top: calc(var(--space-4) * -1);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
}

/* === LOGO CORE === */
.logo-core {
  width: 150px;
  height: 150px;
  background-color: var(--color-ivey-green);
  border-radius: var(--radius-full);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  box-shadow: var(--theme-shadow-medium);
  overflow: visible;
  perspective: 750px;
  
  /* Animation will be applied via modifier class */
  animation-duration: 3s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-delay: 2.8s;
  animation-fill-mode: both;
}

/* Core Animation - Applied conditionally */
.logo-core.animate {
  animation-name: logo-core-throb;
}

/* === LOGO INITIALS === */
.logo-initials {
  font-family: var(--font-logo);
  font-size: 75px;
  font-weight: var(--font-weight-medium);
  color: var(--color-white);
  opacity: 0.95;
  line-height: 1;
  display: inline-block;
}

/* === INITIALS WRAPPER === */
.merged-initials-wrapper {
  display: inline-block;
  transform-origin: center center;
  transform-style: preserve-3d;
  
  /* Animation will be applied via modifier class */
  animation-duration: 1.5s;
  animation-timing-function: ease-in-out;
  animation-delay: 1.2s;
  animation-fill-mode: forwards;
}

/* Wrapper Animation - Applied conditionally */
.merged-initials-wrapper.animate {
  animation-name: logo-rotate-flip;
}

/* === INDIVIDUAL INITIALS === */
.initial-i {
  display: inline-block;
  opacity: 0;
  transform: translateX(-0.2em);
  margin-right: 0.05em;
  
  /* Animation properties */
  animation-duration: 1s;
  animation-timing-function: var(--ease-bounce);
  animation-delay: 0.2s;
  animation-fill-mode: forwards;
}

/* I Animation - Applied conditionally */
.initial-i.animate {
  animation-name: logo-merge-i;
}

.initial-v {
  display: inline-block;
  opacity: 0;
  transform: translateX(0.2em);
  
  /* Animation properties */
  animation-duration: 0.8s;
  animation-timing-function: var(--ease-out);
  animation-delay: 0s;
  animation-fill-mode: forwards;
}

/* V Animation - Applied conditionally */
.initial-v.animate {
  animation-name: logo-slide-v;
}

/* === LOGO RINGS === */
.logo-ring {
  position: absolute;
  border-radius: var(--radius-full);
  opacity: 0;
  border-style: solid;
  border-width: 8px;
  
  /* Animation properties */
  animation-duration: 3s;
  animation-timing-function: ease-out;
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}

/* Ring Animations - Applied conditionally */
.logo-ring.animate {
  animation-name: logo-ring-pulse;
}

/* Ring Color Variants */
.logo-ring.ring-primary {
  border-color: var(--color-western-purple);
  animation-delay: 2.8s;
}

.logo-ring.ring-secondary {
  border-color: var(--color-turquoise);
  animation-delay: 3.55s;
}

.logo-ring.ring-tertiary {
  border-color: var(--color-bright-green);
  animation-delay: 4.3s;
}

/* === PERFORMANCE-OPTIMIZED ANIMATIONS === */

/* Core Throb Animation - GPU Accelerated */
@keyframes logo-core-throb {
  0%, 100% {
    transform: scale3d(1, 1, 1);
    box-shadow: 
      0 0 10px rgba(0, 0, 0, 0.2),
      0 0 0px rgba(var(--color-ivey-green-rgb), 0);
  }
  50% {
    transform: scale3d(1.05, 1.05, 1);
    box-shadow: 
      0 0 15px rgba(0, 0, 0, 0.1),
      0 0 20px 5px rgba(var(--color-ivey-green-rgb), 0.35);
  }
}

/* Initial I Merge Animation */
@keyframes logo-merge-i {
  0% {
    opacity: 0;
    transform: translateX(-0.3em);
    margin-right: 0.05em;
  }
  60% {
    opacity: 1;
    transform: translateX(0.05em);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
    margin-right: -0.15em;
  }
}

/* Initial V Slide Animation */
@keyframes logo-slide-v {
  0% {
    opacity: 0;
    transform: translateX(0.3em);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Rotate and Flip Animation - GPU Accelerated */
@keyframes logo-rotate-flip {
  0% { 
    transform: rotateZ(0deg) rotateX(0deg);
  }
  50% { 
    transform: rotateZ(-270deg) rotateX(0deg);
  }
  100% { 
    transform: rotateZ(-270deg) rotateX(180deg);
  }
}

/* Ring Pulse Animation - GPU Accelerated */
@keyframes logo-ring-pulse {
  0% {
    transform: scale3d(0.7, 0.7, 1);
    opacity: 0.9;
  }
  70% {
    transform: scale3d(2.0, 2.0, 1);
    opacity: 0.4;
  }
  100% {
    transform: scale3d(2.5, 2.5, 1);
    opacity: 0;
  }
}

/* Page Transition Burst-Spin Animation - GPU Accelerated */
@keyframes logo-burst-spin {
  0% {
    transform: scale3d(0.8, 0.8, 1) rotate(0deg);
    box-shadow: 0 0 20px rgba(3, 70, 56, 0.3);
  }
  30% {
    transform: scale3d(1.3, 1.3, 1) rotate(180deg);
    box-shadow: 0 0 50px rgba(3, 70, 56, 0.8), 0 0 80px rgba(3, 70, 56, 0.4);
  }
  60% {
    transform: scale3d(0.9, 0.9, 1) rotate(360deg);
    box-shadow: 0 0 40px rgba(3, 70, 56, 0.6);
  }
  100% {
    transform: scale3d(1, 1, 1) rotate(360deg);
    box-shadow: 0 0 20px rgba(3, 70, 56, 0.3);
  }
}

/* === INLINE LOGO VARIANT === */

/* For use in headers and inline text */
.inline-logo {
  display: inline-block;
  position: relative;
  line-height: 1;
  white-space: nowrap;
  font-family: var(--font-logo);
  font-weight: var(--font-weight-medium);
  color: inherit;
  font-size: 1em;
  vertical-align: baseline;
  margin: 0 0.1em;
}

.inline-logo .merged-initials-wrapper {
  display: inline-block;
  transform-origin: center center;
  transform-style: preserve-3d;
  transform: rotateZ(-270deg) rotateX(180deg);
}

.inline-logo .initial-i {
  display: inline-block;
  margin-right: -0.15em;
  opacity: 1;
  transform: none;
  animation: none;
}

.inline-logo .initial-v {
  display: inline-block;
  opacity: 1;
  transform: none;
  animation: none;
}

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

@media (max-width: 768px) {
  .logo-container {
    width: 250px;
    height: 170px;
    margin-bottom: var(--space-6);
  }
  
  .logo-core {
    width: 120px;
    height: 120px;
  }
  
  .logo-initials {
    font-size: 60px;
  }
  
  .logo-ring {
    border-width: 6px;
  }
}

@media (max-width: 480px) {
  .logo-container {
    width: 200px;
    height: 140px;
    margin-bottom: var(--space-4);
  }
  
  .logo-core {
    width: 100px;
    height: 100px;
  }
  
  .logo-initials {
    font-size: 50px;
  }
  
  .logo-ring {
    border-width: 4px;
  }
}

/* === ACCESSIBILITY === */

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .logo-core,
  .merged-initials-wrapper,
  .initial-i,
  .initial-v,
  .logo-ring {
    animation: none !important;
  }
  
  .merged-initials-wrapper {
    transform: rotateZ(-270deg) rotateX(180deg);
  }
  
  .initial-i {
    opacity: 1;
    transform: translateX(0);
    margin-right: -0.15em;
  }
  
  .initial-v {
    opacity: 1;
    transform: translateX(0);
  }
}

/* High contrast support */
@media (prefers-contrast: high) {
  .logo-core {
    border: 2px solid var(--color-white);
  }
  
  .logo-ring {
    border-width: 10px;
  }
}

/* === HEADER LOGO VARIANT === */

/* Smaller logo for header use */
.header-logo {
    width: 60px !important; /* Much smaller for header */
    height: 60px !important;
    margin: 0 !important; /* Remove margins for header */
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.header-logo .logo-core {
    width: 50px !important; /* Smaller core for header */
    height: 50px !important;
    background-color: var(--color-ivey-green);
    border-radius: var(--radius-full);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: visible;
    perspective: 750px;
    /* Disable animations in header */
    animation: none !important;
}

.header-logo .logo-initials {
    font-family: var(--font-logo);
    font-size: 25px !important; /* Smaller initials for header */
    font-weight: var(--font-weight-medium);
    color: var(--color-white);
    opacity: 0.95;
    line-height: 1;
    display: inline-block;
}

.header-logo .merged-initials-wrapper {
    display: inline-block;
    transform-origin: center center;
    transform-style: preserve-3d;
    /* Show final transformed state without animation */
    transform: rotateZ(-270deg) rotateX(180deg);
    animation: none !important;
}

.header-logo .initial-i,
.header-logo .initial-v {
    display: inline-block;
    opacity: 1;
    animation: none !important;
    transform: none !important;
}

.header-logo .initial-i {
    margin-right: -0.15em;
}

/* Disable all logo rings in header */
.header-logo .logo-ring {
    display: none;
}

/* Header layout adjustments */
.app-header .header-nav {
    min-width: 80px; /* Ensure space for logo */
    display: flex;
    align-items: center;
}

.app-header .header-nav:first-child {
    justify-content: flex-start;
}

/* === CENTERED LOGO VARIANT === */

/* For precise center positioning across pages */
.centered-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120px;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  pointer-events: none; /* allow underlying nodes to remain interactive */
  z-index: 10; /* ensure anchor content sits above edge SVG */
}

.centered-logo .logo-core {
  width: 120px;
  height: 120px;
}

.centered-logo .logo-initials {
  font-size: 60px;
}

/* Responsive sizing for centered logo */
@media (max-width: 768px) {
  .centered-logo {
    width: 100px;
    height: 100px;
  }

  .centered-logo .logo-core {
    width: 100px;
    height: 100px;
  }

  .centered-logo .logo-initials {
    font-size: 50px;
  }
}

@media (max-width: 480px) {
  .centered-logo {
    width: 100px;
    height: 100px;
  }

  .centered-logo .logo-core {
    width: 100px;
    height: 100px;
  }

  .centered-logo .logo-initials {
    font-size: 50px;
  }
}

/* === LOGO STATES === */

/* Loading State */
.logo-container.loading .logo-core {
  animation: logo-loading-pulse 1.5s ease-in-out infinite;
}

@keyframes logo-loading-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
  50% {
    opacity: 0.7;
    transform: scale3d(1.05, 1.05, 1);
  }
}

/* Error State */
.logo-container.error .logo-core {
  background-color: var(--color-error);
  animation: logo-error-shake 0.5s ease-in-out;
}

@keyframes logo-error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Success State */
.logo-container.success .logo-core {
  background-color: var(--color-success);
  animation: logo-success-bounce 0.6s ease-in-out;
}

@keyframes logo-success-bounce {
  0%, 100% { transform: scale3d(1, 1, 1); }
  50% { transform: scale3d(1.1, 1.1, 1); }
}
