/* =========================================================
   Header / Navigation
   Modern glassmorphism style
========================================================= */

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

@font-face {
  font-family: "Geologica";
  src: url("../fonts/Geologica-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geologica";
  src: url("../fonts/Geologica-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geologica";
  src: url("../fonts/Geologica-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

/* CSS Variables for header (compatible with index.css) */
:root {
  --header-pill-bg: rgba(17, 24, 17, 0.8);
  --header-pill-border: rgba(255, 255, 255, 0.08);
  --header-pill-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --header-pill-hover: rgba(255, 255, 255, 0.05);
  --header-text: rgba(240, 253, 244, 0.9);
  --header-text-muted: rgba(240, 253, 244, 0.6);
  --header-accent: #22c55e;
  --header-radius: 14px;
  --header-transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --header-pill-bg: rgba(255, 255, 255, 0.9);
  --header-pill-border: rgba(0, 0, 0, 0.08);
  --header-pill-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --header-pill-hover: rgba(0, 0, 0, 0.03);
  --header-text: rgba(10, 31, 10, 0.9);
  --header-text-muted: rgba(10, 31, 10, 0.5);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--header-accent);
  color: #07111f;
  padding: 12px 24px;
  border-radius: 0 0 var(--header-radius) var(--header-radius);
  z-index: 9999;
  transition: top 0.3s;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
}

.skip-link:focus {
  top: 0;
}

/* Topbar container */
.topbar {
  font-family: "Geologica", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  position: fixed;
  top: 24px;
  left: 0;
  right: 0;
  z-index: 1000;
  pointer-events: none;
}

.topbar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Pills (glass panels) */
.topbar__pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 12px;
  background: var(--header-pill-bg);
  border: 1px solid var(--header-pill-border);
  border-radius: var(--header-radius);
  box-shadow: var(--header-pill-shadow);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: all var(--header-transition);
}

.topbar__pill:hover {
  border-color: rgba(34, 197, 94, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(34, 197, 94, 0.1);
}

.topbar__pill--left { 
  gap: 16px; 
  padding-left: 16px;
}

.topbar__pill--right { 
  gap: 8px; 
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--header-text);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.brand:hover {
  opacity: 0.8;
}

.brand__icon {
  font-size: 22px;
  color: var(--header-accent);
  filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.4));
}

.brand__text {
  letter-spacing: -0.02em;
}

/* Navigation */
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav__link {
  position: relative;
  color: var(--header-text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 10px;
  transition: all var(--header-transition);
}

.topnav__link::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px;
  height: 2px;
  background: var(--header-accent);
  border-radius: 2px;
  transition: transform var(--header-transition);
  box-shadow: 0 0 8px var(--header-accent);
}

.topnav__link:hover {
  color: var(--header-text);
  background: var(--header-pill-hover);
}

.topnav__link.is-active {
  color: var(--header-text);
  background: rgba(34, 197, 94, 0.1);
}

.topnav__link.is-active::after {
  transform: translateX(-50%) scaleX(1);
}

/* Buttons in pills */
.pillbtn {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--header-pill-border);
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--header-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--header-transition);
}

.pillbtn:hover {
  background: var(--header-pill-hover);
  border-color: rgba(34, 197, 94, 0.3);
  transform: translateY(-1px);
}

.pillbtn--small {
  width: 40px;
  padding: 0;
  justify-content: center;
}

/* Theme toggle */
.theme-toggle .theme-icon {
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 16px;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(20deg) scale(1.1);
}

/* Language switch */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px solid var(--header-pill-border);
}

.lang-btn {
  width: 34px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--header-transition);
  position: relative;
  overflow: hidden;
}

.lang-btn img {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  display: block;
  object-fit: cover;
  transition: transform 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.lang-btn:hover {
  background: var(--header-pill-hover);
  transform: translateY(-1px);
}

.lang-btn:hover img {
  transform: scale(1.05);
}

.lang-btn.is-active {
  background: rgba(34, 197, 94, 0.15);
  box-shadow: 0 0 0 1.5px rgba(34, 197, 94, 0.5);
}

.lang-btn.is-active::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--header-accent);
  border-radius: 6px;
  opacity: 0.5;
}

/* Visually hidden text */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--header-text);
  border-radius: 8px;
  transition: background 0.2s;
}

.mobile-menu-btn:hover {
  background: var(--header-pill-hover);
}

.hamburger {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  position: relative;
  transition: all 0.3s;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: all 0.3s;
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

.mobile-menu-btn[aria-expanded="true"] {
  background: rgba(34, 197, 94, 0.1);
}

.mobile-menu-btn[aria-expanded="true"] .hamburger {
  background: transparent;
}

.mobile-menu-btn[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}

.mobile-menu-btn[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg);
  top: 0;
}

/* Mobile navigation */
.mobile-nav {
  position: absolute;
  top: calc(100% + 12px);
  left: 24px;
  right: 24px;
  background: var(--header-pill-bg);
  border: 1px solid var(--header-pill-border);
  border-radius: var(--header-radius);
  padding: 12px;
  box-shadow: var(--header-pill-shadow);
  backdrop-filter: blur(20px) saturate(180%);
  transform: translateY(-10px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--header-transition);
}

.mobile-nav:not([hidden]) {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.mobile-nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--header-text);
  text-decoration: none;
  border-radius: 10px;
  font-weight: 500;
  font-size: 15px;
  transition: all var(--header-transition);
}

.mobile-nav__link:hover,
.mobile-nav__link.is-active {
  background: rgba(34, 197, 94, 0.1);
  color: var(--header-accent);
}

.mobile-nav__link::before {
  content: '→';
  opacity: 0;
  transition: all 0.2s;
  font-size: 12px;
}

.mobile-nav__link:hover::before {
  opacity: 1;
  transform: translateX(4px);
}

/* Responsive */
@media (max-width: 900px) {
  .topbar {
    top: 16px;
  }
  
  .topbar__inner {
    padding: 0 16px;
  }
  
  .topnav {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .brand__text {
    display: none;
  }
  
  .theme-text {
    display: none;
  }
  
  .pillbtn {
    width: 40px;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .topbar__pill {
    height: 48px;
  }
  
  .topbar__pill--left {
    padding-left: 12px;
  }
  
  .lang-switch {
    gap: 4px;
  }
  
  .lang-btn {
    width: 32px;
    height: 24px;
  }
  
  .lang-btn img {
    width: 18px;
    height: 12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .topbar__pill,
  .topnav__link,
  .pillbtn,
  .lang-btn,
  .mobile-nav {
    transition: none;
  }
}