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

/* BODY & TOP BAR */
body {
    font-family: Arial, Helvetica, sans-serif;
    background: #0e0e0e;
    color: #fff;
    line-height: 1.6;
    padding-top: 80px;
    transition: background 0.4s ease, color 0.4s ease;
}

#top-bar {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 80px;
background: #030303;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
padding: 0 2rem;
z-index: 1000;
transition: transform 0.4s ease;
}

.bar-title {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
}

/* DARK MODE BUTTON */
#dark-mode-toggle {
position: absolute;
right: 2rem;
background: transparent;
border: none;
cursor: pointer;
}

#dark-mode-toggle img {
width: 24px;
height: 24px;
}

/* NAVIGATION */
.nav {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem 0;
}

.nav a {
    text-decoration: none;
    color: inherit;
    font-weight: bold;
}

/* HERO & SECTION */
.hero {
    text-align: center;
    padding: 8rem 10%;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border: none;
    background: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #fff;
    color: #000;
}

.section {
    padding: 6rem 10%;
    text-align: center;
}

.section h2 {
    margin-bottom: 2rem;
    border-bottom: 2px solid currentColor;
    display: inline-block;
    padding-bottom: 0.5rem;
}

/* GRID */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.card {
    padding: 2rem;
    background: #222;
    border: 2px solid #fff;
    border-radius: 12px;
}

/* FOOTER */
footer {
    margin-top: 4rem;
    text-align: center;
    padding: 2rem;
    border-top: 2px solid currentColor;
}

/* LIGHT MODE */
body.light-mode {
    background: #F2F2F2;
    color: #1C1C1C;
}

body.light-mode #top-bar {
    background: #000;
    color: #fff;
}

body.light-mode .card {
    background: #fff;
    border-color: #000;
}

/* GALLERY */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.gallery-item {
    overflow: hidden;
    border-radius: 12px;
    border: 2px solid currentColor;
    transition: transform 0.3s ease;
    position: relative;
}

.gallery-item img,
.gallery-item iframe {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
    border-radius: 12px;
}

.gallery-item:hover img,
.gallery-item:hover iframe {
    transform: scale(1.05);
}

.gallery-item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* MOBILE RESPONSIVE */
@media (max-width: 768px) {
    #top-bar {
    flex-direction: column;
    height: auto;
    padding: 1rem;
    }
    .bar-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    #dark-mode-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    }
    body {
        padding-top: 100px; /* the mobile top bar is taller than 80px */
    }
    .nav {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        gap: clamp(0.5rem, 3.2vw, 1.4rem);
        padding: 1rem 0.5rem;
    }
    .nav a {
        font-size: clamp(0.7rem, 3.5vw, 1rem);
        white-space: nowrap;
    }
    .section {
        padding: 4rem 5%;
    }
    .hero h1 {
        font-size: 2rem;
    }
    .hero p {
        font-size: 1rem;
    }
    .btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
    .grid,
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .card,
    .gallery-item {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .bar-title {
        font-size: 1.3rem;
    }
    #dark-mode-toggle img {
    width: 20px;
    height: 20px;
    }
    .section h2 {
        font-size: 1.5rem;
    }
}
.contact-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.contact-links a img {
    width: 40px;
    height: 40px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.contact-links a img:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

/* ============ COSMIC THEME ============ */

/* Animated background canvas (created by cosmic.js) */
#cosmos {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: -1;
    pointer-events: none;
}

/* Make the dark / light toggle easy to see and click on the dark top bar */
#dark-mode-toggle {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    padding: 5px;
    line-height: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#dark-mode-toggle:hover,
#dark-mode-toggle:focus-visible {
    transform: scale(1.1);
    box-shadow: 0 0 14px rgba(150, 120, 255, 0.6);
}

/* Language button (left side of the top bar, mirrors the dark/light button on the right) */
#lang-toggle {
    position: absolute;
    left: 2rem;
    display: block;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    padding: 5px;
    line-height: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#lang-toggle img {
    display: block;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

#lang-toggle:hover,
#lang-toggle:focus-visible {
    transform: scale(1.1);
    box-shadow: 0 0 14px rgba(150, 120, 255, 0.6);
}

@media (max-width: 768px) {
    #lang-toggle {
        top: 1rem;
        left: 1rem;
    }
}

