/*
 * Colours come from the logo: its violet gradient (#B3A6EE → #7C66D9 → #5B45B8) and its ink (#2B2640).
 * The page is right-to-left, so spacing uses logical properties (inline-start = right).
 */

:root {
    --ink: #2b2640;
    --muted: #6a6483;
    --paper: #ffffff;
    --wash: #f6f4fd;
    --line: #e6e2f4;
    --brand: #5b45b8;
    --brand-mid: #7c66d9;
    --brand-light: #b3a6ee;
    --brand-pale: #e4deff;
    --brand-soft: #eeeafd;
    --deep: #1f1a3a;
    --deep-2: #2e2560;
    --on-deep: #ffffff;
    --on-deep-muted: #cdc6ec;
    --on-brand: #ffffff;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --success: #047857;
    --success-soft: #d1fae5;
    --warning: #92400e;
    --warning-soft: #fef3c7;
    --shadow: 0 14px 30px rgba(43, 38, 64, 0.1);

    --font-body: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
    --font-display: "Noto Kufi Arabic", "IBM Plex Sans Arabic", Tahoma, sans-serif;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ink: #ece9fa;
        --muted: #a9a3c4;
        --paper: #14111f;
        --wash: #1b1729;
        --line: #2d2842;
        --brand: #a897f2;
        --brand-mid: #8f7be6;
        --brand-soft: #262043;
        --deep: #0f0c1c;
        --deep-2: #221c45;
        --on-brand: #14111f;
        --danger: #f87171;
        --danger-soft: #3b1414;
        --success: #6ee7b7;
        --success-soft: #0b2e23;
        --warning: #fcd34d;
        --warning-soft: #33270b;
        --shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
        color-scheme: dark;
    }
}

/* ------------------------------------------------------------ base */

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    line-height: 1.45;
    text-wrap: balance;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
    outline: 2px solid var(--brand-mid);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.wrap {
    width: 100%;
    max-width: 75rem;
    margin-inline: auto;
    padding-inline: max(16px, env(safe-area-inset-left, 0px));
}

@media (min-width: 768px) {
    .wrap { padding-inline: 24px; }
}

.muted { color: var(--muted); }
.nums { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

.pattern-star {
    position: absolute;
    inset: 0;
    opacity: 0.06;
    pointer-events: none;
    background-image: url("../images/pattern.png");
    background-size: 246px 268px;
    background-position: center top;
}

.eyebrow {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-mid);
}

.eyebrow-on-dark { color: var(--brand-light); }

.more-link {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    font-weight: 600;
    color: var(--brand);
}

.more-link::after { content: "←"; }
a.more-link:hover { text-decoration: underline; }

.empty {
    padding: 32px;
    border: 1px dashed var(--line);
    border-radius: 16px;
    text-align: center;
    color: var(--muted);
}

/* ------------------------------------------------------------ buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, filter 0.15s;
}

.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-mid); }
.btn-secondary { background: var(--paper); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--brand-light); }
.btn-gradient {
    border-radius: 999px;
    padding: 12px 24px;
    background: linear-gradient(120deg, #7c66d9, #b3a6ee);
    color: #fff;
    box-shadow: 0 10px 24px rgba(124, 102, 217, 0.4);
}
.btn-gradient:hover { filter: brightness(1.08); }
.btn-ghost {
    border-radius: 999px;
    padding: 12px 24px;
    border-color: rgba(255, 255, 255, 0.45);
    color: #fff;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.btn-sm { padding: 6px 14px; font-size: 0.88rem; }
.btn-block { width: 100%; }
.btn.is-disabled { opacity: 0.5; pointer-events: none; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.icon-btn:hover { background: var(--brand-soft); }

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--brand);
    cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-muted { color: var(--muted); }
.link-danger { color: var(--danger); }

/* ------------------------------------------------------------ public header */

.util-bar {
    background: var(--deep);
    color: var(--on-deep-muted);
    font-size: 0.82rem;
}

.util-bar-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding-block: 8px;
}

