/*
 * Home page (index.html) upgrade: modern surfaces, responsive layout, rich motion.
 * Loaded after styles.css and navbar.css, on index.html only; other pages sharing
 * styles.css are unaffected. Palette unchanged (tokens in styles.css :root).
 */

:root {
    --home-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --home-radius-xl: 28px;
    --home-radius-lg: 22px;
    --home-radius-md: 16px;
    --home-gutter: clamp(1rem, 4vw, 2rem);
    --home-section-y: clamp(3.75rem, 8vw, 6.5rem);
    --home-border: rgba(37, 99, 235, 0.10);
    --home-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 36px -14px rgba(37, 99, 235, 0.22);
    --home-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 26px 50px -18px rgba(37, 99, 235, 0.32);
}

html,
body {
    overflow-x: clip;
}

/* Anchored sections land below the fixed navbar */
section[id] {
    scroll-margin-top: 84px;
}

.container {
    padding-inline: var(--home-gutter);
}

.section {
    padding-block: var(--home-section-y);
}

.section-title {
    font-size: clamp(1.8rem, 1.2rem + 2.3vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: clamp(2.25rem, 5vw, 3.25rem);
    text-wrap: balance;
}

.section-title::after {
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary-blue), #764ba2);
}

img {
    max-width: 100%;
}

/* ---------------------------------------------------------------- Focus
 * Keyboard focus only (:focus-visible), never on mouse click. An outline
 * follows each element's own border-radius, so pills stay pills. The ring is
 * blue on light surfaces and white on the hero / dark surfaces.
 */
:root {
    --home-ring: var(--primary-blue);
}

.hero,
.footer,
.cookie-consent,
.chat-container,
.nav-cta,
.home-to-top {
    --home-ring: #ffffff;
}

:focus:not(:focus-visible) {
    outline: none;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 3px solid var(--home-ring);
    outline-offset: 3px;
    box-shadow: none;
}

/* Dark pill on a white navbar: blue ring reads better than white */
.navbar .nav-cta:focus-visible {
    outline-color: var(--primary-blue);
}

/* Programmatic focus targets (skip link destination) show no ring */
[tabindex="-1"]:focus {
    outline: none;
}

/* Inside clipped cards the ring sits inside the edge so it is never cut off */
.faq-question:focus-visible {
    outline-offset: -4px;
    border-radius: var(--home-radius-md);
}

.services-dropdown a:focus-visible {
    outline-offset: -3px;
    border-radius: 10px;
}

/* Text fields: their own border + glow ring instead of an outline */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
}

.message-input:focus-visible {
    border-color: rgba(255, 255, 255, 0.75);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25);
}

/* Links in running text keep an underline on focus, not just a ring */
.footer-section a:focus-visible,
.contact-item a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Skip link (created by the page script): readable pill above everything */
/* fully off-screen until focused (the page script only moves it 40px up) */
.skip-to-main:not(:focus) {
    transform: translateY(-150%);
}

.skip-to-main {
    z-index: 10003 !important;
    padding: 10px 18px !important;
    border-radius: 0 0 14px 0 !important;
    font-weight: 600;
    background: var(--dark-blue) !important;
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.5);
}

/* Closed chat panel and dismissed cookie banner leave the Tab order
   (they were only faded / slid away, so Tab reached invisible controls) */
.chat-container:not(.open) {
    visibility: hidden;
}

.chat-container.open {
    visibility: visible;
}

.cookie-consent:not(.show) {
    visibility: hidden;
    transition: transform 0.4s ease, visibility 0s linear 0.4s;
}

.cookie-consent.show {
    visibility: visible;
    transition: transform 0.4s ease, visibility 0s;
}

/* ---------------------------------------------------------------- Loader */
#loading-screen {
    transition: opacity 0.35s ease;
}

/* ------------------------------------------------------------------ Hero */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    padding: 104px var(--home-gutter) clamp(3rem, 7vw, 5rem);
    /* shared script.js used to translate the whole section on scroll */
    transform: none !important;
    isolation: isolate;
}

/* Static soft light instead of the drifting/rotating SVG background */
.hero::before {
    animation: none;
    background:
        radial-gradient(60% 55% at 12% 18%, rgba(255, 255, 255, 0.16), transparent 70%),
        radial-gradient(45% 45% at 88% 78%, rgba(255, 255, 255, 0.10), transparent 70%);
    z-index: -1;
}

