/* ============================================
   MIDNIGHT AURORA DESIGN SYSTEM
   Sophisticated elegance with subtle luminosity
   Version: 1.0.2 - Deployment Heartbeat
   ============================================ */

:root {
  /* Slate & Cyan Palette - Sophisticated & High-End */
  --h-primary: 200;
  /* Cyan-Slate */
  --s-primary: 15%;
  --l-primary: 20%;

  --h-accent: 25;
  /* Warm Sand */
  --s-accent: 30%;
  --l-accent: 50%;

  /* Light Mode - Ethereal Sand & Slate */
  --color-primary: hsl(var(--h-primary), 80%, 45%);
  --color-primary-dark: hsl(var(--h-primary), 85%, 35%);
  --color-primary-light: hsl(var(--h-primary), 75%, 60%);
  --color-primary-glow: hsla(var(--h-primary), 80%, 45%, 0.1);

  --color-accent: hsl(var(--h-accent), 60%, 45%);
  --color-accent-dark: hsl(var(--h-accent), 70%, 35%);
  --color-accent-light: hsl(var(--h-accent), 50%, 65%);

  --color-bg: hsl(30, 20%, 98%);
  /* Warm porcelain */
  --color-bg-secondary: hsl(30, 15%, 95%);
  --color-bg-tertiary: hsl(30, 10%, 90%);
  --color-bg-elevated: hsl(0, 0%, 100%);

  --color-text: hsl(210, 25%, 12%);
  --color-text-secondary: hsl(210, 15%, 35%);
  --color-text-tertiary: hsl(210, 10%, 55%);

  --color-border: hsl(210, 15%, 88%);
  --color-border-hover: hsl(210, 15%, 82%);

  --color-shadow: hsla(210, 25%, 12%, 0.04);
  --color-shadow-elevated: hsla(210, 25%, 12%, 0.08);
  --color-shadow-primary: hsla(var(--h-primary), 80%, 45%, 0.15);

  /* Gradient System - Refined & Liquid */
  --gradient-primary: linear-gradient(135deg, hsl(var(--h-primary), 70%, 40%) 0%, hsl(var(--h-primary), 50%, 60%) 100%);
  --gradient-aurora: linear-gradient(135deg, hsl(var(--h-primary), 70%, 40%) 0%, hsl(280, 40%, 50%) 50%, hsl(var(--h-accent), 60%, 50%) 100%);
  --gradient-subtle: linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-secondary) 100%);
  --gradient-card-shine: linear-gradient(135deg, hsla(0, 0%, 100%, 0.4) 0%, hsla(0, 0%, 100%, 0) 50%);

  /* Glass Effect - Apple Style */
  --glass-bg: hsla(0, 0%, 100%, 0.75);
  --glass-border: hsla(0, 0%, 100%, 0.4);
  --glass-shadow: 0 12px 40px hsla(210, 25%, 12%, 0.08);

  /* Typography - Refined Hierarchy */
  --font-sans: "Inter", "Outfit", -apple-system, BlinkMacSystemFont, sans-serif;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1.0625rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 3rem;
  --font-size-4xl: 4rem;
  --font-size-5xl: 5.5rem;
  --font-size-6xl: 7rem;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.1;
  --line-height-snug: 1.3;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* Precision Spacing */
  --space-4: 0.25rem;
  --space-8: 0.5rem;
  --space-12: 0.75rem;
  --space-16: 1rem;
  --space-20: 1.25rem;
  --space-24: 1.5rem;
  --space-32: 2rem;
  --space-40: 2.5rem;
  --space-48: 3rem;
  --space-64: 4rem;
  --space-80: 5rem;
  --space-96: 6rem;
  --space-128: 8rem;

  /* Layout */
  --max-width-content: 1100px;
  --max-width-narrow: 740px;
  --max-width-wide: 1440px;
  --header-height: 64px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 4px hsla(210, 25%, 12%, 0.04);
  --shadow-md: 0 4px 12px hsla(210, 25%, 12%, 0.08);
  --shadow-lg: 0 16px 48px hsla(210, 25%, 12%, 0.12);
  --shadow-xl: 0 24px 64px hsla(210, 25%, 12%, 0.16);

  /* Curves */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --transition-fast: 0.2s var(--ease-out);
  --transition-base: 0.4s var(--ease-out);
  --transition-slow: 0.8s var(--ease-out);

  /* Blurs */
  --blur-sm: 8px;
  --blur-md: 16px;
  --blur-lg: 32px;

  --z-fixed: 1030;
}

/* Disable transitions on initial page load to prevent flash */
.no-transitions,
.no-transitions *,
.no-transitions *::before,
.no-transitions *::after {
  transition: none !important;
}