.util-links, .util-langs { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.util-bar a:hover { color: var(--on-deep); }
.util-langs b { color: var(--on-deep); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-block: 12px;
}

.site-logo { flex-shrink: 0; }
.site-logo img { width: 176px; height: auto; }

.main-nav {
    display: none;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
}

.nav-item { position: relative; }

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.93rem;
    font-weight: 600;
    transition: background-color 0.15s, color 0.15s;
}

.nav-item:hover .nav-link,
.nav-item:focus-within .nav-link {
    background: var(--brand-soft);
    color: var(--brand);
}

.nav-link.is-active {
    color: var(--brand);
    box-shadow: inset 0 -3px 0 var(--brand-mid);
}

.mega {
    position: absolute;
    inset-inline-start: 0;
    top: 100%;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 27rem;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    box-shadow: 0 18px 40px rgba(43, 38, 64, 0.14);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s;
}

.nav-item:hover .mega,
.nav-item:focus-within .mega {
    visibility: visible;
    opacity: 1;
}

.mega h4 { margin-bottom: 6px; font-size: 0.85rem; color: var(--brand-mid); }
.mega a { display: block; padding-block: 4px; font-size: 0.9rem; }
.mega a:hover { color: var(--brand); }

.header-buttons { display: flex; gap: 8px; margin-inline-start: auto; }

.mobile-nav { border-top: 1px solid var(--line); background: var(--paper); }
.mobile-nav-inner { display: grid; gap: 2px; padding-block: 12px; }
.mobile-nav a { padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.mobile-nav a:hover, .mobile-nav a.is-active { background: var(--brand-soft); color: var(--brand); }

@media (min-width: 768px) {
    .site-logo img { width: 208px; }
}

@media (min-width: 1100px) {
    .main-nav { display: flex; }
    .header-buttons { margin-inline-start: 0; }
    .menu-btn, .mobile-nav { display: none !important; }
}

/* ------------------------------------------------------------ hero & slider */

.hero {
    position: relative;
    overflow: hidden;
    background: radial-gradient(90% 120% at 10% 0%, var(--deep-2), var(--deep) 60%);
    color: var(--on-deep);
}

.hero-grid {
    position: relative;
    display: grid;
    gap: 48px;
    align-items: center;
    padding-block: 56px 80px;
}

.hero-eyebrow { font-size: 0.85rem; font-weight: 600; color: var(--brand-light); }

.hero-title {
    margin-block: 14px 20px;
    font-size: clamp(2rem, 4.4vw, 3.2rem);
    font-weight: 800;
    line-height: 1.4;
}

.hero-title-accent {
    background: linear-gradient(90deg, #e4deff, #b3a6ee);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-lead { max-width: 34em; font-size: 1.08rem; line-height: 2; color: var(--on-deep-muted); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

@media (min-width: 1024px) {
    .hero-grid { grid-template-columns: 1fr 1.05fr; padding-block: 72px 96px; }
}

.slider {
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    background: rgba(46, 37, 96, 0.6);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.slider-empty {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    padding: 32px;
    text-align: center;
    color: var(--on-deep-muted);
}

.slider-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; }

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.7s;
    pointer-events: none;
}

.slide.is-active { opacity: 1; pointer-events: auto; }

.slider-count {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    padding: 2px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    font-size: 0.75rem;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.slider-body { display: grid; gap: 8px; padding: 20px 22px 4px; }

.slider-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--brand-light);
    font-variant-numeric: tabular-nums;
}

.slider-title { font-size: 1.15rem; line-height: 1.7; color: var(--on-deep); }
.slider-title a:hover { color: var(--brand-light); }

.slider-title, .slider-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.slider-excerpt { font-size: 0.92rem; color: var(--on-deep-muted); }

.slider-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 22px 20px;
}

.slider-dots { display: flex; gap: 6px; }

.slider-dot {
    width: 12px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: width 0.2s, background-color 0.2s;
}

.slider-dot:hover { background: rgba(255, 255, 255, 0.5); }
.slider-dot.is-active { width: 28px; background: var(--brand-light); }

.slider-arrows { display: flex; gap: 8px; }