/* Soft fade into the services section */
.hero::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 90px;
    background: linear-gradient(180deg, transparent, rgba(248, 250, 252, 0.14));
    pointer-events: none;
    z-index: -1;
}

.hero-container {
    width: 100%;
    gap: clamp(2rem, 5vw, 4.5rem);
}

.hero-title {
    font-size: clamp(2.1rem, 1.1rem + 3.8vw, 3.75rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

.hero-title span {
    animation: none;
}

.hero-subtitle {
    font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
    line-height: 1.6;
    max-width: 34em;
}

/* One orchestrated entrance: title, subtitle, CTA, then the photo.
   fill-mode "backwards" = hidden only during the delay; a "forwards" fill
   would pin transform afterwards and cancel the hover effects. */
.hero-content {
    opacity: 1;
    transform: none;
    animation: none;
}

.hero-title,
.hero-subtitle,
.hero-cta {
    animation: home-rise 0.9s var(--home-ease) backwards;
}

.hero-title    { animation-delay: 0.1s; }
.hero-subtitle { animation-delay: 0.25s; }
.hero-cta      { animation-delay: 0.4s; }

.hero-cta {
    min-height: 54px;
    padding: 1rem 2.1rem;
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.45);
    transition: transform 0.25s var(--home-ease), box-shadow 0.25s ease, background-color 0.25s ease;
}

.hero-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.5);
}

.hero-image {
    opacity: 1;
    transform: none;
    animation: home-photo-in 1.1s var(--home-ease) 0.3s backwards;
}

/* Frosted glass frame around the photo */
.hero-image::before {
    animation: none;
    inset: -14px;
    border-radius: calc(var(--home-radius-xl) + 12px);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.hero-image img {
    display: block;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--home-radius-xl);
    box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.55);
}

.hero-image:hover img {
    transform: none;
}

@keyframes home-rise {
    from { opacity: 0; transform: translateY(22px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes home-photo-in {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------- Services */
.services::before {
    display: none;
}

/* Available services: two wide cards on the first row.
   Coming soon: a compact row of three underneath. */
.services-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: clamp(1.25rem, 3vw, 1.75rem);
    margin-top: 0;
}

.services-grid > .service-card {
    grid-column: span 3;
}

.services-grid > .service-card.coming-soon {
    grid-column: span 2;
}

.service-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(1.75rem, 4vw, 2.5rem) clamp(1.25rem, 3vw, 2rem);
    border-radius: var(--home-radius-lg);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
    transition: transform 0.35s var(--home-ease), box-shadow 0.35s ease, border-color 0.35s ease;
}

.service-card::before {
    display: none;
}

.service-description {
    flex-grow: 1;
    margin-bottom: 1.75rem;
}

.service-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 1.5rem;
    border-radius: 20px;
    font-size: 1.9rem;
    animation: none;
    transition: transform 0.35s var(--home-ease);
}

.service-icon::after {
    display: none;
}

/* Available services respond to the pointer; "coming soon" ones stay quiet */
.service-card:not(.coming-soon):hover {
    transform: translateY(-6px);
    box-shadow: var(--home-shadow-hover);
    border-color: rgba(37, 99, 235, 0.22);
}

.service-card:not(.coming-soon):hover .service-icon {
    transform: scale(1.06);
}

.service-card.coming-soon {
    opacity: 1;
    padding: 1.5rem 1.25rem;
    background: rgba(255, 255, 255, 0.55);
    border: 1.5px dashed #cbd5e1;
    box-shadow: none;
}

.service-card.coming-soon .service-icon {
    margin-bottom: 1rem;
}

.service-card.coming-soon .service-title {
    margin-bottom: 0.6rem;
}

.service-card.coming-soon .service-description {
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 1.1rem;
}

.service-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
}

.service-card.coming-soon .service-icon {
    width: 58px;
    height: 58px;
    font-size: 1.45rem;
    filter: saturate(0.5);
    box-shadow: none;
}

.service-card.coming-soon .service-title {
    font-size: 1.2rem;
    color: #475569;
}

