/* ============================================
   NAJDI CONSTELLATIONS — Desert Observatory
   ============================================ */

/* Backup font import */
@import url('https://fonts.googleapis.com/css2?family=Eczar:wght@400;500;600;700;800&display=swap');

/* ── Custom Properties ── */
:root {
    --color-void: #030108;
    --color-night: #060612;
    --color-deep: #0a0a18;
    --color-gold: #B67300;
    --color-gold-light: #D49A2A;
    --color-gold-dim: #7A4D00;
    --color-star: #F5E6C8;
    --color-text: #E0D8CC;
    --color-text-dim: #8B8478;
    --color-border: rgba(182, 115, 0, 0.1);
    --color-glow: rgba(182, 115, 0, 0.08);
    --color-card: rgba(182, 115, 0, 0.025);
    --font-ar: 'Greta Text Arabic', 'Amiri', serif;
    --font-en: 'Eczar', Georgia, serif;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Font Faces ── */
@font-face {
    font-family: 'Greta Text Arabic';
    src: url('./resources/GretaTextArabicAR-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Greta Text Arabic';
    src: url('./resources/GretaTextArabicAR-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Greta Text Arabic';
    src: url('./resources/GretaTextArabicAR-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Greta Text Arabic';
    src: url('./resources/GretaTextArabicAR-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    overflow-x: hidden;
}

/* ── Base ── */
body {
    font-family: var(--font-ar);
    background-color: var(--color-void);
    color: var(--color-text);
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Typography Classes ── */
.text-en {
    font-family: var(--font-en) !important;
}

.text-ar {
    font-family: var(--font-ar);
}

/* ── Persistent Starfield ── */
#three-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#three-container canvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

/* ── Grain Overlay ── */
.grain {
    position: fixed;
    inset: 0;
    z-index: 900;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    overflow: hidden;
}

.grain::after {
    content: '';
    position: absolute;
    inset: -50%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    animation: grainDrift 0.8s steps(2) infinite;
}

@keyframes grainDrift {
    0%   { transform: translate(0, 0); }
    50%  { transform: translate(-3%, -3%); }
    100% { transform: translate(3%, 1%); }
}

/* ── Loading Screen ── */
.loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--color-void);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s var(--ease-smooth), visibility 0.8s;
}

.loader.done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-star {
    font-size: 2rem;
    color: var(--color-gold);
    animation: loaderPulse 1.5s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

@keyframes loaderPulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%      { opacity: 1; transform: scale(1.2); }
}

.loader-name {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--color-text-dim);
    letter-spacing: 2px;
    opacity: 0;
    animation: loaderFadeIn 1s 0.5s ease both;
}

@keyframes loaderFadeIn {
    to { opacity: 0.7; }
}

/* ── Scroll Progress ── */
.scroll-progress {
    position: fixed;
    top: 0;
    right: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(90deg, var(--color-gold-dim), var(--color-gold), var(--color-gold-light));
    z-index: 1001;
    transition: width 0.1s linear;
}

/* ── Navigation ── */
.nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    transition: background 0.4s var(--ease-smooth), box-shadow 0.4s;
}

.nav.scrolled {
    background: rgba(3, 1, 8, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 var(--color-border);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
}

.nav-brand-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    transition: opacity 0.3s;
}

.nav-brand:hover .nav-brand-img {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    transition: color 0.3s, background 0.3s;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-gold);
}

.nav-link:hover {
    background: rgba(182, 115, 0, 0.06);
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s var(--ease-out);
    transform-origin: center;
}

.nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 5px);
}
.nav-toggle.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(4px, -5px);
}

/* ── Hero ── */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 1;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 30%, var(--color-void) 80%);
    z-index: -1;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 2rem;
}

.hero-logo {
    margin-bottom: 2rem;
}

.hero-logo-img {
    width: 280px;
    height: 280px;
    object-fit: contain;
    margin: 0 auto;
    filter:
        drop-shadow(0 0 40px rgba(182, 115, 0, 0.15))
        drop-shadow(0 0 80px rgba(182, 115, 0, 0.08));
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 1px;
    margin-bottom: 2rem;
}

.hero-desc {
    margin: 0 auto;
}

.hero-desc .text-ar {
    font-size: 1.2rem;
    color: var(--color-text);
    margin-bottom: 0.75rem;
    line-height: 1.8;
}

.hero-desc .text-en {
    font-size: 1rem;
    color: var(--color-text-dim);
    line-height: 1.7;
}

/* Scroll indicator */
.hero-scroll {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 2;
}

