/* ============================================================
   MADE SIMPLE AI — Design Tokens
   Brand: deep purple + gold. Light, airy surfaces; dark text.
   Mobile-first (iPhone first). No build step — import directly.
   ============================================================ */

:root {
  /* ---- Brand: purple (primary) ---- */
  --color-purple-950: #23113A;
  --color-purple-900: #2E1748;
  --color-purple-800: #3B1F5E;   /* brand deep purple */
  --color-purple-700: #4A2B7A;   /* primary interactive */
  --color-purple-600: #5B3A8E;
  --color-purple-500: #6E4FA8;
  --color-purple-200: #C9BCE4;
  --color-purple-100: #EAE4F4;
  --color-purple-50:  #F6F3FB;

  /* ---- Brand: gold (accent) ---- */
  --color-gold-700: #8A6D2F;     /* text-safe gold on light bg */
  --color-gold-600: #A8873C;
  --color-gold-500: #C6A34F;     /* brand gold accent */
  --color-gold-300: #DCC07E;
  --color-gold-100: #F6EFDD;
  --color-gold-50:  #FCF8EE;

  /* ---- Ink / neutrals ---- */
  --color-ink-900: #1A1626;      /* headings */
  --color-ink-700: #3A3350;      /* body text */
  --color-ink-500: #6B6380;      /* muted / secondary text */
  --color-ink-300: #A79FB9;      /* placeholder / disabled text */

  --color-surface: #FFFFFF;
  --color-bg: #FAF9FC;           /* app background */
  --color-bg-tint: #F3EFF9;      /* subtle purple-tinted section bg */
  --color-line: #E6E1F0;         /* hairlines, card borders */
  --color-line-strong: #CFC6E3;

  /* ---- Feedback ---- */
  --color-success: #1E7E4F;
  --color-success-bg: #E9F5EE;
  --color-danger: #B3372A;
  --color-danger-bg: #FBEDEA;
  --color-warning: #8A6D2F;
  --color-warning-bg: #FCF3DF;

  /* ---- Typography ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "New York", "Charter", Georgia, "Times New Roman", serif;

  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */
  --text-hero: clamp(2.25rem, 6vw + 1rem, 3.5rem);

  --leading-tight: 1.15;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

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

  /* ---- Spacing (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 */

  /* ---- Radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* ---- Shadows (restrained; no glow effects) ---- */
  --shadow-sm: 0 1px 2px rgba(46, 23, 72, 0.06);
  --shadow-md: 0 2px 8px rgba(46, 23, 72, 0.08);
  --shadow-lg: 0 8px 24px rgba(46, 23, 72, 0.12);

  /* ---- Touch / motion ---- */
  --touch-min: 44px;             /* minimum touch target */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;

  /* ---- Layout ---- */
  --max-width-content: 720px;
  --max-width-page: 1120px;
  --gutter: var(--space-4);
}

/* ============================================================
   Base reset (minimal)
   ============================================================ */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-ink-700);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0 0 var(--space-3);
  color: var(--color-ink-900);
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
}

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--color-purple-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover { color: var(--color-purple-800); }

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

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

/* Visible focus for keyboard users — never remove */
:focus-visible {
  outline: 3px solid var(--color-gold-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   Utility classes (shared; page-specific styles belong to app.js)
   ============================================================ */

/* Layout */
.ms-container {
  width: 100%;
  max-width: var(--max-width-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.ms-container--narrow {
  max-width: var(--max-width-content);
}

/* Type */
.ms-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gold-700);
  margin: 0 0 var(--space-2);
}
.ms-lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-ink-500);
}
.ms-muted { color: var(--color-ink-500); }
.ms-small { font-size: var(--text-sm); }
.ms-display { font-family: var(--font-serif); font-weight: var(--weight-bold); }

/* Buttons */
.ms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast);
  white-space: nowrap;
}
.ms-btn:active { transform: scale(0.98); }
.ms-btn--primary {
  background: var(--color-purple-700);
  color: #fff;
}
.ms-btn--primary:hover { background: var(--color-purple-800); color: #fff; }
.ms-btn--ghost {
  background: transparent;
  color: var(--color-purple-700);
  border-color: var(--color-line-strong);
}
.ms-btn--ghost:hover { border-color: var(--color-purple-700); }
.ms-btn--gold {
  background: var(--color-gold-500);
  color: var(--color-purple-950);
}
.ms-btn--gold:hover { background: var(--color-gold-600); color: #fff; }
.ms-btn--block { width: 100%; }
.ms-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Cards */
.ms-card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

/* Form inputs */
.ms-field { margin-bottom: var(--space-5); }
.ms-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-ink-900);
  margin-bottom: var(--space-2);
}
.ms-input, .ms-textarea, .ms-select {
  display: block;
  width: 100%;
  min-height: var(--touch-min);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
}
.ms-input::placeholder, .ms-textarea::placeholder { color: var(--color-ink-300); }
.ms-input:focus, .ms-textarea:focus, .ms-select:focus {
  outline: none;
  border-color: var(--color-purple-700);
  box-shadow: 0 0 0 3px rgba(74, 43, 122, 0.15);
}
.ms-textarea { min-height: 120px; resize: vertical; }
.ms-hint { font-size: var(--text-sm); color: var(--color-ink-500); margin-top: var(--space-2); }
.ms-error-text { font-size: var(--text-sm); color: var(--color-danger); margin-top: var(--space-2); }

/* Badges */
.ms-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ms-badge--free { background: var(--color-purple-100); color: var(--color-purple-800); }
.ms-badge--premium { background: var(--color-gold-500); color: var(--color-purple-950); }
.ms-badge--draft { background: var(--color-bg-tint); color: var(--color-ink-500); border: 1px solid var(--color-line); }

/* Progress bar (wizard) */
.ms-progress {
  height: 8px;
  background: var(--color-purple-100);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.ms-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-purple-700), var(--color-gold-500));
  border-radius: var(--radius-pill);
  transition: width var(--transition-base);
}

/* Usage meter */
.ms-meter {
  height: 10px;
  background: var(--color-purple-100);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.ms-meter__fill { height: 100%; background: var(--color-purple-700); border-radius: var(--radius-pill); }
.ms-meter__fill--exhausted { background: var(--color-danger); }

/* Divider */
.ms-divider { border: 0; border-top: 1px solid var(--color-line); margin: var(--space-6) 0; }

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

/* Reduce motion when the user asks for it */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