.coming-soon-badge {
    background: #e2e8f0;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

.service-button {
    min-height: 48px;
    border-radius: 999px;
}

/* ----------------------------------------------------------------- About */
.about-container {
    gap: clamp(2rem, 5vw, 4.5rem);
}

.about-content p {
    max-width: 38em;
}

.about-image img {
    display: block;
    border-radius: var(--home-radius-xl);
    box-shadow: var(--home-shadow);
}

.stats {
    gap: clamp(0.6rem, 2vw, 1.25rem);
    margin-top: 2.5rem;
}

.stat-item {
    padding: clamp(1rem, 2.5vw, 1.5rem) 0.6rem;
    border-radius: var(--home-radius-md);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
}

.stat-item:hover {
    transform: none;
}

.stat-number {
    font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: clamp(0.78rem, 0.72rem + 0.3vw, 0.95rem);
    line-height: 1.35;
}

/* ------------------------------------------------------------------- FAQ */
.faq-item {
    border-radius: var(--home-radius-md);
    border: 1px solid var(--home-border);
    box-shadow: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.faq-item:hover,
.faq-item.active {
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: var(--home-shadow);
}

.faq-question {
    gap: 1rem;
    padding: 1.2rem clamp(1.1rem, 3vw, 1.75rem);
    user-select: none;
}

.faq-question:hover {
    background: transparent;
}

.faq-question > span {
    line-height: 1.45;
}

.faq-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--light-blue);
    transition: transform 0.35s var(--home-ease);
}

/* Height animates to the real content height (the old max-height: 200px
   clipped the long answers on phones) */
.faq-answer,
.faq-answer.active {
    display: grid;
    grid-template-rows: 0fr;
    max-height: none;
    background: transparent;
    transition: grid-template-rows 0.4s var(--home-ease);
}

.faq-answer > p {
    overflow: hidden;
    min-height: 0;
    padding: 0 clamp(1.1rem, 3vw, 1.75rem);
}

.faq-item.active .faq-answer {
    grid-template-rows: 1fr;
}

.faq-item.active .faq-answer > p {
    padding-bottom: 1.35rem;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

/* --------------------------------------------------------------- Contact */
.contact-container {
    gap: clamp(1.5rem, 4vw, 3rem);
}

.contact-form {
    padding: clamp(1.5rem, 4vw, 2.75rem);
    border-radius: var(--home-radius-xl);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
}

.form-group {
    margin-bottom: 1.35rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font: inherit;
    color: var(--text-dark);
    background-color: #fbfcfe;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    background-color: var(--white);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
    border-radius: 12px;
}

/* index.html styles #subject on its own (grey 2px border); align it with the other fields */
#contactForm .form-group input#subject {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background-color: #fbfcfe;
}

#contactForm .form-group input#subject:focus {
    background-color: var(--white);
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
}

.contact-form .cta-button {
    width: 100%;
    justify-content: center;
    min-height: 54px;
    border-radius: 999px;
}

.contact-info {
    gap: 1rem;
}

.contact-item {
    padding: clamp(1.1rem, 3vw, 1.6rem);
    gap: 1rem;
    min-width: 0;
    border-radius: var(--home-radius-lg);
    border: 1px solid var(--home-border);
    box-shadow: var(--home-shadow);
}

.contact-item:hover {
    transform: none;
}

.contact-item > div:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.contact-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
}

/* ---------------------------------------------------------------- Footer */
.footer-content {
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem);
}

.social-icon {
    width: 44px;
    height: 44px;
}

/* ----------------------------------------------------------- Breakpoints */
@media (max-width: 1024px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-subtitle {
        margin-inline: auto;
    }

    .hero-image {
        max-width: 560px;
        margin-inline: auto;
        width: 100%;
    }

    .about-container,
    .contact-container {
        grid-template-columns: 1fr;
    }

    .about-content h2.section-title {
        text-align: center !important;
    }

    .about-content p {
        margin-inline: auto;
    }

    .about-actions {
        display: flex;
        justify-content: center;
    }

    .about-image {
        order: -1;
        max-width: 560px;
        margin-inline: auto;
    }
}