.slider-arrow {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.slider-arrow:hover { background: rgba(255, 255, 255, 0.1); }

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

@media (prefers-reduced-motion: reduce) {
    .slide, .slider-dot { transition: none; }
}

/* ------------------------------------------------------------ covers & tags */

.cover { width: 100%; height: 100%; object-fit: cover; }

.cover-ph { position: relative; overflow: hidden; }
.cover-ph .pattern-star { opacity: 0.25; }
.cover-ph-0 { background: linear-gradient(135deg, #5b45b8, #7c66d9 60%, #b3a6ee); }
.cover-ph-1 { background: linear-gradient(135deg, #2b2640, #5b45b8); }
.cover-ph-2 { background: linear-gradient(135deg, #7c66d9, #b3a6ee 70%, #e4deff); }
.cover-ph-3 { background: linear-gradient(135deg, #1f1a3a, #7c66d9); }

.cover-ph-icon {
    position: absolute;
    inset-inline-end: 8%;
    bottom: 10%;
    width: 25%;
    max-width: 7rem;
    opacity: 0.6;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 0.72rem;
    font-weight: 600;
    color: #2b2640;
}

.tag-on-dark { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ------------------------------------------------------------ announcements */

.promos { background: var(--wash); }

.promos-grid {
    position: relative;
    top: -36px;
    display: grid;
    gap: 20px;
    margin-bottom: -36px;
}

.promo {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
    transition: border-color 0.15s;
}

.promo:hover { border-color: var(--brand-light); }
.promo h3 { font-size: 1.15rem; }
.promo p { font-size: 0.92rem; color: var(--muted); }
.promo .more-link { margin-top: auto; }

.promo-primary {
    border-color: transparent;
    background: linear-gradient(120deg, #5b45b8, #7c66d9);
    color: #fff;
    box-shadow: 0 18px 36px rgba(91, 69, 184, 0.3);
}

.promo-primary .eyebrow, .promo-primary p { color: #e4deff; }
.promo-primary .more-link { color: #fff; }

@media (min-width: 768px) {
    .promos-grid { grid-template-columns: 2fr 1fr 1fr; }
}

/* ------------------------------------------------------------ sections */

.section { padding-block: 56px; }
.section-wash { background: var(--wash); }
.section-tight { padding-top: 0; }

@media (min-width: 768px) {
    .section { padding-block: 72px; }
    .section-tight { padding-top: 0; }
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}

.section-head h2, .section-title { font-size: clamp(1.5rem, 2.6vw, 2rem); line-height: 1.5; }
.section-more { margin-top: 32px; }

/* stats */
.stats-row { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.stat { padding: 24px 0 16px; border-bottom: 1px solid var(--line); }
.stat b {
    display: block;
    font-family: var(--font-display);
    font-size: 2.6rem;
    line-height: 1.25;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}
.stat span { font-size: 0.92rem; color: var(--muted); }

@media (min-width: 768px) {
    .stats-row { grid-template-columns: repeat(4, 1fr); }
    .stat { padding-inline: 20px; border-bottom: 0; border-inline-start: 1px solid var(--line); }
    .stat:first-child { padding-inline-start: 0; border-inline-start: 0; }
}

/* about */
.about-grid { display: grid; gap: 40px; align-items: start; }
.about-grid .section-title { margin-block: 8px 24px; }

.about-quote {
    margin: 0;
    padding-inline-start: 20px;
    border-inline-start: 4px solid var(--brand-mid);
    font-family: var(--font-display);
    font-size: 1.3rem;
    line-height: 1.9;
    color: var(--brand);
}

.about-body { display: grid; gap: 14px; max-width: 38em; line-height: 2; color: var(--muted); }

.axes {
    display: grid;
    gap: 1px;
    margin-top: 40px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--line);
}

.axis { display: grid; align-content: start; gap: 8px; padding: 22px; background: var(--paper); }
.axis h3 { font-size: 1rem; }
.axis p { font-size: 0.86rem; color: var(--muted); }

.axis-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
}

@media (min-width: 640px) { .axes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) {
    .about-grid { grid-template-columns: 1fr 1.2fr; gap: 56px; }
    .axes { grid-template-columns: repeat(4, 1fr); }
}

/* media center */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }

.tab {
    padding: 8px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
}

.tab:hover { border-color: var(--brand-light); }
.tab.is-active { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }

.cards-grid { display: grid; gap: 24px; }

@media (min-width: 640px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .cards-grid { grid-template-columns: repeat(3, 1fr); } }

.news-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.news-card:hover { border-color: var(--brand-light); box-shadow: var(--shadow); }
.news-card-media { position: relative; aspect-ratio: 16 / 10; }
.news-card-media .tag { position: absolute; top: 12px; inset-inline-start: 12px; }
.news-card-body { display: grid; gap: 8px; padding: 20px; }
.news-card-body h3 { font-size: 1.02rem; line-height: 1.7; }
.news-card:hover h3 { color: var(--brand); }
.date { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.events-grid { display: grid; gap: 16px; }
@media (min-width: 768px) { .events-grid { grid-template-columns: repeat(2, 1fr); } }

.event-tile {
    display: grid;
    min-width: 0;
    grid-template-columns: 4.5rem 1fr;
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
}

a.event-tile:hover { border-color: var(--brand-light); }

.cal {
    padding-block: 8px;
    border-radius: 12px;
    background: var(--brand);
    color: var(--on-brand);
    text-align: center;
    line-height: 1.25;
}

.cal b { display: block; font-family: var(--font-display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.cal span { font-size: 0.75rem; }
.event-tile-body { min-width: 0; }
.event-tile-body h3 { margin-bottom: 2px; font-size: 1rem; }
.event-tile-body p { font-size: 0.85rem; color: var(--muted); }
.event-tile-body .more-link { margin-top: 4px; font-size: 0.85rem; }

/* outputs */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
    padding: 8px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    font-size: 0.92rem;
}

.chip-hi { border-color: transparent; background: var(--brand-soft); font-weight: 600; color: var(--brand); }

/* coordinator & apply */
.people-grid { display: grid; gap: 24px; }
@media (min-width: 1024px) { .people-grid { grid-template-columns: 1.3fr 1fr; } }

.coord {
    position: relative;
    display: grid;
    align-items: center;
    gap: 24px;
    overflow: hidden;
    padding: 28px;
    border-radius: 18px;
    background: var(--deep);
    color: var(--on-deep);
}

.coord .pattern-star { opacity: 0.12; }
.coord-body { position: relative; }
.coord h3 { font-size: 1.3rem; }
.coord p { margin-top: 10px; color: var(--on-deep-muted); }
.coord-link { margin-top: 18px; }

.avatar {
    position: relative;
    display: block;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    border: 3px solid var(--brand-light);
    background: linear-gradient(135deg, #b3a6ee, #7c66d9);
    object-fit: cover;
    object-position: center 30%;
}

@media (min-width: 640px) { .coord { grid-template-columns: auto 1fr; } }

.apply {
    display: grid;
    align-content: center;
    gap: 10px;
    padding: 28px;
    border: 1.5px dashed var(--brand-light);
    border-radius: 18px;
    background: var(--brand-soft);
}

.apply h3 { font-size: 1.2rem; }
.apply p { font-size: 0.92rem; color: var(--muted); }
.apply .btn { justify-self: start; }

/* ------------------------------------------------------------ news pages */

.page-hero { position: relative; overflow: hidden; background: var(--deep); color: var(--on-deep); }
.page-hero-inner { position: relative; padding-block: 48px; }
.page-hero h1 { margin-top: 6px; font-size: clamp(1.7rem, 3.4vw, 2.5rem); font-weight: 800; line-height: 1.5; }
.article-head { max-width: 75rem; }
.article-head h1 { max-width: 48rem; margin-top: 14px; }
.back-link { font-size: 0.85rem; font-weight: 600; color: var(--brand-light); }
.back-link:hover { text-decoration: underline; }

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    font-size: 0.88rem;
    color: var(--on-deep-muted);
    font-variant-numeric: tabular-nums;
}

.article-wrap { display: grid; gap: 28px; max-width: 56rem; margin-inline: 0; padding-block: 40px 64px; }
@media (min-width: 1240px) { .article-wrap { margin-inline: auto; } }
.article-cover { aspect-ratio: 2 / 1; overflow: hidden; border-radius: 18px; }
.article-lead { width: 100%; max-width: 42rem; justify-self: center; font-size: 1.15rem; font-weight: 500; line-height: 2; }
.article-body { display: grid; gap: 18px; width: 100%; max-width: 42rem; justify-self: center; line-height: 2.05; color: var(--muted); }

/* Content written with the editor */
.rich-text > * { min-width: 0; }
.rich-text h2, .rich-text h3, .rich-text h4 { margin-top: 10px; font-family: var(--font-display); line-height: 1.6; color: var(--ink); }
.rich-text h2 { font-size: 1.45rem; }
.rich-text h3 { font-size: 1.2rem; }
.rich-text h4 { font-size: 1.05rem; }
.rich-text strong, .rich-text b { color: var(--ink); }
.rich-text a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.rich-text ul, .rich-text ol { margin: 0; padding-inline-start: 1.6em; }
.rich-text li + li { margin-top: 4px; }
.rich-text blockquote {
    margin: 0;
    padding: 6px 18px;
    border-inline-start: 4px solid var(--brand-mid);
    border-radius: 4px;
    background: var(--wash);
    font-weight: 500;
    color: var(--ink);
}
/* Images keep the size and the line alignment chosen in the editor */
.rich-text img { display: inline-block; max-width: 100%; height: auto; vertical-align: bottom; border-radius: 12px; }
.rich-text iframe.ql-video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.rich-text pre { overflow-x: auto; padding: 12px 16px; border-radius: 10px; background: var(--wash); direction: ltr; text-align: left; }
.rich-text hr { width: 100%; border: 0; border-top: 1px solid var(--line); }
.rich-text .ql-align-center { text-align: center; }
.rich-text .ql-align-right { text-align: right; }
.rich-text .ql-align-left { text-align: left; }
.rich-text .ql-align-justify { text-align: justify; }
.rich-text .ql-indent-1 { margin-inline-start: 2em; }
.rich-text .ql-indent-2 { margin-inline-start: 4em; }
.rich-text .ql-indent-3 { margin-inline-start: 6em; }

/* Coordinator's message */
.letter-eyebrow { margin-top: 14px; }

.letter {
    display: grid;
    gap: 32px;
    align-items: start;
    padding-block: 48px 72px;
}

@media (min-width: 900px) {
    .letter { grid-template-columns: 260px minmax(0, 1fr); gap: 56px; }
    .letter-author { position: sticky; top: 24px; }
}

.letter-author {
    display: grid;
    gap: 18px;
    justify-items: center;
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--wash);
    text-align: center;
}

.letter-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--brand-light);
    object-fit: cover;
    object-position: center 30%;
    box-shadow: var(--shadow);
}

.letter-name { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.letter-role { margin-top: 4px; font-size: 0.85rem; line-height: 1.7; color: var(--muted); }

.letter-body { display: grid; gap: 20px; max-width: 44rem; font-size: 1.05rem; line-height: 2.1; color: var(--muted); }

.letter-closing {
    padding: 18px 22px;
    border-inline-start: 4px solid var(--brand-mid);
    border-radius: 6px;
    background: var(--brand-soft);
    font-weight: 500;
    color: var(--ink);
}

.letter-signature { justify-self: end; font-family: var(--font-display); font-weight: 700; color: var(--ink); }

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--muted);
}

.pagination-links { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.pagination-pages, .pagination-count { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ footer */

.site-footer { background: var(--deep); color: var(--on-deep-muted); font-size: 0.9rem; }
.footer-grid { display: grid; gap: 32px; padding-block: 56px 40px; }
.footer-about { display: grid; align-content: start; gap: 16px; }
.footer-logo { width: 224px; height: auto; }
.site-footer h4 { margin-bottom: 12px; font-size: 0.95rem; color: var(--on-deep); }
.site-footer ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.site-footer a:hover { color: var(--on-deep); }
.social { display: flex; gap: 8px; }

.social a {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.social a:hover { border-color: var(--brand-light); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.1); }
.footer-bottom-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-block: 16px; font-size: 0.8rem; }

@media (min-width: 640px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); } }

/* ------------------------------------------------------------ forms (admin, login, setup) */

.form-stack { display: grid; gap: 16px; }
.field { display: grid; align-content: start; gap: 6px; min-width: 0; }
.field label { font-size: 0.88rem; font-weight: 600; }
.field-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.req { color: var(--danger); }

.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    font-size: 0.95rem;
    color: var(--ink);
}

.input::placeholder { color: var(--muted); opacity: 0.7; }
.input:focus { border-color: var(--brand-mid); outline: none; box-shadow: 0 0 0 3px rgba(124, 102, 217, 0.25); }
.input[aria-invalid="true"] { border-color: var(--danger); }
textarea.input { resize: vertical; }
.input-lg { font-size: 1.1rem; font-weight: 600; }
.input-prose { line-height: 2; }
.input-file { padding: 8px; }
.hint { font-size: 0.8rem; color: var(--muted); }
.field-error { font-size: 0.82rem; font-weight: 500; color: var(--danger); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.static-value { padding: 10px 12px; border-radius: 10px; background: var(--wash); text-align: end; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { display: inline; margin: 0; }

.image-preview {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: var(--wash);
    font-size: 0.85rem;
    color: var(--muted);
}

.image-preview img { width: 100%; height: 100%; object-fit: cover; }

.alert { display: grid; gap: 6px; margin-bottom: 18px; padding: 14px 16px; border-radius: 12px; font-size: 0.9rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-detail { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; word-break: break-word; text-align: left; }

/* ------------------------------------------------------------ login / setup / error pages */

.bare-page {
    position: relative;
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow-x: hidden;
    padding: 40px 16px;
    background: var(--deep);
}

.bare-inner { position: relative; display: grid; width: 100%; max-width: 28rem; gap: 24px; }
.bare-logo img { width: 256px; max-width: 100%; height: auto; margin-inline: auto; }

.auth-card {
    padding: 28px 24px;
    border-radius: 18px;
    background: var(--paper);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}

.auth-card h1 { font-size: 1.35rem; }
.auth-card > .muted { margin-block: 4px 22px; font-size: 0.9rem; }
.error-card { display: grid; gap: 10px; justify-items: start; }
.error-card .muted { margin: 0 0 8px; }
.error-status { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; color: var(--brand); }

@media (min-width: 640px) { .auth-card { padding: 32px; } }

/* ------------------------------------------------------------ back office */

.admin-body { background: var(--wash); }
.admin-shell { min-height: 100vh; }

.admin-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 50;
    display: flex;
    width: 16rem;
    flex-direction: column;
    gap: 32px;
    padding: 20px;
    overflow-y: auto;
    background: var(--deep);
    transform: translateX(100%);
    transition: transform 0.2s;
}

.admin-sidebar.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 12, 28, 0.5); }
.admin-logo img { width: 100%; height: auto; }
.admin-nav { display: grid; gap: 2px; }

.admin-nav a {
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--on-deep-muted);
}

.admin-nav a:hover, .admin-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: var(--on-deep); }

.admin-main { min-width: 0; }

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--paper);
}

.admin-greeting { font-size: 0.9rem; color: var(--muted); }
.admin-greeting b { color: var(--ink); }
.admin-logout { margin: 0 0 0 0; margin-inline-start: auto; }

.admin-content { display: grid; gap: 24px; padding: 24px 16px 48px; }

.admin-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.admin-title-row h1 { font-size: 1.5rem; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }

@media (min-width: 768px) {
    .admin-topbar { padding-inline: 32px; }
    .admin-content { padding: 32px; }
}

@media (min-width: 1024px) {
    .admin-shell { display: grid; grid-template-columns: 16rem 1fr; }
    .admin-sidebar { position: sticky; top: 0; height: 100vh; transform: none; }
    .admin-menu-btn { display: none; }
}

.card {
    display: grid;
    min-width: 0;
    align-content: start;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--paper);
}

.card h2 { font-size: 1rem; }
.card-narrow { max-width: 34rem; }

@media (min-width: 768px) { .card { padding: 24px; } }

.grid-2 { display: grid; gap: 24px; }
@media (min-width: 1024px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-wide-first { grid-template-columns: 1.5fr 1fr; }
}

.stat-tiles { display: grid; gap: 16px; }
@media (min-width: 640px) { .stat-tiles { grid-template-columns: repeat(3, 1fr); } }

.stat-tile { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.stat-tile:hover { border-color: var(--brand-light); }

.stat-tile b {
    display: block;
    font-family: var(--font-display);
    font-size: 2.2rem;
    line-height: 1.25;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
}

.stat-tile span { font-size: 0.9rem; color: var(--muted); }

.list { display: grid; margin: 0; padding: 0; list-style: none; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 12px; border-top: 1px solid var(--line); }
.list-row:first-child { padding-top: 0; border-top: 0; }
.list-main { display: grid; min-width: 0; }
.list-title { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.list-title:hover { color: var(--brand); }
.list-meta { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.filters-search { flex: 1 1 14rem; width: auto; min-width: 0; }
.filters-status { flex: 0 1 11rem; width: auto; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.table-plain { border: 0; border-radius: 0; }
.data-table { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: 0.92rem; }
.table-plain .data-table { min-width: 30rem; }

.data-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--wash);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    text-align: start;
}

.data-table td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:first-child td { border-top: 0; }
.data-table tbody tr:hover { background: var(--wash); }
.cell-title { max-width: 28rem; }
.cell-title a { font-weight: 600; }
.cell-title a:hover { color: var(--brand); }
.cell-sub { display: block; margin-top: 2px; font-size: 0.78rem; color: var(--muted); }
.cell-ltr { text-align: end; }
.table-empty { padding: 40px 16px !important; text-align: center; color: var(--muted); }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 16px; white-space: nowrap; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--wash);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
}

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-published { background: var(--success-soft); color: var(--success); }
.badge-draft { background: var(--warning-soft); color: var(--warning); }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); }

