/* ==========================================================================
   Al Huwais — Base Layer
   Typography defaults, RTL helpers, utility classes.
   Loaded after tokens.css, before components.
   ========================================================================== */

/* Typography scale --------------------------------------------------------- */
.ah-h1,
.ah-h2,
.ah-h3,
.ah-h4 {
    color: var(--ah-ink-1);
    line-height: var(--ah-lh-tight);
    font-weight: var(--ah-fw-bold);
    margin: 0 0 var(--ah-s-4);
}

.ah-h1 { font-size: var(--ah-fs-3xl); font-weight: var(--ah-fw-black); letter-spacing: -.02em; }
.ah-h2 { font-size: var(--ah-fs-2xl); letter-spacing: -.015em; }
.ah-h3 { font-size: var(--ah-fs-xl); }
.ah-h4 { font-size: var(--ah-fs-lg); }

.ah-lead {
    font-size: var(--ah-fs-lg);
    line-height: var(--ah-lh-snug);
    color: var(--ah-ink-2);
    max-width: 70ch;
}

.ah-body  { font-size: var(--ah-fs-md); line-height: var(--ah-lh-normal); color: var(--ah-ink-1); }
.ah-small { font-size: var(--ah-fs-sm); color: var(--ah-ink-2); }
.ah-eyebrow {
    display: inline-block;
    font-size: var(--ah-fs-xs);
    font-weight: var(--ah-fw-semibold);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--ah-brand-primary);
    margin-bottom: var(--ah-s-3);
}

/* Layout primitives -------------------------------------------------------- */
.ah-container {
    width: 100%;
    max-width: var(--ah-container);
    margin-inline: auto;
    padding-inline: var(--ah-s-5);
}

.ah-container--tight {
    max-width: var(--ah-container-tight);
}

.ah-section {
    padding-block: var(--ah-section-y);
}

.ah-stack > * + * { margin-top: var(--ah-s-4); }
.ah-stack-lg > * + * { margin-top: var(--ah-s-6); }

.ah-cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ah-s-3);
    align-items: center;
}

.ah-grid {
    display: grid;
    gap: var(--ah-s-5);
}

.ah-grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ah-grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.ah-grid--4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* RTL adjustments — use logical properties throughout the system ----------- */
[dir="rtl"] .ah-eyebrow { letter-spacing: 0; }

/* Focus ring (a11y) -------------------------------------------------------- */
.ah-focusable:focus-visible,
a.ah-link:focus-visible,
button.ah-btn:focus-visible {
    outline: none;
    box-shadow: var(--ah-shadow-focus);
    border-radius: var(--ah-r-sm);
}

/* Links -------------------------------------------------------------------- */
.ah-link {
    color: var(--ah-brand-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--ah-d-fast) var(--ah-ease);
}
.ah-link:hover { border-bottom-color: currentColor; }

/* Visually-hidden ---------------------------------------------------------- */
.ah-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;
}

/* Image frames ------------------------------------------------------------- */
.ah-media {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--ah-r-md);
    overflow: hidden;
}
.ah-media img,
.ah-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ah-media--16-9 { aspect-ratio: 16 / 9; }
.ah-media--4-3  { aspect-ratio: 4 / 3; }
.ah-media--1-1  { aspect-ratio: 1 / 1; }

/* Reduced motion ----------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    /* Partners logo ticker must always scroll (client requirement) — exclude it. */
    *:not(.ah-partners__grid):not(.ah-partners__track), *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Responsive breakpoints — base layer -------------------------------------- */
@media (max-width: 1024px) {
    :root { --ah-section-y: clamp(40px, 7vw, 80px); }
    .ah-grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .ah-container { padding-inline: var(--ah-s-4); }
}

@media (max-width: 768px) {
    :root {
        --ah-section-y: clamp(32px, 6vw, 56px);
        --ah-fs-3xl: 32px;
        --ah-fs-4xl: 40px;
        --ah-fs-2xl: 26px;
        --ah-fs-xl: 22px;
        --ah-fs-lg: 18px;
    }

    .ah-h1 { font-size: var(--ah-fs-2xl); }
    .ah-h2 { font-size: var(--ah-fs-xl); }
    .ah-h3 { font-size: var(--ah-fs-lg); }

    .ah-container { padding-inline: var(--ah-s-3); }

    .ah-grid--2,
    .ah-grid--3,
    .ah-grid--4 {
        grid-template-columns: 1fr;
        gap: var(--ah-s-4);
    }

    .ah-section-header {
        margin-bottom: var(--ah-s-5);
    }

    /* Add space at the very bottom so the theme's mobile bottom bar
       (.mobile-bottom-menu) never overlaps page content. */
    body.ah-themed { padding-bottom: 72px; }
}

@media (max-width: 480px) {
    .ah-container { padding-inline: var(--ah-s-3); }
    .ah-cluster { gap: var(--ah-s-2); }
    .ah-btn--lg { width: 100%; }
}