/* Dark Mode - Midnight Aurora */
[data-theme="dark"] {
  /* Dark Mode - Deep Obsidian & Cyan */
  --color-primary: hsl(var(--h-primary), 90%, 65%);
  --color-primary-dark: hsl(var(--h-primary), 80%, 55%);
  --color-primary-light: hsl(var(--h-primary), 100%, 75%);
  --color-primary-glow: hsla(var(--h-primary), 90%, 65%, 0.15);

  --color-accent: hsl(var(--h-accent), 80%, 65%);

  --color-bg: hsl(220, 30%, 4%);
  /* Obsidian slate */
  --color-bg-secondary: hsl(220, 25%, 7%);
  --color-bg-tertiary: hsl(220, 20%, 12%);
  --color-bg-elevated: hsl(220, 20%, 15%);

  --color-text: hsl(210, 20%, 94%);
  --color-text-secondary: hsl(210, 15%, 75%);
  --color-text-tertiary: hsl(210, 10%, 55%);

  --color-border: hsl(220, 20%, 16%);
  --color-border-hover: hsl(220, 20%, 22%);

  --color-shadow: hsla(0, 0%, 0%, 0.6);
  --color-shadow-elevated: hsla(0, 0%, 0%, 0.8);
  --color-shadow-primary: hsla(var(--h-primary), 90%, 65%, 0.2);

  --gradient-primary: linear-gradient(135deg, hsl(var(--h-primary), 90%, 60%) 0%, hsl(260, 60%, 70%) 100%);
  --gradient-card-shine: linear-gradient(135deg, hsla(0, 0%, 100%, 0.05) 0%, hsla(0, 0%, 100%, 0) 50%);

  --glass-bg: hsla(220, 30%, 4%, 0.75);
  --glass-border: hsla(210, 20%, 100%, 0.08);
  --glass-shadow: 0 12px 48px hsla(0, 0%, 0%, 0.5);
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1;
  padding-top: var(--header-height);
}

/* Typography - Senior UI/UX Approach */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin: 0;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--font-size-6xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.04em;
}

h2 {
  font-size: var(--font-size-5xl);
  letter-spacing: -0.03em;
}

h3 {
  font-size: var(--font-size-4xl);
  letter-spacing: -0.02em;
}

h4 {
  font-size: var(--font-size-3xl);
}

p {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
  font-size: var(--font-size-base);
}

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

a:hover {
  color: var(--color-primary-dark);
}

ul,
ol {
  list-style: none;
}

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

/* ============================================
   SOLID HEADER NAVIGATION
   ============================================ */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border-bottom: 1px solid var(--glass-border);
  z-index: var(--z-fixed);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

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

.nav__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.nav__brand:hover {
  opacity: 0.7;
}

.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  color: white;
  font-size: 14px;
  font-weight: var(--font-weight-bold);
  border-radius: 50%;
  letter-spacing: 0.5px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: 0 2px 12px var(--color-shadow-primary);
  overflow: hidden;
  padding: 4px;
}

.brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.nav__brand:hover .brand-badge {
  transform: scale(1.08);
  box-shadow: 0 4px 20px var(--color-shadow-primary);
}

.brand-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-tertiary);
  letter-spacing: 0.01em;
}

.brand-name__first {
  color: var(--color-text-secondary);
}

.brand-name__last {
  color: var(--color-text-tertiary);
}

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

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

.nav__link {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  transition: color var(--transition-fast);
  position: relative;
  padding: var(--space-12) var(--space-4);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width var(--transition-fast);
}

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

.nav__link:hover::after {
  width: 100%;
}

.nav__link.active {
  color: var(--color-primary);
}

.nav__link.active::after {
  width: 100%;
  background-color: var(--color-primary);
}

/* Theme Toggle - CSS Icon Style */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-12);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  position: relative;
}

.theme-toggle:hover {
  color: var(--color-text);
  background-color: var(--color-bg-tertiary);
}

/* Tooltip - desktop only */
@media (min-width: 769px) {
  .theme-toggle::after {
    content: 'Dark mode';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
  }

  [data-theme="dark"] .theme-toggle::after {
    content: 'Light mode';
  }

  .theme-toggle:hover::after {
    opacity: 1;
    visibility: visible;
  }
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  position: relative;
}

/* Sun icon in light mode */
.theme-toggle__icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* Moon icon in dark mode */
[data-theme="dark"] .theme-toggle__icon {
  background: transparent;
}

[data-theme="dark"] .theme-toggle__icon::before {
  width: 14px;
  height: 14px;
  background: var(--color-bg);
  top: -2px;
  left: 6px;
  transform: none;
}

/* Mobile Menu Toggle - Hamburger Icon */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-8);
  width: 40px;
  height: 40px;
  position: relative;
  transition: opacity var(--transition-fast);
}

/* Header download button - hidden on desktop */
.header__download {
  display: none;
}

.nav__toggle-icon,
.nav__toggle-icon::before,
.nav__toggle-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--color-text);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: all 0.3s var(--ease-out);
}

.nav__toggle-icon {
  top: 50%;
  transform: translate(-50%, -50%);
}

.nav__toggle-icon::before {
  content: '';
  top: -6px;
}

.nav__toggle-icon::after {
  content: '';
  top: 6px;
}

/* Transform to X when menu is open */
.nav__toggle[aria-expanded="true"] .nav__toggle-icon {
  background-color: transparent;
}

.nav__toggle[aria-expanded="true"] .nav__toggle-icon::before {
  top: 0;
  transform: translateX(-50%) rotate(45deg);
}

