/* ==========================================================================
   AlMohamy Theme - Base Styles
   Foundation, Reset, Typography, RTL Support
   ========================================================================== */

/* ── Base Reset & Global ── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--al-font-primary);
    font-size: var(--al-text-base);
    font-weight: var(--al-font-weight-regular);
    line-height: var(--al-leading-relaxed);
    color: var(--al-color-charcoal);
    background-color: var(--al-color-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ── Container Utility ── */
.al-container {
    width: 100%;
    max-width: var(--al-container-max);
    margin-inline: auto;
    padding-inline: var(--al-container-padding);
}

.al-container--narrow {
    max-width: var(--al-container-narrow);
}

.al-container--wide {
    max-width: var(--al-container-wide);
}

/* ── Section Spacing ── */
.al-section {
    padding-block: var(--al-space-section);
    position: relative;
}

.al-section--sm {
    padding-block: calc(var(--al-space-section) * 0.6);
}

.al-section--lg {
    padding-block: calc(var(--al-space-section) * 1.4);
}

.al-section--dark {
    background: var(--al-gradient-section-dark);
    color: var(--al-color-white);
}

.al-section--light {
    background: var(--al-color-snow);
}

.al-section--gradient {
    background: var(--al-gradient-mesh-1);
}

/* ── Diagonal Section Divider ── */
.al-section--diagonal-top {
    clip-path: polygon(0 4%, 100% 0, 100% 100%, 0 100%);
    margin-top: -4%;
}

.al-section--diagonal-bottom {
    clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
    padding-bottom: calc(var(--al-space-section) + 4%);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--al-font-primary);
    font-weight: var(--al-font-weight-bold);
    line-height: var(--al-leading-snug);
    color: var(--al-color-navy);
    margin-bottom: var(--al-space-md);
}

h1 {
    font-size: var(--al-text-4xl);
    font-weight: var(--al-font-weight-extrabold);
    letter-spacing: -0.02em;
}

h2 {
    font-size: var(--al-text-3xl);
    font-weight: var(--al-font-weight-bold);
    letter-spacing: -0.01em;
}

h3 {
    font-size: var(--al-text-2xl);
    font-weight: var(--al-font-weight-bold);
}

h4 {
    font-size: var(--al-text-xl);
    font-weight: var(--al-font-weight-semibold);
}

h5 {
    font-size: var(--al-text-lg);
    font-weight: var(--al-font-weight-semibold);
}

h6 {
    font-size: var(--al-text-base);
    font-weight: var(--al-font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

p {
    margin-bottom: var(--al-space-md);
    line-height: var(--al-leading-relaxed);
    color: var(--al-color-slate);
}

.text-white,
.al-section--dark h1,
.al-section--dark h2,
.al-section--dark h3,
.al-section--dark h4,
.al-section--dark h5,
.al-section--dark h6,
.al-section--dark p {
    color: var(--al-color-white);
}

.al-section--dark p {
    color: rgba(255, 255, 255, 0.8);
}

/* ── Links ── */
a {
    color: var(--al-color-electric-blue);
    text-decoration: none;
    transition: color var(--al-transition-fast);
}

a:hover {
    color: var(--al-color-navy);
}

/* ── Images ── */
img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ── Lists ── */
ul, ol {
    padding-inline-start: 0;
    list-style: none;
}

/* ── Selection ── */
::selection {
    background-color: var(--al-color-electric-blue);
    color: var(--al-color-white);
}

::-moz-selection {
    background-color: var(--al-color-electric-blue);
    color: var(--al-color-white);
}

/* ── Scrollbar (Webkit) ── */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--al-color-snow);
}

::-webkit-scrollbar-thumb {
    background: var(--al-color-deep-blue);
    border-radius: var(--al-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--al-color-navy);
}

/* ── Text Alignment ── */
.al-text-center {
    text-align: center;
}

.al-text-center > p {
    max-width: 720px;
    margin-inline: auto;
}

.al-text-start {
    text-align: start;
}

.al-text-end {
    text-align: end;
}

/* ── Section Header ── */
.al-section-header {
    text-align: center;
    margin-bottom: var(--al-space-2xl);
    max-width: 800px;
    margin-inline: auto;
}

.al-section-header h2 {
    margin-bottom: var(--al-space-sm);
}

