@layer reset, base, theme, components, utilities;

@font-face {
  font-family: "Vazirmatn";
  src: url("../assets/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@layer reset {
  :where(*, *::before, *::after) {
    box-sizing: border-box;
  }

  :where(html, body, h1, h2, h3, h4, p, ul, ol, dl, dt, dd, figure, blockquote) {
    margin: 0;
  }

  :where(ul[class], ol[class]) {
    padding: 0;
    list-style: none;
  }

  :where(img, picture, svg) {
    display: block;
    max-inline-size: 100%;
  }

  :where(button) {
    font: inherit;
    color: inherit;
  }
}

@layer base {
  html {
    scroll-behavior: smooth;
    scroll-padding-block-start: 5rem;
    scrollbar-color: var(--color-border-strong) var(--color-bg-subtle);
  }

  body {
    min-block-size: 100dvb;
    background-color: var(--color-bg-page);
    color: var(--color-text-main);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    text-align: start;
    font-size-adjust: from-font;
    -webkit-font-smoothing: antialiased;
  }

  @supports not (font-size-adjust: from-font) {
    body {
      line-height: 1.62;
    }

    code,
    kbd,
    .mono {
      font-size: 0.92em;
    }
  }

  :where(:lang(fa)) {
    font-family: var(--font-fa);
  }

  :where(h1, h2, h3, h4) {
    color: var(--color-text-main);
    line-height: 1.25;
    text-wrap: balance;
  }

  :where(p, li, dd) {
    text-wrap: pretty;
  }

  :where(a) {
    color: var(--color-accent);
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
  }

  :where(a:hover) {
    color: var(--color-accent-hover);
  }

  [dir="ltr"],
  bdi {
    unicode-bidi: isolate;
  }

  :where(a:any-link, button, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 3px;
  }

  .skip-link {
    position: fixed;
    inset-block-start: var(--space-sm);
    inset-inline-start: var(--space-sm);
    z-index: 200;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    background-color: var(--color-brand);
    color: var(--color-on-brand);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-md);
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    :where(*, *::before, *::after) {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

@layer utilities {
  .visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    inline-size: 1px !important;
    block-size: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
  }

  .text-muted {
    color: var(--color-text-muted);
  }

  .ltr-isolate {
    direction: ltr;
    unicode-bidi: isolate;
  }

  [hidden] {
    display: none !important;
  }
}
