/* ========================================
   Projects Page — Nader Al Masri
   ======================================== */

:root {
    --bg: #0a0a0b;
    --surface: #141415;
    --border: #1f1f22;
    --border-light: #2c2c30;
    --text: #fafafa;
    --text-secondary: #8a8a8d;
    --text-tertiary: #4a4a4e;
    --accent: #c4a052;
    --accent-hover: #d4b472;
    --accent-subtle: rgba(196, 160, 82, 0.08);
    --accent-glow: rgba(196, 160, 82, 0.15);
    --radius: 14px;
    --nav-height: 64px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --t: 0.3s;
    --t-slow: 0.7s;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    cursor: none;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
::selection { background: var(--accent); color: var(--bg); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 32px; }

/* ===== CURSOR ===== */
.cursor-dot {
    position: fixed;
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
}
.cursor-ring {
    position: fixed;
    width: 36px; height: 36px;
    border: 1px solid rgba(196, 160, 82, 0.5);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.4s var(--ease-out), height 0.4s var(--ease-out),
                border-color 0.4s, background 0.4s;
}
.cursor-ring.hovered {
    width: 52px; height: 52px;
    border-color: var(--accent);
    background: var(--accent-glow);
}
@media (hover: none) {
    .cursor-dot, .cursor-ring { display: none; }
    body { cursor: auto; }
}

/* ===== NAV ===== */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    height: var(--nav-height);
}
.nav::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 11, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    position: relative;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    display: inline-flex;
    align-items: center;
    position: relative;
    color: var(--text);
    text-decoration: none;
}
.nl-short {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
    white-space: nowrap;
}
.nl-short em { font-style: normal; color: var(--accent); }
.nl-full {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    opacity: 0;
    color: var(--text-secondary);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
    pointer-events: none;
}
.nav-logo:hover .nl-short { opacity: 0; transform: translateX(-4px); }
.nav-logo:hover .nl-full { opacity: 1; transform: translateY(-50%) translateX(0); }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
    font-size: 14px;
    font-weight: 450;
    color: var(--text-secondary);
    transition: color var(--t);
    position: relative;
}
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -3px; left: 0;
    width: 0; height: 1px;
    background: var(--accent);
    transition: width var(--t) var(--ease-out);
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--text); }
.nav-cta {
    padding: 8px 20px !important;
    border: 1px solid var(--border) !important;
    border-radius: 100px;
    transition: all var(--t) !important;
}
.nav-cta:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
.nav-cta::after { display: none !important; }
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: none;
    width: 36px; height: 36px;
    position: relative;
    z-index: 10;
}
.nav-toggle span {
    display: block;
    width: 22px; height: 1.5px;
    background: var(--text);
    position: absolute;
    left: 7px;
    transition: all var(--t);
}
.nav-toggle span:first-child { top: 12px; }
.nav-toggle span:last-child { top: 20px; }
.nav-toggle.active span:first-child { transform: rotate(45deg); top: 16px; }
.nav-toggle.active span:last-child { transform: rotate(-45deg); top: 16px; }

/* ===== SCROLL REVEAL ===== */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.75s var(--ease-out), transform 0.75s var(--ease-out);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== HERO ===== */
.line-mask { display: block; overflow: hidden; padding-bottom: 0.08em; }
.line-reveal {
    display: block;
    transform: translateY(110%);
    animation: lineUp 1s var(--ease-out) forwards;
    animation-delay: var(--delay, 0s);
}
@keyframes lineUp { to { transform: translateY(0); } }
.hero-accent { color: var(--accent); }
.hero-fade {
    opacity: 0;
    transform: translateY(16px);
    animation: fadeUp 0.8s var(--ease-out) forwards;
    animation-delay: var(--delay, 0.5s);
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.proj-hero {
    position: relative;
    padding-top: calc(var(--nav-height) + 96px);
    padding-bottom: 100px;
    overflow: hidden;
}
.proj-hero-bg { position: absolute; inset: 0; overflow: hidden; }
.proj-hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
}
.proj-hero-orb--1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(196,160,82,0.16) 0%, transparent 65%);
    top: -200px; right: -100px;
    animation: orbFloat 18s ease-in-out infinite;
}
.proj-hero-orb--2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(150,110,50,0.1) 0%, transparent 65%);
    bottom: -100px; left: -80px;
    animation: orbFloat 14s ease-in-out infinite reverse;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0,0) scale(1); }
    33%  { transform: translate(40px,-40px) scale(1.05); }
    66%  { transform: translate(-25px,25px) scale(0.97); }
}
.proj-hero-grain {
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 200px;
    pointer-events: none;
}
.proj-hero-content { position: relative; }
.proj-hero-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
}
.proj-hero-title {
    font-size: clamp(72px, 14vw, 160px);
    font-weight: 900;
    line-height: 0.92;
    letter-spacing: -0.055em;
    margin-bottom: 28px;
}
.proj-hero-sub {
    font-size: clamp(15px, 1.6vw, 18px);
    color: var(--text-secondary);
    line-height: 1.65;
    max-width: 480px;
    margin-bottom: 40px;
}
.proj-hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 26px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all var(--t) var(--ease);
    cursor: none;
}
.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 24px var(--accent-glow);
}
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 450;
    color: var(--text-secondary);
    transition: color var(--t);
    cursor: none;
}
.btn-ghost:hover { color: var(--text); }
.magnetic { position: relative; }

/* ===== PROJECT LIST ===== */
.proj-list { padding-bottom: 120px; }

.proj-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 72px;
    align-items: center;
    padding: 88px 0;
    border-top: 1px solid var(--border);
    position: relative;
}
.proj-item:last-child { border-bottom: 1px solid var(--border); }

