/* ===========================
   TOKENS
   =========================== */
:root {
    --bg: #0b0b0b;
    --surface: #111111;
    --border: #1e1e1e;

    --text: #d4d4d4;
    --text-secondary: #888888;
    --text-dim: #555555;
    --text-heading: #f0f0f0;

    --accent: #c8956c;

    --serif: 'Instrument Serif', 'Georgia', serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'Fira Code', 'Consolas', monospace;

    --measure: 720px;
    --page-padding: clamp(1.5rem, 5vw, 4rem);
}

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

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
    overflow: hidden;
}

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

img {
    max-width: 100%;
    display: block;
}

/* ===========================
   NAV
   =========================== */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem var(--page-padding);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(11, 11, 11, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-name {
    font-family: var(--serif);
    font-size: 1.3rem;
    color: var(--text-heading);
    font-style: italic;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
}

/* ===========================
   HERO
   =========================== */
.hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6rem;
    align-items: center;
    min-height: 100vh;
    padding: 0 var(--page-padding);
    max-width: 1100px;
    margin: 0 auto;
}

.hero-portrait {
    flex-shrink: 0;
}

.portrait-img {
    width: 240px;
    height: auto;
    border-radius: 4px;
    filter: grayscale(100%) contrast(1.1);
    opacity: 0.85;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

.portrait-img:hover {
    filter: grayscale(0%) contrast(1);
    opacity: 1;
}

.hero-text h1 {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 4.5vw, 3.4rem);
    font-weight: 400;
    line-height: 1.25;
    color: var(--text-heading);
    letter-spacing: -0.5px;
    margin-bottom: 2rem;
}

.hero-text p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 480px;
    line-height: 1.8;
}

/* ===========================
   HERO SOCIALS
   =========================== */
.hero-socials {
    display: flex;
    gap: 1.25rem;
    margin-top: 2rem;
}

.hero-socials a {
    color: var(--text-dim);
    transition: color 0.25s ease, transform 0.25s ease;
    display: flex;
    align-items: center;
}

.hero-socials a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

/* Mobile hero — stack vertically, scale up image and centralize */
@media (max-width: 850px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
        gap: 2.5rem;
        padding-top: 120px;
        min-height: auto;
        padding-bottom: 5rem;
    }

    .portrait-img {
        width: 220px;
    }

    .hero-text p {
        margin: 0 auto;
    }

    .hero-socials {
        justify-content: center;
        margin-top: 2rem;
    }

    .hero-text h1 {
        font-size: clamp(2.2rem, 5vw, 2.8rem);
    }
}

@media (max-width: 550px) {
    .hero {
        gap: 2rem;
    }

    .portrait-img {
        width: 180px;
    }

    .hero-text h1 {
        font-size: 1.8rem;
    }

    .hero-text p {
        font-size: 0.95rem;
    }
}

/* ===========================
   SECTIONS
   =========================== */
.section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 6rem var(--page-padding);
}

.section h2 {
    font-family: var(--serif);
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 400;
    color: var(--text-heading);
    margin-bottom: 3.5rem;
    letter-spacing: -0.3px;
}

/* ===========================
   PROJECTS
   =========================== */
.project {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.3s ease;
}

.project:hover {
    background-color: rgba(255, 255, 255, 0.015);
}

@media (min-width: 768px) {
    .project {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
        align-items: start;
    }
}

.project-image-link {
    display: block;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.project-img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    filter: grayscale(80%);
    transition: transform 0.5s ease, filter 0.5s ease;
}

.project-image-link:hover .project-img {
    transform: scale(1.03);
    filter: grayscale(0%);
}

.project:last-of-type {
    border-bottom: 1px solid var(--border);
}

.project-label {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.project-year {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--accent);
}

.project-status {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 3px;
}

.project h3 {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 1.25rem;
    letter-spacing: -0.2px;
}

.project h3 a {
    color: var(--text-heading);
    transition: color 0.2s;
}

.project h3 a:hover {
    color: var(--accent);
}

.project p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1.25rem;
}

.project-stack {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-dim);
    display: block;
}

/* ===========================
   PROJECT LINK ICONS
   =========================== */
.project-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.project-link {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    padding: 0.4rem;
    border-radius: 4px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.project-link:hover {
    color: var(--accent);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Hidden modal data */
.project-modal-data {
    display: none;
}

/* ===========================
   MINOR PROJECTS (Side Quests)
   =========================== */
.subsection {
    padding-top: 5rem;
}

.subsection h4 {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 2.5rem;
}

.minor-projects {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.minor-project {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1rem;
    border-top: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
    margin: 0 -1rem;
    border-radius: 4px;
    gap: 1rem;
}

.minor-project:hover {
    background-color: rgba(255, 255, 255, 0.03);
    padding-left: 1.5rem;
}

.minor-project:last-child {
    border-bottom: 1px solid var(--border);
}

.minor-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.minor-title {
    font-size: 0.95rem;
    color: var(--text);
}

.minor-link {
    color: var(--text-dim);
    display: flex;
    align-items: center;
    transition: color 0.2s ease, transform 0.2s ease;
}

.minor-link:hover {
    color: var(--accent);
    transform: translateY(-1px);
}

.minor-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: right;
    flex: 1;
}

.minor-arrow {
    font-size: 0.9rem;
    color: var(--text-dim);
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}

.minor-project:hover .minor-arrow {
    transform: translateX(3px);
    color: var(--accent);
}

.minor-modal-data {
    display: none;
}

@media (max-width: 600px) {
    .minor-project {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .minor-desc {
        text-align: left;
        flex-basis: 100%;
        order: 3;
    }

    .minor-arrow {
        order: 2;
        margin-left: auto;
    }
}

/* ===========================
   MODAL
   =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 680px;
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    transform: translateY(24px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 2;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.modal-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}

.modal-body {
    padding: 2rem;
}

.modal-label {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-heading);
    margin-bottom: 1.25rem;
    letter-spacing: -0.2px;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.modal-extended {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.modal-stack {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-dim);
    display: block;
    margin-bottom: 1.5rem;
}

.modal-sublist {
    list-style: none;
    padding: 0.25rem 0 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.modal-sublist li {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-dim);
    position: relative;
    padding-left: 1.1rem;
}

.modal-sublist li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.modal-links {
    display: flex;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

.modal-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.modal-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background-color: rgba(200, 149, 108, 0.06);
}

/* Modal scrollbar */
.modal-content::-webkit-scrollbar {
    width: 4px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

@media (max-width: 600px) {
    .modal-overlay {
        padding: 1rem;
        align-items: flex-end;
    }

    .modal-content {
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-sublist {
        flex-direction: column;
        gap: 0.4rem;
    }
}

/* ===========================
   WRITING / ESSAYS
   =========================== */
.essay {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    transition: padding-left 0.3s ease;
}

.essay:last-child {
    border-bottom: 1px solid var(--border);
}

.essay:hover {
    padding-left: 1rem;
}

.essay-title {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.5;
    max-width: 600px;
}

.essay-desc {
    display: block;
    font-size: 0.875rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-top: 0.4rem;
    max-width: 560px;
}

.essay-arrow {
    font-size: 1.1rem;
    color: var(--text-dim);
    flex-shrink: 0;
    margin-left: 2rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.essay:hover .essay-arrow {
    transform: translateX(4px);
    color: var(--accent);
}

/* ===========================
   FOOTER
   =========================== */
.footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 4rem var(--page-padding) 3rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--text-dim);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text);
}

/* ===========================
   ANIMATIONS
   =========================== */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* ===========================
   SCROLLBAR
   =========================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-dim);
}