/* ==========================================================================
   base.css - foundations for every page
   --------------------------------------------------------------------------
   Purpose:     Colours, fonts, page basics, headings and accessibility helpers.
   Used by:     Every page.
   Order:       Load after fonts.css and before the other style files.
   !important:  Used only here: for hidden items, and for people who ask for less
                motion. Do not add more; write a more exact selector instead.
   ========================================================================== */

/* ---------- Design tokens ---------- */
/* --text-muted passes WCAG AA contrast (4.5:1) on white, magnolia and pale green.
   "Optima Brand" / "Gill Sans Brand" are commercial fonts and need a web licence (see
   docs/AUDIT-NOTES.md). Without them the next fonts in each list are used.
   --logo-clear is the empty space the brand guidelines ask for around the logo. */
:root {
    --bg-main: #F6EFE6; /* Magnolia derived */
    --bg-card: #FFFFFF;
    --text-primary: #1C3A1F; /* Dark Myrtle */
    --text-secondary: #355E3B; /* Lighter Myrtle */
    --accent: #264F27;
    --accent-glow: rgba(38, 79, 39, 0.2);
    --border-color: rgba(38, 79, 39, 0.1);
    --row-highlight-bg: #EAF0DF; /* Very pale green */
    --hero-text: #F2E8D7;
    --hero-accent: #BADEAD;
    --shadow-sm: 0 4px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 12px 24px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.08);
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 30px;
    color-scheme: only light;
    --font-heading: "Optima Brand", "Libertinus Sans", Optima, Candara, "Segoe UI", sans-serif;
    --font-body: "Gill Sans Brand", "Cabin", "Gill Sans", "Gill Sans MT", "Segoe UI", sans-serif;
    --font-arabic: "Noto Sans Arabic", "Geeza Pro", "Segoe UI", sans-serif;
    --text-muted: #4E6F50;
    --logo-clear: 24px;
}

/* ---------- Page foundations ---------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* A column at least as tall as the window, so the footer sits at the bottom of short pages */
body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    font-family: var(--font-body);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-wrap: break-word;
}

/* Anything marked hidden stays hidden, whatever other rules say */
[hidden] {
    display: none !important;
}

body > main {
    flex: 1 0 auto;
    width: 100%;
}

body > .site-footer-banner {
    flex-shrink: 0;
}

/* Stops iOS / Samsung enlarging text when the phone is turned sideways */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

/* 16px: iOS zooms the page when you tap a field with smaller text */
input,
textarea,
select {
    font-size: 16px;
}

main[tabindex="-1"]:focus {
    outline: none;
}

@supports (overflow: clip) {
    body {
        overflow-x: clip;
    }
}

@media (prefers-reduced-motion: reduce) {
    /* For people who ask their device for less motion */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Headings and languages ---------- */
.section-title {
    font-size: 1.6rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    text-align: center;
    position: relative;
    padding-bottom: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--accent);
    opacity: 0.3;
}

[lang="ar"],
[dir="rtl"] {
    font-family: var(--font-arabic);
}

/* Sub-headings: regular weight */
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0;
}

/* Main headings: bold */
h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

/* "1st KHUTBAH" / "2nd KHUTBAH": the ordinal stays lower-case */
.ord {
    text-transform: none;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.75rem;
    }
}

/* ---------- Accessibility helpers ---------- */
/* Read out by screen readers but not shown */
.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;
}

/* For keyboard and screen-reader users: hidden until it gets focus */
.skip-link {
    position: absolute;
    left: 12px;
    top: -100px;
    z-index: 10000;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--hero-text);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-md);
}

.skip-link:focus {
    top: 12px;
    outline: 2px solid var(--hero-accent);
    outline-offset: 2px;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