@media (max-width: 768px) {
    /* Keep the three stats side by side instead of a tall single column */
    .stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 720px) {
    .services-grid > .service-card,
    .services-grid > .service-card.coming-soon {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .hero {
        padding-top: 92px;
    }

    .hero-cta {
        width: 100%;
        justify-content: center;
        padding-inline: 1.25rem;
    }

    .hero-image::before {
        inset: -8px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .social-icons {
        justify-content: center;
    }

    /* styles.css caps every .cta-button at 140px on one line below 480px,
       which truncated these labels */
    .contact-form .cta-button,
    .about-actions .cta-button {
        max-width: none;
        white-space: normal;
        font-size: 1rem;
        padding: 0.9rem 1.25rem;
    }

    .about-actions .cta-button {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

/* RTL: centred blocks stay centred */
[dir="rtl"] .service-card {
    text-align: center;
}

@media (max-width: 900px) {
    [dir="rtl"] .hero-content {
        text-align: center;
    }
}

/* =====================================================================
 * MOTION LAYER
 * Transform/opacity only (GPU-friendly). Elements are visible by default;
 * hidden start states apply only to what home.js has tagged (html.home-js
 * + .home-reveal / .hw-i), so a JS failure never hides content.
 * ===================================================================== */

/* ------------------------------------------------ Scroll progress bar */
.home-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 10001;
    transform-origin: 0 50%;
    transform: scaleX(var(--home-progress, 0));
    background: linear-gradient(90deg, var(--primary-blue), #667eea, #764ba2);
    pointer-events: none;
}

[dir="rtl"] .home-progress {
    transform-origin: 100% 50%;
}

/* ------------------------------------------------ Hero: moving light blobs */
.hero-blobs {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.hero-blobs span {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    will-change: transform;
}

.hero-blobs span:nth-child(1) {
    width: 46vmax;
    height: 46vmax;
    left: -12vmax;
    top: -14vmax;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.9), transparent 65%);
    animation: home-blob-a 18s ease-in-out infinite alternate;
}

.hero-blobs span:nth-child(2) {
    width: 40vmax;
    height: 40vmax;
    right: -14vmax;
    bottom: -16vmax;
    background: radial-gradient(circle, rgba(192, 132, 252, 0.8), transparent 65%);
    animation: home-blob-b 22s ease-in-out infinite alternate;
}

.hero-blobs span:nth-child(3) {
    width: 28vmax;
    height: 28vmax;
    left: 38%;
    top: 30%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.7), transparent 65%);
    animation: home-blob-c 26s ease-in-out infinite alternate;
}

@keyframes home-blob-a {
    to { transform: translate(14vmax, 10vmax) scale(1.15); }
}

@keyframes home-blob-b {
    to { transform: translate(-12vmax, -8vmax) scale(1.2); }
}

@keyframes home-blob-c {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-10vmax, 6vmax) scale(1.25); }
    100% { transform: translate(8vmax, -6vmax) scale(0.9); }
}

/* ------------------------------------------------ Hero: word-by-word title */
.hero-title.is-split {
    animation: none;
}

.hero-title .hw {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.1em;
    margin-bottom: -0.1em;
}

.hero-title .hw-i {
    display: inline-block;
    animation: home-word-in 0.9s var(--home-ease) backwards;
    animation-delay: calc(0.15s + var(--i, 0) * 0.07s);
}

