/* ==========================================================================
   Egypt X — "Descent" design layer (loaded after style.css, public site only)
   Idea: a Red Sea dive. The page starts in sunlit shallows and the background
   deepens as the visitor scrolls; a slim depth gauge reports metres.
   Palette: abyss navy, reef teal, desert gold. Everything is CSS + ~2 KB JS.
   ========================================================================== */

:root {
    --bg: #06121f;
    --surface: #0b1d31;
    --surface-2: #10263d;
    --text: #e8f2f5;
    --text-soft: #c3d6dd;
    --text-muted: #94aebb;
    --border: #1a3550;
    --gold: #e6b04a;
    --gold-light: #f2cd7e;
    --accent: #2dd4cc;
    --accent-ink: #052a2c;
    --deep-tint: rgba(8, 60, 96, .55);
    --glow: 0 10px 40px -12px rgba(45, 212, 204, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -16px rgba(0, 0, 0, .6);
    --radius: 16px;
    --ease: cubic-bezier(.2, .7, .2, 1);
    --d: 0;
}
:root[data-theme="light"] {
    --bg: #f1f6f7;
    --surface: #ffffff;
    --surface-2: #e8f1f3;
    --text: #0b1f2e;
    --text-soft: #2b4354;
    --text-muted: #4a6272;
    --border: #d5e3e8;
    --gold: #b07a1c;
    --gold-light: #8a5d14;
    --accent: #0a7f8c;
    --accent-ink: #ffffff;
    --deep-tint: rgba(10, 127, 140, .10);
    --glow: 0 10px 34px -14px rgba(10, 127, 140, .45);
    --shadow: 0 1px 2px rgba(11, 31, 46, .06), 0 14px 30px -18px rgba(11, 31, 46, .28);
}

/* The deepening background: one fixed layer, opacity driven by scroll. */
body { position: relative; overflow-x: hidden; }
body::before {
    content: "";
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(1200px 600px at 85% -10%, var(--deep-tint), transparent 60%),
        linear-gradient(180deg, transparent 0%, var(--deep-tint) 100%);
    opacity: calc(.25 + var(--d) * .75);
}

/* Type: tighter, heavier display headings; Arabic keeps natural spacing. */
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.15; }
h1, h2 { font-weight: 800; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.35; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Cross-page fades where the browser supports it (zero JS). */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }

/* ---------- Header: glass that tightens on scroll ---------- */
.site-header {
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    -webkit-backdrop-filter: blur(14px) saturate(1.5);
    backdrop-filter: blur(14px) saturate(1.5);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    transition: box-shadow .3s var(--ease), background-color .3s var(--ease);
}
.site-header.is-scrolled { box-shadow: 0 8px 30px -16px rgba(0, 0, 0, .45); }
.header-inner { transition: height .25s var(--ease); }
.site-header.is-scrolled .header-inner { height: 60px; }
.main-nav a { position: relative; padding: 4px 0; }
.main-nav a::after {
    content: ""; position: absolute; inset-inline: 0; bottom: -2px; height: 2px; border-radius: 2px;
    background: linear-gradient(90deg, var(--gold), var(--accent));
    transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
:root[dir="rtl"] .main-nav a::after, [dir="rtl"] .main-nav a::after { transform-origin: right; }
.main-nav a:hover::after, .main-nav a.active::after { transform: scaleX(1); }

/* ---------- Buttons ---------- */
.btn { position: relative; overflow: hidden; border-radius: 999px; padding: 13px 30px; transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s; }
.btn-primary { background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #1b1303; box-shadow: 0 8px 24px -10px color-mix(in srgb, var(--gold) 70%, transparent); }
:root[data-theme="light"] .btn-primary { color: #fff; background: linear-gradient(135deg, #c48a24, #8a5d14); }
.btn-primary:hover { color: #1b1303; transform: translateY(-3px); box-shadow: 0 14px 30px -10px color-mix(in srgb, var(--gold) 80%, transparent); }
:root[data-theme="light"] .btn-primary:hover { color: #fff; }
.btn-primary::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-120%) skewX(-20deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); transition: transform .7s var(--ease);
}
.btn-primary:hover::after { transform: translateX(120%) skewX(-20deg); }
.btn-outline { margin-inline-start: 12px; margin-left: 0; border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }

/* ---------- Hero: the surface of the sea ---------- */
.hero {
    position: relative; overflow: hidden; isolation: isolate;
    padding: 120px 0 150px;
    background:
        radial-gradient(700px 380px at 50% -5%, color-mix(in srgb, var(--gold) 28%, transparent), transparent 70%),
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
}
.hero h1 { font-size: clamp(2.4rem, 6.2vw, 4.6rem); margin-bottom: 20px; }
.hero h1 span {
    background: linear-gradient(100deg, var(--gold) 0%, var(--accent) 60%, var(--gold) 100%);
    background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: sheen 8s linear infinite;
}
.hero p { font-size: 1.15rem; color: var(--text-soft); }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 34px 0 0; padding: 0; list-style: none; }
.hero-chips li {
    padding: 7px 14px; font-size: .82rem; border-radius: 999px; color: var(--text-soft);
    border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.hero-waves { position: absolute; inset-inline: 0; bottom: -1px; height: 120px; z-index: -1; pointer-events: none; }
.hero-waves svg { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; }
.hero-waves .w1 { fill: color-mix(in srgb, var(--accent) 18%, transparent); animation: drift 22s linear infinite; }
.hero-waves .w2 { fill: color-mix(in srgb, var(--accent) 28%, transparent); animation: drift 15s linear infinite reverse; }
.hero-waves .w3 { fill: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.bubbles { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.bubbles i {
    position: absolute; bottom: 8%; width: var(--s, 10px); height: var(--s, 10px); border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent);
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .5), transparent 60%);
    opacity: 0; animation: bubble var(--t, 9s) ease-in infinite var(--dl, 0s);
}
.hero .container > * { animation: rise .9s var(--ease) both; }
.hero .container > :nth-child(2) { animation-delay: .08s; }
.hero .container > :nth-child(3) { animation-delay: .16s; }
.hero .container > :nth-child(4) { animation-delay: .24s; }
.hero .container > :nth-child(5) { animation-delay: .32s; }

@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes sheen { to { background-position: 200% center; } }
@keyframes drift { to { transform: translateX(-50%); } }
@keyframes bubble { 0% { opacity: 0; transform: translateY(0) scale(.6); } 15% { opacity: .8; } 100% { opacity: 0; transform: translateY(-340px) scale(1.15); } }

/* ---------- Sections, cards: depth, spotlight, lift ---------- */
section { padding: 84px 0; }
section.alt { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
.section-head h2::after { content: ""; display: block; width: 56px; height: 4px; margin: 14px auto 0; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--accent)); }
.section-head p { color: var(--text-soft); }

.card, .brand-card, .post-card {
    position: relative; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); box-shadow: var(--shadow);
    transition: transform .35s var(--ease), border-color .3s, box-shadow .35s var(--ease);
}
.card:hover, .brand-card:hover, .post-card:hover { transform: translateY(-6px); border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: var(--glow), var(--shadow); }
.card::after, .brand-card::after, .post-card::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
    background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.card:hover::after, .brand-card:hover::after, .post-card:hover::after { opacity: 1; }