.editor-grid { display: grid; align-items: start; gap: 24px; }
.editor-main, .editor-side { display: grid; min-width: 0; gap: 24px; }

@media (min-width: 1280px) {
    .editor-grid { grid-template-columns: 1fr 20rem; }
    .editor-side { position: sticky; top: 84px; }
}

.toast {
    position: fixed;
    bottom: 16px;
    left: 50%;
    z-index: 60;
    display: flex;
    max-width: calc(100% - 32px);
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(31, 26, 58, 0.25);
    transform: translateX(-50%);
}

.toast-success { background: var(--deep); color: var(--on-deep); }
.toast-error { background: #dc2626; color: #fff; }
.toast-close { margin-inline-start: 6px; padding: 0; border: 0; background: none; color: inherit; opacity: 0.7; cursor: pointer; }
.toast-close:hover { opacity: 1; }

/* ---------------------------------------------------------------- rich text editor (back office) */

.rich-editor {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
}

.rich-editor:focus-within { border-color: var(--brand-mid); box-shadow: 0 0 0 3px rgba(124, 102, 217, 0.25); }
.rich-editor.is-invalid { border-color: var(--danger); }
.rich-editor.is-uploading { opacity: 0.6; cursor: progress; }

.rich-editor .ql-toolbar.ql-snow {
    position: sticky;
    top: 0;
    z-index: 2;
    direction: ltr;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--wash);
    font-family: var(--font-body);
}