/* the gradient-text span: each word carries its own clip */
.hero-title > span .hw-i {
    background: linear-gradient(45deg, #fff, #e0e7ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes home-word-in {
    from { transform: translateY(105%) rotate(4deg); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

/* ------------------------------------------------ Hero: CTA light sweep */
.hero-cta {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.hero-cta::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(102, 126, 234, 0.28) 50%, transparent 70%);
    transform: translateX(-120%);
    animation: home-sweep 3.6s ease-in-out 1.6s infinite;
}

@keyframes home-sweep {
    0%, 55% { transform: translateX(-120%); }
    100%    { transform: translateX(120%); }
}

.hero-cta i,
.service-button i {
    display: inline-block;
}

.hero-cta i {
    animation: home-nudge 3.6s ease-in-out 1.6s infinite;
}

@keyframes home-nudge {
    0%, 60%, 100% { transform: none; }
    70%           { transform: scale(1.18) rotate(-6deg); }
    80%           { transform: scale(1); }
}

/* ------------------------------------------------ Hero: floating, tilting photo */
.hero-image {
    perspective: 1000px;
}

.hero-image-tilt {
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: transform 0.4s var(--home-ease);
}

.hero-image img {
    animation: home-float 7s ease-in-out 1.6s infinite;
}

@keyframes home-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

/* ------------------------------------------------ Hero: scroll cue */
.home-scroll-cue {
    position: absolute;
    left: 50%;
    bottom: 22px;
    width: 26px;
    height: 42px;
    margin-left: -13px;
    border: 2px solid rgba(255, 255, 255, 0.65);
    border-radius: 14px;
    z-index: 3;
    opacity: 0;
    animation: home-fade-in 0.8s ease 1.8s forwards;
}

.home-scroll-cue::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 8px;
    width: 4px;
    height: 8px;
    margin-left: -2px;
    border-radius: 2px;
    background: #fff;
    animation: home-scroll-dot 1.8s ease-in-out infinite;
}

@keyframes home-scroll-dot {
    0%   { transform: translateY(0); opacity: 1; }
    70%  { transform: translateY(14px); opacity: 0; }
    100% { transform: translateY(0); opacity: 0; }
}

@keyframes home-fade-in {
    to { opacity: 1; }
}

@media (max-width: 900px), (max-height: 640px) {
    .home-scroll-cue {
        display: none;
    }
}

/* ------------------------------------------------ Section title underline draws in */
.home-js .section-title.home-reveal::after {
    transform: translateX(-50%) scaleX(0);
    transition: transform 0.9s var(--home-ease) 0.35s;
}

.home-js .section-title.home-reveal.is-visible::after {
    transform: translateX(-50%) scaleX(1);
}

/* ------------------------------------------------ Reveal variants */
.home-js .home-reveal {
    opacity: 0;
    transition:
        opacity 0.8s var(--home-ease) var(--home-delay, 0s),
        transform 0.9s var(--home-ease) var(--home-delay, 0s),
        filter 0.8s var(--home-ease) var(--home-delay, 0s),
        clip-path 1.1s var(--home-ease) var(--home-delay, 0s),
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

.home-js .home-reveal[data-reveal="up"]    { transform: translateY(36px); }
.home-js .home-reveal[data-reveal="rise"]  { transform: translateY(60px) scale(0.92); filter: blur(6px); }
.home-js .home-reveal[data-reveal="left"]  { transform: translateX(-60px); }
.home-js .home-reveal[data-reveal="right"] { transform: translateX(60px); }
.home-js .home-reveal[data-reveal="pop"]   { transform: scale(0.7); }
.home-js .home-reveal[data-reveal="wipe"]  { opacity: 1; clip-path: inset(0 100% 0 0 round 28px); }

[dir="rtl"] .home-reveal[data-reveal="left"]  { transform: translateX(60px); }
[dir="rtl"] .home-reveal[data-reveal="right"] { transform: translateX(-60px); }
[dir="rtl"] .home-reveal[data-reveal="wipe"]  { clip-path: inset(0 0 0 100% round 28px); }

.home-js .home-reveal.is-visible,
[dir="rtl"] .home-js .home-reveal.is-visible {
    opacity: 1;
    transform: none;
    filter: none;
    clip-path: inset(0 0 0 0 round 28px);
}

/* Revealed about photo: slow zoom settle */
.about-image {
    overflow: hidden;
    border-radius: var(--home-radius-xl);
}

.home-js .about-image.home-reveal img {
    transform: scale(1.15);
    transition: transform 1.6s var(--home-ease) 0.2s;
}

.home-js .about-image.home-reveal.is-visible img {
    transform: scale(1);
}

/* Stat numbers bump when the count finishes */
.stat-number.is-done {
    animation: home-stat-bump 0.6s var(--home-ease);
}

@keyframes home-stat-bump {
    40% { transform: scale(1.18); }
}

/* ------------------------------------------------ Service cards: 3D tilt + spotlight */
.services-grid {
    perspective: 1200px;
}

/* .is-settled is added by home.js once the entrance has finished, so the fast
   tilt transition never shortens the slower reveal */
.service-card.is-settled:not(.coming-soon),
.home-js .service-card.home-reveal.is-visible.is-settled:not(.coming-soon) {
    transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
    transition:
        opacity 0.8s var(--home-ease),
        transform 0.25s ease-out,
        filter 0.8s var(--home-ease),
        box-shadow 0.35s ease,
        border-color 0.35s ease;
}

.service-card:not(.coming-soon):hover {
    --lift: -6px;
}

.service-card:not(.coming-soon)::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(102, 126, 234, 0.16), transparent 45%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.service-card:not(.coming-soon):hover::after {
    opacity: 1;
}

.service-card:not(.coming-soon):hover .service-icon {
    animation: home-icon-bounce 0.7s var(--home-ease);
}

@keyframes home-icon-bounce {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.18) rotate(-8deg); }
    60%  { transform: scale(0.95) rotate(4deg); }
    100% { transform: scale(1.06); }
}

