/* =====================================================
   HXI Website — Modern Light Theme Design System
   ===================================================== */

/* ——— Design Tokens ——— */
:root {
  /* Primary */
  --primary: #6d28d9;
  --primary-light: #8b5cf6;
  --primary-lighter: #c4b5fd;
  --primary-bg: #ede9fe;

  /* Accent */
  --accent: #4f46e5;
  --accent-light: #818cf8;

  /* Neutrals */
  --white: #ffffff;
  --gray-50: #faf9fc;
  --gray-100: #f3f2f7;
  --gray-200: #e8e5f0;
  --gray-300: #d4d0e0;
  --gray-400: #9c97b0;
  --gray-500: #6e6a80;
  --gray-600: #4a4660;
  --gray-700: #342f4a;
  --gray-800: #231f36;
  --gray-900: #1a1628;

  /* Functional */
  --text: #2e2a42;
  --text-muted: #6e6a80;
  --bg: #faf9fc;
  --bg-alt: #f3f0fa;
  --surface: #ffffff;

  /* Gradients */
  --gradient-hero: linear-gradient(
    135deg,
    #7c3aed 0%,
    #6366f1 40%,
    #818cf8 100%
  );
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  --gradient-subtle: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(109, 40, 217, 0.06);
  --shadow-md: 0 4px 16px rgba(109, 40, 217, 0.08);
  --shadow-lg: 0 8px 30px rgba(109, 40, 217, 0.1);
  --shadow-xl: 0 16px 50px rgba(109, 40, 217, 0.12);
  --shadow-glow: 0 0 40px rgba(109, 40, 217, 0.1);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 150ms var(--ease);
  --t-base: 250ms var(--ease);
  --t-slow: 400ms var(--ease);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ——— Container ——— */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* =====================================================
   Navbar
   ===================================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--gray-200);
  transition: box-shadow var(--t-base);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary);
}

.nav-logo {
  width: 30px;
  height: 30px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-600);
  border-radius: var(--radius-full);
  transition: all var(--t-base);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--gray-600);
  border-radius: 2px;
  transition: all var(--t-base);
}
.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Language switcher */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 6px 12px;
  background: var(--primary-bg);
  border-radius: var(--radius-full);
  color: var(--primary);
  font-size: 0.85rem;
}

.lang-switcher i {
  font-size: 0.9rem;
}

.lang-switcher select {
  border: none;
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  padding-right: 4px;
}

/* =====================================================
   Hero Section
   ===================================================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: 140px 24px 100px;
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.hero-orb-1 {
  width: 500px;
  height: 500px;
  background: #a78bfa;
  top: -120px;
  right: -80px;
  animation: orbFloat1 18s ease-in-out infinite;
}

.hero-orb-2 {
  width: 350px;
  height: 350px;
  background: #6366f1;
  bottom: -100px;
  left: -60px;
  animation: orbFloat2 22s ease-in-out infinite;
}

.hero-orb-3 {
  width: 250px;
  height: 250px;
  background: #c4b5fd;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 15s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-30px, 20px) scale(1.1);
  }
}
@keyframes orbFloat2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(20px, -25px) scale(1.05);
  }
}
@keyframes orbFloat3 {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -55%) scale(1.15);
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--white);
  max-width: 720px;
  animation: heroFadeIn 0.9s ease-out;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.12);
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 400;
  opacity: 0.93;
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

@keyframes heroFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   Sections
   ===================================================== */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  text-align: center;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  position: relative;
  display: inline-block;
  width: 100%;
}

.section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  margin: 12px auto 0;
}

.section-subtitle {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 40px;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.7;
}

/* =====================================================
   Feature Cards (Intro)
   ===================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 20px 0;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform var(--t-base);
}

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-lighter);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  background: var(--gradient-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--primary);
  transition: transform var(--t-base);
}

.feature-card:hover .feature-icon {
  transform: scale(1.08);
}

.feature-card p {
  font-size: 0.92rem;
  color: var(--gray-600);
  line-height: 1.6;
}

/* =====================================================
   Structure Section
   ===================================================== */
.structure-overview {
  display: flex;
  align-items: center;
  gap: 36px;
  max-width: 900px;
  margin: 0 auto 48px;
}

.model-image {
  max-width: 230px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}

.structure-overview p {
  flex: 1;
  color: var(--gray-600);
  text-align: justify;
  line-height: 1.7;
  font-size: 0.95rem;
  min-width: 280px;
}

/* Factor Tabs */
.factor-tabs {
  max-width: 900px;
  margin: 0 auto;
}

.factor-tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.factor-tab-btn {
  border: none;
  background: transparent;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: all var(--t-base);
  position: relative;
}

.factor-tab-btn:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

.factor-tab-btn.active {
  color: var(--white);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-sm);
}

