@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-Thin.ttf") format("truetype");
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-ExtraLight.ttf") format("truetype");
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-Light.ttf") format("truetype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-Medium.ttf") format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "IBM Plex Sans Arabic";
    src: url("../fonts/IBMPlexSansArabic-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Arkan Dima Sina";
    src: url("../fonts/ArkanDimaSina.ttf") format("truetype");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Futura";
    src: url("../fonts/Futura.ttc") format("truetype");
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

:root,
[data-theme="light"] {
    --brown: #732A19;
    --gold: #BF7F30;
    --terra: #BF4F36;
    --accent: #BF4F36;
    --accent-hover: #732A19;
    --accent-soft: rgba(191, 79, 54, 0.12);
    --bg: #FFE3E3;
    --bg-soft: #f7d4d4;
    --surface: #fff6f6;
    --text: #1a120f;
    --text-muted: #5c4a44;
    --border: #efc4c4;
    --header: #FFE3E3;
    --shadow: 0 18px 50px rgba(115, 42, 25, 0.1);
    --radius: 18px;
    --max: 1120px;
    --header-h: 84px;
    --display: "Arkan Dima Sina", "IBM Plex Sans Arabic", serif;
    --sans: "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
    --latin: "Futura", "IBM Plex Sans Arabic", sans-serif;
    --fill-warm: linear-gradient(160deg, #732A19 0%, #BF4F36 55%, #BF7F30 100%);
    --hero-bg: #FFE3E3;
    --hero-text: #732A19;
    --hero-muted: #5c4a44;
    --hero-kicker: #BF7F30;
    --hero-veil: linear-gradient(180deg, rgba(255,227,227,0.15), rgba(255,227,227,0.55));
    --footer-bg: #f5d0d0;
    --footer-text: #732A19;
    --footer-muted: #5c4a44;
    --footer-line: #e8b8b8;
}

[data-theme="dark"] {
    --gold: #e2b056;
    --terra: #ef7a5c;
    --accent: #e2b056;
    --accent-hover: #ef7a5c;
    --accent-soft: rgba(226, 176, 86, 0.14);
    --bg: #050506;
    --bg-soft: #0c0c0f;
    --surface: #141418;
    --text: #f5f5f7;
    --text-muted: #a8a8b3;
    --border: #2a2a32;
    --header: #050506;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    --fill-warm: linear-gradient(160deg, #3a1610 0%, #732A19 48%, #BF7F30 100%);
    --hero-bg: #050506;
    --hero-text: #fafafa;
    --hero-muted: #c5c5ce;
    --hero-kicker: #e2b056;
    --hero-veil: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.78));
    --footer-bg: #000000;
    --footer-text: #f5f5f7;
    --footer-muted: #a8a8b3;
    --footer-line: #2a2a32;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
    letter-spacing: 0;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

.skip-link {
    position: absolute;
    inset-inline-start: 12px;
    top: -40px;
    background: var(--accent);
    color: #fff;
    padding: 8px 12px;
    z-index: 80;
}

.skip-link:focus {
    top: 12px;
}

.container {
    width: min(var(--max), calc(100% - 40px));
    margin-inline: auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(16px);
    background: var(--header);
    border-bottom: 1px solid var(--border);
}

.header-bar {
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 24px;
}

.site-nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-inline: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    height: 52px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    display: block;
}

.brand-logo-official {
    height: 62px;
    max-width: 220px;
    background: #0b0b0b;
    border-radius: 12px;
    padding: 4px 8px;
}

[data-theme="dark"] .brand-logo-official {
    background: transparent;
    padding: 0;
}

.brand-mark {
    width: 42px;
    height: 42px;
    color: var(--accent);
    display: grid;
    place-items: center;
}

.brand-mark svg {
    width: 42px;
    height: 42px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-text strong {
    font-family: var(--latin);
    font-size: 1.05rem;
    letter-spacing: 0.16em;
    font-weight: 700;
}

.brand-text small {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: 3px;
}

.site-nav a {
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: 999px;
}

.site-nav a:hover,
.site-nav a.is-active {
    color: var(--text);
}

.site-nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-end;
}

.theme-toggle,
.nav-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: var(--text);
}