.service-button:hover i {
    animation: home-arrow 0.8s ease-in-out infinite;
}

@keyframes home-arrow {
    50% { transform: translateX(5px); }
}

[dir="rtl"] .service-button:hover i {
    animation-name: home-arrow-rtl;
}

@keyframes home-arrow-rtl {
    50% { transform: translateX(-5px); }
}

/* Coming-soon badge breathes softly */
.coming-soon-badge {
    animation: home-breathe 3s ease-in-out infinite;
}

@keyframes home-breathe {
    50% { background: #dbeafe; color: var(--dark-blue); }
}

/* ------------------------------------------------ Contact + social micro-interactions */
.contact-item .contact-icon {
    transition: transform 0.4s var(--home-ease);
}

.contact-item:hover .contact-icon {
    transform: rotate(-10deg) scale(1.08);
}

.social-icon {
    transition: transform 0.3s var(--home-ease), background-color 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-4px) rotate(-8deg);
}

/* =====================================================================
 * Reduced motion: no movement, but keep soft fades so the page still
 * feels alive (opacity changes are safe for motion-sensitive users).
 * ===================================================================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero-blobs span,
    .hero-image img,
    .hero-cta::after,
    .hero-cta i,
    .coming-soon-badge,
    .home-scroll-cue::before,
    .service-card:not(.coming-soon):hover .service-icon,
    .service-button:hover i,
    .stat-number.is-done {
        animation: none !important;
    }

    .hero-title .hw-i,
    .hero-subtitle,
    .hero-cta,
    .hero-image {
        animation-name: home-fade-in-soft !important;
    }

    .home-js .home-reveal,
    .home-js .home-reveal[data-reveal],
    [dir="rtl"] .home-reveal[data-reveal] {
        transform: none !important;
        filter: none !important;
        clip-path: none !important;
        transition: opacity 0.8s ease !important;
    }

    .home-js .about-image.home-reveal img,
    .service-card.is-settled:not(.coming-soon),
    .home-js .service-card.home-reveal.is-visible.is-settled:not(.coming-soon),
    .hero-image-tilt {
        transform: none !important;
    }
}

@keyframes home-fade-in-soft {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* =====================================================================
 * UI POLISH LAYER 2: navbar, ripples, FAQ, form, back-to-top, chat,
 * footer wave, ambient orbs.
 * ===================================================================== */

/* ------------------------------------------------ Navbar: glass on scroll */
.navbar {
    transition: background-color 0.35s ease, box-shadow 0.35s ease, backdrop-filter 0.35s ease;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    box-shadow: 0 1px 0 rgba(37, 99, 235, 0.08), 0 10px 30px -18px rgba(15, 23, 42, 0.35);
}

/* ------------------------------------------------ Click ripple */
.home-ripple-host {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.home-ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0);
    background: currentColor;
    opacity: 0.28;
    animation: home-ripple 0.65s ease-out forwards;
    z-index: -1;
}

@keyframes home-ripple {
    to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ------------------------------------------------ Magnetic hero CTA */
.hero-cta.is-magnetic {
    translate: var(--mgx, 0px) var(--mgy, 0px);
    transition: transform 0.25s var(--home-ease), box-shadow 0.25s ease, translate 0.3s var(--home-ease);
}

/* ------------------------------------------------ FAQ details */
.faq-item {
    position: relative;
}

.faq-item::before {
    content: "";
    position: absolute;
    inset-block: 14px;
    inset-inline-start: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--primary-blue), #764ba2);
    transform: scaleY(0);
    transition: transform 0.45s var(--home-ease);
}

[dir="rtl"] .faq-item::before {
    border-radius: 4px 0 0 4px;
}

.faq-item.active::before {
    transform: scaleY(1);
}

.faq-question > span {
    transition: color 0.3s ease;
}

.faq-item.active .faq-question > span,
.faq-question:hover > span {
    color: var(--dark-blue);
}

.faq-item.active .faq-icon {
    background: var(--primary-blue);
    color: #fff;
}

.faq-answer > p {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.35s ease, transform 0.45s var(--home-ease), padding 0.4s var(--home-ease);
}

