/**
 * Onisomi Design System
 * Consistent, minimal, breathing design system
 *
 * Philosophy:
 * - Quiet and calm
 * - No pressure, only invitation
 * - Generous white space
 * - Not a fortune-telling site, a consciousness space
 */

/* ========================================
   1. CSS VARIABLES
   ======================================== */

:root {
  /* Night Sky Palette - Dark Theme */
  --void: #050608;
  --night: #0a0e1a;
  --midnight: #141a26;
  --dusk: #1e2636;
  --twilight: #2a3347;

  /* Moonlight - Text Colors */
  --moonlight: #f0f2f5;
  --stardust: #c8ccd4;
  --mist: #8b92a3;
  --fog: #5c6478;

  /* Accent Colors */
  --lavender: #a78bfa;
  --lavender-soft: rgba(167, 139, 250, 0.15);
  --lavender-glow: rgba(167, 139, 250, 0.4);

  --aurora: #67e8f9;
  --aurora-soft: rgba(103, 232, 249, 0.15);

  --ember: #fbbf24;
  --ember-soft: rgba(251, 191, 36, 0.15);

  --sage: #86efac;
  --sage-soft: rgba(134, 239, 172, 0.15);

  --rose: #fda4af;
  --rose-soft: rgba(253, 164, 175, 0.15);

  --cosmic: #818cf8;
  --cosmic-soft: rgba(129, 140, 248, 0.15);

  /* Semantic Colors */
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.15);
  --error: #f43f5e;
  --error-soft: rgba(244, 63, 94, 0.15);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.15);

  /* Typography */
  --font-logo: 'Afacad', system-ui, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Jost', system-ui, sans-serif;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Font Weights */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Spacing - 4px base */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 30px var(--lavender-glow);

  /* Animations - Slow, meditative */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.15, 0.265, 1.15);
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  --duration-slower: 0.8s;

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* Container */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;

  /* Borders */
  --border-subtle: 1px solid rgba(255, 255, 255, 0.06);
  --border-light: 1px solid rgba(255, 255, 255, 0.1);
  --border-medium: 1px solid rgba(255, 255, 255, 0.15);

  /* Gradients */
  --gradient-dream: linear-gradient(135deg, var(--lavender), var(--aurora));
  --gradient-cosmic: linear-gradient(135deg, var(--cosmic), var(--lavender));
  --gradient-warm: linear-gradient(135deg, var(--ember), var(--rose));
}

/* Light Theme Override */
[data-theme="light"] {
  --night: #f8fafc;
  --midnight: #ffffff;
  --dusk: #f1f5f9;
  --twilight: #e2e8f0;
  --moonlight: #0f172a;
  --stardust: #334155;
  --mist: #64748b;
  --fog: #94a3b8;

  --border-subtle: 1px solid rgba(0, 0, 0, 0.04);
  --border-light: 1px solid rgba(0, 0, 0, 0.08);
  --border-medium: 1px solid rgba(0, 0, 0, 0.12);

  --lavender: #8b5cf6;
  --lavender-soft: rgba(139, 92, 246, 0.1);
  --lavender-glow: rgba(139, 92, 246, 0.25);
}

/* ========================================
   2. RESET & BASE
   ======================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--moonlight);
  background: var(--night);
  min-height: 100vh;
}

/* Background effect */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(167, 139, 250, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(103, 232, 249, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(129, 140, 248, 0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(103, 232, 249, 0.04) 0%, transparent 50%);
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

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

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--lavender);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: var(--lavender-soft);
  color: var(--moonlight);
}

/* ========================================
   3. LAYOUT
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-6);
  position: relative;
  z-index: 1;
}

.container-sm { max-width: var(--container-sm); }
.container-md { max-width: var(--container-md); }
.container-lg { max-width: var(--container-lg); }

/* Page Layout */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-main {
  flex: 1;
  padding: var(--space-12) 0;
}

/* ========================================
   4. HEADER
   ======================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  padding: var(--space-4) 0;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: var(--border-subtle);
}

[data-theme="light"] .site-header {
  background: rgba(248, 250, 252, 0.9);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  transition: transform var(--duration-normal) var(--ease-smooth);
}

.logo:hover {
  transform: scale(1.02);
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  object-fit: contain;
  background: #fff;
  border: 2px solid var(--lavender);
  padding: 4px;
  box-shadow: var(--shadow-glow);
  transition: all var(--duration-slow) var(--ease-smooth);
}

.logo:hover .logo-icon {
  border-color: var(--aurora);
  transform: scale(1.05);
}

.logo-text {
  font-family: var(--font-logo);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.5px;
  background: var(--gradient-dream);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Navigation */
.nav-main {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-link {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--stardust);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) var(--ease-smooth);
}

.nav-link:hover {
  color: var(--moonlight);
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
  color: var(--lavender);
  background: var(--lavender-soft);
}

