@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@600;700;800&family=Poppins:wght@600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    font-family: 'Poppins', 'Cairo', sans-serif;
    background-color: #f4fbf7;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(254, 240, 138, 0.45) 0%, rgba(167, 243, 208, 0.25) 38%, transparent 70%),
        radial-gradient(circle at 50% 105%, rgba(16, 185, 129, 0.2) 0%, rgba(52, 211, 153, 0.08) 45%, transparent 72%),
        linear-gradient(180deg, #ffffff 0%, #eaf9f1 55%, #d6f3e4 100%);
    overflow-x: hidden;
    position: relative;
}

#ecoDomeCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.sunbeam-aura {
    position: fixed;
    top: -180px;
    left: 50%;
    transform: translateX(-50%);
    width: 780px;
    height: 420px;
    background: radial-gradient(ellipse at center, rgba(253, 224, 71, 0.32) 0%, rgba(52, 211, 153, 0.14) 50%, transparent 75%);
    filter: blur(28px);
    z-index: -1;
    pointer-events: none;
    animation: sunPulse 6s ease-in-out infinite alternate;
}

@keyframes sunPulse {
    from { opacity: 0.75; transform: translateX(-50%) scale(0.96); }
    to { opacity: 1; transform: translateX(-50%) scale(1.06); }
}

/* =========================================
   Header: Welcome — [Big TO Loop Logo] — Centered ECO GUARDIAN
   ========================================= */
.welcome-header {
    width: 100%;
    max-width: 1300px;
    margin: 1.4rem auto 0.5rem;
    padding: 0 1.2rem;
    animation: fadeSlideDown 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.nav-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 0.6rem 1rem 1rem;
}

/* Left Side: "Welcome" */
.first-line h1 {
    font-size: clamp(2.4rem, 4.4vw, 3.6rem);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    background: linear-gradient(135deg, #1b4332 0%, #059669 60%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.22));
}

/* Middle: Bigger Curved "TO" Loop Around Logo */
.logo-halo {
    position: relative;
    width: 235px;
    height: 235px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: floatLogo 4.5s ease-in-out infinite;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

.orbit-ring {
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    border: 2px dashed rgba(16, 185, 129, 0.48);
    animation: spinOrbit 20s linear infinite;
}

@keyframes spinOrbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.to-loop-svg {
    position: absolute;
    inset: -12px;
    width: calc(100% + 24px);
    height: calc(100% + 24px);
    overflow: visible;
    pointer-events: none;
    z-index: 3;
}

.curved-to-text {
    font-family: 'Poppins', 'Cairo', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    fill: #059669;
    letter-spacing: 6px;
    filter: drop-shadow(0 3px 8px rgba(16, 185, 129, 0.4));
}

.image img.eco {
    width: 145px;
    height: auto;
    display: block;
    margin-top: 22px;
    z-index: 2;
    filter: drop-shadow(0 10px 20px rgba(16, 185, 129, 0.32));
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo-halo:hover img.eco {
    transform: scale(1.08) rotate(-4deg);
}

/* Right Side: ECO Centered Directly Above GUARDIAN */
.second-line {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.04;
}

.brand-eco {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 800;
    letter-spacing: 3px;
    color: #10b981;
    text-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

.second-line h1 {
    color: #064e3b;
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 0 4px 14px rgba(16, 185, 129, 0.22);
}

/* =========================================
   Arabic Header Mirror Styling (أهلاً • إلى • الحامي البيئي)
   ========================================= */
.first-line h1.ar-brand-stack {
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    text-align: center;
    line-height: 1.15;
    letter-spacing: 0;
}

.first-line h1.ar-brand-stack .brand-eco {
    display: inline-block;
    color: #10b981;
    letter-spacing: 0;
    text-shadow: 0 0 18px rgba(16, 185, 129, 0.35);
}

.first-line h1.ar-brand-stack .brand-guardian {
    display: inline-block;
    color: #064e3b;
    letter-spacing: 0;
    text-shadow: 0 4px 14px rgba(16, 185, 129, 0.22);
}

.second-line h1.ar-welcome-word {
    font-size: clamp(2.6rem, 4.6vw, 3.8rem);
    font-weight: 800;
    letter-spacing: 0;
    background: linear-gradient(135deg, #1b4332 0%, #059669 60%, #10b981 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 12px rgba(16, 185, 129, 0.22));
}

hr.eco-divider {
    border: none;
    height: 2.5px;
    background: linear-gradient(90deg, transparent, #10b981, #fbbf24, #10b981, transparent);
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.45);
}

/* =========================================
   Interactive Language Curve Switcher
   ========================================= */
section.log-sign {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.6rem auto;
    padding: 1rem;
    max-width: 1300px;
}

nav.eng-ar {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 900px;
}

.switch-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 800 / 220;
    container-type: size;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lang-btn {
    width: 185px;
    height: 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Poppins', 'Cairo', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #133a2a;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border: 2.5px solid #10b981;
    border-radius: 16px;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 10px 24px rgba(16, 185, 129, 0.18);
    transition:
        transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.35s ease,
        background 0.35s ease,
        color 0.35s ease,
        border-color 0.35s ease;
}

.active-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.85rem;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lang-btn.active-lang .active-check {
    opacity: 1;
    transform: scale(1);
}

.lang-btn:hover {
    border-color: #059669;
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.35);
}

.lang-btn.active-lang {
    color: #ffffff;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border-color: #fbbf24;
    box-shadow:
        0 12px 28px rgba(16, 185, 129, 0.45),
        0 0 22px rgba(251, 191, 36, 0.45);
}

#englishBtn {
    transform: translateY(-25cqh) scale(1.06);
}

#arabicBtn {
    transform: translateY(25cqh) scale(0.96);
}

.arabic-active #englishBtn {
    transform: translateY(25cqh) scale(0.96);
}

.arabic-active #arabicBtn {
    transform: translateY(-25cqh) scale(1.06);
}