.card h3 { color: var(--text); }
.card-ico {
    display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 16px; border-radius: 14px;
    color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--gold)));
    transition: transform .4s var(--ease);
}
.card:hover .card-ico { transform: rotate(-6deg) scale(1.08); }
.card-ico svg { width: 26px; height: 26px; }
.brand-card h3 { font-size: 1.35rem; }
.status { border-radius: 999px; padding: 4px 12px; font-weight: 600; }

/* Blog cards: zoom image, tidy pills */
.post-card { overflow: hidden; }
.post-card .post-thumb { overflow: hidden; }
.post-card .post-thumb img { transition: transform .8s var(--ease); }
.post-card:hover .post-thumb img { transform: scale(1.07); }
.post-card h3 a:hover { color: var(--accent); }
.post-card .read-more { color: var(--accent); }
.post-cat { color: var(--accent); }
.blog-hero { position: relative; padding: 110px 0 64px; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent); }
.blog-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.cat-pills a { border-radius: 999px; backdrop-filter: blur(6px); transition: transform .2s var(--ease), border-color .2s, background-color .2s; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.cat-pills a:hover { border-color: var(--accent); transform: translateY(-2px); }
.cat-pills a.active { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--gold))); border-color: transparent; color: var(--accent-ink); }

/* Articles */
.article-body .prose a { color: var(--accent); text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.article-body .prose h2 { border-inline-start-color: var(--accent); }
.faq h2 { border-inline-start-color: var(--accent); }
.faq-item { transition: border-color .25s, transform .25s var(--ease); }
.faq-item:hover, .faq-item[open] { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.faq-item summary::after { color: var(--accent); transition: transform .3s var(--ease); }
.article-figure img { box-shadow: var(--shadow); }
.reading-progress-bar { background: linear-gradient(90deg, var(--gold), var(--accent)); }

/* Footer */
.site-footer { position: relative; border-top: 0; background: color-mix(in srgb, var(--surface) 85%, transparent); }
.site-footer::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--gold), var(--accent), transparent); }
.site-footer a { transition: color .2s; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Scroll reveal (classes added by JS only) ---------- */
.rv { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.rv.rv-in { opacity: 1; transform: none; }
.card.rv.rv-in:hover, .brand-card.rv.rv-in:hover, .post-card.rv.rv-in:hover { transform: translateY(-6px); transition-delay: 0s; }

/* ---------- Depth gauge (built by JS, wide screens only) ---------- */
.depth {
    position: fixed; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 26px; height: 200px; pointer-events: none; display: none;
}
.depth-rail {
    position: absolute; inset-inline-start: 11px; top: 0; bottom: 0; width: 4px; border-radius: 4px;
    background: color-mix(in srgb, var(--text-muted) 30%, transparent);
    background-image: repeating-linear-gradient(180deg, transparent 0 18px, color-mix(in srgb, var(--text) 35%, transparent) 18px 19px);
}
.depth-fill { position: absolute; inset-inline-start: 11px; top: 0; width: 4px; border-radius: 4px; height: calc(var(--d) * 100%); background: linear-gradient(180deg, var(--gold), var(--accent)); }
.depth-val {
    position: absolute; inset-inline-end: 22px; top: calc(var(--d) * 100%); transform: translateY(-50%);
    font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 999px; padding: 5px 8px; white-space: nowrap; box-shadow: var(--shadow);
}
@media (min-width: 1100px) { .depth { display: block; } }

/* ---------- Phones ---------- */
@media (max-width: 640px) {
    .hero { padding: 84px 0 110px; }
    section { padding: 60px 0; }
    .btn-outline { margin-inline-start: 0; margin-top: 10px; }
    .hero-waves { height: 80px; }
}

/* ---------- Motion off for anyone who asks ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .rv { opacity: 1; transform: none; }
    @view-transition { navigation: none; }
}