.theme-toggle svg,
.nav-toggle span {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

.header-admin {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}

.nav-toggle {
    display: none;
    position: relative;
}

.nav-toggle span {
    position: absolute;
    width: 16px;
    height: 1.5px;
    background: currentColor;
    transition: 0.2s ease;
}

.nav-toggle span:first-child {
    transform: translateY(-4px);
}

.nav-toggle span:last-child {
    transform: translateY(4px);
}

body.nav-open .nav-toggle span:first-child {
    transform: rotate(45deg);
}

body.nav-open .nav-toggle span:last-child {
    transform: rotate(-45deg);
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 0 0 28px;
}

.hero-stage {
    position: relative;
    min-height: min(86vh, 820px);
    display: grid;
    align-items: end;
    isolation: isolate;
    background: var(--hero-bg);
}

.hero-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.hero-veil {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: var(--hero-veil);
}

.hero:not(.has-photo) .hero-veil {
    background: var(--hero-veil);
}

.hero-motif {
    position: absolute;
    inset-inline-start: 4%;
    bottom: 12%;
    width: 260px;
    height: 260px;
    z-index: 1;
    opacity: 0.28;
    background: url("../img/motif.svg") center / contain no-repeat;
}

[data-theme="dark"] .hero-motif {
    opacity: 0.4;
    filter: brightness(1.15);
}

.hero-copy {
    position: relative;
    z-index: 2;
    padding: 120px 0 88px;
    color: var(--hero-text);
}

.hero-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    max-width: 36rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px;
}

.hero-search input {
    border: 0;
    background: transparent;
    box-shadow: none;
    min-height: 44px;
    padding-inline: 16px;
}

.hero-search input:focus {
    border: 0;
    box-shadow: none;
}

.hero-search .btn {
    min-height: 44px;
    flex-shrink: 0;
}

.page-search {
    margin-top: 22px;
}

.to-top {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--footer-line);
    color: var(--footer-text);
    border-radius: 50%;
    background: var(--surface);
    margin-inline-start: auto;
}

.to-top svg {
    width: 22px;
    height: 22px;
}

.to-top:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.hero-kicker {
    color: var(--hero-kicker);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 18px;
}

.hero .lede {
    color: var(--hero-muted);
}

.hero .btn-ghost {
    border-color: var(--hero-text);
    color: var(--hero-text);
}

.hero .btn-ghost:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.hero .btn-primary {
    background: var(--gold);
    color: #fff;
}

.hero .btn-primary:hover {
    filter: brightness(0.92);
}

h1, h2, h3, .display {
    font-family: var(--display);
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.25;
    margin: 0;
}

h1 {
    font-size: clamp(2.7rem, 6vw, 5rem);
    max-width: 12em;
}

h2 {
    font-size: clamp(2rem, 4vw, 3rem);
}

h3 {
    font-size: 1.45rem;
}

.lede {
    max-width: 42rem;
    color: var(--text-muted);
    font-size: 1.08rem;
    margin: 22px 0 0;
}

.hero-actions,
.setup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    border-color: var(--border);
    background: transparent;
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.section {
    padding: 96px 0;
}

.section-soft {
    background:
        url("../img/motif.svg") calc(100% - 4%) 12% / 200px no-repeat,
        linear-gradient(180deg, var(--bg-soft), var(--bg));
}

.section-motif {
    position: relative;
    background:
        url("../img/motif.svg") 4% 70% / 240px no-repeat,
        var(--bg);
}

[data-theme="dark"] .section-soft,
[data-theme="dark"] .section-motif {
    background-blend-mode: lighten;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 24px;
    margin-bottom: 36px;
}

