:root {
    --brand-blue: #004e7a;
    --brand-dark: #001a29;
    --brand-deeper: #000d15;
    --text-gold: #e2d1c3;
    --text-light: #d7e5ef;
    --text-muted: #8faec2;
    --border-soft: rgba(255,255,255,0.08);
    --border-strong: rgba(226,209,195,0.3);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background-color: var(--brand-dark);
    background-image: radial-gradient(circle at center, #003049 0%, #00121c 100%);
    color: white;
    font-family: 'Noto Serif Display', serif;
    overflow-x: hidden;
    position: relative;
}

body.rtl {
    direction: rtl;
    font-family: 'Tajawal', sans-serif;
}

/* BACKGROUND EFFECT */
#gravityGrid {
    position: fixed;
    inset: 0;
    z-index: -3;
    pointer-events: none;
}

.tech-circuit {
    position: fixed;
    width: 360px;
    height: 360px;
    z-index: -2;
    pointer-events: none;
    opacity: 0.35;
}

.top-left {
    top: 0;
    left: 0;
    border-right: 1px solid rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 36px 36px;
}

.bottom-right {
    right: 0;
    bottom: 0;
    border-left: 1px solid rgba(255,255,255,0.04);
    border-top: 1px solid rgba(255,255,255,0.04);
    background-image:
        linear-gradient(to left, rgba(255,255,255,0.05) 1px, transparent 1px),
        linear-gradient(to top, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 36px 36px;
}

/* HEADER */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(0, 15, 25, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
}

.premium-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(226,209,195,0.18) 20%,
        rgba(226,209,195,0.28) 50%,
        rgba(226,209,195,0.18) 80%,
        transparent 100%
    );
    pointer-events: none;
}

.header-inner {
    max-width: 1240px;
    margin: auto;
    padding: 15px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
    position: relative;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.header-brand-wrap:hover {
    color: white;
}

.header-brand-mark {
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 1rem;
    color: #fff;
    padding-right: 12px;
    border-right: 1px solid rgba(255,255,255,0.12);
}

.header-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.header-brand-name {
    font-size: 0.96rem;
    font-weight: 600;
    color: #fff;
}

.header-brand-role {
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    position: relative;
    padding-bottom: 2px;
}

.main-nav a:hover,
.main-nav a.active-link {
    color: var(--text-gold);
}

.main-nav a.active-link::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 1px;
    background: var(--text-gold);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-self: end;
}

.lang-switch {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    user-select: none;
}

.lang-switch span:hover,
.lang-switch span.active {
    color: var(--text-gold);
    font-weight: 700;
}

/* MAIN */
.page-shell {
    max-width: 1200px;
    margin: auto;
    padding: 48px 20px 70px;
}

/* HERO */
.hero {
    text-align: center;
    margin-bottom: 52px;
}

.hero h1 {
    font-size: 3rem;
    margin: 0;
    line-height: 1.15;
    text-transform: uppercase;
}

.hero .subtitle {
    margin-top: 14px;
    color: var(--text-gold);
    letter-spacing: 5px;
    text-transform: uppercase;
    font-size: 1rem;
}

.hero .skills-line {
    margin-top: 14px;
    font-size: 0.95rem;
    color: var(--text-light);
    opacity: 0.92;
}

.hero .intro {
    max-width: 760px;
    margin: 22px auto 0 auto;
    line-height: 1.9;
    color: var(--text-muted);
    font-size: 1rem;
}

/* SECTION TITLE */
.section-title {
    text-align: center;
    margin-bottom: 26px;
}

.section-title h2 {
    margin: 0;
    font-size: 1.95rem;
}

.section-title p {
    max-width: 780px;
    margin: 12px auto 0 auto;
    color: var(--text-muted);
    line-height: 1.8;
}

/* PORTAL GRID */
.portal-grid,
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 30px;
}

/* FLIP CARDS */
.flip-card {
    background-color: transparent;
    width: 100%;
    height: 270px;
    perspective: 1100px;
    cursor: pointer;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.85s;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    inset: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 24px;
}

.flip-card-front {
    background: rgba(0, 30, 50, 0.58);
    border: 1px solid var(--border-soft);
    backdrop-filter: blur(6px);
}

.flip-card-front h3 {
    margin: 0 0 10px 0;
    font-size: 1.6rem;
    color: #fff;
}

.flip-card-front span {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.click-indicator {
    position: absolute;
    bottom: 14px;
    right: 16px;
    color: var(--text-gold);
    font-size: 1.15rem;
    opacity: 0.7;
    animation: pulseArrow 2s infinite;
}

@keyframes pulseArrow {
    0% { transform: scale(1); opacity: 0.45; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 0.45; }
}

.flip-card-back {
    transform: rotateY(180deg);
    background: linear-gradient(180deg, rgba(0,18,28,0.98), rgba(0,10,18,0.98));
    border: 1px solid var(--border-strong);
}

.flip-card-back p {
    font-size: 0.95rem;
    color: var(--text-gold);
    line-height: 1.65;
    margin: 0 0 20px 0;
}

.discover-btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--text-gold);
    color: var(--brand-dark);
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 1px;
    font-weight: 700;
    border-radius: 2px;
}

/* SIMPLE CARDS */
.card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-soft);
    padding: 26px;
    text-align: center;
    transition: all 0.25s ease;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--text-gold);
}

.card h3 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.card span {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card p {
    font-size: 0.97rem;
    color: var(--text-light);
    line-height: 1.75;
}

.card a {
    display: inline-block;
    margin-top: 16px;
    text-decoration: none;
    color: var(--text-gold);
    border: 1px solid var(--text-gold);
    padding: 8px 14px;
}

.card a:hover {
    background: var(--text-gold);
    color: var(--brand-dark);
}

/* FOOTER */
.site-footer {
    margin-top: 70px;
    border-top: 1px solid var(--border-soft);
    padding: 40px 20px;
    text-align: center;
    background: rgba(0,0,0,0.28);
}

.footer-inner {
    max-width: 1100px;
    margin: auto;
}

.footer-title {
    font-size: 0.85rem;
    margin-bottom: 18px;
    color: white;
    letter-spacing: 1px;
}

.footer-nav,
.footer-social {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
}

.footer-nav a,
.footer-social a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-nav a:hover,
.footer-social a:hover {
    color: white;
}

.footer-copy {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* CONTACT MODAL */
.contact-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 10, 20, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.contact-overlay.active {
    display: flex;
}

.modal-content {
    position: relative;
    background: radial-gradient(circle, rgba(0,78,122,0.22) 0%, rgba(0,18,28,0.98) 92%);
    padding: 32px 26px;
    border: 1px solid var(--border-soft);
    text-align: center;
    width: 90%;
    max-width: 420px;
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
}

.contact-item {
    margin-bottom: 22px;
}

.contact-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-gold);
    margin-bottom: 7px;
    letter-spacing: 2px;
}

.contact-value {
    font-size: 1.1rem;
}

.contact-value a {
    color: white;
    text-decoration: none;
}

/* RESPONSIVE */
@media (max-width: 980px) {
    .header-inner {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .header-left,
    .header-actions {
        justify-self: start;
    }

    .main-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .page-shell {
        padding: 36px 16px 60px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero .subtitle {
        letter-spacing: 3px;
        font-size: 0.9rem;
    }

    .hero .skills-line {
        font-size: 0.88rem;
        line-height: 1.7;
    }

    .section-title h2 {
        font-size: 1.55rem;
    }

    .portal-grid,
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .flip-card {
        height: 235px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}