/* ============================================================
   KMT Services Privé — V4 « editorial premium » (light/dark, RTL/LTR)
   ============================================================ */
:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #eef1f8;
    --ink: #0e1b33;
    --text: #3b4560;
    --muted: #737d94;
    --line: #e4e8f2;
    --gold: #f7c051;
    --gold-ink: #a17120;
    --brand: #143059;
    --nav-bg: rgba(246, 247, 251, 0.8);
    --menu-bg: #0b1730;
    --menu-ink: #f2f6ff;
    --menu-line: rgba(242, 246, 255, 0.14);
    --shadow: 0 30px 70px -36px rgba(20, 48, 89, 0.4);
    --radius: 22px;
    --container: 1240px;
    --font-head: 'Cairo', system-ui, sans-serif;
    --font-body: 'Tajawal', system-ui, sans-serif;
    color-scheme: light;
}
[data-theme="dark"] {
    --bg: #0a1526;
    --surface: rgba(255, 255, 255, 0.045);
    --surface-2: rgba(255, 255, 255, 0.06);
    --ink: #f2f6ff;
    --text: rgba(234, 240, 251, 0.78);
    --muted: rgba(234, 240, 251, 0.52);
    --line: rgba(255, 255, 255, 0.1);
    --gold-ink: #f7c051;
    --brand: #f2f6ff;
    --nav-bg: rgba(10, 21, 38, 0.72);
    --menu-bg: #060f1c;
    --shadow: 0 34px 74px -34px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}
html[lang="fr"] { --font-head: 'Sora', 'Cairo', system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.75; font-size: 17px; -webkit-font-smoothing: antialiased; overflow-x: hidden; transition: background-color 0.5s ease, color 0.5s ease; }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; font-weight: 800; line-height: 1.14; color: var(--ink); letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 10px; }
.skip-link { position: fixed; inset-block-start: 10px; inset-inline-start: 10px; z-index: 300; background: var(--ink); color: var(--bg); font-family: var(--font-head); font-weight: 700; padding: 10px 18px; border-radius: 999px; transform: translateY(-220%); transition: transform 0.2s; }
.skip-link:focus-visible { transform: translateY(0); }
.container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(20px, 5vw, 48px); }
.text-gold { color: var(--gold-ink); }

.h-lg { font-size: clamp(1.9rem, 4vw, 3rem); }
.h-xl { font-size: clamp(2.2rem, 5.5vw, 4rem); }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 0.8rem; letter-spacing: 0.14em; color: var(--gold-ink); text-transform: uppercase; }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: linear-gradient(90deg, var(--gold-ink), var(--gold)); }

.scroll-progress { position: fixed; inset-block-start: 0; inset-inline-start: 0; height: 3px; width: 0; background: linear-gradient(to bottom, var(--gold), var(--gold-ink)); z-index: 200; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-head); font-weight: 700; font-size: 1rem; padding: 0.72em 1.5em; border: 0; border-radius: 999px; cursor: pointer; transition: transform 0.25s, box-shadow 0.25s, background 0.25s, color 0.25s; white-space: nowrap; }
.btn--solid { background: var(--gold); color: #0b1730; box-shadow: 0 16px 34px -14px rgba(247, 192, 81, 0.6); }
.btn--solid:hover { transform: translateY(-2px); box-shadow: 0 22px 42px -16px rgba(247, 192, 81, 0.8); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--gold); color: var(--gold-ink); }
.btn--sm { padding: 0.5em 1.1em; font-size: 0.9rem; }
.btn--lg { padding: 0.85em 1.7em; font-size: 1.08rem; }
.btn--xl { padding: 1em 2.2em; font-size: 1.15rem; }