.rich-editor .ql-container.ql-snow { border: 0; font-family: var(--font-body); font-size: 1rem; }

.rich-editor .ql-snow .ql-editor {
    min-height: 360px;
    max-height: 70vh;
    padding: 16px 18px;
    direction: rtl;
    text-align: right;
    line-height: 2;
    color: var(--ink);
}

.rich-editor .ql-snow .ql-editor.ql-blank::before { right: 18px; left: 18px; font-style: normal; color: var(--muted); }
.rich-editor .ql-snow .ql-editor h2 { font-size: 1.4rem; }
.rich-editor .ql-snow .ql-editor h3 { font-size: 1.15rem; }
.rich-editor .ql-snow .ql-editor img { max-width: 100%; height: auto; border-radius: 8px; }
.rich-editor .ql-snow .ql-editor blockquote { border-left: 0; border-right: 4px solid var(--brand-mid); padding-left: 0; padding-right: 16px; }
.rich-editor .ql-snow .ql-editor a { color: var(--brand); }

/* Lists: markers on the right for Arabic text */
.rich-editor .ql-snow .ql-editor ol { padding-left: 0; padding-right: 1.5em; }
.rich-editor .ql-snow .ql-editor li { padding-left: 0; padding-right: 1.5em; }
.rich-editor .ql-snow .ql-editor li > .ql-ui:before { margin-left: 0.3em; margin-right: -1.5em; text-align: left; }

