@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@700&display=swap');

:root {
    --bg: #fafaf8;
    --surface: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --accent: #15803d;
    --accent-hover: #166534;
    --border: #e5e7eb;
}

.darkmode {
    --bg: #111827;
    --surface: #1f2937;
    --text: #f9fafb;
    --text-muted: #9ca3af;
    --accent: #4ade80;
    --accent-hover: #86efac;
    --border: #374151;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Header ── */
header {
    position: sticky;
    top: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 5%;
    height: 60px;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    margin-right: auto;
    letter-spacing: -0.01em;
}

.nav__links {
    list-style: none;
    display: flex;
    gap: 2px;
}

.nav__links li a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    display: block;
}

.nav__links li a:hover {
    color: var(--text);
    background: var(--bg);
}

.cta-btn {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: 8px;
    padding: 8px 18px;
    text-decoration: none;
    margin-left: 16px;
    transition: background 0.15s;
    display: inline-block;
}

.darkmode .cta-btn {
    color: #111827;
}

.cta-btn:hover {
    background: var(--accent-hover);
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    margin-left: 8px;
    transition: background 0.15s;
}

#theme-toggle:hover {
    background: var(--bg);
}

#theme-toggle img {
    width: 20px;
    height: 20px;
    object-fit: contain;
    filter: brightness(0);
}

.darkmode #theme-toggle img {
    filter: brightness(0) invert(1);
}

/* ── Project page layout ── */
.project-page {
    max-width: 960px;
    margin: 0 auto;
    padding: 52px 5% 96px;
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 36px;
    transition: color 0.15s;
}

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

/* Project header */
.project-header {
    margin-bottom: 48px;
}

.project-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.project-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.github-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 18px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.github-btn:hover {
    border-color: var(--text-muted);
    background: var(--surface);
}

.project-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 3px 9px;
    border-radius: 4px;
    opacity: 0.85;
}

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 56px;
}

.gallery figure {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

/* First figure spans full width */
.gallery figure:first-child {
    grid-column: 1 / -1;
}

.gallery img {
    width: 100%;
    object-fit: cover;
    display: block;
}

/* Featured (full-width) image is taller */
.gallery figure:first-child img {
    max-height: 480px;
}

/* Secondary images are shorter */
.gallery figure:not(:first-child) img {
    height: 240px;
}

.gallery figcaption {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Span both columns for wide/panoramic screenshots */
.gallery figure.full-width {
    grid-column: 1 / -1;
}

.gallery figure.full-width img {
    max-height: 480px;
    height: auto;
}

/* Portrait-oriented images (phone screens, tall dialogs, etc.) */
.gallery figure.portrait img {
    height: auto;
    max-height: 480px;
    object-fit: contain;
    background: var(--bg);
}

/* Details */
.project-details {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.detail-block h2 {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
}

.detail-block ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-block li {
    font-size: 15px;
    color: var(--text);
    line-height: 1.7;
    padding-left: 20px;
    position: relative;
}

.detail-block li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
}

@media (max-width: 640px) {
    .gallery {
        grid-template-columns: 1fr;
    }

    .gallery figure:first-child {
        grid-column: auto;
    }

    .gallery figure:not(:first-child) img {
        height: 200px;
    }

    .project-header-top {
        flex-direction: column;
        align-items: flex-start;
    }
}
