/* Affine-inspired dark theme */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --text-primary: #ededed;
    --text-secondary: #a1a1a1;
    --text-muted: #666666;
    --accent-blue: #5AC8FA;
    --accent-green: #44FF9A;
    --accent-orange: #FF9B4E;
    --accent-purple: #BF5AF2;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(90, 200, 250, 0.15);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Links with accent colors */
a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast), opacity var(--transition-fast);
}

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

a:visited {
    color: var(--accent-purple);
}

/* Layout */
.container {
    margin-left: auto;
    margin-right: auto;
    padding-left: 24px;
    padding-right: 24px;
    max-width: 1100px;
}

@media (min-width: 992px) {
    .container {
        padding-left: 40px;
        padding-right: 40px;
    }
}

.row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

/* Header Section */
#dhead {
    margin-top: 60px;
    margin-bottom: 40px;
}

#dpic {
    grid-column: span 5;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#dpic img {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: 3px solid var(--border-card);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    object-fit: cover;
}

#dpic img:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-md), 0 0 40px rgba(90, 200, 250, 0.25);
}

#ddesc {
    padding-top: 30px;
    padding-left: 40px;
    grid-column: span 7;
}

@media (max-width: 991px) {
    #dhead {
        margin-top: 40px;
    }
    #dpic {
        grid-column: span 12;
        justify-content: center;
        text-align: center;
    }
    #ddesc {
        grid-column: span 12;
        padding-top: 24px;
        padding-left: 0;
        text-align: center;
    }
    #dpic img {
        width: 180px;
        height: 180px;
    }
}

h1 {
    font-size: 42px;
    font-weight: 600;
    padding: 0;
    margin: 0;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 17px;
    padding: 0;
    margin: 8px 0 16px 0;
    line-height: 1.5;
}

@media (min-width: 992px) {
    h2 {
        max-width: 340px;
    }
}

/* Tagline */
.tagline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 16px 0;
}

.tag {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.tag.role {
    background: rgba(90, 200, 250, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(90, 200, 250, 0.3);
}

.tag.skills {
    background: rgba(68, 255, 154, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(68, 255, 154, 0.25);
}

.tag.location {
    background: rgba(255, 155, 78, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(255, 155, 78, 0.25);
}

@media (max-width: 991px) {
    .tagline {
        justify-content: center;
    }
}

/* Social Icons */
#dico {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

@media (max-width: 991px) {
    #dico {
        justify-content: center;
    }
}

.iico {
    width: 36px;
    height: 36px;
    filter: invert(0.7);
    transition: filter var(--transition-fast), transform var(--transition-fast);
    cursor: pointer;
}

.iico:hover {
    filter: invert(1);
    transform: translateY(-2px);
}

#demail {
    margin-top: 12px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition-slow);
    font-family: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
    font-size: 14px;
}

/* Divider */
hr {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
    padding: 0;
    margin: 40px auto;
    border: 0;
    max-width: 600px;
}

/* Timeline Section */
#history {
    padding: 20px 0;
    position: relative;
}

.entry {
    margin-bottom: 8px;
}

.entry.row {
    display: grid;
    grid-template-columns: 80px 90px 1fr;
    gap: 0;
}

.ico {
    vertical-align: top;
    border-left: 2px solid var(--border-card);
    position: relative;
    padding-left: 16px;
    min-height: 100%;
}

.ico img {
    border-radius: 8px;
    width: 70px;
    height: auto;
    background: var(--bg-card);
    padding: 4px;
    transition: transform var(--transition-fast);
}

.ico img:hover {
    transform: scale(1.05);
}

.desc {
    vertical-align: top;
    font-size: 16px;
    padding-left: 24px;
    padding-bottom: 24px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.entry-dot {
    position: absolute;
    top: 0px;
    left: -7px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-blue);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 10px rgba(90, 200, 250, 0.4);
}

