/* ==========================================================================
   Auto École Faddoul — motion layer
   Loaded after styles.css. Everything here is decoration: with JavaScript off
   or "reduce motion" enabled, the page renders fully and statically.
   ========================================================================== */

:root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --reveal-distance: 28px;
}

/* ---------- Hero entrance (plays once on load) ---------- */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(var(--reveal-distance)); }
    to   { opacity: 1; transform: none; }
}
@keyframes photoIn {
    from { opacity: 0; transform: scale(0.94) translateY(18px); clip-path: inset(8% 8% 8% 8% round 16px); }
    to   { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 16px); }
}
@keyframes labelIn {
    from { opacity: 0; transform: translateX(-14px); }
    to   { opacity: 1; transform: none; }
}

.hero-text > * {
    animation: fadeUp 0.9s var(--ease-out) both;
}
.hero-text > :nth-child(1) { animation-delay: 0.05s; }
.hero-text > :nth-child(2),
.hero-text > :nth-child(3) { animation-delay: 0.15s; }
.hero-text > :nth-child(4) { animation-delay: 0.3s; }
.hero-text > :nth-child(5) { animation-delay: 0.45s; }

.hero-photo {
    animation: photoIn 1.1s var(--ease-out) 0.2s both;
}
.hero-photo .photo-label {
    animation: labelIn 0.7s var(--ease-out) 1s both;
}

/* Orange word in the hero heading gets a drawn underline. */
.hero h1 span {
    position: relative;
    white-space: nowrap;
}
.hero h1 span::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.04em;
    height: 0.12em;
    border-radius: 99px;
    background: currentColor;
    opacity: 0.22;
    transform: scaleX(0);
    transform-origin: left;
    animation: drawLine 0.9s var(--ease-out) 0.9s forwards;
}
html[dir="rtl"] .hero h1 span::after { transform-origin: right; }
@keyframes drawLine { to { transform: scaleX(1); } }

/* ---------- Scroll reveal (classes added by site.js) ---------- */
.js-motion .reveal {
    opacity: 0;
    transform: translateY(var(--reveal-distance));
    transition:
        opacity 0.8s var(--ease-out),
        transform 0.8s var(--ease-out);
    transition-delay: calc(var(--i, 0) * 90ms);
}
.js-motion .reveal.reveal-scale {
    transform: scale(0.96);
}
.js-motion .reveal.is-visible {
    opacity: 1;
    transform: none;
}
/* Once revealed, give hover effects their own fast timing back. */
.js-motion .reveal.is-visible.reveal-done {
    transition-delay: 0s;
}
.js-motion .course-card.reveal.is-visible.reveal-done {
    transition: transform 0.85s ease, box-shadow 0.85s ease;
}
.js-motion .step-card.reveal.is-visible.reveal-done {
    transition: transform 0.2s, box-shadow 0.2s;
}

/* ---------- Navigation ---------- */
.navbar {
    transition: box-shadow 0.35s ease, padding 0.35s ease, background-color 0.35s ease;
}
.navbar.scrolled {
    padding-top: 9px;
    padding-bottom: 9px;
    background-color: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    box-shadow: 0 10px 30px rgba(17, 28, 40, 0.1);
}
.logo img {
    transition: width 0.35s ease;
}
.navbar.scrolled .logo img {
    width: 140px;
}

/* Animated underline for the active / hovered nav link (desktop). */
@media (min-width: 1101px) {
    .nav-links > a,
    .dropdown > a {
        position: relative;
    }
    .nav-links > a::after,
    .dropdown > a::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -6px;
        height: 2px;
        border-radius: 2px;
        background: #ff650d;
        transform: scaleX(0);
        transition: transform 0.3s var(--ease-out);
    }
    .nav-links > a:hover::after,
    .nav-links > a.active::after,
    .dropdown > a:hover::after,
    .dropdown > a.active::after {
        transform: scaleX(1);
    }
    .dropdown-content {
        display: block;
        visibility: hidden;
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.25s ease, transform 0.25s var(--ease-out), visibility 0.25s;
    }
    .dropdown:hover .dropdown-content,
    .dropdown:focus-within .dropdown-content {
        visibility: visible;
        opacity: 1;
        transform: none;
    }
}

.dropdown > a.active {
    color: #ff650d;
}

/* Mobile menu slides open instead of popping. */
@media (max-width: 800px) {
    .menu-toggle:checked ~ .nav-links {
        animation: menuOpen 0.35s var(--ease-out);
    }
    @keyframes menuOpen {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: none; }
    }
}

