/*
 * Behnam Bagheri Design System - base (v1)
 * Load after tokens.css. Fonts are self-hosted next to this file and served with CORS,
 * so any domain can load them.
 */

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/space-grotesk/SpaceGrotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/space-grotesk/SpaceGrotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/space-grotesk/SpaceGrotesk-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* Vazirmatn variable font (Arabic + Latin, weights 100-900), SIL OFL 1.1 */
@font-face {
  font-family: Vazirmatn;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/vazirmatn/Vazirmatn-variable.woff2') format('woff2');
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--bb-line) 34%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--bb-line) 34%, transparent) 1px, transparent 1px),
    var(--bb-bg);
  background-size: var(--bb-grid-size) var(--bb-grid-size);
  color: var(--bb-text);
  font-family: var(--bb-font-sans);
  line-height: var(--bb-line-height);
}

/* Accent glow over the grid, fading into the background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bb-bg) 6%, transparent), var(--bb-bg) 92%),
    radial-gradient(circle at 14% 12%, color-mix(in srgb, var(--bb-accent) 18%, transparent), transparent 32%),
    radial-gradient(circle at 88% 6%, color-mix(in srgb, var(--bb-warning) 12%, transparent), transparent 28%);
  z-index: -1;
}

/* Persian and other RTL pages */
:lang(fa) body,
body:lang(fa),
[dir='rtl'] body,
body[dir='rtl'] {
  font-family: var(--bb-font-fa);
  line-height: var(--bb-line-height-fa);
}

:lang(fa),
[dir='rtl'] {
  --bb-tracking-caps: 0;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--bb-accent) 72%, transparent);
  outline-offset: 3px;
}

/* Inline LTR text (emails, domains, IPs) inside RTL copy */
.bb-ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.bb-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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