/* ============================================
   LAYOUT – Header, Nav, Grid, Footer
   ============================================ */

/* ── Header / Floating Glass Navbar ── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: var(--border-subtle);
  z-index: var(--z-sticky);
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--glass-shadow);
}

/* Adjust header placement if viewport has a frame */
@media (min-width: 1280px) {
  .header {
    top: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
  }
}

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

.header__logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: var(--ls-tight);
}

.header__logo-img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  box-shadow: 0 0 16px var(--primary-glow);
  transition: all var(--duration-normal) var(--ease-out);
  object-fit: cover;
}

.header__logo:hover .header__logo-img {
  transform: rotate(6deg) scale(1.08);
  box-shadow: 0 0 24px var(--primary-light);
}

.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header__nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-out);
  text-decoration: none;
  position: relative;
}

.header__nav-link:hover {
  color: var(--text-primary);
  background: hsla(240, 10%, 100%, 0.04);
}

/* Beautiful Glowing Cyan Active Tab Indicator */
.header__nav-link--active {
  color: var(--text-primary);
  background: hsla(240, 10%, 100%, 0.06);
  border: var(--border-subtle);
  box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

.header__nav-link--active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
  box-shadow: 0 0 12px var(--primary-light), 0 0 4px var(--primary);
  animation: tab-pulse 2s infinite alternate;
}

@keyframes tab-pulse {
  0% { opacity: 0.7; box-shadow: 0 0 8px var(--secondary-light); }
  100% { opacity: 1; box-shadow: 0 0 16px var(--secondary-light), 0 0 6px var(--secondary); }
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Mobile Menu Toggle ── */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--duration-normal) var(--ease-out);
}

.header__nav--open {
  animation: slide-down var(--duration-normal) var(--ease-out);
}

/* ── Main Content ── */
.main {
  padding-top: var(--header-height);
  min-height: 100vh;
}

/* Adjust main placement if viewport has a frame */
@media (min-width: 1280px) {
  .main {
    padding-top: calc(var(--header-height) + 12px);
  }
}

.main--centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Sections ── */
.section {
  padding: var(--space-20) 0;
}

.section--hero {
  padding: var(--space-24) 0 var(--space-16);
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
}

@media (min-width: 1280px) {
  .section--hero {
    min-height: calc(100vh - var(--header-height) - 24px);
  }
}

/* ── 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); }

/* ── Flex Utils ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.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); }

/* ── Footer ── */
.footer {
  padding: var(--space-12) 0 var(--space-8);
  border-top: var(--border-subtle);
  background: var(--surface-0);
  position: relative;
  z-index: 5;
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

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

.footer__link {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  transition: color var(--duration-fast);
}

.footer__link:hover {
  color: var(--text-secondary);
}

.footer__copy {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}

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

@media (max-width: 768px) {
  .header__nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface-0);
    flex-direction: column;
    padding: var(--space-8) var(--space-6);
    gap: var(--space-4);
    z-index: var(--z-overlay);
    backdrop-filter: blur(20px);
  }

  .header__nav--open {
    display: flex;
  }

  .header__nav-link {
    font-size: var(--fs-lg);
    padding: var(--space-3) var(--space-6);
    width: 100%;
    justify-content: center;
  }

  .header__nav-link--active::after {
    bottom: 6px;
    left: 40%;
    right: 40%;
  }

  .menu-toggle {
    display: flex;
  }

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

  .section--hero {
    padding: var(--space-16) 0 var(--space-10);
    min-height: auto;
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }

  .container {
    padding: 0 var(--space-4);
  }
}