/* ---------- Buttons & links ---------- */
.button {
    position: relative;
    overflow: hidden;
}
/* Light sweep across primary buttons on hover. */
.button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.35) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
    pointer-events: none;
}
.button:hover::before {
    transform: translateX(120%);
}
.button-outline::before {
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.25) 50%, transparent 70%);
}

/* ---------- Stats ---------- */
.stats strong {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ---------- Success stories ---------- */
.success-card {
    border-radius: 16px;
}
.success-card img {
    transition: transform 0.6s var(--ease-out), filter 0.6s ease;
}
.success-card:hover img {
    transform: scale(1.04);
}

/* ---------- FAQ ---------- */
.faq-grid details {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.faq-grid details:hover,
.faq-grid details[open] {
    border-color: #f6c19a;
    box-shadow: 0 10px 28px rgba(244, 123, 32, 0.08);
}
.faq-grid summary::after {
    transition: transform 0.3s var(--ease-out);
}
.faq-grid details[open] summary::after {
    transform: rotate(180deg);
}
.faq-grid details[open] p {
    animation: fadeUp 0.45s var(--ease-out);
    --reveal-distance: 8px;
}

/* ---------- App carousel ---------- */
.app-live-dot {
    box-shadow: 0 0 0 0 rgba(255, 101, 13, 0.6);
    animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 101, 13, 0.6); }
    70%  { box-shadow: 0 0 0 9px rgba(255, 101, 13, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 101, 13, 0); }
}
.app-carousel-controls button {
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.app-carousel-controls button:active {
    transform: scale(0.92);
}

/* ---------- Floating WhatsApp ---------- */
.floating-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s ease;
    animation: waIn 0.6s var(--ease-out) 1.4s both;
}
.floating-whatsapp svg {
    width: 20px;
    height: 20px;
    flex: none;
}
.floating-whatsapp::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 rgba(27, 175, 99, 0.55);
    animation: waRing 3.2s ease-out 3s infinite;
    pointer-events: none;
}
.floating-whatsapp:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.25);
}
@keyframes waIn {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to   { opacity: 1; transform: none; }
}
@keyframes waRing {
    0%   { box-shadow: 0 0 0 0 rgba(27, 175, 99, 0.55); }
    35%  { box-shadow: 0 0 0 14px rgba(27, 175, 99, 0); }
    100% { box-shadow: 0 0 0 14px rgba(27, 175, 99, 0); }
}

/* ---------- Back to top ---------- */
.back-to-top {
    position: fixed;
    left: 20px;
    bottom: 22px;
    z-index: 49;
    width: 46px;
    height: 46px;
    border: 0;
    border-radius: 50%;
    background: #19222d;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s var(--ease-out), visibility 0.3s, background-color 0.2s;
}
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.back-to-top:hover {
    background: #ff650d;
}
/* WhatsApp button moves to the left in Arabic, so this goes right. */
html[dir="rtl"] .back-to-top {
    left: auto;
    right: 20px;
}

/* ---------- Keyboard focus ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
.menu-icon:focus-visible {
    outline: 3px solid #ff650d;
    outline-offset: 3px;
    border-radius: 6px;
}

/* ---------- Respect reduced-motion settings ---------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0s !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }
    .js-motion .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ==========================================================================
   Header: drawer menu on phones (replaces the old drop-down list)
   ========================================================================== */
.drawer-title,
.drawer-cta,
.menu-backdrop {
    display: none;
}

.burger {
    position: relative;
    display: block;
    width: 22px;
    height: 16px;
}
.burger i {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2.5px;
    border-radius: 3px;
    background: #19222d;
    transition: transform 0.35s var(--ease-out), opacity 0.2s ease, top 0.35s var(--ease-out);
}
.burger i:nth-child(1) { top: 0; }
.burger i:nth-child(2) { top: 6.75px; }
.burger i:nth-child(3) { top: 13.5px; }