.timespan {
    font-size: 13px;
    text-align: right;
    padding-right: 12px;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Mobile timeline */
@media (max-width: 600px) {
    .entry.row {
        grid-template-columns: 1fr;
        gap: 0;
        padding-left: 24px;
        position: relative;
    }

    /* Continuous vertical line on mobile */
    #history::before {
        content: '';
        position: absolute;
        left: 39px;
        top: 20px;
        bottom: 40px;
        width: 2px;
        background: var(--border-card);
    }

    .timespan {
        text-align: left;
        padding-left: 24px;
        padding-bottom: 8px;
        font-size: 12px;
    }

    .ico {
        border-left: none;
        padding-left: 24px;
        padding-bottom: 12px;
    }

    .entry-dot {
        left: -24px;
    }

    .ico img {
        width: 60px;
    }

    .desc {
        padding-left: 24px;
        padding-bottom: 32px;
        font-size: 15px;
    }
}

/* Featured Projects Section */
.projects-section {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    margin-top: 20px;
}

#featured-projects {
    padding: 60px 0;
}

.ctitle {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 32px;
    margin-top: 0;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

#featured-projects .row {
    grid-column-gap: 20px;
    grid-row-gap: 20px;
    padding-bottom: 40px;
}

/* Project Cards */
.card {
    grid-column: span 4;
    vertical-align: top;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 16px;
    padding-bottom: 20px;
    transition: transform var(--transition-normal),
                box-shadow var(--transition-normal),
                border-color var(--transition-normal),
                background var(--transition-normal);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(90, 200, 250, 0.3);
    background: var(--bg-card-hover);
}

@media (max-width: 991px) {
    .card {
        grid-column: span 6;
    }
    #featured-projects .row {
        grid-column-gap: 16px;
        grid-row-gap: 16px;
    }
}

@media (max-width: 600px) {
    .card {
        grid-column: span 12;
    }
}

.card a {
    display: block;
}

.ccimg {
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 12px;
}

.card img {
    border-radius: 10px;
    width: 100%;
    transition: transform var(--transition-normal);
    display: block;
}

.card:hover img {
    transform: scale(1.03);
}

.cdesc {
    text-align: center;
    font-weight: 600;
    min-height: 28px;
    vertical-align: top;
    margin-bottom: 8px;
    font-size: 15px;
    color: var(--text-primary);
}

.pdesc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    text-align: center;
}

@media (max-width: 768px) {
    .cdesc {
        font-size: 15px;
        padding-bottom: 8px;
    }
    .pdesc {
        font-size: 13px;
    }
}

/* Additional Sections */
#pet-projects .row {
    grid-column-gap: 20px;
    grid-row-gap: 20px;
}

.project {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.pico {
    float: left;
    margin-right: 16px;
}

.pend {
    clear: both;
}

.pico img {
    height: 80px;
    border-radius: 8px;
    border: 1px solid var(--border-card);
}

.pub {
    font-size: 14px;
    border-left: 3px solid var(--accent-blue);
    padding: 4px 0px 4px 16px;
    margin-bottom: 12px;
    background: rgba(90, 200, 250, 0.05);
    border-radius: 0 8px 8px 0;
}

.pub-title {
    display: inline;
    color: var(--text-primary);
}

.pub-venue {
    display: inline;
    color: var(--accent-green);
}

.pub-authors {
    display: block;
    color: var(--accent-orange);
}

.tul {
    text-align: center;
    padding: 0;
}

.til {
    display: inline-block;
    padding: 4px 20px;
    margin-bottom: 8px;
}

.tilb {
    border-right: 1px solid var(--border-subtle);
}

.nodot {
    list-style-type: none;
    padding-left: 0;
}

/* Hidden assets */
.hassets {
    position: relative;
}

@media (max-width: 991px) {
    .hassets {
        display: none;
    }
}

.hasset {
    position: absolute;
    margin: 0;
    padding: 0;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Selection styling */
::selection {
    background: rgba(90, 200, 250, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(90, 200, 250, 0.3);
    color: var(--text-primary);
}
