/* ============================================================
   YOSHIMITSU GOTO — Animations & Motion System
   ============================================================ */

/* --- Keyframe Animations --- */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(60px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes lineExpand {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

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

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

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.1);
  }
  50% {
    box-shadow: 0 0 40px rgba(201, 168, 76, 0.3);
  }
}

@keyframes borderGlow {
  0%, 100% {
    border-color: rgba(201, 168, 76, 0.1);
  }
  50% {
    border-color: rgba(201, 168, 76, 0.4);
  }
}

@keyframes textReveal {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(30px, -40px) scale(1.1); }
  50% { transform: translate(-20px, -60px) scale(0.9); }
  75% { transform: translate(-40px, -20px) scale(1.05); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.15); }
  66% { transform: translate(30px, -30px) scale(0.85); }
}

@keyframes gridPulse {
  0%, 100% { opacity: 0.02; }
  50% { opacity: 0.06; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Animation Utility Classes --- */
.anim-fade-in-up {
  animation: fadeInUp 0.8s var(--ease-out) both;
}

.anim-fade-in-down {
  animation: fadeInDown 0.6s var(--ease-out) both;
}

.anim-fade-in-left {
  animation: fadeInLeft 0.8s var(--ease-out) both;
}

.anim-fade-in-right {
  animation: fadeInRight 0.8s var(--ease-out) both;
}

.anim-fade-in {
  animation: fadeIn 0.6s var(--ease-out) both;
}

.anim-scale-in {
  animation: scaleIn 0.6s var(--ease-out) both;
}

/* Stagger delays */
.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }
.anim-delay-5 { animation-delay: 0.5s; }
.anim-delay-6 { animation-delay: 0.6s; }
.anim-delay-7 { animation-delay: 0.7s; }
.anim-delay-8 { animation-delay: 0.8s; }

/* --- Password Page Animations --- */
.gate-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--color-black);
}

.gate-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gate-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(201, 168, 76, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 168, 76, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridPulse 4s ease-in-out infinite;
}

.gate-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
}

.gate-orb--1 {
  width: 500px;
  height: 500px;
  background: rgba(201, 168, 76, 0.08);
  top: -10%;
  right: -10%;
  animation: orbFloat1 15s ease-in-out infinite;
}

.gate-orb--2 {
  width: 400px;
  height: 400px;
  background: rgba(76, 201, 240, 0.05);
  bottom: -15%;
  left: -10%;
  animation: orbFloat2 20s ease-in-out infinite;
}

.gate-orb--3 {
  width: 300px;
  height: 300px;
  background: rgba(201, 168, 76, 0.05);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat1 12s ease-in-out infinite reverse;
}

.gate-content {
  position: relative;
  z-index: 10;
  text-align: center;
  padding: var(--space-md);
  max-width: 480px;
  width: 100%;
}

.gate-logo {
  margin-bottom: var(--space-lg);
  animation: fadeInDown 0.8s var(--ease-out) both;
}

.gate-logo__text {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-white);
}

.gate-logo__sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-top: 0.5rem;
}

.gate-form {
  animation: fadeInUp 0.8s var(--ease-out) 0.2s both;
}

.gate-input-group {
  position: relative;
  margin-bottom: var(--space-sm);
}

.gate-input {
  width: 100%;
  padding: 1.25rem 1.5rem;
  background: rgba(22, 22, 31, 0.6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-white);
  font-family: var(--font-mono);
  font-size: 1rem;
  letter-spacing: 0.3em;
  text-align: center;
  transition: all var(--duration-fast) var(--ease-out);
}

.gate-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-dim), 0 0 40px var(--color-accent-glow);
}

.gate-input::placeholder {
  color: var(--color-muted);
  letter-spacing: 0.2em;
  font-size: 0.8rem;
}

.gate-submit {
  width: 100%;
  padding: 1.25rem;
  background: var(--color-accent);
  color: var(--color-black);
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  border: none;
}

.gate-submit:hover {
  background: var(--color-accent-light);
  box-shadow: 0 0 40px var(--color-accent-glow);
  transform: translateY(-2px);
}

.gate-error {
  color: #ff4d4d;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.gate-error--visible {
  opacity: 1;
  animation: fadeInUp 0.3s var(--ease-out);
}

.gate-footer {
  margin-top: var(--space-lg);
  animation: fadeIn 0.8s var(--ease-out) 0.4s both;
}

.gate-footer__text {
  font-size: 0.7rem;
  color: var(--color-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* --- Page Transition --- */
.page-transition {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-black);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.page-transition--entering {
  animation: fadeIn 0.3s var(--ease-out) both;
}

.page-transition--leaving {
  animation: fadeIn 0.3s var(--ease-out) reverse both;
}

/* --- Scroll Indicator --- */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 5;
  animation: fadeIn 1s var(--ease-out) 1.5s both;
}

.scroll-indicator__text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-muted);
}

.scroll-indicator__line {
  width: 1px;
  height: 40px;
  background: linear-gradient(180deg, var(--color-accent), transparent);
  animation: pulse 2s ease-in-out infinite;
}

/* --- Magnetic Cursor Effect Container --- */
.magnetic {
  transition: transform var(--duration-fast) var(--ease-out);
}

/* --- Stagger Children --- */
.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-children--visible > *:nth-child(1) { animation: fadeInUp 0.5s var(--ease-out) 0.05s both; }
.stagger-children--visible > *:nth-child(2) { animation: fadeInUp 0.5s var(--ease-out) 0.1s both; }
.stagger-children--visible > *:nth-child(3) { animation: fadeInUp 0.5s var(--ease-out) 0.15s both; }
.stagger-children--visible > *:nth-child(4) { animation: fadeInUp 0.5s var(--ease-out) 0.2s both; }
.stagger-children--visible > *:nth-child(5) { animation: fadeInUp 0.5s var(--ease-out) 0.25s both; }
.stagger-children--visible > *:nth-child(6) { animation: fadeInUp 0.5s var(--ease-out) 0.3s both; }
.stagger-children--visible > *:nth-child(7) { animation: fadeInUp 0.5s var(--ease-out) 0.35s both; }
.stagger-children--visible > *:nth-child(8) { animation: fadeInUp 0.5s var(--ease-out) 0.4s both; }

/* --- Parallax Layer --- */
.parallax-layer {
  will-change: transform;
  transition: transform 0.1s linear;
}

/* --- Hover Glow Effect --- */
.hover-glow {
  position: relative;
}

.hover-glow::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, var(--color-accent-glow), transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all var(--duration-slow) var(--ease-out);
  pointer-events: none;
  z-index: -1;
}

.hover-glow:hover::after {
  width: 300px;
  height: 300px;
}

/* --- Number Counter Animation --- */
.counter {
  display: inline-block;
}

.counter--animated {
  animation: countUp 0.6s var(--ease-out) both;
}

/* --- Reduce motion for accessibility --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .marquee__inner {
    animation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