.faq-item.active .faq-answer > p {
    opacity: 1;
    transform: none;
    transition-delay: 0.08s;
}

/* ------------------------------------------------ Form details */
.form-group label {
    transition: color 0.25s ease, transform 0.3s var(--home-ease);
    transform-origin: left center;
}

[dir="rtl"] .form-group label {
    transform-origin: right center;
}

.form-group.focused label,
.form-group:focus-within label {
    color: var(--primary-blue);
    transform: translateX(2px);
}

.form-group.error input,
.form-group.error textarea,
.form-group.error select {
    border-color: #ef4444;
    animation: home-shake 0.4s ease;
}

@keyframes home-shake {
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

/* Sending state: moving sheen on the disabled submit button */
.contact-form .cta-button:disabled {
    cursor: progress;
    background-image: linear-gradient(110deg, var(--primary-blue) 30%, #667eea 50%, var(--primary-blue) 70%);
    background-size: 220% 100%;
    animation: home-sheen 1.1s linear infinite;
}

@keyframes home-sheen {
    to { background-position: -120% 0; }
}

/* ------------------------------------------------ Back to top with progress ring */
.home-to-top {
    position: fixed;
    right: 24px;
    bottom: 104px;
    z-index: 999;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-blue), var(--dark-blue));
    box-shadow: 0 12px 28px -10px rgba(37, 99, 235, 0.6);
    display: grid;
    place-items: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.85);
    transition: opacity 0.35s ease, transform 0.4s var(--home-ease), visibility 0s linear 0.4s;
}

[dir="rtl"] .home-to-top {
    right: auto;
    left: 24px;
}

.home-to-top.is-shown {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.35s ease, transform 0.4s var(--home-ease), visibility 0s;
}

.home-to-top:hover {
    transform: translateY(-3px);
}

.home-to-top svg {
    position: absolute;
    inset: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    transform: rotate(-90deg);
}

.home-to-top circle {
    fill: none;
    stroke: #764ba2;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 157;
    stroke-dashoffset: calc(157 - 157 * var(--home-progress, 0));
}

.home-to-top i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .home-to-top {
        right: 16px;
        bottom: 92px;
        width: 44px;
        height: 44px;
    }

    [dir="rtl"] .home-to-top {
        left: 16px;
    }
}

/* ------------------------------------------------ Chat toggle attention ping */
.chat-toggle::after {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 2px solid rgba(118, 75, 162, 0.7);
    opacity: 0;
    pointer-events: none;
    animation: home-ping 1.8s var(--home-ease) 2.5s 3;
}

.chat-toggle.open::after {
    animation: none;
}

@keyframes home-ping {
    0%   { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ------------------------------------------------ Footer wave */
.footer {
    position: relative;
}

.home-wave {
    position: absolute;
    left: 0;
    right: 0;
    top: -38px;
    height: 40px;
    overflow: hidden;
    pointer-events: none;
    color: var(--text-dark);
}

.home-wave svg {
    width: 200%;
    height: 100%;
    display: block;
    animation: home-wave 16s linear infinite;
}

@keyframes home-wave {
    to { transform: translateX(-50%); }
}

/* ------------------------------------------------ Ambient orbs behind sections */
.services,
#contact {
    position: relative;
    overflow: hidden;
}

.home-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(50px);
    opacity: 0.35;
    z-index: 0;
    animation: home-orb 20s ease-in-out infinite alternate;
}

.home-orb.a {
    width: 340px;
    height: 340px;
    top: 8%;
    left: -140px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.55), transparent 70%);
}

.home-orb.b {
    width: 300px;
    height: 300px;
    bottom: 6%;
    right: -120px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.45), transparent 70%);
    animation-duration: 24s;
}

.services > .container,
#contact > .container {
    position: relative;
    z-index: 1;
}

@keyframes home-orb {
    to { transform: translate(60px, -40px) scale(1.15); }
}

/* ------------------------------------------------ Reduced motion for this layer */
@media (prefers-reduced-motion: reduce) {
    .home-ripple,
    .home-wave svg,
    .home-orb,
    .chat-toggle::after,
    .contact-form .cta-button:disabled,
    .form-group.error input,
    .form-group.error textarea,
    .form-group.error select {
        animation: none !important;
    }

    .hero-cta.is-magnetic {
        translate: none;
    }

    .faq-answer > p,
    .form-group label {
        transform: none !important;
    }
}