/* Toolbar colours that follow the light and dark themes */
.rich-editor .ql-snow .ql-stroke { stroke: var(--ink); }
.rich-editor .ql-snow .ql-fill { fill: var(--ink); }
.rich-editor .ql-snow .ql-picker { color: var(--ink); }
.rich-editor .ql-snow .ql-picker-options { background: var(--paper); border-color: var(--line); }
.rich-editor .ql-snow button:hover .ql-stroke,
.rich-editor .ql-snow button.ql-active .ql-stroke,
.rich-editor .ql-snow .ql-picker-label:hover .ql-stroke,
.rich-editor .ql-snow .ql-picker-label.ql-active .ql-stroke { stroke: var(--brand); }
.rich-editor .ql-snow button:hover .ql-fill,
.rich-editor .ql-snow button.ql-active .ql-fill { fill: var(--brand); }
.rich-editor .ql-snow .ql-picker-label:hover,
.rich-editor .ql-snow .ql-picker-item:hover,
.rich-editor .ql-snow .ql-picker-item.ql-selected { color: var(--brand); }

/* Arabic labels for the heading menu and the link / video box */
.rich-editor .ql-snow .ql-picker.ql-header { width: 120px; }
.rich-editor .ql-snow .ql-picker.ql-header .ql-picker-label::before,
.rich-editor .ql-snow .ql-picker.ql-header .ql-picker-item::before { content: "نص عادي"; }
.rich-editor .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.rich-editor .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: "عنوان رئيسي"; }
.rich-editor .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.rich-editor .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: "عنوان فرعي"; }

