/*
 * naderasadi.github.io
 * Adapted from somepago.github.io
 */

:root {
    /* Light palette — the default */
    --bg: #faf9f7;
    --text: #2c2c2c;
    --text-muted: #666;
    --link: #0066cc;
    --border: #e0e0e0;
    --code-bg: #f4f4f4;

    /* Dark palette — swapped in by the two rules at the bottom of this file */
    --dark-bg: #1a1a1a;
    --dark-text: #e0e0e0;
    --dark-text-muted: #999;
    --dark-link: #6db3f2;
    --dark-border: #333;
    --dark-code-bg: #252525;

    --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;
}

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

/* Theme toggle — a small half-filled circle pinned to the top right */
#theme-toggle {
    position: fixed;
    top: 1.4rem;
    right: 1.4rem;
    z-index: 10;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1.5px solid var(--text);
    border-radius: 50%;
    background: linear-gradient(to right, var(--text) 50%, var(--bg) 50%);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: opacity 0.2s;
}

#theme-toggle:hover { opacity: 0.5; }

#theme-toggle:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 3px;
}
/* Root size drives every rem in this file — change it to rescale the whole page. */
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Navigation */
nav {
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-right: 2rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

nav a:hover,
nav a.active { color: var(--text); }
nav a.active::before { content: '> '; }

/* Header */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 3rem;
}

.intro { flex: 1; }

h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* The dot is a divider, not content — dim it and give it a little extra air
   beyond the literal spaces around it in the markup. */
.tagline .sep {
    margin: 0 0.15em;
    opacity: 0.55;
}

.cursor {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

.links { display: flex; flex-wrap: wrap; gap: 1.5rem; }

.links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.links a:hover { color: var(--link); }
.links a::before { content: '['; }
.links a::after  { content: ']'; }

/* Profile image with hover swap (nasir.lol style) */
.portrait-container {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.portrait-container img {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.3s;
}

.portrait-container .portrait-hover { opacity: 0; }
.portrait-container:hover .portrait-default { opacity: 0; }
.portrait-container:hover .portrait-hover  { opacity: 1; }

/* Sections */
section { margin-bottom: 3rem; }

/* Section labels — small, tracked-out and muted so they read as signposts
   rather than headlines. Tracking has to grow as the size shrinks. */
h2 {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* About */
.about p {
    margin-bottom: 1rem;
    font-family: var(--font-sans);
    font-size: 1rem;
}

.about p:last-child { margin-bottom: 0; }

.about a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.about a:hover { border-bottom-color: var(--link); }

.contact {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
    font-family: var(--font-sans);
    font-size: 0.95rem;
}

.email {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background: var(--code-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

/* Products — collapsible rows built on native <details> */
.item-list {
    list-style: none;
    margin-top: 0.4rem;
    border-top: 1px solid var(--border);
}

.item-list li { border-bottom: 1px solid var(--border); }

.item-list summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.item-list summary::-webkit-details-marker { display: none; }

.item-list summary::after {
    content: '\25B8';
    margin-left: auto;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.7em;
}

.item-list details[open] > summary::after { content: '\25BE'; }

.row-title {
    flex: 1;
    font-size: 0.95rem;
}

.row-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.row-title a:hover { color: var(--link); }

.tag {
    flex-shrink: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.row-desc {
    margin-bottom: 0.2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

.media-reveal {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.45s ease;
}

.item-list details[open] > .media-reveal { max-height: 500px; }

.media-reveal video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin: 0.5rem 0 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--code-bg);
}

/* Papers */
.paper {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dotted var(--border);
}

.paper .year {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    width: 50px;
}

.paper-content { flex: 1; }

.paper-content .title {
    color: var(--text);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: color 0.2s;
    display: block;
}

.paper-content .title:hover { color: var(--link); }

.paper-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0;
    margin-top: 0.3rem;
    font-size: 0.8rem;
}

.paper-meta .venue { color: var(--text-muted); }

.paper-meta .award {
    color: #b8860b;
    margin-left: 0.5rem;
}

.paper-links {
    display: inline;
    margin-left: 0.5rem;
}

.paper-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    margin-right: 0.4rem;
    transition: color 0.2s;
}

.paper-links a::before { content: '['; }
.paper-links a::after  { content: ']'; }
.paper-links a:hover { color: var(--link); }

/* News */
.news ul { list-style: none; }

.news li {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.7rem;
    font-size: 0.9rem;
    font-family: var(--font-sans);
}

.news .date {
    flex-shrink: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    width: 90px;
}

.news a {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.news a:hover { border-bottom-color: var(--link); }

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 600px) {
    html { font-size: 15px; }
    .container { padding: 2rem 1.5rem; }

    .header-content {
        flex-direction: column-reverse;
        align-items: center;
        text-align: center;
    }

    .links { justify-content: center; }

    .portrait-container {
        width: 120px;
        height: 120px;
    }

    .portrait-container img {
        width: 120px;
        height: 120px;
    }

    .paper { flex-direction: column; gap: 0.3rem; }
    .paper .year { width: auto; }

    .item-list summary { gap: 0.5rem; }

    nav a { margin-right: 1rem; }

    .news li { flex-direction: column; gap: 0.2rem; }
    .news .date { width: auto; }
}

/*
 * Dark mode. Three states:
 *   no data-theme        -> follow the OS
 *   data-theme="light"   -> forced light, even on a dark OS
 *   data-theme="dark"    -> forced dark, even on a light OS
 * The toggle sets the attribute; see the script at the end of index.html.
 */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: var(--dark-bg);
        --text: var(--dark-text);
        --text-muted: var(--dark-text-muted);
        --link: var(--dark-link);
        --border: var(--dark-border);
        --code-bg: var(--dark-code-bg);
    }
}

:root[data-theme="dark"] {
    --bg: var(--dark-bg);
    --text: var(--dark-text);
    --text-muted: var(--dark-text-muted);
    --link: var(--dark-link);
    --border: var(--dark-border);
    --code-bg: var(--dark-code-bg);
}