/* Nav */
.nav { position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 100; padding-block: 16px; transition: padding-block 0.35s, background-color 0.35s, border-color 0.35s, backdrop-filter 0.35s; }
.nav.scrolled { padding-block: 9px; background: var(--nav-bg); backdrop-filter: blur(16px); border-block-end: 1px solid var(--line); }
.nav__inner { display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand__logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--line); }
.brand__text { font-family: var(--font-head); font-weight: 900; font-size: 1.2rem; color: var(--ink); line-height: 1; transition: color 0.3s; }
.brand__text small { display: block; font-size: 0.58rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-ink); margin-top: 3px; }
.nav__links { display: flex; align-items: center; gap: 26px; margin-inline: auto; }
.nav__links > a { font-family: var(--font-head); font-weight: 700; font-size: 0.96rem; color: var(--text); position: relative; padding-block: 6px; transition: color 0.2s; }
.nav__links > a:hover { color: var(--ink); }
.nav__links > a::after { content: ""; position: absolute; inset-inline: 0; inset-block-end: 0; height: 2px; width: 0; background: var(--gold-ink); transition: width 0.28s; }
.nav__links > a:hover::after { width: 100%; }
.nav__foot { display: none; }
.nav__controls { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: color 0.2s, border-color 0.2s; }
.icon-btn:hover { color: var(--gold-ink); border-color: var(--gold); }
.icon-btn svg { width: 19px; height: 19px; }
.ico-sun { display: none; }
[data-theme="dark"] .ico-moon { display: none; }
[data-theme="dark"] .ico-sun { display: block; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang-switch button { background: none; border: 0; color: var(--muted); font-family: var(--font-head); font-weight: 700; font-size: 0.82rem; padding: 0.4em 0.72em; cursor: pointer; transition: color 0.2s, background-color 0.2s; }
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.is-active { background: var(--gold); color: #0b1730; }
.nav__toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 8px; position: relative; z-index: 2; }
.nav__toggle span { width: 24px; height: 2.4px; background: var(--ink); border-radius: 2px; transition: transform 0.3s cubic-bezier(0.76, 0, 0.24, 1), opacity 0.2s, background-color 0.3s; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.4px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0.3); }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.4px) rotate(-45deg); }

/* Hero */
.hero { position: relative; min-height: 100svh; display: flex; align-items: center; overflow: hidden; }
.hero__aura { position: absolute; inset: 0; z-index: 0; background: radial-gradient(60% 55% at 78% 18%, rgba(247, 192, 81, 0.18), transparent 62%), radial-gradient(50% 50% at 12% 90%, rgba(45, 56, 93, 0.14), transparent 60%); }
[data-theme="dark"] .hero__aura { background: radial-gradient(60% 55% at 78% 18%, rgba(247, 192, 81, 0.16), transparent 62%), radial-gradient(50% 50% at 12% 90%, rgba(45, 56, 93, 0.5), transparent 60%); }
.hero__inner { position: relative; z-index: 2; padding-block: 130px 90px; }
.hero__title { font-size: clamp(2.7rem, 8vw, 6rem); font-weight: 900; margin-top: 18px; max-width: 15ch; }
.hero__sub { margin-top: 24px; font-size: clamp(1.1rem, 1.8vw, 1.4rem); color: var(--text); max-width: 52ch; }
.hero__cta { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 14px; }
.scroll-cue { position: absolute; inset-block-end: 26px; inset-inline: 0; margin-inline: auto; width: 24px; height: 40px; border: 2px solid var(--line); border-radius: 14px; z-index: 2; }
.scroll-cue span { position: absolute; inset-block-start: 8px; inset-inline: 0; margin-inline: auto; width: 3px; height: 8px; border-radius: 2px; background: var(--gold-ink); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(10px); } }

/* Manifesto */
.manifesto { padding-block: clamp(80px, 14vw, 200px); }
.manifesto__text { font-family: var(--font-head); font-weight: 800; font-size: clamp(1.6rem, 3.6vw, 2.9rem); line-height: 1.5; color: var(--ink); letter-spacing: -0.01em; }
.manifesto__text .w { transition: opacity 0.2s; }

/* Sections */
.section { padding-block: clamp(64px, 9vw, 120px); }
.services__head, .work__head, .stats__head { margin-bottom: clamp(30px, 5vw, 52px); }
.services__head .h-lg, .work__head .h-lg, .stats__head .h-lg { margin-top: 12px; }