/* Alternate: flip order every even item */
.proj-item--alt .proj-image-col { order: 2; }
.proj-item--alt .proj-info-col  { order: 1; }

/* Image column */
.proj-image-link { display: block; }
.proj-image {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--border);
}
.proj-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: brightness(0.78) saturate(0.9);
    transform: scale(1.03);
    transition: transform 0.75s var(--ease-out), filter 0.55s;
}
.proj-item:hover .proj-image img {
    transform: scale(1);
    filter: brightness(0.95) saturate(1.05);
}
.proj-image-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 11, 0.65);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
}
.proj-item:hover .proj-image-overlay { opacity: 1; }
.proj-image-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.proj-image-cta:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

/* Info column */
.proj-info-col { position: relative; }
.proj-num {
    display: block;
    font-size: clamp(72px, 10vw, 120px);
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px var(--border-light);
    margin-bottom: 20px;
    user-select: none;
    transition: -webkit-text-stroke-color 0.4s;
}
.proj-item:hover .proj-num { -webkit-text-stroke-color: var(--border); }

.proj-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.proj-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 100px;
    border: 1px solid var(--border);
    color: var(--text-tertiary);
    transition: border-color 0.25s, color 0.25s;
}
.proj-item:hover .proj-tag {
    border-color: var(--border-light);
    color: var(--text-secondary);
}

.proj-title {
    font-size: clamp(26px, 3.2vw, 42px);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin-bottom: 18px;
}
.proj-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 36px;
    max-width: 420px;
}
.proj-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    transition: all var(--t) var(--ease);
    cursor: none;
}
.proj-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 28px var(--accent-glow);
}
.proj-link svg { transition: transform var(--t); }
.proj-link:hover svg { transform: translate(2px, -2px); }

/* ===== FOOTER ===== */
.proj-footer {
    padding: 28px 0;
    border-top: 1px solid var(--border);
}
.proj-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.proj-footer-name { font-size: 13px; color: var(--text-tertiary); }
.proj-footer-links { display: flex; gap: 24px; }
.proj-footer-links a {
    font-size: 13px;
    color: var(--text-tertiary);
    transition: color var(--t);
}
.proj-footer-links a:hover { color: var(--text); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .container { padding: 0 24px; }
    .nav-toggle { display: block; }
    .nav-links {
        position: fixed;
        top: 0; right: 0;
        width: 100%; height: 100vh;
        background: rgba(10,10,11,0.97);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        flex-direction: column;
        justify-content: center;
        gap: 20px;
        opacity: 0;
        visibility: hidden;
        transition: opacity var(--t), visibility var(--t);
    }
    .nav-links.open { opacity: 1; visibility: visible; }
    .nav-links a { font-size: 22px; font-weight: 600; }
    .nav-cta { font-size: 22px !important; padding: 12px 32px !important; }

    .proj-item {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 56px 0;
    }
    .proj-item--alt .proj-image-col { order: 0; }
    .proj-item--alt .proj-info-col  { order: 0; }
    .proj-num { font-size: 56px; margin-bottom: 12px; }
    .proj-desc { max-width: 100%; }
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .proj-hero { padding-top: calc(var(--nav-height) + 56px); padding-bottom: 56px; }
    .proj-footer-inner { flex-direction: column; gap: 14px; text-align: center; }
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] {
    --bg: #f5f3ee;
    --surface: #ffffff;
    --border: #e5e3db;
    --border-light: #d4d2c8;
    --text: #1a1a1c;
    --text-secondary: #555558;
    --text-tertiary: #989894;
    --accent: #a8862e;
    --accent-hover: #8e7126;
    --accent-subtle: rgba(168, 134, 46, 0.08);
    --accent-glow: rgba(168, 134, 46, 0.18);
}
body, .proj-item, .proj-image, .btn, .proj-link {
    transition: background-color 0.4s var(--ease), border-color 0.4s var(--ease), color 0.4s var(--ease);
}
[data-theme="light"] .nav::before {
    background: rgba(245, 243, 238, 0.88);
}
[data-theme="light"] .proj-hero-orb--1 {
    background: radial-gradient(circle, rgba(168,134,46,0.14) 0%, transparent 65%);
}
[data-theme="light"] .proj-hero-orb--2 {
    background: radial-gradient(circle, rgba(168,134,46,0.1) 0%, transparent 65%);
}
[data-theme="light"] .proj-hero-grain { opacity: 0.022; mix-blend-mode: multiply; }
[data-theme="light"] .proj-image img { filter: brightness(0.96) saturate(0.95); }
[data-theme="light"] .proj-item:hover .proj-image img { filter: brightness(1) saturate(1); }
[data-theme="light"] .proj-image-overlay { background: rgba(245,243,238,0.72); }
[data-theme="light"] .proj-image-cta {
    color: var(--text);
    border-color: rgba(0,0,0,0.18);
}
[data-theme="light"] .nav-toggle span { background: var(--text); }
[data-theme="light"] .nav-links { background: rgba(245,243,238,0.97); }
[data-theme="light"] .cursor-dot { background: var(--accent); mix-blend-mode: normal; }
[data-theme="light"] .cursor-ring { border-color: rgba(168,134,46,0.5); }

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    cursor: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--t) var(--ease);
    padding: 0;
    overflow: hidden;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon {
    position: absolute;
    width: 16px; height: 16px;
    transition: opacity 0.4s var(--ease), transform 0.5s var(--ease-out);
}
.theme-icon--moon { opacity: 1; transform: rotate(0) scale(1); }
.theme-icon--sun  { opacity: 0; transform: rotate(-90deg) scale(0.6); }
[data-theme="light"] .theme-icon--moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
[data-theme="light"] .theme-icon--sun  { opacity: 1; transform: rotate(0) scale(1); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }
