/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* LIGHT MODE */
:root {
    --bg: #f5f4ef;
    --bg-alt: #edecea;
    --txt: #2c2c28;
    --txt-muted: #7a7a6e;
    --accent: #5a7a5a;
    --accent-dark: #3d5c3d;
    --accent-soft: #d6e4d6;
    --border: #dddbd3;
    --tag-bg: #e4ece4;
    --tag-txt: #3d5c3d;

    --font-serif: 'Lora', serif;
    --font-sans: 'DM Sans', sans-serif;
}

/* DARK MODE */
.dark-mode {
    --bg: #1a1c19;
    --bg-alt: #222420;
    --txt: #dddbd0;
    --txt-muted: #888878;
    --accent: #7a9e7a;
    --accent-dark: #9aba9a;
    --accent-soft: #2a3a2a;
    --border: #333530;
    --tag-bg: #2a3a2a;
    --tag-txt: #9aba9a;
}


/* BASE */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

body {
    font-family: var(--font-sans);
    font-weight: 300;
    background-color: var(--bg);
    color: var(--txt);
    line-height: 1.75;
    transition: background-color 0.4s, color 0.4s;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* skip link */
.skip-link {
    position: absolute;
    top: -50px;
    left: 1rem;
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    text-decoration: none;
    z-index: 2000;
    border-radius: 4px;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0.75rem;
}

/* progress bar */
.progress-bar {
    height: 4px;
    background: var(--accent);
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    z-index: 1050;
    transition: width 0.1s linear;
}


/* back to top */
.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s, border-color 0.2s;
    z-index: 500;
}

.back-to-top:hover {
    border-color: var(--accent);
}

.back-to-top:focus {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.back-to-top.hidden {
    opacity: 0;
    pointer-events: none;
}

.back-to-top-icon {
    width: 1.1rem;
    height: 1.1rem;
    color: var(--accent);
}


/* HEADER */

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3rem;
    height: 68px;
    z-index: 1000;
    background-color: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.4s, border-color 0.4s;
}

.logo {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--txt);
}

nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

nav a {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--txt-muted);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 4px;
    transition: color 0.2s, background-color 0.2s;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

nav a:hover,
nav a:focus {
    color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}

/* theme toggle */
.toggle {
    display: flex;
    align-items: center;
}

.toggle input {
    display: none;
}

.toggle label {
    display: block;
    width: 38px;
    height: 20px;
    padding: 2px;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    cursor: pointer;
    transition: border-color 0.3s;
    background: var(--bg-alt);
}

.toggle label:hover {
    border-color: var(--accent);
}

.toggle label::after {
    content: "";
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--txt-muted);
    transition: transform 0.3s, background 0.3s;
}

.toggle input:checked~label::after {
    transform: translateX(17px);
    background: var(--accent);
}

/* MAIN */

/* sections */
.section {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px 2rem 60px;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

/* hero */

.hero-inner {
    display: flex;
    justify-content: center;
}

.hero-content {
    text-align: center;
    max-width: 640px;
}

.hero-content h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--txt);
    margin-bottom: 1rem;
}

.heroname {
    font-style: italic;
    color: var(--accent);
    display: block;
    font-size: 1.15em;
}

.hero-sub {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--txt-muted);
    margin-bottom: 1.5rem;
}

.hero-body {
    font-size: 0.95rem;
    color: var(--txt-muted);
}

.hero-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent-soft);
    transition: text-decoration-color 0.2s;
    font-style: italic;
}

.hero-content a:hover,
.hero-content a:focus {
    text-decoration-color: var(--accent);
    outline: none;
}


/* about */

#about {
    background: var(--bg-alt);
}

.aboutme {
    display: flex;
    justify-content: space-between;
    gap: 3rem;
}

.about {
    width: 30%;
}

.about h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 400;
    color: var(--txt);
    margin-bottom: 0.75rem;
}

