/* ========================================
   DESIGN TOKENS
   ======================================== */

:root {
    /* Typography */
    --font-sans: "Inter", system-ui, -apple-system, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

    /* Color Palette */
    --bg: #0a192f;
    --bg-elevated: #112240;
    --text-primary: #e6f1ff;
    --text-secondary: #8892b0;
    --text-muted: #5c6685;
    --line-inactive: #3a4a66;
    --accent: #64ffda;
    --accent-soft: rgba(100, 255, 218, 0.1);
    --border: rgba(255, 255, 255, 0.08);

    /* Spacing & Radii */
    --radius-button: 6px;
    --radius-thumb: 8px;
    --radius-pill: 999px;
    --hairline: 1px solid rgba(255, 255, 255, 0.08);

    /* Responsive Layout */
    --sidebar-width: clamp(280px, 42vw, 460px);
    --section-gap: clamp(40px, 8vh, 60px);
}

/* ========================================
   GLOBAL STYLES & RESET
   ======================================== */

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

html {
    margin: 0 auto;
    padding: 0;
    height: 100%;
    scroll-behavior: smooth;
    max-width: 1600px;
    width: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    font-family: var(--font-mono);
    margin: 0;
    padding: 0;
    height: 100%;
}

header {
    flex-shrink: 0;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1 {
    font-family: var(--font-sans);
    font-size: clamp(40px, 8vw, 64px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h3 {
    color: var(--accent);
    font-size: 13px;
    font-family: var(--font-mono);
    font-weight: 500;
}

h4 {
    font-family: var(--font-sans);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

p {
    color: var(--text-muted);
}

/* ========================================
   SIDEBAR & NAVIGATION
   ======================================== */

#sidebar {
    top: 0;
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 40px 32px;
    position: fixed;
    height: 100vh;
}

#sidebar .content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#sidebar h1 {
    margin-bottom: 0;
}

#sidebar h2 {
    margin-top: 0;
    color: var(--accent);
    margin-bottom: 10px;
}

#sidebar p {
    margin-top: 0;
}

/* Navigation list styles */
nav ul {
    list-style-type: none;
    margin-left: 0;
    padding-left: 0;
}

nav ul li {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

nav ul li a {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Decorative line before nav links */
nav ul li a::before {
    content: "";
    display: inline-block;
    height: 1px;
    width: 12px;
    background-color: var(--line-inactive);
    margin-right: 12px;
    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

nav ul li:not(.active) a:hover {
    color: var(--text-primary);
}

nav ul li.active a {
    color: var(--accent);
}

nav ul li.active a::before {
    width: 24px;
    background-color: var(--accent);
}

/* ========================================
   LINKS & ICONS
   ======================================== */

a {
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

#contact-links {
    margin-top: auto;
    display: flex;
}

#contact-links a {
    margin-right: 12px;
    color: var(--text-secondary);
}

/* Icon link styling using CSS masks */
.icon-link {
    display: inline-block;
    width: 24px;
    height: 24px;
    overflow: hidden;
    text-indent: -9999px;
    white-space: nowrap;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-link:hover {
    color: var(--accent);
}

.github {
    -webkit-mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/brand-github.svg");
    mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/brand-github.svg");
}

.linkedin {
    -webkit-mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/brand-linkedin.svg");
    mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/brand-linkedin.svg");
}

.email {
    -webkit-mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/mail.svg");
    mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/mail.svg");
}

/* ========================================
   MAIN LAYOUT
   ======================================== */

main {
    flex: 1;
    min-width: 0;
    padding: 40px 32px;
    margin-left: var(--sidebar-width);
}

/* ========================================
   SECTIONS
   ======================================== */

#about {
    color: var(--text-secondary);
    margin-bottom: var(--section-gap);
}

#projects {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: var(--section-gap);
}

#contact {
    margin-top: var(--section-gap);
    margin-bottom: var(--section-gap);
}

/* ========================================
   PROJECT BOX COMPONENT
   ======================================== */

.project-box {
    border: var(--hairline);
    border-radius: 12px;
    display: flex;
    align-items: center;
    padding: 24px;
    background-color: var(--bg-elevated);
    transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-right {
    flex-direction: row-reverse;
}

.project-box h4 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 0;
    margin-top: 0;
}

