@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========== CSS Custom Properties ========== */
:root {
  --color-primary: #1a2744;
  --color-accent: #3da5d9;
  --color-accent-hover: #2e8fbf;
  --color-light-bg: #f5f7fa;
  --color-white: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --max-width: 1200px;
  --header-height: 72px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-text);
  background-color: var(--color-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

ul {
  list-style: none;
}

/* ========== Header ========== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: var(--color-white);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 48px);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* When NOT scrolled and JS has removed .scrolled - transparent over hero */
header:not(.scrolled) {
  background-color: transparent;
  box-shadow: none;
}

/* Solid state (default + when .scrolled is added back) */
header.scrolled {
  background-color: var(--color-white);
  box-shadow: var(--shadow-sm);
}

/* Transparent state - make all text/links white for readability over hero image */
header:not(.scrolled) .header-left h1 {
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

header:not(.scrolled) .header-nav a {
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

header:not(.scrolled) .header-nav a:hover {
  background-color: rgba(255,255,255,0.15);
  color: #ffffff;
}

header:not(.scrolled) .header-nav a.active {
  background-color: rgba(255,255,255,0.25);
  color: #ffffff;
}

header:not(.scrolled) .header-nav a.portal-link {
  background: #3da5d9 !important;
  color: #fff !important;
}

header:not(.scrolled) .dark-mode-toggle {
  color: #ffffff;
  border-color: rgba(255,255,255,0.3);
}

header:not(.scrolled) .language-flags {
  border-left-color: rgba(255,255,255,0.3);
}

header:not(.scrolled) .language-flags img {
  opacity: 0.9;
}

header:not(.scrolled) .hamburger span {
  background: #ffffff;
}

/* Logo filter for transparent header (dark hero background needs light logo) */
header:not(.scrolled) .header-left img {
  filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

.header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex-direction: row;
  flex-wrap: nowrap;
  min-width: 0;
}

.logo-link h1 {
  display: inline;
  white-space: nowrap;
}

.logo-link:hover {
  color: inherit;
  opacity: 0.85;
}

.header-left img {
  height: 44px;
  width: auto;
}

.header-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* Desktop Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-nav a {
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.header-nav a:hover {
  background-color: var(--color-light-bg);
  color: var(--color-accent);
}

.header-nav a.portal-link {
  background: linear-gradient(135deg, #3da5d9 0%, #2a7fb5 100%) !important;
  color: #fff !important;
  border-radius: 6px;
  padding: 8px 14px;
}

.header-nav a.portal-link:hover {
  background: linear-gradient(135deg, #2a7fb5 0%, #1f6a99 100%) !important;
}

.header-nav a.active {
  background: linear-gradient(135deg, #2e8fbf 0%, #3da5d9 50%, #2e8fbf 100%);
  color: var(--color-white);
}

/* Language Flags */
.language-flags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--color-border);
}

.language-flags img {
  width: 24px;
  height: auto;
  border-radius: 2px;
  opacity: 0.7;
  cursor: default;
  transition: opacity var(--transition);
}

.language-flags img:hover {
  opacity: 1;
}

/* Hamburger Button */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
  z-index: 1100;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2.5px;
  background-color: var(--color-primary);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

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

.hamburger.open span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Mobile Nav Overlay */
.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100vh;
  background-color: var(--color-white);
  z-index: 1050;
  padding: 100px 32px 40px;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition), visibility var(--transition);
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
}

.mobile-nav.open {
  transform: translateX(0);
  visibility: visible;
}

.mobile-nav a {
  display: block;
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 500;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  transition: color var(--transition), padding-left var(--transition);
}

.mobile-nav a:hover,
.mobile-nav a.active {
  color: var(--color-accent);
  padding-left: 8px;
}

.mobile-nav .mobile-flags {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
}

.mobile-nav .mobile-flags img {
  width: 28px;
  border-radius: 2px;
  opacity: 0.7;
  cursor: default;
}

.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.mobile-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* ========== Main Content ========== */
main {
  padding-top: var(--header-height);
  flex: 1;
}

/* When header is transparent, hero should go behind it */
body.hero-page main {
  padding-top: 0;
}

body.hero-page .hero-section {
  padding-top: var(--header-height);
}

/* ========== Hero Section ========== */
.hero-section {
  position: relative;
  width: 100%;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary) 0%, #243b5e 50%, var(--color-accent) 100%);
}

.hero-section img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.25;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 60px 24px;
  max-width: var(--max-width);
}

.hero-content h2 {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--color-white);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero-content p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: rgba(255, 255, 255, 0.85);
  max-width: 640px;
  margin: 0 auto;
  font-weight: 300;
}

