/* ============================================
   FLOWGINEERING — Layout Components
   ============================================ */

/* ── Header / Navigation ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  z-index: var(--z-fixed);
  background: transparent;
  transition: all var(--transition-base);
}

.header--scrolled {
  height: var(--header-height-scrolled);
  background: var(--bg-surface-overlay);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color-light);
  box-shadow: var(--shadow-sm);
}

.header__inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  z-index: 10;
}

.header__logo-img {
  height: 36px;
  width: auto;
}

.header__logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-heading);
  letter-spacing: var(--letter-spacing-tight);
}

.header--scrolled .header__logo-text,
.header--hero .header__logo-text {
  color: var(--text-heading);
}

/* ── Transparent header over dark hero (light mode fix) ──
   When header has no background it floats over the dark
   hero/page-header gradient. Force white text so it's
   readable regardless of the active colour theme.        */
.header:not(.header--scrolled) .header__logo-text {
  color: rgba(255, 255, 255, 0.95);
}

.header:not(.header--scrolled) .header__logo-img {
  filter: brightness(0) invert(1);
}

.header:not(.header--scrolled) .nav__link {
  color: rgba(255, 255, 255, 0.75);
}

.header:not(.header--scrolled) .nav__link:hover {
  color: rgba(255, 255, 255, 1);
  background: rgba(255, 255, 255, 0.08);
}

.header:not(.header--scrolled) .nav__link--active {
  color: var(--color-primary-light);
  background: rgba(255, 255, 255, 0.08);
}

.header:not(.header--scrolled) .theme-toggle {
  color: rgba(255, 255, 255, 0.75);
}

.header:not(.header--scrolled) .theme-toggle:hover {
  color: rgba(255, 255, 255, 1);
  background: rgba(255, 255, 255, 0.08);
}

.header:not(.header--scrolled) .lang-toggle {
  background: rgba(255, 255, 255, 0.1);
}

.header:not(.header--scrolled) .lang-toggle__btn {
  color: rgba(255, 255, 255, 0.7);
}

.header:not(.header--scrolled) .lang-toggle__btn--active {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 1);
  box-shadow: none;
}

.header:not(.header--scrolled) .mobile-toggle span {
  background: rgba(255, 255, 255, 0.9);
}

/* CTA button stays visible with its own primary style */
.header:not(.header--scrolled) .header__cta.btn--primary {
  box-shadow: 0 4px 14px rgba(0, 180, 216, 0.4);
}


/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.nav__link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.nav__link:hover,
.nav__link--active {
  color: var(--color-primary);
  background: var(--color-primary-50);
}

.nav__link--active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

/* Header Controls */
.header__controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header__cta {
  margin-left: var(--space-4);
}

/* ── Language Toggle ── */
.lang-toggle {
  display: flex;
  align-items: center;
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
  padding: 2px;
  gap: 0;
}

.lang-toggle__btn {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
  background: transparent;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.lang-toggle__btn--active {
  background: var(--color-white);
  color: var(--color-primary);
  box-shadow: var(--shadow-xs);
}

/* ── Theme Toggle ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--color-primary-50);
  color: var(--color-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }

[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ── Mobile Menu ── */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  z-index: 10;
}

.mobile-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
}

.mobile-toggle--active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

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

.mobile-toggle--active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ── Footer ── */
.footer {
  background: var(--color-secondary);
  color: var(--color-gray-300);
  padding: var(--space-16) 0 var(--space-8);
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-10);
  margin-bottom: var(--space-12);
}

.footer__brand {
  max-width: 300px;
}

.footer__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  text-decoration: none;
}

.footer__logo-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-white);
}

.footer__brand-text {
  font-size: var(--font-size-sm);
  color: var(--color-gray-400);
  line-height: var(--line-height-relaxed);
  margin-bottom: var(--space-6);
}

.footer__heading {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-white);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-widest);
  margin-bottom: var(--space-5);
}

.footer__links {
  list-style: none;
  padding: 0;
}

.footer__links li {
  margin-bottom: var(--space-3);
  color: var(--color-gray-400);
}

.footer__links a {
  font-size: var(--font-size-sm);
  color: var(--color-gray-400);
  transition: color var(--transition-fast);
  text-decoration: none;
}

.footer__links a:hover {
  color: var(--color-primary-light);
}

.footer__bottom {
  padding-top: var(--space-8);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__copyright {
  font-size: var(--font-size-sm);
  color: var(--color-gray-500);
}

.footer__legal {
  display: flex;
  gap: var(--space-6);
}

.footer__legal a {
  font-size: var(--font-size-sm);
  color: var(--color-gray-500);
  transition: color var(--transition-fast);
  text-decoration: none;
}

.footer__legal a:hover {
  color: var(--color-primary-light);
}

/* ── Grid Layouts ── */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.grid--gap-lg { gap: var(--space-8); }
.grid--gap-xl { gap: var(--space-10); }

/* ── Flex Utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  /* Mobile Menu */
  .mobile-toggle { display: flex; }

  .nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 380px;
    height: 100vh;
    background: var(--bg-surface);
    flex-direction: column;
    align-items: flex-start;
    padding: calc(var(--header-height) + var(--space-6)) var(--space-6) var(--space-6);
    gap: var(--space-1);
    transition: right var(--transition-base);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
  }

  .nav--open {
    right: 0;
  }

  .nav__link {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
  }

  .header__cta {
    margin-left: 0;
    width: 100%;
    margin-top: var(--space-4);
  }

  .header__cta .btn {
    width: 100%;
    justify-content: center;
  }

  .mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
  }

  .mobile-overlay--visible {
    opacity: 1;
    visibility: visible;
  }

  .grid--2,
  .grid--3 { grid-template-columns: 1fr; }

  .footer__grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .footer__bottom { flex-direction: column; text-align: center; }
  .footer__legal { justify-content: center; }
}
