/**
 * THE KINGDOM OF MOUKI
 * Main CSS Foundation - Design System Tokens, Reset & Global Typography
 */

/* ==========================================================================
   1. DESIGN TOKENS (CUSTOM PROPERTIES)
   ========================================================================== */
:root {
  /* Royal Color Palette */
  --color-cloud-lavender: #FAF6FF;
  --color-blush-silk: #FFF0F5;
  --color-fairy-rose: #FFB6C1;
  --color-fairy-rose-light: #FFE4E8;
  --color-enchanted-lilac: #D8B4F8;
  --color-enchanted-lilac-light: #EEDBFF;
  --color-champagne-gold: #E8C547;
  --color-champagne-gold-light: #FFF5CC;
  --color-champagne-gold-dark: #A57C1B;
  --color-velvet-plum: #3D2C4D;
  --color-dusk-lavender: #766585;
  --color-pure-white: #FFFFFF;

  /* Surfaces & Frosted Glass */
  --surface-card: rgba(255, 255, 255, 0.88);
  --surface-card-subtle: rgba(255, 255, 255, 0.65);
  --surface-card-hover: rgba(255, 255, 255, 0.96);
  --border-gold-subtle: rgba(232, 197, 71, 0.45);
  --border-rose-subtle: rgba(255, 182, 193, 0.55);
  --border-lilac-subtle: rgba(216, 180, 248, 0.45);

  /* Typography Families */
  --font-royal: 'Cinzel Decorative', Georgia, 'Times New Roman', serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-accent: 'Dancing Script', 'Great Vibes', cursive;

  /* Typography Modular Scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8125rem);    /* 12px - 13px */
  --text-sm: clamp(0.8125rem, 0.78rem + 0.3vw, 0.875rem);   /* 13px - 14px */
  --text-base: clamp(0.9375rem, 0.9rem + 0.35vw, 1.0625rem); /* 15px - 17px */
  --text-lg: clamp(1.125rem, 1.05rem + 0.5vw, 1.25rem);     /* 18px - 20px */
  --text-xl: clamp(1.3125rem, 1.2rem + 0.75vw, 1.5625rem);  /* 21px - 25px */
  --text-2xl: clamp(1.625rem, 1.45rem + 1.1vw, 2rem);       /* 26px - 32px */
  --text-3xl: clamp(2rem, 1.75rem + 1.6vw, 2.75rem);        /* 32px - 44px */
  --text-4xl: clamp(2.5rem, 2.1rem + 2.4vw, 3.75rem);       /* 40px - 60px */

  /* Line Heights */
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.6;
  --leading-relaxed: 1.8;

  /* Spacing Scale (4px base) */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Border Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(61, 44, 77, 0.06);
  --shadow-md: 0 6px 20px rgba(61, 44, 77, 0.08), 0 2px 6px rgba(216, 180, 248, 0.15);
  --shadow-lg: 0 12px 36px rgba(61, 44, 77, 0.1), 0 4px 12px rgba(255, 182, 193, 0.2);
  --shadow-gold-glow: 0 0 24px rgba(232, 197, 71, 0.35);
  --shadow-rose-glow: 0 0 24px rgba(255, 182, 193, 0.4);
  --shadow-wand: 0 10px 30px rgba(61, 44, 77, 0.12), 0 0 15px rgba(216, 180, 248, 0.3);

  /* Layout Limits */
  --content-max-width: 1200px;
  --container-padding: clamp(1rem, 4vw, 2.5rem);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-slow: 600ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Z-Index System */
  --z-negative: -1;
  --z-base: 1;
  --z-card: 10;
  --z-sticky: 100;
  --z-nav: 500;
  --z-modal-backdrop: 900;
  --z-modal: 1000;
  --z-toast: 1100;
}

/* ==========================================================================
   2. MODERN CSS RESET
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-velvet-plum);
  background-color: var(--color-cloud-lavender);
  overflow-x: hidden;
  position: relative;
}

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

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* ==========================================================================
   3. GLOBAL TYPOGRAPHY
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-royal);
  font-weight: 700;
  line-height: var(--leading-tight);
  color: var(--color-velvet-plum);
  letter-spacing: 0.02em;
}

h1 {
  font-size: var(--text-4xl);
}

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

h3 {
  font-size: var(--text-2xl);
}

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

p {
  margin-bottom: var(--space-4);
  color: var(--color-velvet-plum);
}

p:last-child {
  margin-bottom: 0;
}

.text-muted {
  color: var(--color-dusk-lavender);
}

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

.text-gold {
  color: var(--color-champagne-gold-dark);
}

/* ==========================================================================
   4. BASE BUTTONS & INTERACTIVE ELEMENTS
   ========================================================================== */
.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-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-pill);
  transition: transform var(--transition-spring), box-shadow var(--transition-normal), background-color var(--transition-fast);
  text-align: center;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-royal {
  background: linear-gradient(135deg, var(--color-fairy-rose) 0%, var(--color-enchanted-lilac) 100%);
  color: var(--color-velvet-plum);
  border: 1px solid var(--border-gold-subtle);
  box-shadow: var(--shadow-sm), var(--shadow-rose-glow);
}

.btn-royal:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 20px rgba(255, 182, 193, 0.6);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--color-velvet-plum);
  border: 1px solid var(--border-rose-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--surface-card-hover);
  border-color: var(--color-champagne-gold);
  transform: translateY(-2px);
}

/* ==========================================================================
   5. CONTAINER & WRAPPERS
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.storybook-realm {
  position: relative;
  width: 100%;
}

/* ==========================================================================
   6. ACCESSIBILITY & REDUCED MOTION
   ========================================================================== */
:focus-visible {
  outline: 3px solid var(--color-champagne-gold);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
