/* ─────────────────────────────────────────────
   SMARA — Warm Ink Design System
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400&family=DM+Sans:wght@300;400;500&family=DM+Mono:wght@300;400&display=swap');

:root {
  /* Warm Ink Palette */
  --ink:         #2C1A0E;
  --ink-soft:    #4A3525;
  --ink-muted:   #7A6555;
  --parchment:   #FDFAF5;
  --parchment-2: #F5EFE4;
  --parchment-3: #EDE4D4;
  --brown:       #8B4513;
  --brown-light: #B5641A;
  --green:       #1A6B4A;
  --green-light: #2A8B62;
  --purple:      #5C4A8A;
  --amber:       #B5541A;

  /* Pillar colors */
  --foundation:  #8B4513;
  --fuel:        #1A6B4A;
  --presence:    #5C4A8A;
  --fulfillment: #B5541A;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', monospace;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(44,26,14,0.08), 0 1px 2px rgba(44,26,14,0.06);
  --shadow-md: 0 4px 12px rgba(44,26,14,0.10), 0 2px 4px rgba(44,26,14,0.06);
  --shadow-lg: 0 8px 32px rgba(44,26,14,0.12), 0 4px 8px rgba(44,26,14,0.08);
  --shadow-ink: 0 0 0 1px rgba(44,26,14,0.08);

  /* Transitions */
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.display { font-size: clamp(2.5rem, 6vw, 4rem); font-style: italic; }
.label   { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.mono    { font-family: var(--font-mono); font-size: 13px; }

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 var(--space-lg); }
.container-sm { max-width: 680px; margin: 0 auto; padding: 0 var(--space-lg); }

/* ── Paper texture background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(253,250,245,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--parchment-3);
  padding: var(--space-md) 0;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand span { color: var(--brown); }

.nav-links { display: flex; align-items: center; gap: var(--space-md); }

.nav-link {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color var(--transition);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
}

.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--brown); font-weight: 500; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--green-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--parchment-2);
  color: var(--ink);
  border: 1px solid var(--parchment-3);
}
.btn-secondary:hover {
  background: var(--parchment-3);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--parchment-2);
  color: var(--ink);
}

.btn-danger {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}
.btn-danger:hover { background: #FEE2E2; }

.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon { padding: 10px; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Loading state */
.btn.loading { pointer-events: none; }
.btn.loading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Cards ── */
.card {
  background: white;
  border: 1px solid var(--parchment-3);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-clickable {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-clickable:hover { transform: translateY(-2px); }

/* ── Pillar chips ── */
.pillar-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.pillar-foundation { background: rgba(139,69,19,0.10); color: var(--foundation); }
.pillar-fuel        { background: rgba(26,107,74,0.10); color: var(--fuel); }
.pillar-presence    { background: rgba(92,74,138,0.10); color: var(--presence); }
.pillar-fulfillment { background: rgba(181,84,26,0.10); color: var(--fulfillment); }

/* ── Gap indicator ── */
.gap-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}

.gap-fresh   { background: rgba(26,107,74,0.08);  color: var(--green); }
.gap-recent  { background: rgba(181,181,26,0.08); color: #7A7A00; }
.gap-stale   { background: rgba(181,84,26,0.10);  color: var(--amber); }
.gap-cold    { background: rgba(139,69,19,0.10);  color: var(--brown); }
.gap-new     { background: rgba(92,74,138,0.10);  color: var(--purple); }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: var(--space-sm); }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--parchment-3);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: white;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--brown);
  box-shadow: 0 0 0 3px rgba(139,69,19,0.08);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

/* ── Momentum indicator ── */
.momentum {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.momentum-rising  { color: var(--green); }
.momentum-steady  { color: var(--ink-soft); }
.momentum-stalled { color: var(--amber); }

.momentum-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.momentum-rising  .momentum-dot { background: var(--green); }
.momentum-steady  .momentum-dot { background: var(--ink-muted); }
.momentum-stalled .momentum-dot { background: var(--amber); }

/* ── Loading states ── */
.skeleton {
  background: linear-gradient(90deg, var(--parchment-2) 25%, var(--parchment-3) 50%, var(--parchment-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Toast notifications ── */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 200ms ease-out;
  pointer-events: all;
  max-width: 320px;
}

.toast-success { background: var(--ink); color: var(--parchment); }
.toast-error   { background: #991B1B; color: white; }
.toast-info    { background: var(--brown); color: white; }

/* ── Dividers ── */
.divider {
  height: 1px;
  background: var(--parchment-3);
  margin: var(--space-lg) 0;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--ink-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--ink-soft);
  margin-bottom: var(--space-sm);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,26,14,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 150ms ease-out;
}

.modal {
  background: var(--parchment);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 200ms ease-out;
}

.modal-header {
  padding: var(--space-lg) var(--space-lg) 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}

.modal-body { padding: var(--space-lg); }
.modal-footer {
  padding: 0 var(--space-lg) var(--space-lg);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* ── Animations ── */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes shimmer  { to { background-position: -200% 0; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes pulse    { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-fadeUp { animation: fadeUp 300ms ease-out both; }

/* Staggered children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--parchment-3); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .container, .container-sm { padding: 0 var(--space-md); }
  .hide-mobile { display: none !important; }
  .modal { max-height: 95vh; }
  .toast-container { left: var(--space-md); right: var(--space-md); bottom: var(--space-md); }
}
