/* custom.css — Things Tailwind CDN cannot handle */

/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* Prevent any horizontal page overflow */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body > * {
  max-width: 100%;
}

/* Scroll-reveal animation classes (JS-driven) */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.6s cubic-bezier(0.22,1,0.36,1), transform 0.6s cubic-bezier(0.22,1,0.36,1); }
.reveal.revealed { opacity: 1; transform: none; }
.reveal--left { transform: translateX(-30px); }
.reveal--right { transform: translateX(30px); }
.reveal--scale { transform: scale(0.95); }
.reveal--left.revealed, .reveal--right.revealed, .reveal--scale.revealed { opacity: 1; transform: none; }
.reveal--delay-1 { transition-delay: 100ms; }
.reveal--delay-2 { transition-delay: 200ms; }
.reveal--delay-3 { transition-delay: 300ms; }
.reveal--delay-4 { transition-delay: 400ms; }

/* Hero entrance animations */
@keyframes fadeInUp { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }
@keyframes float { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-15px); } }
.hero-animate-title { opacity:0; animation: fadeInUp 0.8s cubic-bezier(0.22,1,0.36,1) 0.6s forwards; }
.hero-animate-subtitle { opacity:0; animation: fadeInUp 0.8s cubic-bezier(0.22,1,0.36,1) 0.9s forwards; }
.hero-animate-cta { opacity:0; animation: fadeInUp 0.8s cubic-bezier(0.22,1,0.36,1) 1.2s forwards; }
.hero-pattern-float { animation: float 20s ease-in-out infinite; }

/* Stagger children */
.stagger-children > * { opacity:0; animation: fadeInUp 0.6s cubic-bezier(0.22,1,0.36,1) forwards; }
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 100ms; }
.stagger-children > *:nth-child(3) { animation-delay: 200ms; }
.stagger-children > *:nth-child(4) { animation-delay: 300ms; }
.stagger-children > *:nth-child(5) { animation-delay: 400ms; }
.stagger-children > *:nth-child(6) { animation-delay: 500ms; }

/* Language fade */
body.lang-fade-out { opacity:0; transition: opacity 0.3s ease; }
body.menu-open { overflow: hidden; }

/* Header brand handling for long organization names */
.site-brand {
  max-width: min(32rem, 42vw);
}
.site-brand__short,
.site-brand__legal {
  display: block;
  min-width: 0;
}
.site-brand__legal {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Mobile navigation overlay */
.mobile-menu-overlay { pointer-events: none; }
.mobile-menu-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
.mobile-menu-overlay nav {
  width: min(100%, 24rem);
  max-width: calc(100vw - 2rem);
  padding-inline: 1rem;
}
.mobile-menu__link {
  text-align: center;
  overflow-wrap: anywhere;
}

/* Scroll-to-top button */
.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal, .reveal--left, .reveal--right, .reveal--scale { opacity:1; transform:none; }
  .hero-animate-title, .hero-animate-subtitle, .hero-animate-cta, .stagger-children > * { opacity:1; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f0eeeb; }
::-webkit-scrollbar-thumb { background: #7a7a8e; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #4a4a5e; }

/* Nav toggle X animation */
.nav-toggle.active .nav-toggle__line:first-child { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active .nav-toggle__line:nth-child(2) { opacity: 0; }
.nav-toggle.active .nav-toggle__line:last-child { transform: translateY(-7px) rotate(-45deg); }

/* Slideshow image treatment */
.ss-stage-overlay {
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.12), transparent 42%),
    linear-gradient(180deg, rgba(10,12,24,0.06) 0%, rgba(10,12,24,0.24) 100%);
}
.ss-slide-image { transform: scale(1.02); transition: transform 6s cubic-bezier(0.22,1,0.36,1); }
.ss-slide-image--active { transform: scale(1.08); }
.ss-slide-caption {
  padding: 1.25rem 1.25rem 1.5rem;
  padding-top: 5rem;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.35), transparent);
}
.ss-nav-btn {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}
.ss-nav-btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.35);
  transform: translateY(-50%) scale(1.05);
}
.ss-controls {
  padding: 0.5rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.2);
  backdrop-filter: blur(12px);
}
.ss-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.45);
  transition: width 0.35s ease, background-color 0.35s ease, transform 0.35s ease;
}
.ss-dot:hover { background: rgba(255,255,255,0.7); }
.ss-dot--active {
  width: 1.5rem;
  background: #fff;
}

