/* ---------------------------------------------------------
   Shared design system — monospace, minimal, a bit warmer.
--------------------------------------------------------- */

:root {
    --bg: #fbfaf8;
    --bg-elevated: #ffffff;
    --fg: #14130f;
    --muted: #6f6b62;
    --border: rgba(20, 19, 15, 0.1);
    --accent: #b5601f;
    --shadow: rgba(20, 19, 15, 0.08);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: 'SF Mono', Monaco, 'Ubuntu Mono', Menlo, monospace;
    font-size: 14px;
    margin: 40px;
    line-height: 1.65;
    position: relative;
    transition: background-color 0.35s ease, color 0.35s ease;
}

body.text-left {
    text-align: left;
}

body.home {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    margin-bottom: 0;
    padding-bottom: 8vh;
}

/* Fade-up entrance */
.container,
.links-container,
.archived-message,
main.gallery,
.contact-container,
.projects-container {
    opacity: 0;
    transform: translateY(10px);
    animation: fade-up 0.6s ease forwards;
    animation-delay: 0.05s;
}

@keyframes fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .container,
    .links-container,
    .archived-message,
    main.gallery,
    .contact-container,
    .projects-container {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

a {
    color: var(--fg);
}

h1 {
    font-size: 1.15em;
    font-weight: 600;
    margin: 0 0 12px;
}

/* ---------------- Top-right utility bar ---------------- */

.top-bar {
    position: absolute;
    top: 40px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-home {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.back-home:hover {
    border-color: var(--fg);
    transform: translateX(-2px);
}

/* ---------------- Home page ---------------- */

.container {
    max-width: 50%;
    margin: 0 auto;
}

.home-image {
    max-width: 220px;
    width: 100%;
    height: auto;
    margin-bottom: 22px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 10px;
    box-shadow: 0 12px 30px var(--shadow);
}

.identity {
    margin-bottom: 6px;
}

.identity .name {
    font-size: 1.5em;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.identity .cursor {
    display: inline-block;
    color: var(--accent);
    animation: blink 1.1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.identity .divider {
    color: var(--accent);
    margin: 0 8px;
}

.bio {
    color: var(--fg);
    margin: 10px 0 8px;
}

.quote {
    color: var(--muted);
    font-style: italic;
    max-width: 32em;
    margin: 0 auto 26px;
}

.nav-links {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0 8px;
    line-height: 1.6;
}

.nav-links a {
    color: var(--fg);
    text-decoration: none;
    background-image: linear-gradient(var(--fg), var(--fg));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    padding-bottom: 2px;
    transition: background-size 0.25s ease, color 0.2s ease;
}

.nav-links a:hover {
    background-size: 100% 1px;
}

.nav-separator {
    color: var(--muted);
}

/* ---------------- Links page ---------------- */

.links-container {
    max-width: 65%;
}

.link-item {
    display: block;
    margin-bottom: 15px;
    line-height: 1.4;
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    width: fit-content;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.link-item:hover {
    border-color: var(--fg);
}

.updated-note {
    color: var(--muted);
}

/* ---------------- Projects / Contact ---------------- */

.projects-container a,
.contact-container a {
    color: var(--fg);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.projects-container a:hover,
.contact-container a:hover {
    border-color: var(--fg);
}

/* ---------------- Writings (archived) ---------------- */

.archived-message {
    max-width: 65%;
    margin-top: 40px;
}

/* ---------------- Media gallery ---------------- */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.gallery img,
.gallery video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

.gallery img.big {
    grid-column: span 2;
}

.gallery video {
    grid-column: span 2;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 768px) {
    body {
        margin: 20px;
        font-size: 13px;
    }

    .container {
        max-width: 90%;
    }

    .links-container {
        max-width: 90%;
    }

    .home-image {
        margin-bottom: 20px;
    }

    .nav-links {
        padding: 0 10px;
        gap: 0 6px;
    }

    .nav-separator {
        margin: 0;
    }

    .music-player .label {
        display: none;
    }
}

@media (max-width: 480px) {
    body {
        margin: 15px;
        font-size: 12px;
    }

    .container {
        max-width: 95%;
    }

    .links-container {
        max-width: 95%;
    }

    .nav-links {
        padding: 10px 5px;
        gap: 0 4px;
    }

    .nav-separator {
        font-size: 11px;
    }

    .nav-links a {
        padding: 8px 4px;
    }
}