.project-box p {
    margin: 5px 0;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.thumbnail {
    margin: auto 0;
    margin-right: 24px;
    height: 130px;
    border-radius: var(--radius-thumb);
}

.descriptors {
    display: flex;
    color: var(--text-secondary);
    font-size: 12px;
    gap: 8px;
}

/* Bullet separator between descriptors */
.descriptors p:not(:first-child)::before {
    content: "•";
    margin-right: 8px;
}

/* ========================================
   GRID CARD COMPONENT
   ======================================== */

#project-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.grid-card {
    flex: 0 0 calc(50% - 15px);
    box-sizing: border-box;
    border: var(--hairline);
    border-radius: 12px;
    padding: 24px;
    background-color: var(--bg-elevated);
    transition: border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.grid-card h4 {
    margin: 0;
    margin-top: 5px;
}

.grid-card p {
    margin: 5px 0;
}

.cards-mobile {
    display: flex;
    flex-direction: column;
}

.top-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.folder {
    -webkit-mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/folder.svg");
    mask-image: url("https://unpkg.com/@tabler/icons@latest/icons/outline/folder.svg");
}

/* ========================================
   PILL & TAG COMPONENT
   ======================================== */

.pills {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    color: var(--accent);
    background-color: var(--accent-soft);
    border-radius: var(--radius-pill);
    padding: 3px 9px;
    font-size: 13px;
    font-weight: 400;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ========================================
   FOOTER & CTA
   ======================================== */

#archive {
    margin-top: 15px;
    text-align: center;
    font-size: 13px;
}

#contact-btn {
    font-size: 14px;
    color: var(--accent);
    padding: 12px 24px;
    background-color: var(--bg);
    border: 1px solid var(--accent);
    border-radius: var(--radius-button);
    transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-block;
    margin-top: 10px;
}

footer {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

#contact-links-footer {
    display: none;
}

/* ========================================
   HOVER EFFECTS
   ======================================== */

.project-box:hover {
    border: 1px solid var(--accent);
}

.grid-card:hover {
    border: 1px solid var(--accent);
}

#contact-btn:hover {
    background-color: var(--accent);
    color: var(--bg);
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* ========================================
   MOBILE RESPONSIVE (max-width: 950px)
   ======================================== */

@media (max-width: 950px) {
    /* Layout adjustments */
    body {
        flex-direction: column;
    }

    main {
        margin-left: 0;
        padding: 16px 20px;
    }

    /* Transform sidebar to horizontal header */
    #sidebar {
        display: flex;
        width: 100%;
        max-height: 100px;
        border-right: 0;
        flex-direction: row;
        position: static;
        padding: 8px 30px;
    }

    #sidebar .content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        gap: 12px;
    }

    h1 {
        margin: 0;
        flex-shrink: 0;
    }

    /* Header text styling on mobile */
    .header-blurb {
        display: flex;
        flex-direction: column;
        gap: 2px;
        justify-content: center;
    }

    .header-blurb h2 {
        font-size: clamp(12px, 2.5vw, 18px);
        margin: 0;
        line-height: 1.2;
    }

    .header-blurb p {
        font-size: clamp(10px, 2vw, 14px);
        margin: 0;
        color: var(--text-secondary);
        line-height: 1.2;
    }

    nav {
        display: none;
        width: 100%;
    }

    #about h3 {
        margin-top: 0;
    }

    #skill-pills {
        line-height: 30px;
    }

    /* Mobile project box layout */
    .project-box {
        padding: 20px;
        flex-direction: column;
    }

    .project-box h4 {
        font-size: 24px;
        font-weight: 700;
        margin-top: 0;
        margin-bottom: 0;
    }

    .project-header {
        margin-bottom: 12px;
    }

    .thumbnail {
        display: block;
        margin: 0 auto;
        width: 100%;
        height: auto;
        margin-bottom: 20px;
    }

    /* Mobile grid card layout */
    .grid-card {
        padding: 0 20px;
    }

    .grid-card h4 {
        margin: 0;
        margin-top: 20px;
    }

    #project-cards {
        gap: 30px;
        flex-direction: column;
    }

    .cards-mobile {
        flex-direction: row-reverse;
        justify-content: space-between;
        align-items: center;
        margin-top: 20px;
    }

    .cards-mobile h4 {
        margin: 0;
    }

    .top-card {
        gap: 15px;
    }

    /* Hide desktop sidebar links, show footer links */
    #contact-links {
        display: none;
    }

    footer {
        display: flex;
        justify-content: space-between;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    #contact-links-footer {
        display: flex;
        transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #contact-link-footer {
        color: var(--accent);
    }
}
