/* ========================================
   RIFFICS - Game Development Studio
   Red / Black / White Theme
   ======================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #161616;
    --bg-card: rgba(22, 22, 22, 0.8);
    --text-primary: #f0f0f0;
    --text-secondary: #999999;
    --accent-red: #c1272d;
    --accent-red-light: #e63946;
    --accent-red-dark: #8b1a1f;
    --accent-charcoal: #3d3d3d;
    --glow-red: 0 0 20px rgba(193, 39, 45, 0.5), 0 0 40px rgba(193, 39, 45, 0.2);
    --glow-red-strong: 0 0 30px rgba(193, 39, 45, 0.6), 0 0 60px rgba(193, 39, 45, 0.3);
    --font-heading: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-arabic: 'Cairo', sans-serif;
    --nav-height: 70px;
    --transition-speed: 0.3s;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Arabic font override */
html[lang="ar"] body {
    font-family: var(--font-arabic);
}

html[lang="ar"] .logo-text,
html[lang="ar"] .hero-logo-text,
html[lang="ar"] .section-title {
    font-family: var(--font-heading);
}

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

ul {
    list-style: none;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- Particle Canvas --- */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ========================================
   NAVIGATION
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 1000;
    transition: background-color var(--transition-speed), box-shadow var(--transition-speed);
    background-color: transparent;
}

.navbar.scrolled {
    background-color: rgba(13, 13, 13, 0.95);
    box-shadow: 0 2px 30px rgba(193, 39, 45, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
}

.nav-logo-img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 3px;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-secondary);
    position: relative;
    padding: 8px 0;
    transition: color var(--transition-speed);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-red);
    box-shadow: var(--glow-red);
    transition: width var(--transition-speed);
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-red-light);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* --- Language Toggle --- */
.lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.lang-label {
    font-family: var(--font-heading);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-secondary);
    transition: color var(--transition-speed), text-shadow var(--transition-speed);
}

.lang-label.active {
    color: var(--accent-red-light);
    text-shadow: 0 0 10px rgba(193, 39, 45, 0.5);
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: rgba(193, 39, 45, 0.15);
    border: 2px solid var(--accent-red);
    border-radius: 12px;
    position: relative;
    transition: all var(--transition-speed);
    box-shadow: 0 0 10px rgba(193, 39, 45, 0.15);
}

.toggle-switch:hover {
    box-shadow: var(--glow-red);
}

.toggle-knob {
    width: 16px;
    height: 16px;
    background: var(--accent-red-light);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform var(--transition-speed);
    box-shadow: 0 0 8px rgba(193, 39, 45, 0.6);
}

.lang-toggle.ar .toggle-knob {
    transform: translateX(20px);
}

.lang-toggle.ar .lang-ar {
    color: var(--accent-red-light);
    text-shadow: 0 0 10px rgba(193, 39, 45, 0.5);
}

.lang-toggle.ar .lang-en {
    color: var(--text-secondary);
    text-shadow: none;
}

/* --- Hamburger Menu --- */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 1001;
}

.hamburger .bar {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-speed);
}

.hamburger.active .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: var(--accent-red-light);
}

.hamburger.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger.active .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: var(--accent-red-light);
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 1;
    padding: 0 24px;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-logo-wrapper {
    margin-bottom: 24px;
    animation: float 4s ease-in-out infinite;
}

.hero-logo-img {
    max-width: 220px;
    width: 100%;
    margin: 0 auto;
    filter: drop-shadow(0 0 30px rgba(193, 39, 45, 0.3));
    animation: logoGlow 3s ease-in-out infinite alternate;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 900;
    letter-spacing: 10px;
    color: #ffffff;
    margin-bottom: 8px;
    text-shadow: 0 0 40px rgba(193, 39, 45, 0.3);
}

.hero-tagline {
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    color: var(--text-secondary);
    margin-bottom: 40px;
    letter-spacing: 3px;
    font-weight: 300;
    text-transform: uppercase;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 14px 40px;
    border-radius: 50px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    transition: all var(--transition-speed);
    position: relative;
}

html[lang="ar"] .btn {
    font-family: var(--font-arabic);
    letter-spacing: 0;
}

.btn-primary {
    background: var(--accent-red);
    color: #ffffff;
}

.btn-glow {
    box-shadow: 0 0 20px rgba(193, 39, 45, 0.3), 0 0 40px rgba(193, 39, 45, 0.15);
}

.btn-glow:hover {
    background: var(--accent-red-light);
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--glow-red-strong), 0 5px 20px rgba(0, 0, 0, 0.4);
}

.btn-glow:active {
    transform: translateY(-1px) scale(1.02);
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    border-right: 2px solid var(--accent-red);
    border-bottom: 2px solid var(--accent-red);
    transform: rotate(45deg);
    animation: scrollBounce 2s ease-in-out infinite;
    opacity: 0.6;
}

/* ========================================
   SECTIONS (shared)
   ======================================== */
.section {
    position: relative;
    z-index: 1;
    padding: 100px 0;
}

.section-title {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-title-line {
    width: 80px;
    height: 3px;
    background: var(--accent-red);
    margin: 0 auto 40px;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(193, 39, 45, 0.4);
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto 50px;
}

/* ========================================
   ABOUT SECTION
   ======================================== */
.about {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
}

.about-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto 60px;
    line-height: 1.8;
}

