/* ========================================
   KHAYMA INTERACTIVE — Complete Stylesheet
   Replaces Tailwind CDN with static utilities.
   Works offline via file:// protocol.
   ======================================== */

/* ---- Reset / Base (Tailwind Preflight equivalent) ---- */
*, *::before, *::after {
    box-sizing: border-box;
    border-width: 0;
    border-style: solid;
    border-color: currentColor;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    tab-size: 4;
}

body {
    margin: 0;
    line-height: inherit;
}

h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
    font-weight: inherit;
    margin: 0;
}

p {
    margin: 0;
}

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

button {
    font-family: inherit;
    font-size: 100%;
    line-height: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
    background-color: transparent;
    background-image: none;
    cursor: pointer;
}

img, svg {
    display: block;
    vertical-align: middle;
}

svg {
    max-width: 100%;
}

address {
    font-style: normal;
}

blockquote {
    margin: 0;
}

dl, dd, dt {
    margin: 0;
}

/* ---- CSS Custom Properties ---- */
:root {
    --color-night: #0A1929;
    --color-surface: #122240;
    --color-card: #1A3055;
    --color-limestone: #F2ECDC;
    --color-bone: #EADFC7;
    --color-sand: #E8C07D;
    --color-sand-dark: #B88A52;
    --color-ochre: #B5523A;
}

/* ---- Font Families ---- */
.font-amiri { font-family: 'Amiri', serif; }
.font-naskh { font-family: 'Noto Naskh Arabic', serif; }
.font-spectral { font-family: 'Spectral', serif; }
.font-inter { font-family: 'Inter', sans-serif; }

/* ---- Display ---- */
.hidden { display: none; }
.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }

/* ---- Position ---- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }

.top-0 { top: 0; }
.top-6 { top: 1.5rem; }
.left-0 { left: 0; }
.left-6 { left: 1.5rem; }
.right-0 { right: 0; }
.right-6 { right: 1.5rem; }
.bottom-0 { bottom: 0; }
.bottom-4 { bottom: 1rem; }
.bottom-8 { bottom: 2rem; }

/* Percentage positions */
.top-\[20\%\] { top: 20%; }
.top-\[15\%\] { top: 15%; }
.top-\[22\%\] { top: 22%; }
.top-\[18\%\] { top: 18%; }
.left-\[25\%\] { left: 25%; }
.left-\[45\%\] { left: 45%; }
.left-\[65\%\] { left: 65%; }
.left-\[82\%\] { left: 82%; }
.bottom-\[15\%\] { bottom: 15%; }
.bottom-\[22\%\] { bottom: 22%; }
.left-1\/2 { left: 50%; }

/* ---- Z-Index ---- */
.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-\[60\] { z-index: 60; }
.z-\[100\] { z-index: 100; }

/* ---- Flexbox ---- */
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }

/* ---- Grid ---- */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---- Width ---- */
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.min-w-\[140px\] { min-width: 140px; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }

