/* === HARMATTAN INTELLIGENCE DESIGN SYSTEM === */
:root {
  --sand-50: #faf9f7;
  --sand-100: #f0ede8;
  --sand-200: #e0d9d0;
  --sand-300: #ccc2b5;
  --sand-400: #b5a898;
  --sand-500: #a08f7d;
  --sand-600: #8a7666;
  --sand-700: #726055;
  --sand-800: #5e5048;
  --sand-900: #4d423c;
  --sand-950: #2a231f;

  --harmattan-50: #fdf8f6;
  --harmattan-100: #f9ebe4;
  --harmattan-200: #f3d5c8;
  --harmattan-300: #e8b49e;
  --harmattan-400: #d98b6b;
  --harmattan-500: #c96a44;
  --harmattan-600: #b55432;
  --harmattan-700: #96422a;
  --harmattan-800: #7d3828;
  --harmattan-900: #683225;
  --harmattan-950: #381812;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--sand-50);
  color: var(--sand-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2.5rem, 5vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }

.text-harmattan { color: var(--harmattan-700); }
.text-sand { color: var(--sand-600); }
.bg-harmattan { background: var(--harmattan-700); }
.bg-sand { background: var(--sand-100); }

/* Grain overlay */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Navigation */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(250, 249, 247, 0.85);
  backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--sand-200);
  transition: box-shadow 0.3s;
}
.nav.scrolled { box-shadow: 0 4px 30px rgba(0,0,0,0.08); }

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

.nav-brand {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
}

.nav-logo {
  width: 40px; height: 40px; background: var(--harmattan-700);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 1.25rem; font-family: var(--font-serif);
}

.nav-brand-text h1 {
  font-size: 1.1rem; color: var(--sand-950); letter-spacing: -0.02em;
}

.nav-brand-text span {
  font-size: 0.65rem; color: var(--sand-500); text-transform: uppercase;
  letter-spacing: 0.15em; font-weight: 500;
}

.nav-links {
  display: flex; align-items: center; gap: 32px;
}

.nav-links a {
  text-decoration: none; color: var(--sand-700); font-size: 0.875rem;
  font-weight: 500; position: relative; padding: 4px 0;
  transition: color 0.2s;
}

.nav-links a::after {
  content: ''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px;
  background: var(--harmattan-600); transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--harmattan-700); }
.nav-links a:hover::after { width: 100%; }

.nav-links a.active { color: var(--harmattan-700); }
.nav-links a.active::after { width: 100%; }

.nav-cta {
  background: var(--harmattan-700); color: white; padding: 10px 24px;
  border-radius: 100px; text-decoration: none; font-size: 0.875rem; font-weight: 600;
  transition: all 0.2s; box-shadow: 0 4px 14px rgba(201, 106, 68, 0.25);
}

.nav-cta:hover {
  background: var(--harmattan-800);
  box-shadow: 0 6px 20px rgba(201, 106, 68, 0.35);
  transform: translateY(-1px);
}

.nav-mobile-btn {
  display: none; background: none; border: none; font-size: 1.5rem;
  color: var(--sand-800); cursor: pointer;
}

/* Mobile menu */
.mobile-menu {
  display: none; position: fixed; top: 72px; left: 0; right: 0;
  background: rgba(250, 249, 247, 0.95); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sand-200); padding: 16px 24px;
  z-index: 99;
}

.mobile-menu.open { display: block; }

.mobile-menu a {
  display: block; padding: 12px 0; color: var(--sand-700);
  text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--sand-200);
}

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

/* Sections */
section { padding: 96px 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 14px 32px;
  border-radius: 100px; font-weight: 600; font-size: 0.9375rem;
  text-decoration: none; transition: all 0.2s; cursor: pointer; border: none;
}

.btn-primary {
  background: var(--harmattan-700); color: white;
  box-shadow: 0 4px 14px rgba(201, 106, 68, 0.25);
}

.btn-primary:hover {
  background: var(--harmattan-800);
  box-shadow: 0 6px 20px rgba(201, 106, 68, 0.35);
  transform: translateY(-2px);
}

.btn-secondary {
  background: white; color: var(--sand-800);
  border: 2px solid var(--sand-300);
}

.btn-secondary:hover {
  border-color: var(--harmattan-400); color: var(--harmattan-700);
}

.btn-dark {
  background: var(--sand-900); color: white;
}

.btn-dark:hover { background: var(--sand-950); }

/* Cards */
.card {
  background: white; border-radius: 20px; padding: 32px;
  border: 1px solid var(--sand-200);
  transition: all 0.3s ease;
}

.card:hover {
  border-color: var(--harmattan-300);
  box-shadow: 0 20px 40px -12px rgba(201, 106, 68, 0.12);
  transform: translateY(-4px);
}

.card-dark {
  background: var(--sand-900); color: white; border: 1px solid var(--sand-800);
}

/* Tags */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 100px; font-size: 0.75rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}

.tag-live {
  background: #dcfce7; color: #166534;
}