.about p {
    font-size: 0.88rem;
    color: var(--txt-muted);
    line-height: 1.85;
}


/* projects */
.section-title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--txt-muted);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* extra space */
.section-title--spaced {
    margin-top: 4rem;
}

.recent-projects {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.project-card {
    flex: 0 0 calc(33.333% - 1rem);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.project-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(90, 122, 90, 0.08);
}

.project-image {
    width: 100%;
    height: auto;
    display: block;
    border-bottom: 1px solid var(--border);
    transition: transform 0.5s ease;
}

.project-card:hover .project-image {
    transform: scale(1.03);
}

.project-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1.1rem 1.25rem 1.25rem;
}

.project-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 400;
    color: var(--txt);
    text-align: center;
    margin-bottom: 0.5rem;
}

.project-description {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: var(--txt-muted);
    text-align: center;
    flex-grow: 1;
    margin-bottom: 1rem;
    line-height: 1.75;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.tag {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    padding: 3px 9px;
    border-radius: 20px;
    background: var(--tag-bg);
    color: var(--tag-txt);
}

.button-container {
    text-align: center;
    margin-top: auto;
}

.project-button {
    display: inline-block;
    background: transparent;
    color: var(--accent);
    text-decoration: none;
    padding: 0.45rem 1.6rem;
    border-radius: 4px;
    border: 1px solid var(--accent);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    min-height: 44px;
    line-height: 2.4;
    transition: background 0.2s, color 0.2s;
}

.project-button:hover {
    background: var(--accent);
    color: #fff;
}

.project-button:focus {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}



/* contact */
#contact {
    background: var(--bg-alt);
}

.contactme {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 3rem;
}

.contact-text {
    text-align: right;
    width: 40%;
}

.contact-text p {
    font-size: 0.92rem;
    color: var(--txt-muted);
    line-height: 1.85;
}

.social-links {
    width: 40%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-links a {
    font-size: 1.25rem;
    color: var(--txt-muted);
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg);
    transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.social-links a:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.social-links a:focus {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.social-links a::before {
    content: attr(title);
    position: absolute;
    bottom: -2.2rem;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--accent-dark);
    color: var(--bg);
    padding: 3px 10px;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.social-links a:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* footer */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 2rem;
    text-align: center;
}

footer p {
    font-family: var(--font-sans);
    font-size: 0.78rem;
    color: var(--txt-muted);
    letter-spacing: 0.04em;
}



@media only screen and (max-width: 576px) {
    .header {
        flex-direction: column;
        height: auto;
        padding: 14px 1.25rem;
        gap: 10px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    nav a {
        font-size: 0.72rem;
        padding: 6px 8px;
    }

    .hero-content h1 {
        font-size: 2.4rem;
    }

    .aboutme {
        flex-direction: column;
        gap: 2rem;
    }

    .about {
        width: 100%;
    }

    .recent-projects {
        flex-direction: column;
    }

    .project-card {
        flex: 0 0 100%;
    }

    .contactme {
        flex-direction: column;
    }

    .contact-text {
        text-align: center;
        width: 100%;
    }

    .social-links {
        width: 100%;
    }

    .back-to-top {
        display: none;
    }
}

@media only screen and (min-width: 577px) and (max-width: 768px) {
    .header {
        flex-direction: column;
        height: auto;
        padding: 14px 1.5rem;
        gap: 10px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .aboutme {
        flex-direction: column;
        gap: 2rem;
    }

    .about {
        width: 100%;
    }

    .project-card {
        flex: 0 0 calc(50% - 0.75rem);
    }

    .contactme {
        flex-direction: column;
    }

    .contact-text {
        text-align: center;
        width: 100%;
    }

    .social-links {
        width: 100%;
    }

    .back-to-top {
        display: none;
    }
}

@media only screen and (min-width: 769px) and (max-width: 1024px) {
    .project-card {
        flex: 0 0 calc(50% - 0.75rem);
    }
}