/* Services — scroll-snap gallery */
.services { padding-block: clamp(64px, 9vw, 120px); overflow: hidden; }
.services__pin { overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: grab; padding-block: 10px; padding-inline: clamp(20px, 5vw, 48px); }
.services__pin::-webkit-scrollbar { height: 0; }
.services__pin.dragging { cursor: grabbing; }
.services__track { display: flex; gap: 22px; width: max-content; }
.service-card { scroll-snap-align: start; flex: 0 0 auto; width: min(400px, 82vw); min-height: 340px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform 0.3s, border-color 0.3s; }
.service-card:hover { transform: translateY(-6px); border-color: var(--gold); }
.service-card__n { font-family: var(--font-head); font-weight: 900; font-size: 2.4rem; color: var(--gold-ink); opacity: 0.5; }
.service-card h3 { font-size: 1.5rem; margin-top: 14px; }
.service-card p { color: var(--muted); margin-top: 14px; font-size: 1.02rem; }
.service-card--cta { background: linear-gradient(160deg, var(--gold), #e2a232); border-color: transparent; align-items: flex-start; justify-content: center; gap: 18px; }
.service-card--cta h3 { color: #0b1730; font-size: 1.8rem; }
.service-card--cta .btn--solid { background: #0b1730; color: var(--gold); box-shadow: 0 16px 34px -16px rgba(11, 23, 48, 0.55); }
.service-card--cta .btn--solid:hover { box-shadow: 0 22px 42px -18px rgba(11, 23, 48, 0.7); }

/* Work */
.work__list { display: flex; flex-direction: column; gap: clamp(48px, 8vw, 110px); }
.work-item { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
.work-item--rev .work-item__media { order: 2; }
.work-item__media { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.work-item__media img { width: 100%; aspect-ratio: 4/3; object-fit: cover; transition: transform 0.6s; }
.work-item:hover .work-item__media img { transform: scale(1.05); }
.work-item__info .tag { display: inline-block; font-family: var(--font-head); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.06em; color: var(--gold-ink); background: color-mix(in srgb, var(--gold) 18%, transparent); padding: 5px 14px; border-radius: 999px; }
.work-item__info h3 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin-top: 14px; }
.work-item__info p { color: var(--text); margin-top: 14px; max-width: 44ch; }
.work-item__go { display: inline-block; margin-top: 20px; font-family: var(--font-head); font-weight: 700; color: var(--gold-ink); }
.work-item__go::after { content: " ↗"; }

/* Stats */
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.stat { text-align: center; padding: 30px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat__num { display: block; font-family: var(--font-head); font-weight: 900; font-size: clamp(2.2rem, 5vw, 3.4rem); color: var(--ink); letter-spacing: -0.02em; }
.stat__cap { color: var(--muted); margin-top: 6px; font-weight: 500; }

/* CTA */
.cta { text-align: center; padding-block: clamp(80px, 12vw, 160px); background: var(--surface-2); }
.cta p { color: var(--text); margin: 16px auto 30px; max-width: 46ch; font-size: 1.1rem; }

/* Contact */
.contact__grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(28px, 5vw, 56px); align-items: start; }
.contact__list { display: flex; flex-direction: column; gap: 14px; }
.contact__row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); transition: border-color 0.25s, transform 0.25s; }
.contact__row:hover { border-color: var(--gold); transform: translateY(-2px); }
.c-ic { font-size: 1.4rem; }
.contact__row small { display: block; color: var(--muted); font-size: 0.8rem; }
.contact__row span { font-family: var(--font-head); font-weight: 700; color: var(--ink); }
.contact__map { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.contact__map iframe { width: 100%; height: 100%; min-height: 340px; border: 0; display: block; }

/* Footer */
.footer { background: var(--surface-2); border-block-start: 1px solid var(--line); }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 36px; padding-block: 52px; }
.footer__slogan { margin-top: 14px; font-family: var(--font-head); color: var(--gold-ink); font-weight: 700; }
.footer__links { display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.footer__links a:hover, .footer__contact a:hover { color: var(--gold-ink); }
.footer__contact { display: flex; flex-direction: column; gap: 12px; color: var(--text); }
.footer__bottom { border-block-start: 1px solid var(--line); padding-block: 20px; font-size: 0.86rem; color: var(--muted); }

/* FAB + toTop */
.fab-wa { position: fixed; inset-block-end: 22px; right: 22px; width: 56px; height: 56px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; box-shadow: 0 14px 30px -8px rgba(37, 211, 102, 0.6); z-index: 120; transition: transform 0.25s, opacity 0.25s; }
.fab-wa svg { width: 31px; height: 31px; }
.fab-wa:hover { transform: scale(1.08); }
.to-top { position: fixed; inset-block-end: 22px; left: 22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.2rem; cursor: pointer; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 0.3s, transform 0.3s; z-index: 120; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* Reveal (only hidden when JS is active, so no-JS still shows content) */
.js .reveal { opacity: 0; transform: translateY(30px); }
.js .hero__el { opacity: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .scroll-cue span { animation: none; }
    .js .reveal, .js .hero__el { opacity: 1; transform: none; }
}

/* Responsive */
@media (max-width: 980px) {
    .work-item, .contact__grid { grid-template-columns: 1fr; }
    .work-item--rev .work-item__media { order: 0; }
    .stats__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
    .nav__toggle { display: flex; }
    .btn--sm.wa-link { display: none; }
    .brand, .nav__controls { position: relative; z-index: 2; }

    /* Full-screen panel, revealed along the block axis only: there is no inline
       direction left to get wrong, so the geometry is identical in RTL and LTR. */
    .nav__links {
        position: fixed; inset-block-start: 0; inset-inline: 0; height: 100dvh; z-index: 1;
        flex-direction: column; align-items: flex-start; justify-content: center;
        gap: 0; margin: 0;
        padding-block: 92px calc(176px + env(safe-area-inset-bottom, 0px));
        padding-inline: clamp(20px, 5vw, 48px);
        background: var(--menu-bg);
        overflow-y: auto; overscroll-behavior: contain;
        visibility: hidden;
        clip-path: inset(0 0 100% 0);
        transition: clip-path 0.34s cubic-bezier(0.76, 0, 0.24, 1), visibility 0s linear 0.34s;
    }
    .nav__links.open {
        visibility: visible;
        clip-path: inset(0 0 0 0);
        transition: clip-path 0.52s cubic-bezier(0.76, 0, 0.24, 1), visibility 0s linear 0s;
    }

    .nav__links > a {
        font-weight: 900;
        font-size: clamp(1.9rem, min(11vw, 8.5vh), 4.2rem);
        line-height: 1.1; letter-spacing: -0.03em;
        color: rgba(242, 246, 255, 0.58);
        padding-block: 0.1em;
        opacity: 0; transform: translateY(16px);
        transition: color 0.25s, opacity 0.001s, transform 0.001s;
    }
    /* Negative tracking suits the Latin display face; Arabic is cursive,
       so tightening it crowds the joins and the diacritics. */
    [dir="rtl"] .nav__links > a { letter-spacing: normal; }
    .nav__links > a::after { display: none; }
    .nav__links > a:hover, .nav__links > a:focus-visible { color: var(--menu-ink); }
    .nav__links.open > a { opacity: 1; transform: translateY(0); transition: color 0.25s, opacity 0.42s ease, transform 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
    .nav__links.open > a:nth-child(1) { transition-delay: 0s, 0.15s, 0.15s; }
    .nav__links.open > a:nth-child(2) { transition-delay: 0s, 0.19s, 0.19s; }
    .nav__links.open > a:nth-child(3) { transition-delay: 0s, 0.23s, 0.23s; }
    .nav__links.open > a:nth-child(4) { transition-delay: 0s, 0.27s, 0.27s; }

    /* Gold on the glyphs themselves rather than an underline. The gradient runs
       vertically, so it reads the same whichever way the text runs. */
    @supports ((-webkit-background-clip: text) or (background-clip: text)) {
        .nav__links > a:hover, .nav__links > a:focus-visible {
            background-image: linear-gradient(to bottom, var(--gold), #e2a232);
            -webkit-background-clip: text; background-clip: text;
            -webkit-text-fill-color: transparent;
        }
    }

    .nav__foot {
        display: block; position: absolute;
        inset-inline: clamp(20px, 5vw, 48px);
        inset-block-end: calc(26px + env(safe-area-inset-bottom, 0px));
        border-block-start: 1px solid var(--menu-line);
        padding-block-start: 16px;
        opacity: 0; transition: opacity 0.3s;
    }
    .nav__links.open .nav__foot { opacity: 1; transition: opacity 0.4s ease 0.3s; }
    .nav__foot-row { display: flex; align-items: baseline; gap: 10px; padding-block: 6px; color: rgba(242, 246, 255, 0.66); }
    .nav__foot-row small { font-size: 0.82rem; }
    .nav__foot-row span { font-family: var(--font-head); font-weight: 700; font-size: 1.02rem; color: var(--menu-ink); }
    .nav__foot .btn { margin-block-start: 14px; }

    /* The header stays above the panel, so its own chrome has to read on navy */
    html.menu-open .nav.scrolled { background: transparent; backdrop-filter: none; border-block-end-color: transparent; }
    html.menu-open .brand__text, html.menu-open .icon-btn { color: var(--menu-ink); }
    html.menu-open .icon-btn, html.menu-open .lang-switch { border-color: rgba(242, 246, 255, 0.22); }
    html.menu-open .lang-switch button { color: rgba(242, 246, 255, 0.62); }
    html.menu-open .lang-switch button.is-active { color: #0b1730; }
    html.menu-open .nav__toggle span { background: var(--menu-ink); }
    html.menu-open .fab-wa, html.menu-open .to-top { opacity: 0; pointer-events: none; }
    html.menu-open, html.menu-open body { overflow: hidden; }
}

/* The menu is the one orchestrated moment on the page; it still has to be opt-out */
@media (prefers-reduced-motion: reduce) {
    .nav__links, .nav__links.open { transition: visibility 0s; }
    .nav__links > a, .nav__links.open > a { opacity: 1; transform: none; transition: color 0.2s; transition-delay: 0s; }
    .nav__foot, .nav__links.open .nav__foot { opacity: 1; transition: none; }
    .nav__toggle span { transition: none; }
    .skip-link { transition: none; }
}
@media (max-width: 560px) {
    body { font-size: 16px; }
    .stats__grid { grid-template-columns: 1fr 1fr; }
    .hero__inner { padding-block: 120px 70px; }
}