/* ---- Height ---- */
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.h-20 { height: 5rem; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.h-\[40\%\] { height: 40%; }
.h-\[35\%\] { height: 35%; }
.h-\[12\%\] { height: 12%; }

/* ---- Aspect Ratio ---- */
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-\[4\/3\] { aspect-ratio: 4 / 3; }
.aspect-\[21\/9\] { aspect-ratio: 21 / 9; }

/* ---- Margin ---- */
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-20 { margin-bottom: 5rem; }
.mb-24 { margin-bottom: 6rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-6 { margin-top: 1.5rem; }
.my-16 { margin-top: 4rem; margin-bottom: 4rem; }

/* ---- Padding ---- */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.py-28 { padding-top: 7rem; padding-bottom: 7rem; }
.py-32 { padding-top: 8rem; padding-bottom: 8rem; }

/* ---- Transform ---- */
.-translate-x-1\/2 { transform: translateX(-50%); }

/* ---- Overflow ---- */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* ---- Border Radius ---- */
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* ---- Border ---- */
.border { border-width: 1px; }
.border-t { border-top-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-r-2 { border-right-width: 2px; }

/* Border Colors */
.border-sand\/5 { border-color: rgba(232, 192, 125, 0.05); }
.border-sand\/10 { border-color: rgba(232, 192, 125, 0.1); }
.border-sand\/20 { border-color: rgba(232, 192, 125, 0.2); }
.border-sand\/30 { border-color: rgba(232, 192, 125, 0.3); }

/* ---- Background Colors ---- */
.bg-night { background-color: #0A1929; }
.bg-surface { background-color: #122240; }
.bg-card { background-color: #1A3055; }

.bg-night\/80 { background-color: rgba(10, 25, 41, 0.8); }
.bg-night\/90 { background-color: rgba(10, 25, 41, 0.9); }
.bg-night\/95 { background-color: rgba(10, 25, 41, 0.95); }
.bg-surface\/50 { background-color: rgba(18, 34, 64, 0.5); }
.bg-surface\/80 { background-color: rgba(18, 34, 64, 0.8); }
.bg-card\/30 { background-color: rgba(26, 48, 85, 0.3); }
.bg-card\/50 { background-color: rgba(26, 48, 85, 0.5); }
.bg-ochre\/90 { background-color: rgba(181, 82, 58, 0.9); }

/* ---- Text Colors ---- */
.text-limestone { color: #F2ECDC; }
.text-sand { color: #E8C07D; }
.text-sand-dark { color: #B88A52; }
.text-ochre { color: #B5523A; }
.text-night { color: #0A1929; }

.text-bone\/40 { color: rgba(234, 223, 199, 0.4); }
.text-bone\/50 { color: rgba(234, 223, 199, 0.5); }
.text-bone\/60 { color: rgba(234, 223, 199, 0.6); }
.text-bone\/70 { color: rgba(234, 223, 199, 0.7); }
.text-bone\/80 { color: rgba(234, 223, 199, 0.8); }
.text-bone\/90 { color: rgba(234, 223, 199, 0.9); }
.text-sand\/40 { color: rgba(232, 192, 125, 0.4); }
.text-sand\/60 { color: rgba(232, 192, 125, 0.6); }

/* ---- Typography ---- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }

.font-medium { font-weight: 500; }
.italic { font-style: italic; }
.not-italic { font-style: normal; }

.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }
.tracking-wide { letter-spacing: 0.025em; }

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

/* ---- Opacity ---- */
.opacity-0 { opacity: 0; }
.opacity-60 { opacity: 0.6; }

/* ---- Pointer Events ---- */
.pointer-events-none { pointer-events: none; }

/* ---- Cursor ---- */
.cursor-pointer { cursor: pointer; }

/* ---- Will Change ---- */
.will-change-transform { will-change: transform; }

/* ---- Backdrop Blur ---- */
.backdrop-blur-sm { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.backdrop-blur-md { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }

/* ---- Transitions ---- */
.transition-colors {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

.duration-300 { transition-duration: 300ms; }

/* ---- Hover States ---- */
.hover\:bg-card:hover { background-color: #1A3055; }
.hover\:text-sand:hover { color: #E8C07D; }
.hover\:text-sand-dark:hover { color: #B88A52; }

/* ---- Space Between Children ---- */
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* ---- Animation ---- */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---- Responsive: sm (640px) ---- */
@media (min-width: 640px) {
    .sm\:flex-row { flex-direction: row; }
    .sm\:gap-4 { gap: 1rem; }
}

/* ---- Responsive: md (768px) ---- */
@media (min-width: 768px) {
    .md\:text-base { font-size: 1rem; line-height: 1.5rem; }
    .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
    .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
    .md\:text-5xl { font-size: 3rem; line-height: 1; }
    .md\:text-6xl { font-size: 3.75rem; line-height: 1; }
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:py-28 { padding-top: 7rem; padding-bottom: 7rem; }
}

/* ========================================
   CUSTOM COMPONENTS & ANIMATIONS
   ======================================== */

/* ---- Nav Stars ---- */
.nav-star {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.75rem;
    transition: transform 0.3s ease;
}

.nav-star:hover {
    transform: scale(1.3);
}

.nav-star:focus-visible {
    outline: 2px solid #E8C07D;
    outline-offset: 4px;
    border-radius: 50%;
}

.star-core {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 0%, #E8C07D 40%, #B88A52 100%);
    box-shadow:
        0 0 8px 3px rgba(232, 192, 125, 0.8),
        0 0 24px 8px rgba(232, 192, 125, 0.5),
        0 0 48px 16px rgba(232, 192, 125, 0.2),
        0 0 80px 24px rgba(232, 192, 125, 0.08);
    animation: star-pulse 2.5s ease-in-out infinite;
}

.star-label {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
    font-size: 0.8rem;
    color: #E8C07D;
    text-shadow: 0 0 8px rgba(232, 192, 125, 0.5);
}

.nav-star:hover .star-label,
.nav-star:focus .star-label {
    opacity: 1;
    transform: translateY(0);
}

@keyframes star-pulse {
    0%, 100% {
        box-shadow:
            0 0 8px 3px rgba(232, 192, 125, 0.8),
            0 0 24px 8px rgba(232, 192, 125, 0.5),
            0 0 48px 16px rgba(232, 192, 125, 0.2),
            0 0 80px 24px rgba(232, 192, 125, 0.08);
        transform: scale(1);
    }
    50% {
        box-shadow:
            0 0 12px 6px rgba(232, 192, 125, 1),
            0 0 36px 12px rgba(232, 192, 125, 0.6),
            0 0 72px 24px rgba(232, 192, 125, 0.25),
            0 0 100px 32px rgba(232, 192, 125, 0.1);
        transform: scale(1.25);
    }
}

/* ---- Fire Glow ---- */
.fire-glow {
    animation: fire-flicker 2s ease-in-out infinite alternate;
}

@keyframes fire-flicker {
    0% { opacity: 0.8; transform: scaleY(1); }
    25% { opacity: 1; transform: scaleY(1.05); }
    50% { opacity: 0.9; transform: scaleY(0.95); }
    75% { opacity: 1; transform: scaleY(1.02); }
    100% { opacity: 0.85; transform: scaleY(0.98); }
}

/* ---- Tagline Glow ---- */
.tagline-glow {
    text-shadow:
        0 0 20px rgba(232, 192, 125, 0.15),
        0 0 40px rgba(232, 192, 125, 0.05);
}

/* ---- Section Overlays ---- */
.section-overlay {
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
}

.section-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.section-overlay.entering {
    display: flex !important;
    opacity: 0;
    pointer-events: none;
}

.section-overlay.active {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
    overflow-y: auto;
}

/* ---- Sadu Pattern Divider ---- */
.sadu-divider {
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #B88A52 0px,
        #B88A52 8px,
        transparent 8px,
        transparent 12px,
        #E8C07D 12px,
        #E8C07D 16px,
        transparent 16px,
        transparent 20px,
        #B5523A 20px,
        #B5523A 28px,
        transparent 28px,
        transparent 32px
    );
    opacity: 0.6;
    border-radius: 2px;
}

/* ---- Horizontal Scroll Canvas ---- */
.canvas-scroll {
    transition: transform 0.1s linear;
}

/* ---- Stars Field Parallax ---- */
.stars-field {
    transition: transform 0.15s linear;
}

/* ---- Scroll Animations ---- */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Close Button ---- */
.close-overlay {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.close-overlay:hover {
    transform: scale(1.1);
}

.close-overlay:active {
    transform: scale(0.95);
}

/* ---- Custom Scrollbar (overlays) ---- */
.section-overlay ::-webkit-scrollbar {
    width: 6px;
}

.section-overlay ::-webkit-scrollbar-track {
    background: transparent;
}

.section-overlay ::-webkit-scrollbar-thumb {
    background: rgba(232, 192, 125, 0.2);
    border-radius: 3px;
}

.section-overlay ::-webkit-scrollbar-thumb:hover {
    background: rgba(232, 192, 125, 0.4);
}

/* ---- Star Hint (fade out after 3s) ---- */
.star-hint {
    opacity: 1;
    animation: hint-fade 4s ease forwards;
}

@keyframes hint-fade {
    0%, 60% { opacity: 1; }
    100% { opacity: 0; }
}

/* ---- Bottom Nav Bar ---- */
.bottom-nav {
    background: rgba(10, 25, 41, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(232, 192, 125, 0.15);
    padding: 0.75rem 1.5rem;
}

.bottom-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: rgba(234, 223, 199, 0.8);
}

.bottom-nav-btn:hover {
    background-color: rgba(232, 192, 125, 0.12);
    color: #E8C07D;
}

.bottom-nav-btn:active {
    background-color: rgba(232, 192, 125, 0.2);
}

/* ---- Bottom percentage position for star hint ---- */
.bottom-\[16\%\] { bottom: 16%; }

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .star-core {
        animation: none;
    }

    .fire-glow {
        animation: none;
    }

    .canvas-scroll {
        transition: none;
    }

    .section-overlay {
        transition: none;
    }

    .fade-in-up {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .star-label {
        opacity: 1;
        transform: none;
    }

    .animate-pulse {
        animation: none;
    }
}

/* ---- Mobile Touch Feedback ---- */
@media (hover: none) {
    .star-label {
        opacity: 1;
        transform: translateY(0);
    }

    .nav-star:active {
        transform: scale(0.9);
    }
}

/* ---- RTL direction support ---- */
[dir="rtl"] .sadu-divider {
    background-direction: rtl;
}

/* Smooth body overflow transition for overlay open/close */
body.overlay-open {
    overflow: hidden;
}

/* Language mode: when English is active, set text direction on overlay content */
body.lang-en .section-overlay .max-w-4xl,
body.lang-en .section-overlay .max-w-5xl,
body.lang-en .section-overlay .max-w-3xl,
body.lang-en #reduced-motion-layout {
    direction: ltr;
    text-align: left;
}
body.lang-en .font-amiri,
body.lang-en .font-naskh {
    font-family: "Spectral", "Inter", serif;
}


/* Mouse parallax layers */
.parallax-layer {
    transition: transform 0.3s ease-out;
    will-change: transform;
}

/* ---- Loader — Pulsing Star ---- */
#site-loader {
    will-change: opacity;
}

.khayma-loader-star {
    animation: khayma-star-pulse 1.8s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(232, 192, 125, 0.5));
}

@keyframes khayma-star-pulse {
    0%, 100% {
        transform: scale(0.8);
        filter: drop-shadow(0 0 12px rgba(232, 192, 125, 0.3));
    }
    50% {
        transform: scale(1.2);
        filter: drop-shadow(0 0 28px rgba(232, 192, 125, 0.7));
    }
}

#khayma-loader-dots .loader-dot {
    transition: background 0.3s ease;
}

@keyframes khayma-dot-seq {
    0%, 100% { background: rgba(232, 192, 125, 0.2); }
    50% { background: #E8C07D; }
}

#khayma-loader-dots .loader-dot:nth-child(1) { animation: khayma-dot-seq 1.6s ease-in-out 0s infinite; }
#khayma-loader-dots .loader-dot:nth-child(2) { animation: khayma-dot-seq 1.6s ease-in-out 0.2s infinite; }
#khayma-loader-dots .loader-dot:nth-child(3) { animation: khayma-dot-seq 1.6s ease-in-out 0.4s infinite; }
#khayma-loader-dots .loader-dot:nth-child(4) { animation: khayma-dot-seq 1.6s ease-in-out 0.6s infinite; }