.factor-tab-content {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

.factor-pane {
  display: none;
  padding: 32px;
  animation: paneIn 0.3s ease;
}

.factor-pane.active {
  display: block;
}

.factor-pane > p {
  color: var(--gray-600);
  line-height: 1.75;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.factor-example {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px;
  background: var(--gradient-subtle);
  border-radius: var(--radius-lg);
  border-left: 3px solid var(--primary-light);
}

.factor-example i {
  color: var(--primary);
  font-size: 1rem;
  margin-top: 3px;
  flex-shrink: 0;
}

.factor-example p {
  font-size: 0.88rem;
  color: var(--gray-600);
  line-height: 1.65;
  white-space: pre-line;
}

@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================================
   Related Work — Timeline
   ===================================================== */
.timeline {
  max-width: 780px;
  margin: 0 auto;
  position: relative;
  padding-left: 60px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -60px;
  top: 24px;
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  z-index: 1;
}

.timeline-card {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-base);
}

.timeline-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.timeline-icon {
  width: 44px;
  height: 44px;
  background: var(--gradient-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.timeline-body {
  display: block;
}

.timeline-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.timeline-card p {
  color: var(--gray-600);
  font-size: 0.93rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.paper-link {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
  padding: 4px 0;
  margin-right: 16px;
  transition: color var(--t-fast);
  line-height: 1.5;
}

.paper-link:hover {
  color: var(--accent);
}

.paper-link i {
  font-size: 0.72rem;
}

/* =====================================================
   Related Work — Tabs
   ===================================================== */
.related-work-tabs {
  max-width: 780px;
  margin: 0 auto;
}

.related-work-tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--gray-200);
  flex-wrap: wrap;
  padding-bottom: 0;
}

.related-work-tab-btn {
  border: none;
  background: transparent;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-400);
  cursor: pointer;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  transition: all var(--t-base);
  position: relative;
}

.related-work-tab-btn:hover {
  color: var(--primary);
  background: var(--primary-bg);
}

.related-work-tab-btn.active {
  color: var(--white);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-sm);
}

.related-work-tab-content {
  padding-top: 32px;
  animation: paneIn 0.3s ease;
}

/* =====================================================
   User Guide
   ===================================================== */
.guide-container {
  display: flex;
  max-width: 960px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.guide-nav {
  display: flex;
  flex-direction: column;
  min-width: 210px;
  background: var(--gray-100);
  padding: 16px;
  gap: 6px;
}

.guide-nav-btn {
  border: none;
  background: transparent;
  text-align: left;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--t-base);
}

.guide-nav-btn:hover {
  background: var(--white);
  color: var(--primary);
  transform: translateX(3px);
}

.guide-nav-btn.active {
  background: var(--gradient-primary);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.guide-content {
  flex: 1;
  padding: 32px;
}

.guide-pane {
  display: none;
  animation: paneIn 0.3s ease;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 12px;
}

.guide-pane.active {
  display: block;
}

.guide-pane p {
  color: var(--gray-600);
  font-size: 0.93rem;
  line-height: 1.75;
  margin-bottom: 16px;
}

.guide-pane p:last-child {
  margin-bottom: 0;
}

.guide-pane strong {
  color: var(--text);
}

.formula-box {
  background: var(--gradient-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-top: 8px;
  text-align: center;
}

.formula-box code {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary);
  font-family: inherit;
}

/* =====================================================
   Download Section
   ===================================================== */
.download-card {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.download-desc {
  color: var(--gray-600);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 28px;
}

.download-desc a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.download-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--t-base);
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--white);
  border-color: var(--primary);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--gradient-primary);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* =====================================================
   Share Your Work
   ===================================================== */
.share-card {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-sm);
}

.share-icon {
  font-size: 2rem;
  color: var(--primary);
  margin-bottom: 16px;
  display: block;
}

.share-card p {
  color: var(--gray-600);
  font-size: 1rem;
  line-height: 1.7;
}

.share-card a {
  font-weight: 600;
}

/* =====================================================
   Footer
   ===================================================== */
footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 28px 0;
  text-align: center;
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

footer p {
  color: var(--gray-400);
  font-size: 0.88rem;
}

/* =====================================================
   Scroll Reveal Animations
   ===================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    flex-direction: column;
    padding: 16px 24px;
    gap: 4px;
    box-shadow: var(--shadow-md);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-link {
    padding: 12px 16px;
    border-radius: var(--radius-md);
  }

  .lang-switcher {
    margin-left: 0;
    align-self: flex-start;
    margin-top: 8px;
  }

  .hero {
    padding: 120px 20px 70px;
    min-height: 340px;
  }

  .section {
    padding: 56px 0;
  }

  .structure-overview {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }

  .structure-overview p {
    text-align: center;
    min-width: unset;
  }

  .model-image {
    max-width: 180px;
    margin: 0 auto;
  }

  .factor-tab-nav {
    gap: 4px;
  }

  .factor-tab-btn {
    font-size: 0.8rem;
    padding: 10px 14px;
  }

  .factor-pane {
    padding: 24px 20px;
  }

  .guide-container {
    flex-direction: column;
  }

  .guide-nav {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: auto;
    justify-content: center;
    padding: 12px;
    gap: 4px;
  }

  .guide-nav-btn {
    text-align: center;
    font-size: 0.8rem;
    padding: 10px 14px;
  }

  .guide-nav-btn:hover {
    transform: none;
  }

  .guide-content {
    padding: 24px 20px;
  }

  .timeline {
    padding-left: 50px;
  }

  .timeline::before {
    left: 18px;
  }

  .timeline-marker {
    left: -50px;
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .timeline-card {
    padding: 22px 20px;
  }

  .features-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin: 0 auto;
  }

  .download-buttons {
    flex-direction: column;
    align-items: center;
  }
}

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

  .hero-title {
    font-size: 1.7rem;
  }

  .factor-tab-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
}
