/* =========================================================
   Kareem Said — Portfolio
   base.css : design tokens + shared shell (navbar, buttons,
   section headers, works gallery, video modal, footer)
   Shared by index.html and portfolio.html
   ========================================================= */

/* --- Fonts (Thmanyah) --- */
@font-face {
    font-family: 'Thmanyah';
    src: url('https://kareemsaid74.github.io/fonts/thmanyahseriftext-Medium.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('https://kareemsaid74.github.io/fonts/thmanyahserifdisplay-Bold.woff2') format('woff2'),
         url('https://kareemsaid74.github.io/fonts/thmanyahserifdisplay-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* --- Design tokens --- */
:root {
    --primary-color: #0A5CFF;
    --primary-hover: #084BCE;
    --primary-glow: rgba(10, 92, 255, 0.4);
    --bg-color: #030303;
    --surface-color: rgba(20, 20, 22, 0.7);
    --surface-solid: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #FFFFFF;
    --text-muted: #A1A1AA;

    --radius-card: 24px;
    --radius-lg: 28px;
    --transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Thmanyah', sans-serif;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
    line-height: 1.6;
}

img { max-width: 100%; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 10px; }

/* --- Ambient glow --- */
.bg-glow {
    position: absolute;
    width: 100%;
    max-width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.3;
    pointer-events: none;
}

/* --- Navbar --- */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 8%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: transparent;
    transition: var(--transition);
}

.navbar.scrolled {
    padding: 1rem 8%;
    background: rgba(3, 3, 3, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Portfolio page keeps the navbar permanently solid */
.navbar--solid {
    background: rgba(3, 3, 3, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.2rem 8%;
}

.logo {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: var(--text-main);
}
.logo span { color: var(--primary-color); }

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.05rem;
    transition: var(--transition);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
    box-shadow: 0 0 10px var(--primary-color);
}

.nav-links a:hover { color: var(--text-main); }
.nav-links a:hover::after { width: 100%; }

.nav-back {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}
.nav-back:hover { color: var(--primary-color); }

.menu-icon {
    display: none;
    font-size: 1.8rem;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

/* --- Buttons --- */
.btn {
    padding: 14px 40px;
    border-radius: 100px;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 10px 30px rgba(10, 92, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(10, 92, 255, 0.4);
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    background: rgba(10, 92, 255, 0.05);
    transform: translateY(-3px);
}

/* --- Sections + headers --- */
section { padding: 120px 8%; position: relative; }

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-badge {
    display: inline-block;
    padding: 8px 22px;
    border-radius: 50px;
    background: rgba(10, 92, 255, 0.12);
    border: 1px solid rgba(10, 92, 255, 0.28);
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.section-tag {
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: block;
}

.section-title {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-main);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 620px;
    margin: 1rem auto 0;
}

/* =========================================================
   Works gallery — shared "شاهد أعمالي" card grid
   (home featured works + portfolio video cards)
   ========================================================= */
.works-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.work-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(22, 22, 26, 0.95), rgba(10, 10, 12, 0.95));
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
}

.work-card:hover {
    transform: translateY(-8px);
    border-color: rgba(10, 92, 255, 0.5);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.55), 0 0 30px rgba(10, 92, 255, 0.15);
}

/* 16:9 clickable media area */
.work-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    padding: 0;
    border: none;
    background: #000;
    cursor: pointer;
    overflow: hidden;
}

.work-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.work-card:hover .work-media img { transform: scale(1.05); }

.work-media-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    transition: var(--transition);
}
.work-card:hover .work-media-overlay { background: rgba(0, 0, 0, 0.5); }

.work-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 2px solid rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    transition: var(--transition);
}

.work-card:hover .work-play {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 0 30px var(--primary-glow);
}

.work-play i { margin-left: 4px; } /* optical centering of play glyph */

.work-body {
    padding: 1.75rem 1.75rem 2rem;
    text-align: right;
}

.work-tag {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
}

.work-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.6rem;
    line-height: 1.4;
}

.work-desc {
    color: var(--text-muted);
    font-size: 1.02rem;
    line-height: 1.7;
}

/* =========================================================
   Video modal (shared player) — adapts to MP4 / embed / portrait
   ========================================================= */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.open { display: flex; }

/* Shell shrink-wraps the media so nothing is letterboxed. */
.modal-shell {
    position: relative;
    display: flex;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: #000;
    max-width: 92vw;
    max-height: 85vh;
}

.modal-media { display: flex; }

/* MP4: the video sizes to its own aspect ratio (landscape or portrait). */
.modal-media video {
    display: block;
    width: auto;
    height: auto;
    max-width: 92vw;
    max-height: 85vh;
}
.modal-shell--portrait .modal-media video { max-width: min(420px, 90vw); }

/* YouTube / Vimeo: force a clean 16:9 frame. */
.modal-shell--embed { width: min(960px, 92vw); }
.modal-shell--embed .modal-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 85vh;
}
.modal-media iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}
.modal-close:hover { background: var(--primary-color); border-color: var(--primary-color); }

/* --- Footer --- */
.site-footer {
    background: #020202;
    border-top: 1px solid var(--border-color);
    padding: 80px 8% 30px;
    position: relative;
    overflow: hidden;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-brand p {
    color: var(--text-muted);
    margin-top: 1.5rem;
    max-width: 400px;
    line-height: 1.8;
}

.footer-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    position: relative;
}

.footer-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 5px;
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 1rem; }

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary-color);
    transform: translateX(-5px);
}

.footer-contact-info p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.footer-contact-info i { color: var(--primary-color); }
.footer-contact-info a { color: inherit; text-decoration: none; transition: var(--transition); }
.footer-contact-info a:hover { color: var(--primary-color); }

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* --- Reveal-on-scroll (progressive enhancement) ---
   Hidden only when JS is active (html.js). Without JS, content stays visible. */
.js .reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}
.js .reveal.active { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* --- Floating action buttons (WhatsApp + back-to-top) --- */
.fab-stack {
    position: fixed;
    bottom: 22px;
    left: 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1500;
}

.fab {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    border: 1px solid var(--border-color);
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.fab-wa { background: #25D366; border-color: #25D366; }
.fab-wa:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4); }

.fab-top {
    background: var(--surface-color);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
}
.fab-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.fab-top:hover { background: var(--primary-color); border-color: var(--primary-color); }

/* --- Shared responsive --- */
@media (max-width: 992px) {
    section { padding: 80px 5%; }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    .footer-brand p { margin: 1.5rem auto; }
    .footer-title::after { left: 50%; transform: translateX(-50%); right: auto; }
    .footer-contact-info p { justify-content: center; }
}

@media (max-width: 768px) {
    .menu-icon { display: block; }
    .works-grid { grid-template-columns: 1fr; }
    .section-title { font-size: 2.2rem; }
    .btn { width: 100%; justify-content: center; }
}
