/* CSS Variables for Colors */
:root {
    /* Monochrome palette */
    --primary-color: #f5f5f5;
    --secondary-color: #e5e7eb;
    --accent-color: #ffffff;
    
    /* Background Colors */
    --bg-primary: #09090b;
    --bg-secondary: #111113;
    --bg-article: #18181b;
    --bg-footer: #050506;
    --bg-ask-start: #18181b;
    --bg-ask-end: #0f0f11;
    --bg-chat-overlay: rgba(255, 255, 255, 0.025);
    --bg-transparent: transparent;
    
    /* Text Colors */
    --text-primary: #f4f4f5;
    --text-secondary: #c4c4c9;
    --text-light: #ffffff;
    --text-muted: #a1a1aa;
    
    /* Link Colors */
    --link-color: #f4f4f5;
    --link-hover: #d4d4d8;
    
    /* Form Colors */
    --input-border: #3f3f46;
    --input-focus: #e4e4e7;
    --button-bg: #f4f4f5;
    --button-hover: #d4d4d8;
    
    /* Border Colors */
    --border-color: #3f3f46;
    --border-accent: #52525b;
    
    /* Shadow Colors */
    --shadow-light: rgba(0, 0, 0, 0.25);
    --shadow-medium: rgba(0, 0, 0, 0.55);
    --shadow-focus: rgba(244, 244, 245, 0.16);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    display: grid;
    grid-template-areas:
        "main main main"
        "footer footer footer";
    grid-template-columns: 1fr minmax(auto, 1200px) 1fr;
    grid-template-rows: 1fr auto;
    min-height: 100vh;
}

.ambient-network {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    z-index: 0;
}

/* Main Content */
main {
    grid-area: main;
    position: relative;
    z-index: 1;
    padding: 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

main > h1,
main > h2 {
    text-align: center;
}

h1 {
    color: var(--primary-color);
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.06em;
}

h2 {
    color: var(--secondary-color);
    font-size: 2rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-accent);
}

.section-heading {
    font-size: 1.6rem;
    margin: 1.25rem 0 0.65rem;
    padding-bottom: 0.35rem;
}

h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 1.5rem 0 1rem;
}

h4 {
    color: var(--accent-color);
    font-size: 1.25rem;
    margin: 1rem 0 0.5rem;
}

h5 {
    color: var(--text-muted);
    font-size: 1rem;
    font-style: italic;
    margin: 0.5rem 0;
}

p {
    color: var(--text-secondary);
    margin: 0.75rem 0;
}

h1,
h2,
h3,
h4,
h5,
.education-date,
.about-links a {
    font-family: 'IBM Plex Mono', 'Consolas', monospace;
}

/* Sections */
section {
    margin: 3rem 0;
    padding: 2rem;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow-light);
}

section#overview {
    display: flex;
    flex-wrap: nowrap;
    gap: 2rem;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

section#overview > section {
    margin: 0;
    min-width: 0;
    background-color: var(--bg-transparent);
    border-radius: 0;
    box-shadow: none;
}

section#overview > #about {
    flex: 1 1 0;
}

section#overview > #background {
    flex: 1 1 0;
}

.about-headshot {
    float: left;
    display: grid;
    place-items: center;
    width: clamp(14rem, 48%, 18rem);
    aspect-ratio: 1;
    margin: 0 1.25rem 1rem 0;
}

.about-headshot img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 0;
    object-fit: cover;
}

#about > p {
    font-size: 1.05rem;
    line-height: 1.75;
}

section#about,
section#background,
section#experience,
section#projects,
section#linkedin {
    background-color: var(--bg-primary);
}

section#experience {
    padding: 1rem 0;
    box-shadow: none;
}

section#experience .experience-entry {
    margin: 0;
}

section#about > h2,
section#background > h2,
section#experience > h2,
section#projects > h2 {
    text-align: center;
}

section#featuredProjects,
section#otherProjects,
section#certifications,
section#linkedin {
    background-color: var(--bg-transparent);
    box-shadow: none;
    border-radius: 0;
    padding: 1rem 0;
    margin: 1rem 0;
}

section#experience,
section#linkedin {
    margin: 3rem 0;
    padding: 0;
}

section#experience > .section-heading,
section#linkedin > .section-heading {
    margin: 0 0 1rem;
}

main > h2.section-heading {
    margin: 3rem 0 1rem;
}

main > #certifications {
    margin-top: 0;
}

section#linkedin > h2 {
    text-align: center;
}