/* Theme Toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-light);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--stardust);
  font-size: var(--text-lg);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
}

.theme-toggle:hover {
  color: var(--moonlight);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 10px;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--stardust);
  border-radius: 2px;
  transition: all var(--duration-normal);
}

@media (max-width: 768px) {
  .nav-main {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: var(--space-6);
    gap: var(--space-2);
    background: rgba(10, 14, 26, 0.98);
    backdrop-filter: blur(20px);
    border-bottom: var(--border-subtle);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-normal) var(--ease-smooth);
    z-index: var(--z-dropdown);
  }

  [data-theme="light"] .nav-main {
    background: rgba(248, 250, 252, 0.98);
  }

  .nav-main.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    width: 100%;
    text-align: center;
    padding: var(--space-3) var(--space-4);
  }

  .nav-toggle {
    display: flex;
  }
}

/* ========================================
   5. FOOTER
   ======================================== */

.site-footer {
  padding: var(--space-10) 0;
  border-top: var(--border-subtle);
  margin-top: auto;
}

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

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

.footer-logo {
  width: 32px;
  height: 32px;
}

.footer-copy {
  font-size: var(--text-sm);
  color: var(--fog);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.footer-link {
  font-size: var(--text-sm);
  color: var(--mist);
  transition: color var(--duration-normal);
}

.footer-link:hover {
  color: var(--moonlight);
}

@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }
}

/* ========================================
   6. BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-smooth);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-dream);
  color: white;
  box-shadow: 0 4px 20px var(--lavender-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px var(--lavender-glow);
}

/* Secondary Button */
.btn-secondary {
  background: var(--dusk);
  color: var(--moonlight);
  border: var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--twilight);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--stardust);
  border: var(--border-light);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--moonlight);
  background: rgba(255, 255, 255, 0.05);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

/* Full Width */
.btn-full { width: 100%; }

/* Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   7. FORM ELEMENTS
   ======================================== */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--moonlight);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--moonlight);
  background: rgba(20, 26, 38, 0.6);
  border: var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-smooth);
}

[data-theme="light"] .form-input {
  background: var(--dusk);
}

.form-input::placeholder {
  color: var(--fog);
}

.form-input:focus {
  outline: none;
  border-color: var(--lavender);
  box-shadow: 0 0 0 3px var(--lavender-soft);
}

.form-input.error {
  border-color: var(--error);
}

/* Textarea */
textarea.form-input {
  min-height: 120px;
  resize: vertical;
}

/* Select */
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b92a3' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
}

/* Password Toggle */
.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--fog);
  cursor: pointer;
  padding: var(--space-1);
  font-size: var(--text-lg);
}

.password-toggle:hover {
  color: var(--stardust);
}

/* Form Messages */
.form-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--error-soft);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.form-success {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--success-soft);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  color: var(--success);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

/* ========================================
   8. CARDS
   ======================================== */

.card {
  background: rgba(20, 26, 38, 0.5);
  border: var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-slow) var(--ease-smooth);
  backdrop-filter: blur(10px);
}

[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.7);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-4px);
}

[data-theme="light"] .card:hover {
  box-shadow: var(--shadow-lg);
}

/* Path Card - Homepage path cards */
.path-card {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: var(--space-8) var(--space-6);
  position: relative;
  overflow: hidden;
}

.path-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-dream);
  opacity: 0;
  transition: opacity var(--duration-slow);
}

.path-card:hover::before {
  opacity: 1;
}

.path-emoji {
  font-size: 2.5rem;
  display: block;
  margin-bottom: var(--space-4);
  transition: transform var(--duration-slow) var(--ease-bounce);
}

.path-card:hover .path-emoji {
  transform: scale(1.15);
}

.path-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
  color: var(--moonlight);
  margin-bottom: var(--space-2);
}

.path-subtitle {
  font-size: var(--text-sm);
  color: var(--mist);
}

/* ========================================
   9. TYPOGRAPHY UTILITIES
   ======================================== */

.text-display {
  font-family: var(--font-display);
}

.text-logo {
  font-family: var(--font-logo);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-moonlight { color: var(--moonlight); }
.text-stardust { color: var(--stardust); }
.text-mist { color: var(--mist); }
.text-fog { color: var(--fog); }
.text-lavender { color: var(--lavender); }

/* ========================================
   10. SPACING UTILITIES
   ======================================== */

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }

/* ========================================
   11. GRID UTILITIES
   ======================================== */

.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-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .grid-6 {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   12. 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-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ========================================
   13. ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes breathe {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-smooth) both;
}

.animate-fade-in-up {
  animation: fadeInUp var(--duration-slow) var(--ease-smooth) both;
}

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ========================================
   14. LOADING STATES (Skeleton)
   ======================================== */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--dusk) 0%,
    var(--twilight) 50%,
    var(--dusk) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--lavender-soft);
  border-top-color: var(--lavender);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* ========================================
   15. VISIBILITY
   ======================================== */

.hidden { display: none !important; }

@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ========================================
   16. SCROLLBAR
   ======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--midnight);
}

::-webkit-scrollbar-thumb {
  background: var(--twilight);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fog);
}
