/* ============================================================
   UAE DISTRESS TRACKER — BASE STYLESHEET
   Dark-mode financial terminal aesthetic
   ============================================================ */

/* --- Custom Design Tokens (Dark-only, terminal theme) --- */
:root {
  /* Type scale (fluid) */
  --text-xs:   clamp(0.688rem, 0.65rem + 0.2vw, 0.75rem);
  --text-sm:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-base: clamp(0.875rem, 0.82rem + 0.3vw,  1rem);
  --text-lg:   clamp(1rem,     0.9rem  + 0.5vw,  1.25rem);
  --text-xl:   clamp(1.25rem,  1rem    + 1vw,    1.75rem);
  --text-2xl:  clamp(1.75rem,  1.2rem  + 1.8vw,  2.75rem);
  --text-3xl:  clamp(2.25rem,  1.2rem  + 3vw,    4rem);

  /* Spacing (4px base) */
  --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;

  /* Dark terminal surfaces */
  --color-bg:              #0a0a0a;
  --color-surface:         #111111;
  --color-surface-2:       #161616;
  --color-surface-3:       #1a1a1a;
  --color-surface-hover:   #1e1e1e;
  --color-border:          #222222;
  --color-border-muted:    #1a1a1a;
  --color-divider:         #1c1c1c;

  /* Text */
  --color-text:            #e8e8e8;
  --color-text-muted:      #888888;
  --color-text-faint:      #444444;
  --color-text-inverse:    #0a0a0a;

  /* Accent: Crimson red for drops */
  --color-drop:            #ef4444;
  --color-drop-hover:      #f87171;
  --color-drop-dim:        rgba(239, 68, 68, 0.12);
  --color-drop-glow:       rgba(239, 68, 68, 0.08);

  /* Green for gains */
  --color-gain:            #22c55e;
  --color-gain-dim:        rgba(34, 197, 94, 0.1);

  /* Neutral accent */
  --color-primary:         #ef4444;
  --color-muted-accent:    #555555;

  /* Semantic */
  --color-warning:         #f59e0b;
  --color-info:            #3b82f6;

  /* Source badges */
  --color-pf:              #1e3a5f;
  --color-pf-text:         #60a5fa;
  --color-bayut:           #1a3a1a;
  --color-bayut-text:      #4ade80;

  /* Border radius */
  --radius-sm:  0.25rem;
  --radius-md:  0.375rem;
  --radius-lg:  0.5rem;
  --radius-xl:  0.75rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 0 0 1px var(--color-border), 0 2px 8px rgba(0,0,0,0.4);

  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-base: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Fonts */
  --font-ui:   'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Layout */
  --content-max: 1400px;
  --content-wide: 1200px;
  --header-h: 60px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  text-size-adjust: none;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.5;
  overflow-x: hidden;
}

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

ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.2; }

button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }

/* Numeric display: monospace tabular */
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
}

/* Focus */
:focus-visible {
  outline: 2px solid var(--color-drop);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection {
  background: rgba(239, 68, 68, 0.25);
  color: var(--color-text);
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-muted-accent); }

/* Screen reader only */
.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;
}

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