/* Base Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Cormorant Garamond', serif;
  color: #e6dada;
  height: 100vh;
  background: radial-gradient(ellipse at 50% 30%, #2a1015 0%, #1a0d0d 40%, #0d0505 70%, #000 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  cursor: default;
}

/* Fog Overlay with Breathing Effect */
.fog-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('assets/photos/fog-texture2.gif') no-repeat center center;
  background-size: cover;
  opacity: 0.4;
  mix-blend-mode: screen;
  pointer-events: none;
  z-index: 1;
  animation: fogBreathe 12s ease-in-out infinite;
}

@keyframes fogBreathe {
  0%, 100% { 
    transform: translateX(0) scale(1); 
    opacity: 0.35; 
  }
  25% { 
    transform: translateX(-1%) scale(1.015); 
    opacity: 0.4; 
  }
  50% { 
    transform: translateX(0) scale(1.03); 
    opacity: 0.5; 
  }
  75% { 
    transform: translateX(1%) scale(1.015); 
    opacity: 0.4; 
  }
}

/* Background overlay for subtle cracks/grain */
.bg-overlay {
  background: url('cracks-texture.png');
  background-size: cover;
  opacity: 0.07;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Flickering Candlelight Shadow Effects */
.bg-overlay::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 800px 400px at 20% 30%, rgba(196,30,58,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 600px 300px at 80% 70%, rgba(196,30,58,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 400px 600px at 60% 20%, rgba(196,30,58,0.04) 0%, transparent 50%);
  animation: candleFlicker 8s ease-in-out infinite;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.bg-overlay::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse 500px 800px at 10% 80%, rgba(0,0,0,0.1) 0%, transparent 60%),
    radial-gradient(ellipse 700px 400px at 90% 40%, rgba(0,0,0,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 300px 500px at 40% 10%, rgba(0,0,0,0.06) 0%, transparent 60%);
  animation: shadowDance 6s ease-in-out infinite reverse;
  pointer-events: none;
}

@keyframes candleFlicker {
  0%, 100% { 
    opacity: 0.6;
    transform: scale(1);
  }
  15% { 
    opacity: 0.8;
    transform: scale(1.02);
  }
  30% { 
    opacity: 0.4;
    transform: scale(0.98);
  }
  45% { 
    opacity: 0.9;
    transform: scale(1.01);
  }
  60% { 
    opacity: 0.5;
    transform: scale(0.99);
  }
  75% { 
    opacity: 0.7;
    transform: scale(1.015);
  }
  90% { 
    opacity: 0.3;
    transform: scale(0.985);
  }
}

@keyframes shadowDance {
  0%, 100% { 
    opacity: 0.7;
    transform: translateX(0) translateY(0) scale(1);
  }
  20% { 
    opacity: 0.5;
    transform: translateX(2px) translateY(-1px) scale(1.01);
  }
  40% { 
    opacity: 0.9;
    transform: translateX(-1px) translateY(2px) scale(0.99);
  }
  60% { 
    opacity: 0.4;
    transform: translateX(1px) translateY(1px) scale(1.005);
  }
  80% { 
    opacity: 0.8;
    transform: translateX(-2px) translateY(-1px) scale(0.995);
  }
}

/* Floating Particles */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: radial-gradient(circle, #c41e3a 0%, transparent 70%);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat 12s infinite ease-in-out;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 30%; animation-delay: 3s; }
.particle:nth-child(3) { left: 50%; animation-delay: 6s; }
.particle:nth-child(4) { left: 70%; animation-delay: 9s; }
.particle:nth-child(5) { left: 90%; animation-delay: 1.5s; }

@keyframes particleFloat {
  0%, 100% { transform: translateY(100vh) scale(0); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  50% { transform: translateY(-20px) scale(1); opacity: 0.8; }
}

/* Title Styling */
.title {
  font-family: 'Cinzel', serif;
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.title-line {
  display: block;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: #8b8680;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  opacity: 0.9;
}

.title-main {
  display: block;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(145deg, #c41e3a 0%, #8b1538 50%, #c41e3a 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(196,30,58,0.4);
  animation: titleGlow 4s ease-in-out infinite;
  position: relative;
}

.title-main::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(145deg, #c41e3a 0%, #8b1538 50%, #c41e3a 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: blur(8px);
  opacity: 0.3;
  z-index: -1;
}

@keyframes titleGlow {
  0%, 100% { 
    text-shadow: 0 0 30px rgba(196,30,58,0.4), 0 0 50px rgba(196,30,58,0.2);
    transform: scale(1);
  }
  50% { 
    text-shadow: 0 0 40px rgba(196,30,58,0.7), 0 0 70px rgba(196,30,58,0.4);
    transform: scale(1.02);
  }
}

/* Gate Layout */
.gate {
  z-index: 2;
  text-align: center;
  max-width: 450px;
  width: 90%;
  backdrop-filter: blur(1px);
  padding: 2rem;
  border-radius: 8px;
  background: rgba(10, 5, 5, 0.3);
  border: 1px solid rgba(196, 30, 58, 0.1);
}

/* Enhanced Sigil */
.sigil {
  width: 100px;
  height: 100px;
  margin: 1.5rem auto;
  position: relative;
  background: radial-gradient(circle at 30% 30%, #4a1520 0%, #2a0d12 50%, #0a0305 100%);
  border: 3px solid #c41e3a;
  border-radius: 50%;
  box-shadow: 
    0 0 30px rgba(196,30,58,0.4),
    inset 0 0 20px rgba(196,30,58,0.1);
  animation: sigilPulse 6s ease-in-out infinite;
}

.sigil-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 70%;
  transform: translate(-50%, -50%);
  opacity: 0.9;
  animation: innerRotate 8s linear infinite;
}

/* Gothic Cross Structure */
.sigil-inner::before,
.sigil-inner::after {
  content: '';
  position: absolute;
  background: linear-gradient(180deg, #c41e3a 0%, #8b1538 50%, #c41e3a 100%);
  box-shadow: 
    0 0 10px rgba(196,30,58,0.6),
    inset 0 0 5px rgba(255,255,255,0.1);
}

/* Vertical beam of cross */
.sigil-inner::before {
  top: 0;
  left: 50%;
  width: 12px;
  height: 100%;
  transform: translateX(-50%);
  clip-path: polygon(
    35% 0%,    /* Top left point */
    50% 8px,   /* Top center sharp point */
    65% 0%,    /* Top right point */
    65% 85%,   /* Right side down */
    50% 100%,  /* Bottom sharp point */
    35% 85%    /* Left side down */
  );
}

/* Horizontal beam of cross */
.sigil-inner::after {
  top: 40%;
  left: 0;
  width: 100%;
  height: 12px;
  transform: translateY(-50%);
  clip-path: polygon(
    0% 35%,    /* Left sharp point top */
    8px 50%,   /* Left center point */
    0% 65%,    /* Left sharp point bottom */
    85% 65%,   /* Right side */
    100% 50%,  /* Right sharp point */
    85% 35%    /* Right side top */
  );
}

/* Gothic ornamental details */
.sigil-inner {
  filter: drop-shadow(0 0 8px rgba(196,30,58,0.4));
}

.sigil-inner::before {
  background: 
    linear-gradient(180deg, #c41e3a 0%, #8b1538 30%, #c41e3a 45%, #8b1538 55%, #c41e3a 70%, #8b1538 100%),
    linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
}

.sigil-inner::after {
  background: 
    linear-gradient(90deg, #c41e3a 0%, #8b1538 30%, #c41e3a 45%, #8b1538 55%, #c41e3a 70%, #8b1538 100%),
    linear-gradient(180deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
}

@keyframes sigilPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(196,30,58,0.4), inset 0 0 20px rgba(196,30,58,0.1); }
  50% { box-shadow: 0 0 50px rgba(196,30,58,0.7), inset 0 0 30px rgba(196,30,58,0.2); }
}

@keyframes innerRotate {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Forms */
.entry-form {
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.request-form-container {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-out, opacity 0.3s ease-out;
  opacity: 0;
}

.request-form-container.active {
  max-height: 500px;
  opacity: 1;
}

.request-form {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 1rem;
}

/* Input Styling */
input, textarea {
  background: rgba(10, 5, 5, 0.8);
  border: 2px solid rgba(139, 134, 128, 0.3);
  border-radius: 4px;
  padding: 0.9rem;
  color: #e6dada;
  font-size: 1rem;
  font-family: 'Cormorant Garamond', serif;
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(2px);
}

textarea {
  text-align: left;
  resize: vertical;
  min-height: 80px;
  font-size: 0.9rem;
}

input:focus, textarea:focus {
  border: 2px solid #c41e3a;
  outline: none;
  box-shadow: 0 0 20px rgba(196,30,58,0.3);
  background: rgba(20, 10, 10, 0.9);
}

input::placeholder, textarea::placeholder {
  color: #8b8680;
  opacity: 0.8;
}

/* Button Styling */
button {
  background: linear-gradient(145deg, #c41e3a 0%, #8b1538 100%);
  border: 2px solid #c41e3a;
  border-radius: 4px;
  padding: 0.9rem;
  font-size: 1rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s ease;
}

button:hover {
  background: linear-gradient(145deg, #a2162e 0%, #6b1028 100%);
  box-shadow: 0 0 25px rgba(196,30,58,0.5);
  transform: translateY(-1px);
}

button:hover::before {
  left: 100%;
}

button:active {
  transform: translateY(0);
  box-shadow: 0 0 15px rgba(196,30,58,0.3);
}

/* Request Toggle Button */
.request-toggle {
  background: transparent;
  border: 2px solid rgba(139, 134, 128, 0.5);
  color: #8b8680;
  font-size: 0.9rem;
  padding: 0.7rem;
  margin: 1rem 0;
}

.request-toggle:hover {
  border-color: #c41e3a;
  color: #c41e3a;
  background: rgba(196, 30, 58, 0.1);
  box-shadow: 0 0 15px rgba(196,30,58,0.2);
}

/* Captcha Styling */
.captcha-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

.captcha-label {
  color: #8b8680;
  font-size: 0.9rem;
  text-align: center;
}

#mathProblem {
  color: #c41e3a;
  font-weight: 600;
}

#mathAnswer {
  max-width: 120px;
}

/* Message Styling */
.error-message, .success-message {
  font-size: 0.9rem;
  text-align: center;
  padding: 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  min-height: 20px;
}

.error-message {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.success-message {
  color: #51cf66;
  background: rgba(81, 207, 102, 0.1);
  border: 1px solid rgba(81, 207, 102, 0.3);
}

/* Animation for shake effect */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.5s ease-in-out;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 2rem 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, #8b8680, transparent);
  opacity: 0.4;
}

.divider-text {
  padding: 0 1rem;
  color: #8b8680;
  font-size: 0.9rem;
  font-style: italic;
  letter-spacing: 0.1em;
}

/* Audio Button */
.audio-toggle {
  position: absolute;
  bottom: 30px;
  right: 30px;
  background: rgba(10, 5, 5, 0.8);
  border: 2px solid rgba(196, 30, 58, 0.6);
  border-radius: 50%;
  padding: 0.8rem;
  color: #c41e3a;
  cursor: pointer;
  font-size: 1.3rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.audio-toggle:hover {
  background: rgba(196, 30, 58, 0.2);
  border-color: #c41e3a;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(196,30,58,0.4);
}

/* Fade out animation for page transitions */
.fade-out {
  opacity: 0;
  transition: opacity 1.5s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
  .title-main { font-size: 2.5rem; }
  .title-line { font-size: 1.2rem; }
  .gate { 
    max-width: 95%; 
    padding: 1.5rem;
  }
  .sigil { 
    width: 80px; 
    height: 80px; 
  }
}

/* Request Loading Overlay */
.request-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

.loading-content {
  text-align: center;
  color: #c41e3a;
}

.loading-sigil {
  width: 60px;
  height: 60px;
  margin: 0 auto 1.5rem;
  position: relative;
  animation: sigilSpin 2s linear infinite;
}

.loading-cross {
  position: relative;
  width: 100%;
  height: 100%;
}

.loading-vertical, .loading-horizontal {
  position: absolute;
  background: linear-gradient(45deg, #c41e3a 0%, #8b1538 50%, #c41e3a 100%);
  box-shadow: 0 0 20px rgba(196, 30, 58, 0.6);
}

.loading-vertical {
  width: 8px;
  height: 100%;
  left: 50%;
  transform: translateX(-50%);
  clip-path: polygon(30% 0%, 70% 0%, 100% 15%, 100% 85%, 70% 100%, 30% 100%, 0% 85%, 0% 15%);
}

.loading-horizontal {
  width: 100%;
  height: 8px;
  top: 45%;
  transform: translateY(-50%);
  clip-path: polygon(0% 30%, 15% 0%, 85% 0%, 100% 30%, 100% 70%, 85% 100%, 15% 100%, 0% 70%);
}

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

.loading-text {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.loading-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c41e3a;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.3s; }
.loading-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes loadingPulse {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1.2);
  }
}

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

@media (max-width: 480px) {
  .title-main { font-size: 2rem; }
  .title-line { font-size: 1rem; }
  .gate { padding: 1rem; }
  input, textarea, button { font-size: 0.9rem; }
  .loading-text { font-size: 1rem; }
  .loading-sigil { width: 50px; height: 50px; }
}