.line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

#curvePath,
#curvePathGlow {
    d: path("M 120 50 C 400 50, 400 150, 680 150");
    transition: d 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#curvePath {
    stroke-width: 5.5;
    stroke-dasharray: 14 8;
    animation: flowCurve 1.6s linear infinite;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.55));
}

@keyframes flowCurve {
    to { stroke-dashoffset: -44; }
}

.arabic-active #curvePath,
.arabic-active #curvePathGlow {
    d: path("M 120 150 C 400 150, 400 50, 680 50");
}

hr.forest-divider {
    border: none;
    height: 2px;
    max-width: 1100px;
    margin: 0 auto;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.5), transparent);
}

/* =========================================
   Kinetic Neon-Border "Next" Button Design
   ========================================= */
.next {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    padding-bottom: 2.5rem;
}

.magnetic-zone {
    padding: 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.kinetic-next-btn {
    position: relative;
    padding: 3px;
    border: none;
    border-radius: 22px;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    box-shadow:
        0 14px 32px rgba(5, 150, 105, 0.35),
        0 0 24px rgba(16, 185, 129, 0.35);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}

.kinetic-border-glow {
    position: absolute;
    inset: -120%;
    background: conic-gradient(
        from 0deg,
        #059669 0%,
        #34d399 25%,
        #fde047 50%,
        #10b981 75%,
        #059669 100%
    );
    animation: rotateBorder 3.2s linear infinite;
    z-index: 0;
}

@keyframes rotateBorder {
    to { transform: rotate(360deg); }
}

.kinetic-inner {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 0.9rem 2.4rem;
    border-radius: 19px;
    background: linear-gradient(135deg, #07291e 0%, #0d4734 55%, #065f46 100%);
    color: #ecfdf5;
    font-family: 'Poppins', 'Cairo', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 2px;
    transition: background 0.35s ease;
}

.kinetic-leaf {
    font-size: 1.35rem;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.kinetic-chevrons {
    display: inline-flex;
    align-items: center;
    font-size: 1.7rem;
    line-height: 1;
    color: #6ee7b7;
}

.kinetic-chevrons span {
    animation: chevronWave 1.3s ease-in-out infinite;
}

.kinetic-chevrons span:nth-child(2) {
    animation-delay: 0.18s;
}

.kinetic-chevrons span:nth-child(3) {
    animation-delay: 0.36s;
}

@keyframes chevronWave {
    0%, 100% { opacity: 0.35; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(4px); color: #fde047; }
}

.kinetic-next-btn.rtl-next .kinetic-inner {
    flex-direction: row-reverse;
}

.kinetic-next-btn:hover {
    box-shadow:
        0 18px 40px rgba(5, 150, 105, 0.5),
        0 0 34px rgba(253, 224, 71, 0.55);
}

.kinetic-next-btn:hover .kinetic-inner {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.kinetic-next-btn:hover .kinetic-leaf {
    transform: rotate(-18deg) scale(1.2);
}

.kinetic-next-btn:active {
    transform: scale(0.95) !important;
}

@media (max-width: 760px) {
    .nav-head {
        flex-direction: column;
        text-align: center;
    }
    .second-line {
        align-items: center;
    }
    .switch-wrapper {
        aspect-ratio: 500 / 190;
    }
    .lang-btn {
        width: 145px;
        height: 50px;
        font-size: 1.05rem;
    }
}

/* Mobile Responsiveness (keeps all animations active) */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    width: 100%;
  }

  /* Stack side-by-side grids and flex rows vertically on phones */
  .container, .cards-grid, .hero, .nav-links, .features-grid {
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Scale large desktop headings for phone screens */
  h1 {
    font-size: clamp(1.8rem, 7vw, 2.5rem) !important;
  }

  h2 {
    font-size: clamp(1.4rem, 5.5vw, 2rem) !important;
  }

  /* Prevent fixed-width elements or images from overflowing */
  img, video, canvas, iframe {
    max-width: 100% !important;
    height: auto !important;
  }
}