/*
==================================================
================ GLOBAL STYLES =================
==================================================
Table of Content:
0. Global Styles
  0.1 Body Base
  0.2 RTL Support
  0.3 Headings
  0.4 Paragraphs
  0.5 Links
  0.6 Images & Media
  0.7 Inputs & Buttons
  0.8 Accessibility Focus
1. Layout Structure
  1.1 Mobile-first Grid
  1.2 Grid Area Assignments
  1.3 Page Container
2. Media Queries
  2.1 Small Devices (≥576px)
  2.2 Medium Devices (≥768px)
  2.3 Large Devices (≥1200px)
  2.4 Extra Large Devices (≥1440px)
==================================================
*/

/* ============================================
   0. GLOBAL STYLES
============================================ */

/* --- 0.1 Body Base --- */
body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-md);
    color: var(--color-text-primary);
    background: var(--site-bg-gradient);
    position: relative;
    min-height: 100vh;
}

/* --- 0.2 RTL Support --- */
html[dir="rtl"] body {
    font-family: 'Almarai', sans-serif;
    direction: rtl;
}

/* --- 0.3 Headings --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-extrabold);
    line-height: var(--line-height-sm);
    margin-bottom: var(--spacing-sm);
}

/* Arabic headings override */
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] h5,
html[lang="ar"] h6 {
    font-family: 'Cairo', sans-serif;
}

/* --- 0.4 Paragraphs --- */
p {
    margin-bottom: var(--spacing-md);
    color: var(--color-text-secondary);
    font-family: inherit;
}

/* --- 0.5 Links --- */
a {
    text-decoration: none;
    color: inherit;
}

/* --- 0.6 Images & Media --- */
img,
picture {
    display: block;
    max-width: 100%;
    height: auto;
}

/* --- 0.7 Inputs & Buttons --- */
input,
textarea,
select,
button {
    background: none;
    border: none;
    outline: none;
    font: inherit;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

/* --- 0.8 Accessibility Focus --- */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================
   1. LAYOUT STRUCTURE
============================================ */

/* --- 1.1 Mobile-first Grid --- */
.site {
    display: grid;
    grid-template-areas:
        "header"
        "main"
        "footer";
    grid-template-columns: 1fr;
    grid-template-rows: 60px 1fr auto;
}

/* --- 1.2 Grid Area Assignments --- */
.site__header {
    grid-area: header;
}

.site__aside {
    grid-area: aside;
}

.site__main {
    grid-area: main;
}

.site__footer {
    grid-area: footer;
}

/* --- 1.3 Page Container --- */
.container {
    width: 100%;
    max-width: 425px;
    padding: 0 var(--spacing-md);
    margin: 0 auto;
}

/* ============================================
   2. MEDIA QUERIES
============================================ */

/* --- 2.1 Small Devices (≥576px) --- */
@media (max-width: 320px) {
    .container {
        max-width: 300px;
    }
}

@media (max-width: 375px) {
    .container {
        max-width: 375px;
    }
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

/* --- 2.2 Medium Devices (≥768px) --- */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }

    .site {
        grid-template-areas:
            "header header"
            "aside  main"
            "footer footer";
        grid-template-columns: 60px 1fr;
        grid-template-rows: 60px 1fr auto;
    }

    html[dir="rtl"] body .site {
        grid-template-areas:
            "header header"
            "main aside"
            "footer footer";
        grid-template-columns: 1fr 60px;

    }
}

/* --- 2.3 Large Devices (≥1200px) --- */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* --- 2.4 Extra Large Devices (≥1440px) --- */
@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }
}