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

:root {
    --bg: #0a0a0a;
    --surface: #111111;
    --border: #1f1f1f;
    --accent: #d93838;
    --accent2: #ff5a5a;
    --text: #e4e4e7;
    --muted: #71717a;
    --font-sans: 'Montserrat', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius: 12px;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Nav (identical to index) ── */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, .85);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

nav .inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

nav .logo {
    font-weight: 700;
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: .3rem;
}

nav .back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: .9rem;
    font-family: var(--font-mono);
    transition: color .2s;
}

nav .back-btn:hover {
    color: var(--text);
}

nav .back-btn svg {
    width: 16px;
    height: 16px;
}

/* ── Page wrapper ── */
main {
    max-width: 900px;
    margin: 0 auto;
    padding: 104px 24px 80px;
}

/* ── Hero banner ── */
.project-hero {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 48px;
    aspect-ratio: 16/7;
    background: var(--surface);
    border: 1px solid var(--border);
}

.project-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.project-hero .hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(10, 10, 10, .85) 0%, transparent 50%);
}

.project-hero .hero-title {
    position: absolute;
    bottom: 28px;
    left: 32px;
    right: 32px;
}

.project-hero .hero-title h1 {
    font-size: clamp(1.0rem, 4vw, 2.0rem);
    font-weight: 500;
    letter-spacing: -.04em;
    color: #fff;
    line-height: 1.1;
}

/* ── Tags row ── */
.tags-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(217, 56, 56, .12);
    border: 1px solid rgba(217, 56, 56, .3);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: .75rem;
    color: var(--accent2);
    letter-spacing: .02em;
}

/* ── Two-column layout ── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 700px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

/* ── Card (shared) ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

/* ── Description block ── */
.desc-card h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.desc-card p {
    color: #a1a1aa;
    line-height: 1.8;
    font-size: .975rem;
}

/* ── Screenshots ── */
.screenshots {
    margin-top: 28px;
}

.screenshots h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

/* ── Screenshots Collage (WhatsApp style) ── */
.screenshots-collage {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 360px;
    border-radius: 8px;
    overflow: hidden;
}

@media (max-width: 700px) {
    .screenshots-collage {
        grid-template-columns: repeat(2, 1fr);
        max-height: 280px;
    }
}

.collage-item {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    cursor: pointer;
    transition: transform .25s, filter .25s;
    position: relative;
    overflow: hidden;
}

.collage-item:hover {
    transform: scale(1.05);
    filter: brightness(0.9);
}

.collage-item.collage-more {
    background: linear-gradient(135deg, rgba(217, 56, 56, .3) 0%, rgba(217, 56, 56, .1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.collage-item.collage-more span {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent2);
    background: rgba(10, 10, 10, .6);
    padding: 8px 16px;
    border-radius: 6px;
}

/* ── Sidebar ── */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.meta-card h3 {
    font-size: .8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 14px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: .875rem;
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-row .label {
    color: var(--muted);
}

.meta-row .value {
    color: var(--text);
    font-weight: 600;
}

/* ── Links card ── */
.links-card h3 {
    font-size: .8rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    margin-bottom: 14px;
}

.link-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    transition: background .2s, color .2s, border-color .2s;
    margin-bottom: 10px;
}

.link-btn:last-child {
    margin-bottom: 0;
}

.link-btn.primary {
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
}

.link-btn.primary:hover {
    background: #c02a2a;
}

.link-btn.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.link-btn.ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.link-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── Reveal animations ── */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity .6s ease, transform .6s ease;
}

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

.reveal-d1 {
    transition-delay: .1s;
}

.reveal-d2 {
    transition-delay: .2s;
}

.reveal-d3 {
    transition-delay: .3s;
}

/* ── Lightbox ── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, .95);
    align-items: center;
    justify-content: center;
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 10px;
    box-shadow: 0 0 60px rgba(0, 0, 0, .8);
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: transform .2s;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .1);
    border: none;
    color: #fff;
    cursor: pointer;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
    flex-shrink: 0;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, .2);
}

.lightbox-nav svg {
    width: 24px;
    height: 24px;
}

.lightbox-prev {
    left: 24px;
}

.lightbox-next {
    right: 24px;
}

.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, .6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: .85rem;
    letter-spacing: .05em;
}

@media (max-width: 600px) {
    .lightbox-nav {
        width: 40px;
        height: 40px;
    }
    
    .lightbox-prev {
        left: 12px;
    }
    
    .lightbox-next {
        right: 12px;
    }
    
    .lightbox-close {
        top: 12px;
        right: 12px;
        font-size: 1.5rem;
    }
}

/* ── Footer ── */
footer {
    margin-top: 5rem;
    padding: 2.5rem 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: #71717a;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    letter-spacing: 0.05em;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

footer p {
    color: #a1a1aa;
    text-decoration: none;
    transition: color 0.3s ease;
}

footer p:hover {
    color: #ffffff;
}

/* ── Grid background (hero section) ── */
.grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}