/* ===== 1. Variables (mirrored from CV style.css) ===== */
:root {
    --color-primary: #2d5016;
    --color-primary-light: #3a6b1e;
    --color-primary-bg: #f0f4ec;
    --color-text: #1a1a1a;
    --color-text-secondary: #555;
    --color-text-muted: #888;
    --color-border: #e0e0e0;
    --color-border-light: #eee;
    --color-bg: #f5f5f5;
    --color-white: #fff;
    --font-main: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --radius: 4px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 6px 16px rgba(0, 0, 0, 0.04);
}

/* ===== 1b. Dark Theme ===== */
[data-theme="dark"] {
    --color-primary: #5a9a32;
    --color-primary-light: #6db840;
    --color-primary-bg: #1a2a12;
    --color-text: #e0e0e0;
    --color-text-secondary: #aaa;
    --color-text-muted: #777;
    --color-border: #333;
    --color-border-light: #2a2a2a;
    --color-bg: #111;
    --color-white: #1a1a1a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* ===== 2. Base Reset ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    padding: 32px 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

/* ===== 3. Layout ===== */
.page {
    max-width: 1100px;
    margin: 0 auto;
    background: var(--color-white);
    padding: 40px 48px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: background-color 0.3s, box-shadow 0.3s;
}

/* ===== 4. Typography ===== */
h1 {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

h2 {
    font-size: 1.15em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 4px;
    margin-top: 28px;
    margin-bottom: 16px;
}

h3 {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 2px;
}

h4 {
    font-size: 0.9em;
    font-weight: 400;
    font-style: italic;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

/* ===== 5. Links ===== */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-primary-light);
    text-decoration: underline;
}

/* ===== 6. Header ===== */
header {
    text-align: center;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 16px;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    font-size: 0.9em;
    font-weight: 500;
}

.contact-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 6px;
    font-size: 0.9em;
    margin-top: 4px;
}

.contact-info .sep {
    color: var(--color-text-muted);
    margin: 0 2px;
}

/* ===== 7. Hero / Intro ===== */
.hero {
    text-align: center;
    padding: 12px 0 4px;
    font-size: 0.95em;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* ===== 8. Project Navigation ===== */
.project-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 10px;
    padding: 12px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.85em;
}

.project-nav a {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    font-weight: 500;
    transition: all 0.2s;
}

.project-nav a:hover {
    background: var(--color-primary);
    color: var(--color-white);
    text-decoration: none;
}

/* ===== 9. Project Cards ===== */
.project-card {
    padding: 24px 0 24px 20px;
    border-left: 4px solid var(--color-primary-bg);
    margin-bottom: 16px;
    transition: border-left-color 0.2s;
}

.project-card:hover {
    border-left-color: var(--color-primary);
}