.rich-editor .ql-snow .ql-tooltip {
    z-index: 3;
    direction: rtl;
    border-color: var(--line);
    border-radius: 10px;
    background: var(--paper);
    box-shadow: var(--shadow);
    color: var(--ink);
    font-family: var(--font-body);
}
.rich-editor .ql-snow .ql-tooltip input[type="text"] { direction: ltr; border-color: var(--line); background: var(--paper); color: var(--ink); }
.rich-editor .ql-snow .ql-tooltip::before { content: "الرابط:"; margin-right: 0; margin-left: 8px; }
.rich-editor .ql-snow .ql-tooltip[data-mode="link"]::before { content: "أدخل الرابط:"; }
.rich-editor .ql-snow .ql-tooltip[data-mode="video"]::before { content: "رابط فيديو YouTube أو Vimeo:"; }
.rich-editor .ql-snow .ql-tooltip a.ql-action::after { content: "تعديل"; border-right: 0; margin-left: 0; margin-right: 8px; padding-right: 0; }
.rich-editor .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "حفظ"; }
.rich-editor .ql-snow .ql-tooltip a.ql-remove::before { content: "حذف"; margin-left: 0; margin-right: 8px; }
.rich-editor .ql-snow .ql-tooltip a.ql-preview { direction: ltr; }

/* Selected image: frame, corner handles, size and quick-size buttons */
.rich-editor .ql-snow .ql-editor img { cursor: pointer; }

.image-tools { position: absolute; z-index: 4; pointer-events: none; }
.image-tools-frame { position: absolute; inset: 0; border: 2px solid var(--brand-mid); border-radius: 4px; }

.image-tools-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--brand-mid);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    pointer-events: auto;
    touch-action: none;
}

.image-tools-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.image-tools-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.image-tools-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.image-tools-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }

.image-tools-size {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(31, 26, 58, 0.8);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

.image-tools-bar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(31, 26, 58, 0.88);
    transform: translateX(-50%);
    pointer-events: auto;
    white-space: nowrap;
}

.image-tools-bar button {
    padding: 3px 10px;
    border: 0;
    border-radius: 999px;
    background: none;
    font: inherit;
    font-size: 0.78rem;
    color: #fff;
    cursor: pointer;
}

.image-tools-bar button:hover { background: rgba(255, 255, 255, 0.18); }
.image-tools.is-resizing .image-tools-bar { display: none; }