.al-section-header p {
    font-size: var(--al-text-lg);
    color: var(--al-color-slate);
}

/* ── Section Label / Badge ── */
.al-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-radius: var(--al-radius-full);
    font-size: var(--al-text-xs);
    font-weight: var(--al-font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--al-space-sm);
}

.al-badge--gold {
    background: var(--al-gradient-gold);
    color: var(--al-color-navy);
}

.al-badge--blue {
    background: var(--al-gradient-navy-blue);
    color: var(--al-color-white);
}

.al-badge--outline {
    background: transparent;
    border: 2px solid var(--al-color-gold);
    color: var(--al-color-gold);
}

.al-badge--glass {
    background: var(--al-glass-bg);
    border: 1px solid var(--al-glass-border);
    backdrop-filter: blur(var(--al-glass-blur));
    color: var(--al-color-white);
}

/* ── Decorative Elements ── */
.al-divider {
    width: 60px;
    height: 4px;
    background: var(--al-gradient-gold);
    border-radius: var(--al-radius-full);
    margin-block: var(--al-space-sm) var(--al-space-lg);
}

.al-divider--center {
    margin-inline: auto;
}

/* ── Gold Accent Line ── */
.al-accent-line {
    position: relative;
    display: inline-block;
}

.al-accent-line::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 50%;
    height: 4px;
    background: var(--al-gradient-gold);
    border-radius: var(--al-radius-full);
}

/* ── RTL Specific Adjustments ── */
[dir="rtl"] .al-accent-line::after {
    right: 0;
    left: auto;
}

/* ── Responsive Grid Utility ── */
.al-grid {
    display: grid;
    gap: var(--al-space-lg);
}

.al-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
}

.al-grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.al-grid--4 {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

/* ── Flex Utilities ── */
.al-flex {
    display: flex;
    flex-wrap: wrap;
}

.al-flex--center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.al-flex--between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Screen Reader Only ── */
.al-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── WordPress Alignments ── */
.alignwide {
    max-width: var(--al-container-wide);
    margin-inline: auto;
}

.alignfull {
    max-width: 100%;
    width: 100%;
    margin-inline: 0;
}

/* ── WordPress Blocks Overrides ── */
.wp-block-group {
    margin-block-start: 0;
    margin-block-end: 0;
}

.wp-block-columns {
    gap: var(--al-space-lg);
}

/* ── Entry Content (Blog Posts) ── */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    margin-top: var(--al-space-xl);
    margin-bottom: var(--al-space-sm);
}

.entry-content p {
    margin-bottom: var(--al-space-md);
}

.entry-content ul,
.entry-content ol {
    padding-inline-start: var(--al-space-lg);
    margin-bottom: var(--al-space-md);
}

.entry-content ul {
    list-style-type: disc;
}

.entry-content ol {
    list-style-type: decimal;
}

.entry-content li {
    margin-bottom: var(--al-space-xs);
}

.entry-content blockquote {
    border-inline-start: 4px solid var(--al-color-gold);
    padding: var(--al-space-md) var(--al-space-lg);
    margin-block: var(--al-space-lg);
    background: var(--al-color-snow);
    border-radius: 0 var(--al-radius-md) var(--al-radius-md) 0;
    font-style: italic;
}

[dir="rtl"] .entry-content blockquote {
    border-radius: var(--al-radius-md) 0 0 var(--al-radius-md);
}

.entry-content img {
    border-radius: var(--al-radius-lg);
    margin-block: var(--al-space-md);
}

.entry-content a {
    color: var(--al-color-electric-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.entry-content a:hover {
    color: var(--al-color-navy);
}

/* ── Responsive Typography Adjustments ── */
@media (max-width: 768px) {
    h1 {
        font-size: var(--al-text-3xl);
    }
    h2 {
        font-size: var(--al-text-2xl);
    }
    h3 {
        font-size: var(--al-text-xl);
    }
    .al-section {
        padding-block: calc(var(--al-space-section) * 0.7);
    }
    .al-section--diagonal-top {
        clip-path: polygon(0 2%, 100% 0, 100% 100%, 0 100%);
        margin-top: -2%;
    }
    .al-section--diagonal-bottom {
        clip-path: polygon(0 0, 100% 0, 100% 98%, 0 100%);
    }
}