.section-head p,
.muted {
    color: var(--text-muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-top: -36px;
    position: relative;
    z-index: 3;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stat {
    padding: 26px 24px;
    border-inline-start: 1px solid var(--border);
}

.stat:first-child {
    border-inline-start: 0;
}

.stat strong {
    display: block;
    font-family: var(--display);
    font-size: 2.4rem;
    font-weight: 500;
    color: var(--gold);
}

.stat span {
    color: var(--text-muted);
    font-size: 0.92rem;
}

.card-grid,
.pillar-grid,
.branch-grid,
.value-grid {
    display: grid;
    gap: 18px;
}

.pillar-grid,
.value-grid {
    grid-template-columns: repeat(3, 1fr);
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.activity-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px 22px 22px 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.activity-card img,
.activity-fallback {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.activity-fallback {
    background:
        url("../img/motif.svg") center / 120px no-repeat,
        var(--fill-warm);
}

.activity-body {
    padding: 18px 20px 22px;
}

.activity-body h3 {
    margin: 8px 0 8px;
    font-size: 1.25rem;
}

.activity-body p {
    margin: 0;
    color: var(--text-muted);
}

.activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.activity-meta span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    background: var(--accent-soft);
    padding: 3px 10px;
    border-radius: 999px;
}

a.video-card {
    color: inherit;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

a.video-card:hover,
a.video-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.video-thumb {
    position: relative;
}

.video-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.video-play svg {
    width: 58px;
    height: 58px;
}

.branch-grid {
    grid-template-columns: repeat(2, 1fr);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px 22px 22px 22px;
    padding: 30px 28px;
    box-shadow: none;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card::before {
    content: "";
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: 0;
    width: 42px;
    height: 2px;
    background: var(--gold);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.card-quiet {
    margin-bottom: 14px;
}

.branch-stack .card:last-child {
    margin-bottom: 0;
}

.card h3 {
    margin-bottom: 10px;
}

.card p {
    margin: 0;
    color: var(--text-muted);
}

.card-index {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 18px;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
}

.split-copy p {
    color: var(--text-muted);
}

.panel {
    min-height: 360px;
    border-radius: 4px 40px 4px 40px;
    border: 1px solid var(--border);
    background:
        url("../img/motif.svg") 82% 18% / 180px no-repeat,
        var(--fill-warm);
    position: relative;
    overflow: hidden;
}

.panel::before,
.panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
}

.panel::before {
    width: 220px;
    height: 220px;
    right: -40px;
    top: -50px;
}

.panel::after {
    width: 140px;
    height: 140px;
    left: 28px;
    bottom: 28px;
}

.cta-band {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 48px 50px;
    border: 1px solid var(--border);
    border-radius: 4px 32px 4px 32px;
    background:
        linear-gradient(120deg, rgba(191, 127, 48, 0.1), transparent 40%),
        var(--surface);
}

.page-hero {
    padding: 88px 0 44px;
    border-bottom: 1px solid var(--border);
    background:
        url("../img/motif.svg") 92% 8% / 180px no-repeat,
        radial-gradient(circle at 90% 0, rgba(191, 127, 48, 0.16), transparent 34%),
        var(--bg-soft);
}

.prose {
    max-width: 46rem;
}

.prose p {
    color: var(--text-muted);
    font-size: 1.05rem;
}

.hq {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}

.meta-list {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    color: var(--text-muted);
}

.meta-list li {
    padding: 8px 0;
    border-top: 1px solid var(--border);
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid label,
.two-col label,
.stat-fields label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.form-grid h2 {
    margin-top: 8px;
}

label.check {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

label.check input {
    width: auto;
}

.footer-social {
    display: flex;
    gap: 14px;
    margin-top: 16px;
}

.footer-social a {
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.contact-layout {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 28px;
}

.notice {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--text);
    margin-bottom: 16px;
}

.notice-ok {
    background: var(--accent-soft);
}

.notice-error {
    background: rgba(196, 72, 72, 0.12);
}

.site-footer {
    padding: 64px 0 24px;
    background: var(--footer-bg);
    color: var(--footer-text);
}

.footer-rule {
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--terra), transparent);
    margin-bottom: 48px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr 1fr;
    gap: 36px;
    padding-bottom: 36px;
}

.footer-brand p,
.footer-meta,
.site-footer a {
    color: var(--footer-muted);
}

.site-footer h3 {
    font-family: var(--sans);
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 14px;
}

.site-footer a:hover {
    color: var(--gold);
}

.footer-base {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--footer-line);
    color: var(--footer-muted);
    font-size: 0.88rem;
}

.site-footer .brand-text strong,
.site-footer .brand-mark {
    color: var(--footer-text);
}

.site-footer .brand-text small {
    color: var(--footer-muted);
}

.site-footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-footer li + li {
    margin-top: 8px;
}

.setup-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background: var(--bg-soft);
}

.setup-card {
    width: min(560px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 36px;
    box-shadow: var(--shadow);
}

.setup-card h1 {
    font-size: 2.6rem;
    max-width: none;
}

.setup-help {
    margin: 0 0 22px;
}

.setup-help ol {
    color: var(--text-muted);
    padding-inline-start: 1.2rem;
}

.setup-help li + li {
    margin-top: 8px;
}

.sql-box {
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.82rem;
    min-height: 120px;
    background: var(--bg-soft);
}

.kicker {
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 10px;
}

@media (max-width: 900px) {
    .header-bar {
        gap: 12px;
    }

    .nav-toggle {
        display: grid;
    }

    .hero-search {
        max-width: 100%;
    }

    .site-nav {
        display: none;
        position: absolute;
        inset-inline: 0;
        top: var(--header-h);
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px 20px 20px;
    }

    body.nav-open .site-nav {
        display: flex;
    }

    .stats,
    .pillar-grid,
    .value-grid,
    .branch-grid,
    .activity-grid,
    .split,
    .contact-layout,
    .footer-grid,
    .cta-band,
    .section-head {
        grid-template-columns: 1fr;
        display: grid;
    }

    .cta-band,
    .section-head {
        align-items: start;
    }

    .hero-stage {
        min-height: 72vh;
    }

    .hero-copy {
        padding: 88px 0 56px;
    }

    .stat {
        border-inline-start: 0;
        border-top: 1px solid var(--border);
    }

    .stat:first-child {
        border-top: 0;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(var(--max), calc(100% - 28px));
    }

    .brand-text small {
        display: none;
    }

    .footer-base {
        flex-direction: row;
        align-items: center;
    }
}
