/**
 * IQ-SIGNAL-HUB — Base CSS & Typography (v4)
 * Canonical Reference: docs/MASTER_SPEC.md Section 5.2
 */

/* 1. Local Cairo Typography */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/Cairo-Regular.woff2') format('woff2');
}

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/Cairo-SemiBold.woff2') format('woff2');
}

@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/Cairo-Bold.woff2') format('woff2');
}

/* 2. Global Reset & Box-Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-family);
  font-size: 16px;
  background-color: var(--bg);
  color: var(--text);
  line-height: var(--line-height-ar);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-size: var(--font-size-body);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
  position: relative;
}

/* 3. Typography & Numbers Standards */
h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }

p {
  color: var(--text-muted);
  font-size: var(--font-size-body);
}

small, .text-small {
  font-size: 14px; /* Hard floor: no text below 14px */
}

/* Tabular & Latin Numerals (Section 5.2) */
.tabular-nums,
.num,
.code-num,
.currency-val {
  font-variant-numeric: tabular-nums;
  direction: ltr;
  display: inline-block;
  unicode-bidi: isolate;
  font-family: var(--font-family);
}

/* 4. Form Elements & Minimum Touch Targets (>= 52px) */
button, input, select, textarea {
  font-family: inherit;
  font-size: var(--font-size-body);
  color: inherit;
  border: none;
  outline: none;
  background: transparent;
}

button {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-speed) ease;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select {
  min-height: var(--touch-target-min);
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  color: var(--text);
  width: 100%;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

input:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--border-gold);
}

input::placeholder {
  color: var(--text-dim);
}

/* 5. Custom Dark Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}

/* 6. Accessibility & Motion Preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

