/* ==========================================================================
   Baharak — Base
   Intentional reset + global element foundations (RTL-first, Persian type).
   ========================================================================== */

/* ----- Font: Vazirmatn (self-hosted) ----- */

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

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

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

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

/* The `hidden` attribute must win over any component display rule. */
[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-family-base);
    font-size: var(--text-md);
    line-height: var(--line-height-normal);
    color: var(--text-body);
    background-color: var(--color-bg-page);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ----- Typography ----- */

h1, h2, h3, h4 {
    margin: 0 0 var(--space-4);
    color: var(--text-strong);
    line-height: var(--line-height-tight);
    font-weight: 700;
}

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

p {
    margin: 0 0 var(--space-4);
}

a {
    color: var(--color-primary-600);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-700);
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

ul, ol {
    padding-inline-start: var(--space-5);
}

/* ----- Focus & accessibility ----- */

:focus-visible {
    outline: 3px solid var(--color-primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.skip-link {
    position: absolute;
    inset-inline-start: var(--space-4);
    top: -100%;
    z-index: var(--z-toast);
    padding: var(--space-2) var(--space-4);
    background: var(--color-primary-600);
    color: var(--text-inverse);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.skip-link:focus {
    top: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

::selection {
    background: var(--color-primary-100);
}

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

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