.hero-scroll-line {
    width: 1px;
    height: 48px;
    background: linear-gradient(to bottom, var(--color-gold), transparent);
    animation: scrollPulse 2.5s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; transform: scaleY(0.5); }
    50%      { opacity: 0.8; transform: scaleY(1); }
}

.hero-scroll span {
    font-size: 0.65rem;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--color-gold-dim);
}

/* ── Sections (shared) ── */
.section {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8rem 2rem 6rem;
    z-index: 1;
    scroll-margin-top: 70px;
}

/* Cinematic full-screen sections (text-only, short content) */
#story,
#about {
    min-height: 100vh;
    align-items: center;
}

/* Content sections - natural height with comfortable spacing */
#vision,
#successes,
#services,
#team,
#contact,
#social {
    min-height: auto;
    padding-top: 7rem;
    padding-bottom: 5rem;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--color-gold-dim), transparent);
    opacity: 0.4;
}

.section:nth-child(even) {
    background: linear-gradient(180deg, transparent, rgba(6, 6, 18, 0.5) 30%, rgba(6, 6, 18, 0.5) 70%, transparent);
}

.section-inner {
    max-width: 1100px;
    width: 100%;
    position: relative;
}

/* Section Numbers */
.section-num {
    position: absolute;
    top: -1rem;
    left: 0;
    font-size: clamp(4rem, 8vw, 7rem);
    font-weight: 800;
    color: rgba(182, 115, 0, 0.03);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

/* Section Titles */
.section-title {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title .text-ar {
    display: block;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 0.5rem;
}

.section-title .text-en {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-dim);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Section Divider (within content) */
.section-divider {
    width: 60px;
    height: 1px;
    background: var(--color-gold-dim);
    margin: 2.5rem auto;
    opacity: 0.5;
}

/* ── Cards (shared) ── */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.5s var(--ease-out);
}

.card:hover {
    border-color: rgba(182, 115, 0, 0.25);
    background: rgba(182, 115, 0, 0.04);
    transform: translateY(-4px);
    box-shadow:
        0 24px 60px -15px rgba(0, 0, 0, 0.5),
        0 0 40px -10px var(--color-glow);
}

/* ── Section Visibility ── */
.section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ── Reveal Animations ── */
[data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 0.9s var(--ease-out),
        transform 0.9s var(--ease-out);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ── Story Section ── */
#story {
    text-align: center;
}

#story .section-body {
    max-width: 900px;
    margin: 0 auto;
}

.story-quote {
    font-size: clamp(1.8rem, 4.5vw, 3.2rem);
    font-weight: 700;
    line-height: 1.6;
    color: var(--color-gold);
    margin-bottom: 2rem;
}

.story-quote-en {
    font-size: clamp(1rem, 2vw, 1.4rem);
    line-height: 1.8;
    color: var(--color-text-dim);
    font-weight: 400;
    font-style: italic;
    max-width: 750px;
    margin: 0 auto;
}

/* ── About Section ── */
#about {
    text-align: center;
}

#about .section-body {
    max-width: 850px;
    margin: 0 auto;
}

.section-heading-ar {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    font-weight: 700;
    color: var(--color-gold);
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.body-ar {
    font-size: 1.15rem;
    color: var(--color-text);
    line-height: 1.9;
}

.section-heading-en {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.body-en {
    font-size: 1rem;
    color: var(--color-text-dim);
    line-height: 1.8;
}

/* ── Vision & Mission ── */
.vm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.vm-card {
    text-align: center;
    padding: 3rem 2rem;
}

.vm-icon-wrap {
    margin-bottom: 1.5rem;
}

.vm-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: brightness(1.3);
    margin: 0 auto;
}

.vm-card h3 {
    margin-bottom: 1.5rem;
}

.vm-card h3 .text-ar {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 0.25rem;
}

.vm-card h3 .text-en {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-dim);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 500;
}

.vm-card .text-ar:not(h3 .text-ar) {
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 0.75rem;
}

.vm-card .text-en:not(h3 .text-en) {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    line-height: 1.7;
}

/* ── Successes ── */
.successes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.success-card {
    text-align: right;
}

/* Parallax Image Container */
.parallax-img {
    position: relative;
    width: 100%;
    height: 220px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1.25rem;
    background: #000000;
}

.parallax-back {
    position: absolute;
    inset: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    object-fit: cover;
    transition: transform 0.3s var(--ease-out);
}

.parallax-front {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 70%;
    max-height: 100%;
    width: auto;
    object-fit: contain;
    z-index: 1;
    will-change: transform;
}