/* --- Feature Cards --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 60px;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid rgba(193, 39, 45, 0.15);
    border-radius: 16px;
    padding: 40px 30px;
    text-align: center;
    transition: all var(--transition-speed);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-red), transparent);
    opacity: 0;
    transition: opacity var(--transition-speed);
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: rgba(193, 39, 45, 0.4);
    box-shadow: 0 10px 40px rgba(193, 39, 45, 0.1), 0 0 20px rgba(193, 39, 45, 0.05);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    color: var(--accent-red);
    filter: drop-shadow(0 0 8px rgba(193, 39, 45, 0.3));
}

.feature-icon svg {
    width: 100%;
    height: 100%;
}

.feature-card h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* --- Stats Row --- */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 60px;
    padding: 40px 0;
    border-top: 1px solid rgba(193, 39, 45, 0.15);
    border-bottom: 1px solid rgba(193, 39, 45, 0.15);
}

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

.stat-number {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent-red-light);
    display: block;
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(193, 39, 45, 0.3);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
    display: block;
}

/* ========================================
   GAMES SECTION
   ======================================== */
.games {
    background: var(--bg-primary);
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.game-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-6px);
    border-color: rgba(193, 39, 45, 0.4);
    box-shadow: 0 15px 50px rgba(193, 39, 45, 0.12), 0 0 30px rgba(193, 39, 45, 0.06);
}

.game-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
}

.game-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.game-card:hover .game-thumbnail img {
    transform: scale(1.05);
}

/* Placeholder for game thumbnails */
.game-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary), var(--accent, #2a2a2a));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.game-thumb-placeholder::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent 0%, var(--accent, var(--accent-red-dark)) 10%, transparent 20%);
    animation: rotateBg 8s linear infinite;
    opacity: 0.08;
}

.game-info {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.game-info .store-buttons {
    margin-top: auto;
}

.game-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.game-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* --- Store Buttons --- */
.store-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.store-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all var(--transition-speed);
    flex: 1;
    min-width: 140px;
}

.store-btn:hover {
    background: rgba(193, 39, 45, 0.1);
    border-color: var(--accent-red);
    box-shadow: 0 0 15px rgba(193, 39, 45, 0.15);
    transform: translateY(-2px);
}

.store-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.store-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.store-small {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.store-name {
    font-size: 0.8rem;
    font-weight: 600;
}

/* ========================================
   FOOTER / CONTACT
   ======================================== */
.footer {
    position: relative;
    z-index: 1;
    padding: 80px 0 40px;
    text-align: center;
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.footer-glow-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-red-dark), var(--accent-red), var(--accent-red-dark), transparent);
    box-shadow: 0 0 20px rgba(193, 39, 45, 0.3);
}

.footer-text {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 40px;
    max-width: 500px;
    margin-inline: auto;
}

/* --- Social Links --- */
.social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 40px;
}

.social-link {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(22, 22, 22, 0.5);
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

.social-link:hover {
    color: var(--accent-red-light);
    border-color: var(--accent-red);
    transform: translateY(-4px);
    box-shadow: 0 0 20px rgba(193, 39, 45, 0.3);
}

.footer-bottom {
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* ========================================
   SCROLL REVEAL ANIMATIONS
   ======================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.features-grid .feature-card.reveal:nth-child(2) { transition-delay: 0.15s; }
.features-grid .feature-card.reveal:nth-child(3) { transition-delay: 0.3s; }

.games-grid .game-card.reveal:nth-child(2) { transition-delay: 0.15s; }
.games-grid .game-card.reveal:nth-child(3) { transition-delay: 0.3s; }
.games-grid .game-card.reveal:nth-child(4) { transition-delay: 0.45s; }

/* ========================================
   KEYFRAME ANIMATIONS
   ======================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes logoGlow {
    0% { filter: drop-shadow(0 0 20px rgba(193, 39, 45, 0.2)); }
    100% { filter: drop-shadow(0 0 40px rgba(193, 39, 45, 0.45)); }
}

@keyframes scrollBounce {
    0%, 20%, 50%, 80%, 100% { transform: rotate(45deg) translateY(0); }
    40% { transform: rotate(45deg) translateY(10px); }
    60% { transform: rotate(45deg) translateY(5px); }
}

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

/* ========================================
   RTL SUPPORT
   ======================================== */
html[dir="rtl"] .nav-link::after {
    left: auto;
    right: 0;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet */
@media (max-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .stats-row {
        gap: 40px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --nav-height: 60px;
    }

    /* Mobile Nav */
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(13, 13, 13, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-speed);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .nav-links.open {
        opacity: 1;
        visibility: visible;
    }

    .nav-link {
        font-size: 1.1rem;
    }

    .hamburger {
        display: flex;
    }

    /* Sections */
    .section {
        padding: 70px 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .stats-row {
        flex-direction: column;
        gap: 30px;
        align-items: center;
    }

    .stat-number {
        font-size: 2rem;
    }

    .hero-tagline {
        font-size: 1rem;
        padding: 0 20px;
    }

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

    .hero-title {
        letter-spacing: 5px;
    }

    .about-text {
        font-size: 1rem;
    }

    .store-buttons {
        flex-direction: column;
    }

    .store-btn {
        justify-content: center;
    }

    .social-links {
        gap: 14px;
    }

    .social-link {
        width: 42px;
        height: 42px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    .section-title {
        font-size: 1.5rem;
    }

    .btn {
        padding: 12px 30px;
        font-size: 0.75rem;
    }

    .hero-logo-img {
        max-width: 140px;
    }

    .hero-title {
        letter-spacing: 4px;
    }
}