.project-card:last-child {
    margin-bottom: 0;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.item-date {
    font-size: 0.85em;
    font-weight: 400;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* ===== 10. Project Status Badge ===== */
.status-badge {
    display: inline-block;
    font-size: 0.78em;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 999px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.status-badge.development {
    background: #fff8e1;
    color: #f57f17;
}

.status-badge.complete {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge.production {
    background: #e3f2fd;
    color: #1565c0;
}

/* ===== 11. Project Overview ===== */
.project-overview {
    font-size: 0.93em;
    line-height: 1.65;
    margin-bottom: 12px;
    color: var(--color-text);
}

/* ===== 12. Key Features ===== */
.key-features {
    margin-bottom: 12px;
}

.key-features h4 {
    font-weight: 600;
    font-style: normal;
    color: var(--color-text);
    margin-bottom: 6px;
    font-size: 0.88em;
}

.key-features ul {
    list-style: disc;
    padding-left: 20px;
    font-size: 0.88em;
    line-height: 1.5;
}

.key-features li {
    margin-bottom: 3px;
}

/* ===== 13. Sub-projects ===== */
.sub-project {
    padding: 10px 0 10px 16px;
    border-left: 2px solid var(--color-border-light);
    margin-bottom: 10px;
    margin-left: 4px;
}

.sub-project:last-child {
    margin-bottom: 0;
}

.sub-project h4 {
    font-weight: 600;
    font-style: normal;
    color: var(--color-text);
    font-size: 0.95em;
    margin-bottom: 4px;
}

.sub-project p {
    font-size: 0.88em;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

/* ===== 14. Tech Tags (same as CV) ===== */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    list-style: none;
    align-items: center;
    margin-top: 10px;
}

.tech-tags li {
    font-size: 0.75em;
    font-weight: 500;
    background: var(--color-primary-bg);
    color: var(--color-primary);
    padding: 2px 9px;
    border-radius: 999px;
    white-space: nowrap;
}

/* ===== 15. Project Media ===== */
.project-media-container {
    margin: 12px 0;
}

.project-media {
    position: relative;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
}

.project-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.project-media:hover img {
    transform: scale(1.03);
}

.media-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.project-media:hover .media-overlay {
    background: rgba(0, 0, 0, 0.5);
}

.media-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.project-media:hover .media-icon {
    transform: scale(1.1);
}

.media-icon svg {
    fill: var(--color-primary);
    margin-left: 2px;
}

/* Media placeholder */
.media-placeholder {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--color-primary-bg) 0%, #e8ede4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 0.85em;
}

.media-placeholder svg {
    width: 24px;
    height: 24px;
    fill: var(--color-text-muted);
    opacity: 0.6;
}

/* Photo thumbnail (static, no overlay) */
.photo-thumb {
    position: relative;
    width: 100%;
    max-width: 480px;
    border-radius: var(--radius);
    overflow: hidden;
}

.photo-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== 16. Project Links ===== */
.project-links {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.88em;
}

.project-links a {
    font-weight: 500;
}

/* ===== 17. Architecture Section ===== */
.architecture {
    margin: 12px 0;
    padding: 12px 16px;
    background: var(--color-bg);
    border-radius: var(--radius);
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.82em;
    line-height: 1.5;
    white-space: pre;
    overflow-x: auto;
    color: var(--color-text-secondary);
}

/* ===== 18. Services Table ===== */
.services-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin: 10px 0;
}

.services-table th {
    text-align: left;
    font-weight: 600;
    color: var(--color-primary);
    padding: 6px 10px;
    border-bottom: 2px solid var(--color-primary-bg);
}

.services-table td {
    padding: 4px 10px;
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text-secondary);
}

.services-table code {
    font-family: "SF Mono", "Fira Code", monospace;
    font-size: 0.9em;
    background: var(--color-primary-bg);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ===== 19. Modal Lightbox (same as CV) ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 24px;
    font-size: 2.2em;
    color: #aaa;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #fff;
}

.modal-content {
    max-width: 90vw;
    max-height: 85vh;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content img,
.modal-content video {
    max-width: 100%;
    max-height: 85vh;
    border-radius: var(--radius);
}

/* ===== 20. GDPR Footer ===== */
.gdpr {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
    font-size: 0.7em;
    color: var(--color-text-muted);
    text-align: justify;
}

/* ===== 20b. Dark Theme Overrides ===== */
[data-theme="dark"] .status-badge.development {
    background: #332b00;
    color: #fbc02d;
}

[data-theme="dark"] .status-badge.complete {
    background: #0d2a0d;
    color: #66bb6a;
}

[data-theme="dark"] .status-badge.production {
    background: #0a1929;
    color: #42a5f5;
}

[data-theme="dark"] .media-placeholder {
    background: linear-gradient(135deg, #1a2a12 0%, #1e2e1a 100%);
}

[data-theme="dark"] .media-icon {
    background: rgba(26, 26, 26, 0.9);
}

[data-theme="dark"] .media-overlay {
    background: rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .project-media:hover .media-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #1a1a1a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    color: #e0e0e0;
    z-index: 100;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    color: #fff;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s;
}

.theme-toggle:hover svg {
    transform: rotate(15deg);
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun  { display: block; }

[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }

[data-theme="dark"] .theme-toggle {
    background: #f0f0f0;
    color: #333;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle:hover {
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
}

/* ===== 21. Responsive ===== */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .page {
        padding: 20px 16px;
        border-radius: 0;
        box-shadow: none;
    }

    h1 {
        font-size: 1.7em;
    }

    h3 {
        font-size: 1.05em;
    }

    .contact-info {
        flex-direction: column;
        align-items: center;
    }

    .contact-info .sep {
        display: none;
    }

    .item-header {
        flex-direction: column;
        gap: 2px;
    }

    .project-nav {
        gap: 4px 6px;
        font-size: 0.8em;
    }

    .project-nav a {
        padding: 3px 10px;
    }

    .project-card {
        padding: 16px 0 16px 14px;
    }

    .project-media,
    .media-placeholder,
    .photo-thumb {
        max-width: 100%;
    }

    .theme-toggle {
        width: 36px;
        height: 36px;
        bottom: 20px;
        right: 20px;
    }

    .theme-toggle svg {
        width: 16px;
        height: 16px;
    }

    .architecture {
        font-size: 0.72em;
    }

    .services-table {
        font-size: 0.78em;
    }
}

/* ===== 22. Print ===== */
@media print {
    body {
        background: #fff;
        padding: 0;
        font-size: 10pt;
    }

    .page {
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }

    .project-nav,
    .modal-overlay,
    .media-overlay,
    .media-icon,
    .theme-toggle {
        display: none !important;
    }

    a {
        color: #000 !important;
        text-decoration: none;
    }

    .project-card {
        border-left-color: #ccc !important;
        page-break-inside: avoid;
    }

    .tech-tags li {
        background: transparent !important;
        border: 1px solid #999;
        color: #000 !important;
    }

    .status-badge {
        border: 1px solid currentColor;
        background: transparent !important;
    }
}
