@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

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

/* Default theme variables on :root to prevent flash */
:root {
    --bg-primary: #2e3440;
    --bg-secondary: #3b4252;
    --bg-card: #434c5e;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #4c566a;
    --accent: #88c0d0;
    --accent-secondary: #81a1c1;
    --accent-tertiary: #5e81ac;
    --border-color: #4c566a;
    --link-color: #88c0d0;
    --link-hover: #8fbcbb;
    --tag-bg: #4c566a;
    --tag-text: #88c0d0;
}

html,
body {
    min-height: 100vh;
    background-color: var(--bg-primary);
}

body {
    transition:
        background-color 0.3s,
        color 0.3s;
}

/* ==================== */
/* Nord Theme           */
/* ==================== */
:root.theme-nord,
body.theme-nord {
    --bg-primary: #2e3440;
    --bg-secondary: #3b4252;
    --bg-card: #434c5e;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --text-muted: #4c566a;
    --accent: #88c0d0;
    --accent-secondary: #81a1c1;
    --accent-tertiary: #5e81ac;
    --border-color: #4c566a;
    --link-color: #88c0d0;
    --link-hover: #8fbcbb;
    --tag-bg: #4c566a;
    --tag-text: #88c0d0;
}

/* ==================== */
/* Terminal Dark Theme  */
/* ==================== */
:root.theme-terminal-dark,
body.theme-terminal-dark {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #666666;
    --accent: #ffffff;
    --accent-secondary: #aaaaaa;
    --accent-tertiary: #888888;
    --border-color: #333333;
    --link-color: #ffffff;
    --link-hover: #cccccc;
    --tag-bg: #222222;
    --tag-text: #ffffff;
}

/* ==================== */
/* Terminal Light Theme */
/* ==================== */
:root.theme-terminal-light,
body.theme-terminal-light {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-card: #eeeeee;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-muted: #999999;
    --accent: #000000;
    --accent-secondary: #555555;
    --accent-tertiary: #777777;
    --border-color: #cccccc;
    --link-color: #000000;
    --link-hover: #333333;
    --tag-bg: #dddddd;
    --tag-text: #000000;
}

/* ==================== */
/* Base Styles          */
/* ==================== */
.container {
    font-family:
        "Inter",
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 3rem 4rem;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    justify-content: flex-end;
}

.theme-switcher label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.theme-select {
    font-family: inherit;
    font-size: 0.85rem;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
}

.theme-select:hover {
    border-color: var(--accent);
}

.theme-select:focus {
    outline: none;
    border-color: var(--accent);
}

.theme-select option {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

/* ASCII Art (Braille) */
.ascii-art {
    font-family: "Courier New", Consolas, monospace;
    font-size: 10px;
    line-height: 1.45;
    color: var(--accent);
    margin-bottom: 1.5rem;
    white-space: pre;
    display: inline-block;
    overflow-x: auto;
    max-width: 100%;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Header Links (Social Icons) */
.header-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.header-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition:
        color 0.2s,
        transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.header-links svg {
    width: 1.5rem;
    height: 1.5rem;
}

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

section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.about p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* CV Link */
.cv-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--link-color);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 0.25rem;
    transition:
        background-color 0.2s,
        transform 0.2s;
    margin-top: 0.5rem;
}

.cv-link:hover {
    background: var(--bg-secondary);
    transform: translateY(-2px);
}

.cv-link svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Projects */
.project-card {
    background: var(--bg-card);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: transform 0.2s;
}

.project-card:hover {
    transform: translateY(-2px);
}

.project-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.project-title a {
    color: var(--link-color);
    text-decoration: none;
}

.project-title a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.stars {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.stars svg {
    width: 0.9rem;
    height: 0.9rem;
    color: var(--accent);
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}

/* Footer */
.footer {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition:
        color 0.2s,
        transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.footer-links svg {
    width: 1.5rem;
    height: 1.5rem;
}

.footer-text {
    margin-bottom: 0.25rem;
}

.footer-copy {
    color: var(--text-muted);
}

/* Desktop Layout */
@media (min-width: 900px) {
    .container {
        display: grid;
        grid-template-columns: 300px 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 0 3rem;
        padding: 3rem 4rem;
        max-width: 1200px;
        margin: 0 auto;
    }

    .theme-switcher {
        grid-column: 1 / -1;
        justify-content: flex-end;
        margin-bottom: 2rem;
    }

    .header {
        grid-column: 1;
        grid-row: 2;
        text-align: left;
        position: sticky;
        top: 3rem;
        align-self: start;
    }

    .header-links {
        justify-content: flex-start;
    }

    .ascii-art {
        font-size: 8px;
    }

    main {
        grid-column: 2;
        grid-row: 2;
    }

    .footer {
        grid-column: 1 / -1;
        grid-row: 3;
    }
}

/* Tablet */
@media (max-width: 899px) and (min-width: 601px) {
    .container {
        max-width: 700px;
        margin: 0 auto;
        padding: 2rem;
    }

    .header {
        text-align: center;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .container {
        padding: 2rem 1rem;
    }

    .header {
        text-align: center;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .ascii-art {
        font-size: 6px;
    }

    .theme-switcher {
        justify-content: center;
    }
}
