@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Space Mono', monospace;
}

:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --text: #1f2937;
    --muted: #4b5563;
    --border: #d1d5db;
    --header-bg: linear-gradient(135deg, #ff6f00 0%, #ffb74d 100%);
    --section-accent: #ffa726;
    --card-bg: #f9f9f9;
    --footer-bg: #111827;
    --footer-text: #f9fafb;
    --link-bg: rgba(255, 255, 255, 0.12);
    --link-border: rgba(255, 255, 255, 0.18);
}

html.theme-dark {
    color-scheme: dark;
    --bg: #0f172a;
    --surface: #111827;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.12);
    --header-bg: linear-gradient(135deg, #1f2937 0%, #4b5563 100%);
    --section-accent: #93c5fd;
    --card-bg: #111827;
    --footer-bg: #020617;
    --footer-text: #e2e8f0;
    --link-bg: rgba(255, 255, 255, 0.1);
    --link-border: rgba(255, 255, 255, 0.18);
}

html.theme-preload *,
html.theme-preload *::before,
html.theme-preload *::after {
    transition: none !important;
}

body {
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

header {
    position: relative;
    background: var(--header-bg);
    color: white;
    padding: 80px 20px 60px;
    text-align: center;
    overflow: hidden;
}

header nav {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    align-items: center;
}

header nav a {
    color: white;
    text-decoration: none;
    font-weight: 700;
}

.theme-switcher {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
}

.theme-track {
    display: inline-flex;
    position: relative;
    gap: 4px;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    padding: 4px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.14), 0 8px 20px rgba(0, 0, 0, 0.12);
}

.theme-slider {
    position: absolute;
    top: 4px;
    left: 0;
    width: 90px;
    height: calc(100% - 8px);
    border-radius: 999px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.12));
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, width 0.3s ease;
}

.theme-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 2;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
    font-weight: 700;
    min-width: 90px;
    padding: 10px 16px;
    margin: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    transition: color 0.2s ease;
}

.theme-option.active {
    color: #111827;
}

html.theme-dark .theme-option.active {
    color: #0f172a;
}

.theme-option:hover {
    color: #111827;
}

html.theme-dark .theme-option:hover {
    color: #0f172a;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
    background-color: var(--section-accent);
    color: var(--text);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s ease, color 0.2s ease;
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
    opacity: 0.95;
}

.theme-option {
    background-color: transparent;
}

.theme-option:hover,
.hamburger-menu:hover {
    opacity: 1;
}

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

section {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
}

section h2 {
    color: var(--section-accent);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--section-accent);
    padding-bottom: 10px;
}

section p + p {
    margin-top: 1.25rem;
}

.projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    background: var(--card-bg);
    transition: transform 0.3s, box-shadow 0.3s;
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.project-card h3 {
    color: var(--section-accent);
    margin-bottom: 10px;
}

footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--link-bg);
    border: 1px solid var(--link-border);
    color: white;
    text-decoration: none;
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.social-link:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}

.social-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    color: #111;
    font-size: 0.9rem;
    font-weight: 700;
}

.social-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.codewars-icon {
    background: linear-gradient(135deg, #b1361e 0%, #7f1d1d 100%);
    color: white;
}

/* Hamburger Menu */
.hamburger-menu {
    position: absolute;
    top: 18px;
    left: 18px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.2s ease;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hamburger-line {
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu[aria-expanded="true"] .hamburger-line {
    background: #111827;
}

html.theme-dark .hamburger-menu[aria-expanded="true"] .hamburger-line {
    background: white;
}

.hamburger-menu[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-menu[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Sidebar */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100%;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
}

.sidebar[aria-hidden="false"] {
    left: 0;
}

.sidebar-nav {
    padding: 72px 20px 24px;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 10px;
}

.sidebar-nav a {
    color: var(--text);
    text-decoration: none;
    display: block;
    padding: 10px 15px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.sidebar-nav a:hover {
    background: var(--card-bg);
}

.has-submenu > a::after {
    content: '\25B6';
    float: right;
    transition: transform 0.2s ease;
}

.has-submenu.open > a::after {
    transform: rotate(90deg);
}

.submenu {
    list-style: none;
    padding-left: 20px;
    margin-top: 5px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.has-submenu.open .submenu {
    max-height: 200px;
}

body.sidebar-open {
    overflow: hidden;
}

@media (max-width: 700px) {
    header {
        padding-top: 132px;
    }

    .theme-switcher {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: min(calc(100% - 32px), 360px);
    }

    .theme-track {
        display: flex;
        width: 100%;
    }

    .theme-option {
        min-width: 0;
        flex: 1 1 0;
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