.linkedin-carousel {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.linkedin-carousel-track {
    display: flex;
    width: max-content;
    gap: 1.5rem;
    will-change: transform;
}

.linkedin-slide {
    flex: 0 0 clamp(320px, 38vw, 504px);
    width: clamp(320px, 38vw, 504px);
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.linkedin-slide:hover {
    transform: none;
    box-shadow: none;
}

.linkedin-slide iframe {
    display: block;
    width: 100%;
    height: 645px;
    border: 0;
    border-radius: 8px;
    background: #fff;
}

section#otherProjects,
section#certifications {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

section#otherProjects article,
section#certifications article {
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 280px;
    width: 100%;
    margin: 0;
    border-radius: 12px;
}

#certifications article {
    background-color: var(--bg-article);
    border: 0;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
}

#certifications article:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px var(--shadow-medium);
}

#certifications article > a {
    display: inline-block;
}

.cert-logo {
    display: block;
    width: 100%;
    max-width: 180px;
    max-height: 130px;
    height: auto;
    margin: 0 auto 1rem;
    object-fit: contain;
}

#certifications article h4 {
    margin: 0 0 0.75rem;
}

#experience article {
    min-width: 0;
    border-radius: 12px;
}

.about-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.about-links a {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--button-bg);
    border-radius: 999px;
    color: #09090b;
    background-color: var(--button-bg);
    font-weight: 600;
    text-decoration: none;
}

.about-links a:hover {
    background-color: var(--button-hover);
}

.cert-skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.cert-skills li {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.class-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
}

.class-skills li {
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Articles */
article {
    background-color: var(--bg-article);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 6px;
    border-left: 2px solid var(--border-accent);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

article:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

article header h4 {
    margin-top: 0;
}

#background .education-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

#background .education-entry {
    margin: 0;
    border-left: 1px solid var(--border-accent);
    border-radius: 8px;
    transition: box-shadow 0.2s ease;
}

#background .education-entry:hover {
    transform: none;
    box-shadow: 0 6px 18px var(--shadow-medium);
}

#background article .education-header,
#experience article .education-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

#background article .education-header h4,
#experience article .education-header h4 {
    flex: 1;
    margin-bottom: 0;
}

.education-date {
    flex: 0 0 auto;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    white-space: nowrap;
}

@media (max-width: 768px) {
    #background .education-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .about-headshot {
        width: clamp(8rem, 38%, 11rem);
        margin-left: 1rem;
    }
}

article div p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 1rem;
}

label {
    color: var(--text-primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    grid-area: footer;
    position: relative;
    z-index: 1;
    background-color: var(--bg-footer);
    color: var(--text-light);
    text-align: center;
    padding: 2rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-links a {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--button-bg);
    border-radius: 999px;
    color: #09090b;
    background-color: var(--button-bg);
    font-family: 'IBM Plex Mono', 'Consolas', monospace;
    font-weight: 600;
    text-decoration: none;
}

.footer-links a:hover {
    background-color: var(--button-hover);
}

footer p {
    color: var(--text-light);
    margin: 0;
}

/* Floating Ask Frame */
.ask-frame {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: min(360px, calc(100vw - 2rem));
    background: linear-gradient(150deg, var(--bg-ask-start), var(--bg-ask-end) 70%);
    border: 1px solid var(--border-accent);
    border-radius: 10px;
    box-shadow: 0 10px 24px var(--shadow-medium);
    padding: 1rem;
    z-index: 1200;
}

.ask-frame h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.ask-form {
    background: var(--bg-transparent);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.ask-form label {
    font-size: 0.95rem;
}

.chat-hint {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.chat-history {
    display: flex;
    flex-direction: column;
    max-height: 260px;
    min-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 0.6rem;
    background: var(--bg-chat-overlay);
}

.chat-message {
    display: flex;
    margin-bottom: 0.55rem;
}

.chat-message:last-child {
    margin-bottom: 0;
}

.chat-message.composer {
    margin-top: auto;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.bot {
    justify-content: flex-start;
}

.chat-bubble {
    margin: 0;
    padding: 0.45rem 0.65rem;
    border-radius: 10px;
    line-height: 1.4;
    max-width: 90%;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.92rem;
}

.chat-message.user .chat-bubble {
    background-color: var(--button-bg);
    color: var(--bg-primary);
    border-bottom-right-radius: 4px;
}

.chat-message.bot .chat-bubble {
    background-color: var(--bg-article);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    border-bottom-left-radius: 4px;
}

.chat-message.composer .chat-bubble {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
}

.chat-composer {
    border: 1px dashed var(--secondary-color);
    outline: none;
    cursor: text;
}

.chat-composer:focus {
    box-shadow: 0 0 0 3px var(--shadow-focus);
}

.chat-composer:empty::before {
    content: attr(data-placeholder);
    color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
    .ambient-network {
        display: none;
    }



    .linkedin-slide {
        flex-basis: min(504px, calc(100vw - 4rem));
        width: min(504px, calc(100vw - 4rem));
    }

    main {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    section {
        padding: 1rem;
    }
    
    article {
        padding: 1rem;
    }

    .linkedin-slide {
        flex-basis: min(82vw, 504px);
        width: min(82vw, 504px);
    }
}