.tag-live::before {
  content: ''; width: 6px; height: 6px; background: #22c55e;
  border-radius: 50%; animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Chart containers */
.chart-wrap {
  position: relative; width: 100%;
}

.chart-wrap.sm { height: 240px; }
.chart-wrap.md { height: 320px; }
.chart-wrap.lg { height: 400px; }

/* Progress bars */
.progress-track {
  width: 100%; height: 8px; background: var(--sand-200);
  border-radius: 100px; overflow: hidden;
}

.progress-fill {
  height: 100%; border-radius: 100px; transition: width 1s ease;
}

/* Grid */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }

/* Spacing */
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }

/* Text utilities */
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.leading-relaxed { line-height: 1.625; }

/* Colors */
.text-white { color: white; }
.text-red { color: #dc2626; }
.text-green { color: #16a34a; }
.text-orange { color: #ea580c; }
.text-sand-400 { color: var(--sand-400); }
.text-sand-500 { color: var(--sand-500); }
.text-sand-600 { color: var(--sand-600); }

.bg-red-50 { background: #fef2f2; }
.bg-green-50 { background: #f0fdf4; }
.bg-yellow-50 { background: #fefce8; }
.bg-orange-50 { background: #fff7ed; }

/* Footer */
.footer {
  background: var(--sand-950); color: var(--sand-400); padding: 64px 0 32px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 48px;
}

.footer h4 { color: white; font-size: 1rem; margin-bottom: 16px; font-family: var(--font-sans); }
.footer a { color: var(--sand-500); text-decoration: none; font-size: 0.875rem; display: block; padding: 4px 0; transition: color 0.2s; }
.footer a:hover { color: var(--harmattan-400); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.05); padding-top: 32px;
  display: flex; justify-content: space-between; align-items: center;
}

.social-links { display: flex; gap: 12px; }
.social-links a {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center; color: white;
  transition: all 0.2s; text-decoration: none;
}
.social-links a:hover { background: var(--harmattan-700); }

/* Scroll reveal */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.active { opacity: 1; transform: translateY(0); }

/* Metric counters */
.metric { font-variant-numeric: tabular-nums; }

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

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-btn { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  section { padding: 64px 0; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}

/* Dashboard specific */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
}

.dash-col-8 { grid-column: span 8; }
.dash-col-6 { grid-column: span 6; }
.dash-col-4 { grid-column: span 4; }
.dash-col-3 { grid-column: span 3; }

@media (max-width: 1024px) {
  .dash-col-8, .dash-col-6, .dash-col-4, .dash-col-3 { grid-column: span 12; }
}

/* Index cards */
.index-card {
  background: white; border-radius: 16px; padding: 24px;
  border: 1px solid var(--sand-200); transition: all 0.3s;
}

.index-card:hover {
  border-color: var(--harmattan-300);
  box-shadow: 0 12px 24px -8px rgba(201, 106, 68, 0.1);
}

.index-value {
  font-size: 2.5rem; font-weight: 800; font-family: var(--font-mono);
  line-height: 1;
}

.index-value.up { color: #16a34a; }
.index-value.down { color: #dc2626; }
.index-value.neutral { color: var(--harmattan-600); }

/* Zone map visualization */
.zone-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--sand-100);
}

.zone-bar:last-child { border-bottom: none; }

.zone-name {
  width: 120px; font-size: 0.875rem; font-weight: 600; color: var(--sand-800);
  flex-shrink: 0;
}

.zone-track {
  flex: 1; height: 32px; background: var(--sand-100); border-radius: 8px;
  overflow: hidden; position: relative;
}

.zone-fill {
  height: 100%; border-radius: 8px; transition: width 1s ease;
  display: flex; align-items: center; justify-content: flex-end;
  padding-right: 10px; color: white; font-size: 0.75rem; font-weight: 700;
}

/* Predictive board */
.prediction-card {
  background: linear-gradient(135deg, var(--sand-900) 0%, #1a1a1a 100%);
  border-radius: 20px; padding: 32px; color: white;
  border: 1px solid var(--sand-800);
}

.forecast-line {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 2s ease forwards;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* Data table */
.data-table {
  width: 100%; border-collapse: collapse;
}

.data-table th {
  text-align: left; padding: 12px 16px; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--sand-500);
  border-bottom: 2px solid var(--sand-200); font-weight: 600;
}

.data-table td {
  padding: 16px; border-bottom: 1px solid var(--sand-100);
  font-size: 0.875rem;
}

.data-table tr:hover td { background: var(--sand-50); }

/* Tooltip */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tip);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--sand-900); color: white; padding: 6px 12px;
  border-radius: 8px; font-size: 0.75rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}

.tooltip:hover::after { opacity: 1; }

/* Loading state */
.skeleton {
  background: linear-gradient(90deg, var(--sand-200) 25%, var(--sand-100) 50%, var(--sand-200) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* Print styles */
@media print {
  .nav, .footer, .btn { display: none; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
}