.nav__toggle[aria-expanded="true"] .nav__toggle-icon::after {
  top: 0;
  transform: translateX(-50%) rotate(-45deg);
}

.nav__toggle:hover {
  opacity: 0.7;
}

/* Mobile Navigation - Hamburger Menu */
@media (max-width: 768px) {
  .header {
    height: 44px;
  }

  .nav {
    padding: 0 var(--space-16);
  }

  /* Hide name on homepage mobile - full name already shown on page */
  .homepage .brand-name {
    display: none;
  }

  /* Header download button - mobile only */
  .header__download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    color: var(--color-text-tertiary);
    border-radius: var(--radius-full);
    transition: color var(--transition-fast);
  }

  .header__download:active {
    color: var(--color-primary);
  }

  /* Hide hamburger and desktop nav on mobile - using bottom nav instead */
  .nav__toggle,
  .nav__menu {
    display: none;
  }

  /* Adjust main padding for smaller header */
  main {
    padding-top: 44px;
  }

  /* Hide theme toggle in header on mobile - it's in the footer */
  .header .theme-toggle,
  .nav__menu .theme-toggle {
    display: none;
  }
}

/* ============================================
   MOBILE BOTTOM NAVIGATION
   ============================================ */

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--color-bg);
    border-top: 1px solid var(--color-border);
    z-index: var(--z-fixed);
    padding: 0 var(--space-8);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-bottom-nav__list {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .mobile-bottom-nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-16);
    min-height: 44px;
    text-decoration: none;
    color: var(--color-text-tertiary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-fast);
    position: relative;
  }

  .mobile-bottom-nav__link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 32px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 2px;
    transition: transform var(--transition-fast);
  }

  .mobile-bottom-nav__link.active {
    color: var(--color-primary);
  }

  .mobile-bottom-nav__link.active::before {
    transform: translateX(-50%) scaleX(1);
  }

  /* Theme toggle in mobile nav */
  .mobile-bottom-nav .theme-toggle {
    display: flex;
    background: none;
    border: none;
    cursor: pointer;
  }

  .mobile-bottom-nav .theme-toggle__icon {
    width: 20px;
    height: 20px;
  }

  /* Add padding to body so content isn't hidden behind bottom nav */
  body {
    padding-bottom: 56px;
  }

  /* Adjust footer margin on mobile */
  .footer {
    margin-bottom: 0;
  }
}

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

.footer {
  background-color: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
  padding: var(--space-80) var(--space-24);
  margin-top: var(--space-128);
  transition: all 0.5s var(--ease-out);
}

.footer__content {
  max-width: var(--max-width-content);
  margin: 0 auto;
  text-align: center;
}

.footer__text {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  margin: 0;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.container {
  max-width: var(--max-width-content);
  margin: 0 auto;
  padding: 0 var(--space-24);
  width: 100%;
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-16);
  }
}

@media (max-width: 374px) {
  .container {
    padding: 0 var(--space-12);
  }
}

.container-narrow {
  max-width: var(--max-width-narrow);
}

.container-wide {
  max-width: var(--max-width-wide);
}

.section {
  padding: var(--space-48) 0 var(--space-64) 0;
}

.section-sm {
  padding: var(--space-32) 0 var(--space-48) 0;
}

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

/* ============================================
   SKIP TO CONTENT LINK (Accessibility)
   ============================================ */

.skip-to-content {
  position: absolute;
  top: -100px;
  left: var(--space-16);
  z-index: 9999;
  background-color: var(--color-primary);
  color: white;
  padding: var(--space-12) var(--space-24);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-to-content:focus {
  top: var(--space-16);
}

/* ============================================
   KEYBOARD FOCUS STATES
   ============================================ */

*:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Better focus for buttons */
.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
}

/* Better focus for links */
a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Body loaded state */
body.loaded {
  opacity: 1;
}

/* ============================================
   RESPONSIVE TYPOGRAPHY
   ============================================ */

@media (max-width: 1068px) {
  :root {
    --font-size-6xl: 4.5rem;
    /* 72px */
    --font-size-5xl: 3.5rem;
    /* 56px */
    --font-size-4xl: 2.75rem;
    /* 44px */
    --font-size-3xl: 2rem;
    /* 32px */
  }
}

@media (max-width: 734px) {
  :root {
    --font-size-6xl: 3rem;
    /* 48px */
    --font-size-5xl: 2.5rem;
    /* 40px */
    --font-size-4xl: 2rem;
    /* 32px */
    --font-size-3xl: 1.75rem;
    /* 28px */

    --space-128: 4rem;
    /* 64px */
    --space-96: 3rem;
    /* 48px */
    --space-80: 2.5rem;
    /* 40px */
  }

  .section {
    padding: var(--space-48) 0;
  }

  .section-sm {
    padding: var(--space-32) 0;
  }
}

/* ============================================
   ANIMATIONS - Global Keyframes
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes expandX {
  from {
    transform: scaleX(0);
    opacity: 0;
  }

  to {
    transform: scaleX(1);
    opacity: 0.8;
  }
}