/* ========================================
   FILE: css/main.css
   Universal styles across all pages
   VERSION: 2.2 - Mobile Nav & Animations Fixed
   ======================================== */

:root {
  /* Core Colors */
  --ink: #0a1f2e;
  --ink-light: #1a3a4d;
  --muted: #5a7589;
  --muted-light: #7a95a9;
  --bg: #ffffff;
  --bg-subtle: #f8fafb;
  --line: #e1e8ed;
  --line-subtle: #f0f4f7;
  
  /* Accent Colors */
  --accent: #0ea5b7;
  --accent-dark: #0c8a9a;
  --accent-light: #3fc5d4;
  --accent-bg: #e6f7f9;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #0ea5b7 0%, #0c8a9a 100%);
  --gradient-dark: linear-gradient(135deg, #0a1f2e 0%, #1a3a4d 100%);
  --gradient-light: linear-gradient(135deg, #f8fafb 0%, #ffffff 100%);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(10, 31, 46, 0.06);
  --shadow-md: 0 4px 6px rgba(10, 31, 46, 0.08), 0 1px 3px rgba(10, 31, 46, 0.06);
  --shadow-lg: 0 10px 15px rgba(10, 31, 46, 0.1), 0 4px 6px rgba(10, 31, 46, 0.05);
  --shadow-xl: 0 20px 25px rgba(10, 31, 46, 0.12), 0 10px 10px rgba(10, 31, 46, 0.04);
  
  /* Spacing */
  --section-padding: 80px;
  --container-max: 1200px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   HEADER STYLES
   ======================================== */

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.logo:hover {
  opacity: 0.8;
}

.logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.logo-text h1 {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  color: var(--ink);
}

.logo-text p {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Header Social Icons */
.header-social-icons {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-social-icons a {
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 6px;
  border-radius: 6px;
}

.header-social-icons a:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.header-social-icons svg {
  width: 20px;
  height: 20px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

/* Language Toggle - OUTSIDE navigation */
.language-toggle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.lang-btn {
  background: var(--bg-subtle);
  color: var(--accent);
  border: 2px solid var(--line);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.lang-text {
  font-weight: 700;
}

/* Desktop Navigation */
nav {
  display: flex;
  align-items: center;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
}

nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

nav a:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

nav a.active {
  color: var(--accent);
  background: var(--accent-bg);
}

/* Hamburger Menu */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  z-index: 103;
  width: 30px;
  height: 24px;
  position: relative;
  background: none;
  border: none;
  padding: 0;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--ink);
  border-radius: 3px;
  position: absolute;
  transition: all 0.3s ease-in-out;
}

.hamburger span:nth-child(1) {
  top: 0;
}

.hamburger span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.hamburger span:nth-child(3) {
  bottom: 0;
}

/* Hamburger to X animation */
.hamburger.active span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  z-index: 101;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
  overflow-y: auto;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
}

.mobile-menu-overlay.active {
  display: flex;
  opacity: 1;
  visibility: visible;
}

/* Force mobile menu items to be visible - override any animate-on-scroll */
/* Only apply when menu is ACTIVE to prevent invisible overlay blocking page */
.mobile-menu-overlay.active * {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Exclude hamburger spans from transform override so X animation works */
.mobile-menu-overlay .hamburger span {
  transform: none;
}

.mobile-menu-overlay .hamburger.active span:nth-child(1) {
  top: 50%;
  transform: translateY(-50%) rotate(45deg) !important;
}

.mobile-menu-overlay .hamburger.active span:nth-child(2) {
  opacity: 0 !important;
}

.mobile-menu-overlay .hamburger.active span:nth-child(3) {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg) !important;
}

/* Hamburger X button inside mobile overlay - only show when menu is active */
.mobile-menu-overlay.active .hamburger {
  display: flex !important;
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 104;
}

.mobile-menu-overlay .hamburger span {
  background: var(--ink);
}

/* Mobile Menu Logo */
.mobile-menu-logo {
  text-align: center;
  padding: 4rem 0 2rem;
  width: 100%;
}

.mobile-menu-logo img {
  width: 120px;
  height: auto;
  margin: 0 auto;
}

/* Mobile Navigation */
.mobile-menu-overlay nav {
  display: block !important;
  padding: 0;
  width: 100%;
}

.mobile-menu-overlay nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.mobile-menu-overlay nav a {
  font-size: 1.5rem;
  padding: 1rem 2rem;
  color: var(--ink);
  display: block;
  text-align: center;
  width: 100%;
}

.mobile-menu-overlay nav a:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

/* Mobile Social Icons */
.mobile-social-icons {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  padding: 2rem 0;
  width: 100%;
}

.mobile-social-icons a {
  color: var(--muted);
  transition: color 0.3s, transform 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-social-icons a:hover {
  color: var(--accent);
  transform: scale(1.1);
}

.mobile-social-icons svg {
  width: 32px;
  height: 32px;
}

/* ========================================
   FOOTER STYLES
   ======================================== */

footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.8);
  padding: 60px 0 0;
  margin-top: 80px;
}

.footer-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 40px 40px;
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-brand .brand {
  color: white;
  margin-bottom: 16px;
}

.footer-brand .brand-mark {
  width: 40px;
  height: 40px;
}

.footer-tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
}

.footer-section h3 {
  color: white;
  font-weight: 700;
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer-section a,
.footer-link {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  margin-bottom: 8px;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.footer-section a:hover,
.footer-link:hover {
  color: var(--accent-light);
}

.footer-bottom {
  padding: 24px 0;
}

.footer-bottom .wrap {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 40px;
}

.footer-bottom p {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */

.scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 100;
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.scroll-top svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   UNIVERSAL ANIMATIONS
   ======================================== */

.animate-on-scroll {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll.hidden-top {
  opacity: 0;
  transform: translateY(-50px);
}

.animate-on-scroll.hidden-bottom {
  opacity: 0;
  transform: translateY(50px);
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
  color: var(--accent);
}

.btn-large {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

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

@media (max-width: 1024px) {
  :root {
    --section-padding: 60px;
  }
  
  .header-content,
  .footer-content,
  .footer-bottom .wrap {
    padding-left: 24px;
    padding-right: 24px;
  }
  
  .footer-content {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 768px) {
  :root {
    --section-padding: 50px;
  }
  
  .header-content {
    padding: 12px 20px;
  }
  
  .logo img {
    width: 36px;
    height: 36px;
  }
  
  .logo-text {
    display: none;
  }
  
  .header-social-icons {
    gap: 8px;
  }
  
  .header-social-icons svg {
    width: 18px;
    height: 18px;
  }
  
  .header-right {
    gap: 12px;
  }
  
  .lang-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  
  .header-right nav {
    display: none !important;
  }
  
  .hamburger {
    display: flex;
  }
  
  footer {
    margin-top: 60px;
    padding: 40px 0 0;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 0 20px 32px;
  }
  
  .footer-bottom .wrap {
    padding: 0 20px;
  }
  
  .scroll-top {
    bottom: 20px;
    right: 20px;
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  .header-content {
    padding: 10px 16px;
  }
  
  .logo img {
    width: 32px;
    height: 32px;
  }
  
  .header-social-icons {
    display: none;
  }
  
  .header-right {
    gap: 10px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .animate-on-scroll {
    opacity: 1;
    transform: none;
  }
}