.parallax-img::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, #000000, transparent);
    z-index: 0;
    pointer-events: none;
}

.parallax-img--left .parallax-front {
    left: 5%;
    transform: translateX(0);
}

.parallax-img--single .parallax-back {
    inset: 0;
    width: 100%;
    height: 100%;
}

.success-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 0.75rem;
}

.success-card p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text-dim);
}

/* ── Services ── */
.services-intro,
.services-outro {
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
}

.services-intro {
    margin-bottom: 3.5rem;
}

.services-intro .body-ar {
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--color-text);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3.5rem;
}

.service-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.service-icon {
    width: 64px;
    height: 64px;
    background: rgba(182, 115, 0, 0.06);
    border: 1px solid rgba(182, 115, 0, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: all 0.4s var(--ease-out);
}

.service-icon i {
    width: 24px;
    height: 24px;
    stroke: var(--color-gold);
    stroke-width: 1.5;
}

.service-card:hover .service-icon {
    background: rgba(182, 115, 0, 0.12);
    border-color: rgba(182, 115, 0, 0.3);
    transform: scale(1.08);
}

.service-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 0.75rem;
}

.service-card p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--color-text-dim);
}

.services-outro {
    margin-top: 0;
}

.services-outro .body-ar {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--color-text-dim);
    font-style: italic;
}

/* ── Team ── */
.team-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.team-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.team-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-night), var(--color-deep));
    border-radius: 50%;
    margin: 0 auto 1.25rem;
    border: 2px solid rgba(182, 115, 0, 0.2);
    transition: border-color 0.4s;
}

.team-card:hover .team-avatar {
    border-color: var(--color-gold);
}

.team-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 0.4rem;
}

.team-role {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    line-height: 1.5;
}

/* ── Contact ── */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.contact-card {
    text-align: center;
    padding: 2.5rem 2rem;
}

.contact-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 0.3rem;
}

.contact-role {
    font-size: 0.9rem;
    color: var(--color-text-dim);
    margin-bottom: 1.25rem;
}

.contact-email {
    display: inline-block;
    font-size: 0.95rem;
    color: var(--color-text);
    padding: 0.6rem 1.5rem;
    border: 1px solid rgba(182, 115, 0, 0.2);
    border-radius: 8px;
    transition: all 0.3s var(--ease-out);
    letter-spacing: 0.5px;
}

.contact-email:hover {
    background: var(--color-gold);
    color: var(--color-void);
    border-color: var(--color-gold);
}

/* ── Social ── */
.social-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.social-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 2.5rem;
    min-width: 130px;
}

.social-icon-wrap {
    width: 52px;
    height: 52px;
    background: rgba(182, 115, 0, 0.06);
    border: 1px solid rgba(182, 115, 0, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s var(--ease-out);
}

.social-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(1.2);
    transition: filter 0.3s;
}

.social-card:hover .social-icon-wrap {
    background: var(--color-gold);
    border-color: var(--color-gold);
    transform: scale(1.08);
}

.social-card:hover .social-icon-img {
    filter: brightness(0);
}

.social-card span {
    font-size: 0.85rem;
    color: var(--color-text-dim);
}

/* ── End Mark ── */
.end-mark {
    text-align: center;
    padding: 4rem 0 3rem;
    font-size: 1.5rem;
    color: var(--color-gold);
    opacity: 0.2;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-void);
}

::-webkit-scrollbar-thumb {
    background: var(--color-gold-dim);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-gold);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: rgba(3, 1, 8, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        gap: 0.25rem;
        transition: right 0.4s var(--ease-out);
        border-left: 1px solid var(--color-border);
    }

    .nav-links.open {
        right: 0;
    }

    .nav-link {
        font-size: 1.05rem;
        padding: 0.75rem 1rem;
    }

    .nav-toggle {
        display: flex;
    }

    .vm-grid {
        grid-template-columns: 1fr;
    }

    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .successes-grid {
        grid-template-columns: 1fr;
    }

    .social-grid {
        flex-direction: column;
        align-items: center;
    }

    .section {
        min-height: auto;
        padding: 5rem 1.5rem;
    }

    .hero-logo-img {
        width: 200px;
        height: 200px;
    }

    .section-num {
        font-size: 3.5rem;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .hero-logo-img {
        width: 160px;
        height: 160px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .section {
        padding: 4rem 1rem;
    }

    .section-title {
        margin-bottom: 2.5rem;
    }

    .card {
        padding: 1.5rem;
    }

    .team-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .nav-brand-img {
        width: 30px;
        height: 30px;
    }
}