@media (max-width: 1100px) {
    /* backdrop-filter would trap the fixed drawer inside the header box */
    .navbar.scrolled {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background-color: #fff;
    }

    .menu-icon {
        position: relative;
        z-index: 62;
        display: grid !important;
        place-items: center;
        width: 46px;
        height: 46px;
        margin-left: 0;
        border-radius: 14px;
        background: #f2f3f5;
        font-size: 0;
        transition: background-color 0.25s ease;
    }
    .menu-toggle:checked ~ .menu-icon {
        background: #19222d;
    }
    .menu-toggle:checked ~ .menu-icon .burger i {
        background: #fff;
    }
    .menu-toggle:checked ~ .menu-icon .burger i:nth-child(1) {
        top: 6.75px;
        transform: rotate(45deg);
    }
    .menu-toggle:checked ~ .menu-icon .burger i:nth-child(2) {
        opacity: 0;
        transform: scaleX(0.2);
    }
    .menu-toggle:checked ~ .menu-icon .burger i:nth-child(3) {
        top: 6.75px;
        transform: rotate(-45deg);
    }

    /* The panel */
    .navbar > .nav-links,
    .menu-toggle:checked ~ .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 61;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        width: min(86vw, 360px);
        height: 100dvh;
        padding: 92px 22px 28px;
        overflow-y: auto;
        background: #fff;
        box-shadow: -24px 0 60px rgba(17, 28, 40, 0.18);
        border-radius: 26px 0 0 26px;
        transform: translateX(105%);
        visibility: hidden;
        animation: none;
        transition: transform 0.45s var(--ease-out), visibility 0.45s;
    }
    .menu-toggle:checked ~ .nav-links {
        transform: none;
        visibility: visible;
    }

    .drawer-title {
        display: block;
        margin: 0 0 10px;
        padding: 0 14px;
        color: #9aa3af;
        font-size: 12px;
        font-weight: 800;
        letter-spacing: 0.14em;
        text-transform: uppercase;
    }

    .nav-links > a,
    .dropdown > a {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 14px !important;
        border-radius: 14px;
        color: #19222d;
        font-size: 17px;
        font-weight: 700;
    }
    .nav-links > a:not(.button)::after {
        content: "›";
        color: #c3c8cf;
        font-size: 22px;
        line-height: 1;
        transition: transform 0.25s ease, color 0.25s ease;
    }
    html[dir="rtl"] .nav-links > a:not(.button)::after {
        content: "‹";
    }
    .nav-links > a:not(.button):hover,
    .nav-links > a.active,
    .dropdown > a.active {
        color: #ff650d;
        background: #fff4ec;
    }
    .nav-links > a.active::after {
        color: #ff650d;
    }
    .nav-extra {
        display: flex !important; /* "How It Works" is hidden on mid screens only */
    }

    /* Courses: always open inside the drawer, as an indented list */
    .dropdown {
        padding: 0 !important;
    }
    .dropdown > a {
        pointer-events: auto;
    }
    .dropdown-content,
    .dropdown:hover .dropdown-content {
        display: block !important;
        position: static !important;
        width: auto !important;
        margin: 2px 0 6px;
        padding: 4px 0 4px 14px !important;
        border-left: 2px solid #ffe0cc;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        transform: none !important;
    }
    html[dir="rtl"] .dropdown-content {
        padding: 4px 14px 4px 0 !important;
        border-left: 0;
        border-right: 2px solid #ffe0cc;
    }
    .dropdown-content a {
        padding: 9px 12px !important;
        color: #5a6472;
        font-size: 14px;
        font-weight: 600;
    }

    .drawer-cta {
        display: flex !important;
        justify-content: center;
        margin-top: auto;
        padding: 15px 22px !important;
        border-radius: 16px;
        font-size: 15px !important;
    }

    /* Links slide in one after another when the drawer opens */
    .nav-links > * {
        opacity: 0;
        transform: translateX(18px);
        transition: opacity 0.35s ease, transform 0.45s var(--ease-out);
    }
    .menu-toggle:checked ~ .nav-links > * {
        opacity: 1;
        transform: none;
    }
    .menu-toggle:checked ~ .nav-links > :nth-child(2) { transition-delay: 0.06s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(3) { transition-delay: 0.09s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(4) { transition-delay: 0.12s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(5) { transition-delay: 0.15s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(6) { transition-delay: 0.18s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(7) { transition-delay: 0.21s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(8) { transition-delay: 0.24s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(9) { transition-delay: 0.27s; }
    .menu-toggle:checked ~ .nav-links > :nth-child(10) { transition-delay: 0.3s; }

    /* Dim the page behind; tapping it closes the menu */
    .menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 60;
        display: block;
        background: rgba(15, 22, 32, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s;
        cursor: pointer;
    }
    .menu-toggle:checked ~ .menu-backdrop {
        opacity: 1;
        visibility: visible;
    }

    html.menu-open,
    html.menu-open body {
        overflow: hidden;
    }
    html.menu-open .floating-whatsapp,
    html.menu-open .back-to-top {
        opacity: 0 !important;
        pointer-events: none;
    }
}

/* ==========================================================================
   App showcase: real screenshots in a phone frame + chevron arrows
   ========================================================================== */
.app-screen {
    padding: 0;
}
.app-screen .phone {
    position: relative;
    padding: 7px;
    border-radius: 38px;
    background: linear-gradient(145deg, #3a404b, #0d1016 60%);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 18px 40px rgba(0, 0, 0, 0.45);
}
.app-screen .phone::after {
    /* camera island */
    content: "";
    position: absolute;
    top: 15px;
    left: 50%;
    width: 30%;
    height: 17px;
    border-radius: 20px;
    background: #05070a;
    transform: translateX(-50%);
}
.app-screen .phone img,
.app-screen img {
    display: block;
    width: 100%;
    height: auto !important;
    aspect-ratio: 1206 / 2622;
    object-fit: cover;
    object-position: top center;
    border: 0 !important;
    border-radius: 31px !important;
    background: #fff !important;
}
.app-screen figcaption {
    padding-top: 14px;
}

.app-carousel-controls button {
    display: grid;
    place-items: center;
    width: 46px !important;
    height: 46px !important;
    padding: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.22) !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06) !important;
    color: #fff !important;
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.app-carousel-controls button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.app-carousel-controls button:hover {
    border-color: #ff650d !important;
    background: #ff650d !important;
}
.app-carousel-controls button:active {
    transform: scale(0.92);
}

/* Phone-sized screenshots: show ~2.5 phones so it's obvious you can swipe */
.app-screens .app-screen {
    flex: 0 0 auto !important;
    width: 228px;
    max-width: none !important;
}
@media (max-width: 600px) {
    .app-screens .app-screen {
        width: min(62vw, 230px);
    }
}

/* Phone header: language | logo | burger always on ONE row */
@media (max-width: 1100px) {
    .navbar {
        flex-wrap: nowrap !important;
        gap: 12px;
    }
    .navbar > .logo {
        flex: 0 1 auto;
        min-width: 0;
    }
    .navbar > .logo img {
        width: 150px;
        max-width: 100%;
        height: auto;
    }
    .navbar.scrolled > .logo img {
        width: 128px;
    }
    .menu-icon {
        flex: none;
    }
    .nav-links > a.drawer-cta {
        justify-content: center;
        gap: 6px;
    }
}
@media (max-width: 360px) {
    .navbar > .logo img { width: 118px; }
    .navbar > .language-switch button { padding: 6px 7px; }
}

/* Tablets / small laptops (801–1100px): drawer menu, keep the WhatsApp button */
@media (min-width: 801px) and (max-width: 1100px) {
    .navbar > .logo { order: 1; }
    .navbar > .nav-button { order: 2; margin-left: auto; display: inline-block; white-space: nowrap; }
    .navbar > .language-switch { order: 3; margin: 0; }
    .navbar > .menu-icon { order: 4; }
}

/* ---------- Drawer fixes ----------
   1) Lock scrolling on <html> only: overflow on <body> turned it into a scroll
      container, which broke the sticky header after scrolling down.
   2) The drawer has its own close button, so it never depends on the header. */
html.menu-open body {
    overflow: visible !important;
}
html.menu-open {
    overflow: hidden !important;
}
.drawer-head {
    display: none;
}
@media (max-width: 1100px) {
    .navbar > .nav-links,
    .menu-toggle:checked ~ .nav-links {
        padding-top: 18px;
        overscroll-behavior: contain;
    }
    .menu-icon {
        z-index: auto;
    }
    .drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0 0 14px;
        padding: 4px 0 12px 14px;
        border-bottom: 1px solid #f0f1f3;
    }
    html[dir="rtl"] .drawer-head {
        padding: 4px 14px 12px 0;
    }
    .drawer-head .drawer-title {
        margin: 0;
        padding: 0;
    }
    .drawer-close {
        display: grid;
        place-items: center;
        width: 46px;
        height: 46px;
        border-radius: 14px;
        background: #19222d;
        color: #fff;
        cursor: pointer;
        transition: background-color 0.2s ease, transform 0.2s ease;
    }
    .drawer-close:hover {
        background: #ff650d;
    }
    .drawer-close:active {
        transform: scale(0.92);
    }
    .drawer-close svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.6;
        stroke-linecap: round;
    }
}