/* Gallery preview grid */
.gallery-preview-shell {
  position: relative;
  padding: 1.25rem;
  border: 1px solid rgba(50, 18, 122, 0.08);
  border-radius: 1.5rem;
  background:
    radial-gradient(circle at top, rgba(50,18,122,0.05), transparent 42%),
    linear-gradient(180deg, rgba(250,249,247,0.95), rgba(255,255,255,1));
  box-shadow: 0 18px 50px rgba(26, 10, 62, 0.05);
}
.gallery-preview-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 1rem;
  background: #ece8e1;
  border: 1px solid rgba(50, 18, 122, 0.06);
  box-shadow: 0 10px 24px rgba(26, 10, 62, 0.06);
}
.gallery-preview-image {
  transition: transform 0.6s cubic-bezier(0.22,1,0.36,1), filter 0.6s ease;
}
.gallery-preview-item:hover .gallery-preview-image {
  transform: scale(1.07);
  filter: saturate(1.05) contrast(1.03);
}
.gallery-preview-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.22), transparent 40%, transparent 60%, rgba(255,255,255,0.1));
  opacity: 0;
  transition: opacity 0.35s ease;
}
.gallery-preview-item:hover .gallery-preview-shine {
  opacity: 1;
}

@media (min-width: 640px) {
  .ss-slide-caption {
    padding: 1.5rem 1.5rem 1.75rem;
    padding-top: 5.5rem;
  }

  .ss-nav-btn {
    width: 3rem;
    height: 3rem;
  }

  .gallery-preview-shell {
    padding: 1.5rem;
  }
}

@media (max-width: 1279px) {
  .site-brand {
    max-width: min(18rem, 58vw);
  }
}

@media (min-width: 1120px) and (max-width: 1535px) {
  .site-header__nav {
    display: block;
    margin-inline: 5px;
  }

  .site-header__nav a {
    padding-inline: 0.65rem;
  }

  .nav-toggle {
    display: none;
  }
}

@media (max-width: 500px) {
  .site-header__inner {
    gap: 0.5rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
  }

  .site-brand {
    max-width: min(16rem, calc(100vw - 8rem));
  }

  .lang-switch {
    display: inline-flex;
    padding: 0.45rem 0.7rem;
    gap: 0.45rem;
    font-size: 0.85rem;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .lang-switch span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .lang-switch img {
    width: 1rem;
    height: auto;
  }

  .nav-toggle {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 auto;
  }

  .mobile-menu-overlay {
    padding: 1rem;
  }

  .mobile-menu__link {
    font-size: 1.4rem;
    line-height: 1.2;
  }
}

@media (max-width: 460px) {
  .site-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand burger"
      "switch switch";
    align-items: center;
    gap: 0.55rem 0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .site-header__inner > a:first-child {
    grid-area: brand;
  }

  .site-header__actions {
    display: contents;
  }

  .lang-switch {
    grid-area: switch;
    justify-self: start;
    padding: 0.45rem 0.7rem;
    max-width: 100%;
  }

  .nav-toggle {
    grid-area: burger;
    justify-self: end;
    width: 2.35rem;
    height: 2.35rem;
    gap: 4px;
  }

  .nav-toggle__line {
    width: 1.2rem;
  }
}

@media (max-width: 375px) {
  .site-brand {
    max-width: 100%;
  }

  .nav-toggle {
    width: 2.2rem;
    height: 2.2rem;
  }

  .nav-toggle__line {
    width: 1.1rem;
  }

  .lang-switch {
    padding-inline: 0.6rem;
  }
}

/* Admin toast entrance */
.admin-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: grid;
  gap: 0.75rem;
  width: min(24rem, calc(100vw - 2rem));
}
.admin-toast {
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(229, 231, 235, 0.9);
  background: #fff;
  box-shadow: 0 18px 45px rgba(26, 10, 62, 0.12);
  color: #1f2937;
  font-size: 0.875rem;
  font-weight: 500;
  transform: translateX(120%);
  transition: transform 0.35s, opacity 0.35s;
  opacity: 0;
}
.admin-toast--success { border-color: rgba(34, 197, 94, 0.28); color: #166534; }
.admin-toast--error { border-color: rgba(239, 68, 68, 0.28); color: #991b1b; }
.admin-toast--visible { transform: translateX(0); opacity: 1; }

/* Form field error state */
.is-invalid { border-color: #c81d11 !important; }
.field-error { display: block; font-size: 0.8rem; color: #c81d11; margin-top: 0.25rem; }
.form-alert { padding: 0.75rem 1rem; border-radius: 0.5rem; margin-bottom: 1rem; }
.form-alert--success { background: #f0faf8; color: #065f53; border-left: 4px solid #00a693; }
.form-alert--error { background: #fef5f4; color: #8b1a10; border-left: 4px solid #c81d11; }

/* HP field (honeypot) */
.honeypot-field {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.hp-field {
  width: 1px;
  height: 1px;
}
