/* ==========================================================================
   IconAI Studio — Global Design System & Variables
   Strict WCAG AA Accessibility, Modern High-Contrast Theming
   ========================================================================== */

:root {
  /* Light Theme (Default) */
  --bg-main: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #64748B;
  
  /* Brand Accents */
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: #EEF2FF;
  --primary-glow: rgba(79, 70, 229, 0.18);
  
  --secondary: #7C3AED;
  --secondary-hover: #6D28D9;
  --secondary-light: #F5F3FF;
  
  --accent: #0EA5E9;
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  --nav-height: 72px;
}

[data-theme="dark"] {
  --bg-main: #090D16;
  --bg-surface: #111827;
  --bg-surface-alt: #1F2937;
  --bg-elevated: #161F30;
  --border-subtle: #1F2937;
  --border-strong: #374151;
  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  --primary: #818CF8;
  --primary-hover: #93C5FD;
  --primary-light: rgba(129, 140, 248, 0.12);
  --primary-glow: rgba(129, 140, 248, 0.25);

  --secondary: #A78BFA;
  --secondary-hover: #C4B5FD;
  --secondary-light: rgba(167, 139, 250, 0.12);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.55), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-main);
  background-color: var(--bg-main);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 3.8vw, 3.25rem); margin-bottom: 0.75rem; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.15rem); margin-top: 2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.35rem; margin-top: 1.25rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; color: var(--text-muted); }
a { color: var(--primary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--primary-hover); }

/* Accessible Focus States */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Layout Utilities */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  color: #FFFFFF;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
}

/* Main Navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-link {
  font-size: 0.925rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: var(--bg-surface-alt);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Nav Backdrop Overlay */
.nav-backdrop {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.nav-backdrop.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

/* Mobile Drawer CTA Button */
.nav-drawer-cta {
  display: none;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.925rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: #FFFFFF;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-alt);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--border-subtle);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.mobile-menu-btn {
  display: none;
}

/* Hero Section */
.hero-section {
  padding: 3rem 0 2rem;
  text-align: center;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 1rem;
}

.hero-desc {
  max-width: 780px;
  margin: 0 auto 1.5rem;
  font-size: 1.15rem;
  color: var(--text-muted);
}

/* Feature Grid & Cards */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: grid;
  place-items: center;
  margin-bottom: 1rem;
}

/* Content Sections */
.content-section {
  padding: 4rem 0;
}

.section-header {
  margin-bottom: 2rem;
}

.section-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 750px;
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 1.25rem 1.5rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-muted);
  line-height: 1.7;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-chevron {
  transition: transform 0.2s ease;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-dim);
}

/* Responsive Breakpoints & Mobile Optimization */
body.menu-open {
  overflow: hidden !important;
  touch-action: none;
}

@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --nav-height: 64px;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .brand-logo {
    font-size: 1.125rem;
    gap: 0.5rem;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
  }

  .brand-badge {
    display: none;
  }

  .main-nav {
    display: flex;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--nav-height));
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 1.25rem 1.75rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    box-shadow: var(--shadow-xl);
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .main-nav.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-link {
    font-size: 1rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .nav-drawer-cta {
    display: block;
  }

  .nav-drawer-cta .btn {
    width: 100%;
    min-height: 48px;
    font-size: 0.95rem;
  }

  .mobile-menu-btn {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
  }

  .mobile-menu-btn.active svg {
    transform: rotate(90deg);
  }

  .hero-section {
    padding: 2.25rem 0 1.5rem;
  }

  .hero-tag {
    font-size: 0.775rem;
    padding: 0.3rem 0.75rem;
    white-space: normal;
    text-align: center;
    line-height: 1.4;
  }

  .hero-desc {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1.75rem 0;
  }

  .feature-card {
    padding: 1.35rem;
  }

  .content-section {
    padding: 2.75rem 0;
  }

  .faq-question {
    padding: 1rem 1.15rem;
    font-size: 0.95rem;
    gap: 0.75rem;
  }

  .faq-answer {
    padding: 0 1.15rem 1.15rem;
    font-size: 0.9rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-links a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .nav-actions .btn-primary {
    display: none;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
  }
}
