@tailwind base;
@tailwind components;
@tailwind utilities;

/* Premium Header styling */
nav.bg-navy.sticky {
  background-color: rgba(26, 30, 66, 0.88) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2) !important;
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.3) !important;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Polished logo card */
nav a.group > div:first-child {
  position: relative;
  padding: 0.38rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff 0%, #f7f8fb 100%);
  box-shadow:
    0 10px 30px rgba(5, 10, 35, 0.28),
    0 0 0 1px rgba(212, 175, 55, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  overflow: hidden;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

nav a.group > div:first-child::after {
  content: '';
  position: absolute;
  right: 0.55rem;
  bottom: 0;
  left: 0.55rem;
  height: 2px;
  background: linear-gradient(90deg, transparent, #D4AF37, transparent);
}

nav a.group:hover > div:first-child {
  transform: translateY(-2px);
  box-shadow:
    0 14px 36px rgba(5, 10, 35, 0.34),
    0 0 0 1px rgba(212, 175, 55, 0.52);
}

nav a.group img {
  display: block;
  border-radius: 8px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

nav a.group:hover img {
  transform: scale(1.025) !important;
}

/* Navigation Links - Reduced spacing for desktop fitting */
nav .max-w-7xl {
  width: 100%;
  max-width: 100% !important;
}

nav .flex-shrink-0.group {
  max-width: 210px !important;
}

/* Desktop logo sizing */
@media (min-width: 1280px) {
  nav .flex-shrink-0.group {
    max-width: 170px !important;
  }

  nav a.group img {
    height: 3.2rem !important;
    width: auto !important;
  }
}

nav .space-x-6 {
  margin-left: 0.5rem !important;
  gap: clamp(0.45rem, 0.7vw, 0.75rem) !important;
  display: flex !important;
  flex-wrap: nowrap !important;
}

/* Tailwind's space-x utility already adds margins. Reset those margins so
   the custom gap above is not applied a second time. */
nav .space-x-6 > :not([hidden]) ~ :not([hidden]) {
  margin-left: 0 !important;
}

nav .space-x-6 > a {
  position: relative;
  text-decoration: none;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important; /* Slightly tighter tracking */
  padding: 0.4rem 0.2rem !important;
  font-size: 0.8rem !important; /* Smaller font to fit All */
  will-change: transform, color;
  transition: color 0.3s ease-out !important;
  overflow: hidden;
  white-space: nowrap;
}

/* Hero Section / Slide Adjustment */
/* Targeting common React hero patterns or the first section after nav */
main > div > section:first-of-type,
.swiper-container,
.hero-section,
.hero-slider {
  margin-top: -3.5rem !important; /* Lifting the section up significantly */
  padding-top: 3.5rem !important;
}

/* Specific background lifting if it is a background image */
section[style*="background-image"], .bg-cover, .hero-bg {
  background-position: center top -60px !important; /* Lift background image up further */
}



nav .space-x-6 > a::after {
  content: '';
  position: absolute;
  width: 0%;
  height: 2px;
  bottom: 0.2rem;
  left: 50%;
  background: linear-gradient(90deg, transparent, #D4AF37, transparent);
  transition: all 0.3s ease-in-out;
  transform: translateX(-50%);
  opacity: 0;
}

nav .space-x-6 > a:hover::after {
  width: 80%;
  opacity: 1;
}

nav .space-x-6 > a.text-gold::after {
  width: 100%;
  background: linear-gradient(90deg, #D4AF37, #FBE081);
  opacity: 1;
}

/* Header Buttons Spenden & Lang */
nav button.bg-gold {
  background: linear-gradient(135deg, #FBE081 0%, #D4AF37 100%) !important;
  color: #1A1E42 !important;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4), inset 0 1px 0 rgba(255,255,255,0.4) !important;
  border: none !important;
  text-shadow: 0 1px 1px rgba(255,255,255,0.4);
  transform: translateY(0);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

nav button.bg-gold:hover {
  transform: translateY(-2px) scale(1.06) !important;
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.6), inset 0 1px 0 rgba(255,255,255,0.6) !important;
}

nav button.bg-gold:active {
  transform: translateY(1px) scale(0.98) !important;
}

/* EN Language Button */
nav button[aria-label^="Switch"] {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  transition: all 0.3s ease;
}

nav button[aria-label^="Switch"]:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(212, 175, 55, 0.5);
  transform: scale(1.05);
}

/* SVG flag for the React language switcher. */
nav .site-language-button {
  display: inline-flex !important;
  align-items: center;
  gap: 0.4rem;
}

nav .site-language-button::before {
  content: '';
  width: 1.35rem;
  height: 0.9rem;
  flex: 0 0 auto;
  border-radius: 3px;
  background-image: var(--language-flag);
  background-position: center;
  background-size: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.38), 0 2px 5px rgba(0, 0, 0, 0.25);
}

nav .site-language-button > svg {
  display: none;
}

/* Flag-decorated native selectors on the Erwachsenenbildung page. */
nav .language-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

nav .language-picker .language-flag {
  position: absolute;
  z-index: 1;
  left: 0.55rem;
  width: 1.25rem;
  height: 0.82rem;
  border-radius: 3px;
  object-fit: cover;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.36), 0 2px 5px rgba(0, 0, 0, 0.22);
}

nav .language-picker .js-lang-selector {
  padding-left: 2.2rem !important;
}

/* Smooth, readable copy changes tied to each hero image. */
.hero-copy-dynamic {
  max-width: 70rem;
  margin-inline: auto;
}

.hero-copy-dynamic h1 span:first-child {
  font-size: clamp(2.5rem, 5vw, 4.75rem);
  line-height: 1.03;
  text-wrap: balance;
}

.hero-copy-dynamic h1 span:nth-child(2) {
  font-size: clamp(1.35rem, 2.5vw, 2.4rem);
  line-height: 1.2;
  text-wrap: balance;
}

.hero-copy-dynamic > p {
  max-width: 52rem;
  text-wrap: balance;
}

/* The complete desktop menu needs more room than Tailwind's default md
   breakpoint. Use the compact menu until it can fit without overlap. */
@media (min-width: 769px) and (max-width: 1279px) {
  nav .h-24 > .hidden.md\:block {
    display: none !important;
  }

  nav .h-24 > .md\:hidden {
    display: flex !important;
  }

  nav .h-24 {
    height: 5.5rem !important;
  }

  nav a.group img {
    height: 4rem !important;
    width: auto !important;
  }
}

/* Mobile responsive fixes & animations */
@media (max-width: 768px) {
  nav .h-24 {
    height: 5rem !important;
    padding: 0 0.5rem;
  }
  
  nav a.group img {
    height: 3.5rem !important;
  }

  /* Hamburger button polish */
  nav button.bg-navy-light {
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(0,0,0,0.2)) !important;
    border: 1px solid rgba(212, 175, 55, 0.3) !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease-out !important;
  }

  nav button.bg-navy-light:active {
    background: rgba(255,255,255,0.05) !important;
    transform: scale(0.95);
  }
  
  nav .max-w-7xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}