/* ========== Sections ========== */
.section {
  padding: 64px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* Celebration animation for 25% */
.celebrate-number {
  display: inline-block;
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #3da5d9 0%, #1f6a99 100%);
  padding: 4px 14px;
  border-radius: 8px;
  position: relative;
  transform: scale(0.3);
  opacity: 0;
}

/* Only animate when parent .reveal becomes .visible */
.visible .celebrate-number {
  animation: celebratePop 0.6s ease-out 0.3s both, celebrateGlow 2s ease-in-out 1s infinite;
}

@keyframes celebratePop {
  0% { transform: scale(0.3) rotate(-10deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(3deg); }
  70% { transform: scale(0.9) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes celebrateGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 165, 217, 0); }
  50% { box-shadow: 0 0 16px 4px rgba(61, 165, 217, 0.35); }
}

/* Sparkle particles */
.celebrate-number::before,
.celebrate-number::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3da5d9;
  transform: scale(0);
  opacity: 0;
}

.visible .celebrate-number::before,
.visible .celebrate-number::after {
  animation: sparkle 0.8s ease-out 0.5s both;
}

.celebrate-number::before {
  top: -8px;
  left: -4px;
  box-shadow: 20px -12px 0 #f59e0b, 50px -6px 0 #22c55e, -10px -18px 0 #a855f7;
}

.celebrate-number::after {
  bottom: -8px;
  right: -4px;
  box-shadow: -20px 12px 0 #f59e0b, -50px 6px 0 #ef4444, 10px 18px 0 #22c55e;
}

@keyframes sparkle {
  0% { transform: scale(0); opacity: 1; }
  50% { transform: scale(1.5); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

.section-alt {
  background: linear-gradient(180deg, var(--color-light-bg) 0%, #eaeff5 100%);
}

.section-alt .section {
  padding: 64px 24px;
}

.section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-top: 32px;
  margin-bottom: 12px;
}

.section p {
  font-size: 1.05rem;
  color: var(--color-text-light);
  line-height: 1.75;
  margin-bottom: 16px;
  max-width: 800px;
}

.section ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 24px;
  max-width: 800px;
}

.section ul li {
  position: relative;
  padding: 10px 0 10px 24px;
  font-size: 1.05rem;
  color: var(--color-text-light);
  line-height: 1.6;
}

.section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  width: 8px;
  height: 8px;
  background-color: var(--color-accent);
  border-radius: 50%;
}

.section-centered {
  text-align: center;
}

.section-centered p {
  margin-left: auto;
  margin-right: auto;
}

/* ========== Grid Cards ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.grid-item {
  background: linear-gradient(145deg, #f0f7fd 0%, #e4f0fa 100%);
  border: 1px solid #d0e3f2;
  border-radius: var(--radius-md);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.grid-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(145deg, #ddedf9 0%, #c5e0f5 100%);
}

/* Card hover background image */
.card-hover-img {
  position: relative;
  overflow: hidden;
}

.card-hover-img::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--hover-img);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
}

.card-hover-img:hover::before {
  opacity: 0.15;
}

.card-hover-img > * {
  position: relative;
  z-index: 1;
}

.grid-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 10px;
}

.grid-item p {
  font-size: 0.95rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* ========== Hero Frames (About page) ========== */
.hero-frames {
  width: 100%;
  overflow: hidden;
  background-color: #000;
  border-radius: var(--radius-md);
  margin: 32px 0;
}

.hero-frames img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

/* ========== FAQ Styles ========== */
.faq-search {
  margin: 0 auto;
  padding: 40px 24px 0;
  max-width: 600px;
  text-align: center;
}

.faq-search input {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--color-white);
}

.faq-search input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(61, 165, 217, 0.15);
}

.faq-list {
  margin: 24px auto 0;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 24px 64px;
}