/* =====================================================================
 * LOADING SCREEN (brand gradient, hands over to the hero)
 * ===================================================================== */
#loading-screen {
    /* above the cookie banner (10000) and the scroll bar (10001) */
    z-index: 10002;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    gap: 0;
    overflow: hidden;
    transition: opacity 0.55s ease, visibility 0s linear 0.55s;
}

#loading-screen::before,
#loading-screen::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    pointer-events: none;
}

#loading-screen::before {
    width: 50vmax;
    height: 50vmax;
    left: -15vmax;
    top: -20vmax;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.9), transparent 65%);
    animation: home-blob-a 14s ease-in-out infinite alternate;
}

#loading-screen::after {
    width: 44vmax;
    height: 44vmax;
    right: -16vmax;
    bottom: -18vmax;
    background: radial-gradient(circle, rgba(192, 132, 252, 0.8), transparent 65%);
    animation: home-blob-b 16s ease-in-out infinite alternate;
}

#loading-screen .loader-stage {
    position: relative;
    width: 132px;
    height: 132px;
    display: grid;
    place-items: center;
    z-index: 1;
    transition: transform 0.6s var(--home-ease);
}

/* rotating gradient ring */
#loading-screen .loader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(255, 255, 255, 0) 0deg, #ffffff 120deg, rgba(255, 255, 255, 0) 240deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    animation: home-spin 1.1s linear infinite;
}

#loading-screen .loader {
    width: 104px;
    height: 104px;
    padding: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    animation: home-breathe-logo 2.4s ease-in-out infinite;
}

#loading-screen .loader img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#loading-screen .loader-brand {
    margin-top: 26px;
    z-index: 1;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    animation: home-rise 0.8s var(--home-ease) 0.15s backwards;
}

#loading-screen .loader-brand span {
    color: #e0e7ff;
    font-weight: 600;
}

#loading-screen .loader-bar {
    position: relative;
    z-index: 1;
    width: 160px;
    height: 4px;
    margin-top: 18px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.25);
}

#loading-screen .loader-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    border-radius: inherit;
    background: #ffffff;
    animation: home-loader-bar 1.3s var(--home-ease) infinite;
}

/* visible to screen readers; the brand + bar already say it visually */
#loading-screen .loader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    animation: none;
}

@keyframes home-spin {
    to { transform: rotate(360deg); }
}

@keyframes home-breathe-logo {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}

@keyframes home-loader-bar {
    0%   { transform: translateX(-110%); }
    100% { transform: translateX(260%); }
}

/* Exit: the page script sets opacity:0 inline; zoom the stage as it fades */
#loading-screen[style*="opacity: 0"] {
    visibility: hidden;
}

#loading-screen[style*="opacity: 0"] .loader-stage {
    transform: scale(1.25);
}

/* =====================================================================
 * HERO TIMING: slower, and held until the loading screen has gone
 * ===================================================================== */
.hero-title .hw-i {
    animation-duration: 1.3s;
    animation-delay: calc(0.25s + var(--i, 0) * 0.12s);
}

.hero-subtitle {
    animation-duration: 1.2s;
    animation-delay: 1.15s;
}

.hero-cta {
    animation-duration: 1.2s;
    animation-delay: 1.45s;
}

.hero-image {
    animation-duration: 1.6s;
    animation-delay: 0.7s;
}

.hero-cta::after,
.hero-cta i {
    animation-duration: 7s;
    animation-delay: 4s;
}

.hero-image img {
    animation-duration: 10s;
    animation-delay: 2.4s;
}

.hero-blobs span:nth-child(1) { animation-duration: 32s; }
.hero-blobs span:nth-child(2) { animation-duration: 38s; }
.hero-blobs span:nth-child(3) { animation-duration: 44s; }

.home-scroll-cue {
    animation-delay: 3s;
}

/* While the loader is up, every hero animation waits at its first frame */
html.home-loading .hero *,
html.home-loading .hero *::before,
html.home-loading .hero *::after,
html.home-loading .hero,
html.home-loading .hero::before {
    animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
    #loading-screen::before,
    #loading-screen::after,
    #loading-screen .loader,
    #loading-screen .loader-brand {
        animation: none !important;
    }

    #loading-screen .loader-ring,
    #loading-screen .loader-bar span {
        animation-duration: 2.4s !important;
    }
}