#top-bar {
    background: rgba(3, 3, 3, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Nav: animated underline */
.nav a {
    position: relative;
    padding-bottom: 4px;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #9d7bff, #5fd3ff);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.nav a:hover::after,
.nav a:focus-visible::after {
    transform: scaleX(1);
}

/* Hero: gradient title and glowing button */
.hero h1 {
    background: linear-gradient(90deg, #ffffff, #bba9ff 45%, #7fd6ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.light-mode .hero h1 {
    background: linear-gradient(90deg, #1c1c3a, #5b3fd1 50%, #1d6fb8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.btn:hover {
    box-shadow: 0 0 26px rgba(150, 120, 255, 0.55);
}

/* Cards float over the starfield */
.card {
    background: rgba(20, 18, 40, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(130, 100, 255, 0.3);
}

body.light-mode .card {
    background: rgba(255, 255, 255, 0.78);
}

footer {
    background: rgba(0, 0, 0, 0.25);
}

body.light-mode footer {
    background: rgba(255, 255, 255, 0.45);
}

/* ============ LINKS PAGE ============ */

.links-intro {
    max-width: 640px;
    margin: 0 auto 2.5rem;
    opacity: 0.8;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    text-align: start;
}

.link-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    border: 2px solid currentColor;
    border-radius: 12px;
    background: rgba(20, 18, 40, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body.light-mode .link-card {
    background: rgba(255, 255, 255, 0.78);
}

.link-card:hover,
.link-card:focus-visible {
    transform: translateY(-6px);
    box-shadow: 0 14px 40px rgba(130, 100, 255, 0.35);
}

.link-shot {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1440, #0b1f3a);
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-shot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform 0.4s ease;
}

.link-card:hover .link-shot img {
    transform: scale(1.05);
}

.link-shot .link-initial {
    font-size: 3.5rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
}

.link-info {
    padding: 1rem 1.2rem 1.2rem;
}

.link-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    overflow-wrap: anywhere;
}

.link-host {
    font-size: 0.85rem;
    opacity: 0.65;
    margin-bottom: 0.5rem;
    overflow-wrap: anywhere;
}

.link-desc {
    font-size: 0.95rem;
    opacity: 0.85;
}

.links-empty {
    grid-column: 1 / -1;
    text-align: center;
    opacity: 0.75;
}

/* Cards keep their own height, so a card without a title has no blank strip */
.links-grid {
    align-items: start;
}

/* A links section with no links is simply hidden */
.links-section[hidden] {
    display: none;
}

/* Embedded YouTube videos */
.link-video {
    aspect-ratio: 16 / 9;
    background: #000;
}

.link-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.video-card:hover {
    transform: none;
}

.link-card .link-info:empty {
    display: none;
}

/* Project cards with a header image that link to Steam */
.project-card {
    display: block;
    padding: 0;
    overflow: hidden;
    color: inherit;
    text-decoration: none;
}

.project-card img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform 0.4s ease;
}

.project-card:hover img {
    transform: scale(1.04);
}

.project-title {
    display: block;
    padding: 1rem 1.2rem 1.2rem;
    font-weight: bold;
}

/* Borderless buttons: keep a soft fill so they still read as buttons */
body.light-mode .btn {
    background: rgba(0, 0, 0, 0.08);
}

body.light-mode .btn:hover {
    background: #1c1c1c;
    color: #fff;
}

/* Custom image title in the top bar (transparent PNG on the black bar, centred) */
.bar-title img {
    display: block;
    height: 58px;
    width: auto;
    max-width: min(70vw, 600px);
    object-fit: contain;
}

/* Respect reduced motion for the hover animations too */
@media (prefers-reduced-motion: reduce) {
    .card,
    .link-card,
    .link-shot img,
    .nav a::after {
        transition: none;
    }
}

/* ============ ARABIC (right-to-left) ============ */
html[lang="ar"] body {
    font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", Arial, sans-serif;
    line-height: 1.8;
}

html[lang="ar"] .hero h1 {
    line-height: 1.5;
}

/* Email addresses and other Latin text keep their own direction inside Arabic text */
bdi.ltr {
    unicode-bidi: isolate;
    direction: ltr;
}