.faq-item {
  background: linear-gradient(135deg, #edf4fb 0%, #e0edfa 100%);
  padding: 18px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  font-weight: 500;
  color: var(--color-primary);
}

.faq-item:hover {
  background: linear-gradient(135deg, #d4e6f7 0%, #bdd8f0 100%);
  transform: translateX(4px);
}

/* ========== Back Button ========== */
.back-button {
  display: inline-block;
  padding: 12px 24px;
  margin-top: 24px;
  background: linear-gradient(135deg, #f0f4ff 0%, #dce8f5 100%);
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), transform var(--transition);
  box-shadow: var(--shadow-sm);
}

.back-button:hover {
  background: linear-gradient(135deg, #dce8f5 0%, #c5d8ed 100%);
  color: var(--color-primary);
  transform: translateX(-2px);
}

/* ========== Footer ========== */
footer {
  background: linear-gradient(135deg, #1a2744 0%, #243b5e 100%);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 32px 24px;
  font-size: 0.875rem;
  margin-top: auto;
}

footer strong {
  color: var(--color-white);
  font-weight: 600;
}

/* ========== Scroll Reveal ========== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Responsive ========== */
@media (max-width: 1350px) {
  .header-nav {
    display: none;
  }

  .language-flags {
    display: none;
  }

  .hamburger {
    display: flex;
  }

  .mobile-nav {
    display: block; /* enable on mobile, still hidden via transform */
  }

  .hero-section {
    min-height: 260px;
  }

  .section {
    padding: 40px 20px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .grid-item {
    padding: 24px 20px;
  }
}

/* Logo dark mode - invert dark navy to white, preserve blue */
body.dark-mode .header-left img {
  filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

/* ========== Dark Mode Toggle Button ========== */
.dark-mode-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--color-text);
  transition: background 0.3s ease, border-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dark-mode-icon {
  display: inline-block;
  width: 1.2em;
  text-align: center;
  line-height: 1;
}

.dark-mode-toggle:hover {
  background: linear-gradient(135deg, var(--color-light-bg) 0%, #e0e8f0 100%);
}

/* ========== Dark Mode ========== */
body.dark-mode {
  --color-primary: #e2e8f0;
  --color-accent: #5bbee8;
  --color-accent-hover: #7dcef0;
  --color-text: #e2e8f0;
  --color-text-light: #a0aec0;
  --color-bg: #0f172a;
  --color-white: #1e293b;
  --color-light-bg: #1e293b;
  --color-border: #334155;
}

body.dark-mode {
  background-color: #0f172a;
}

body.dark-mode header.scrolled {
  background: #1e293b;
  border-bottom-color: #334155;
}

/* Dark mode transparent header - logo already inverted by :not(.scrolled) rule */
body.dark-mode header:not(.scrolled) .header-left img {
  filter: invert(1) hue-rotate(180deg) brightness(1.2);
}

body.dark-mode .grid-item {
  background: linear-gradient(145deg, #1e293b 0%, #253347 100%);
  border-color: #334155;
}

body.dark-mode .grid-item:hover {
  border-color: #5bbee8;
  background: linear-gradient(145deg, #253347 0%, #2d4058 100%);
}

body.dark-mode footer {
  background: linear-gradient(135deg, #0b1120 0%, #162033 100%);
}

body.dark-mode .hero-section {
  background: linear-gradient(135deg, #1a2744 0%, #243b5e 50%, #2e6a8a 100%);
}

body.dark-mode .hero-section img {
  opacity: 0.15;
}

body.dark-mode .hero-content h2 {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

body.dark-mode .hero-content p {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

body.dark-mode .section-alt {
  background: linear-gradient(180deg, #1e293b 0%, #1a2536 100%);
}

body.dark-mode .mobile-nav {
  background: #1e293b;
}

body.dark-mode .hamburger span {
  background: #e2e8f0;
}


body.dark-mode .faq-item {
  background: linear-gradient(135deg, #1e293b 0%, #253347 100%);
}

body.dark-mode .faq-item:hover {
  background: linear-gradient(135deg, #253347 0%, #334155 100%);
}

body.dark-mode .faq-search input {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .back-button {
  background: linear-gradient(135deg, #334155 0%, #3d4f66 100%);
  color: #e2e8f0;
}

body.dark-mode .back-button:hover {
  background: linear-gradient(135deg, #3d4f66 0%, #475569 100%);
}

@media (max-width: 480px) {
  .header-left h1 {
    font-size: 1.05rem;
  }

  .header-left img {
    height: 36px;
  }

  .hero-content h2 {
    font-size: 1.5rem;
  }

  .section h2 {
    font-size: 1.4rem;
  }
}
