:root {
    --bg: #f8fafc;
    --text: #334155;
    --link: #1d4ed8;
    --meta: #64748b;
    --border: #e2e8f0;
    --hover-bg: #f1f5f9;
}

/* Explicit Light Theme */
[data-theme="light"] {
    --bg: #f8fafc;
    --text: #334155;
    --link: #1d4ed8;
    --meta: #64748b;
    --border: #e2e8f0;
    --hover-bg: #f1f5f9;
}

/* Explicit Dark Theme */
[data-theme="dark"] {
    --bg: #0d1117;
    --text: #c9d1d9;
    --link: #58a6ff;
    --meta: #8b949e;
    --border: #31363c;
    --hover-bg: #161b22;
}

/* Default Dark if system preferred and no explicit theme set */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0d1117;
        --text: #c9d1d9;
        --link: #58a6ff;
        --meta: #8b949e;
        --border: #31363c;
        --hover-bg: #161b22;
    }
}

* {
    box-sizing: border-box;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.6;
    max-width: 700px;
    margin: 40px auto 80px auto;
    padding: 0 30px;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Background Styles */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.03), transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(139, 92, 246, 0.02), transparent 50%);
    z-index: -1;
    pointer-events: none;
    transition: background 0.5s ease;
}

[data-theme="dark"] .bg-glow {
    background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.05), transparent 55%),
        radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.03), transparent 55%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .bg-glow {
        background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.05), transparent 55%),
            radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.03), transparent 55%);
    }
}

header {
    margin-bottom: 50px;
}

.header-top {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.theme-btn {
    background: none;
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
    overflow: hidden;
    transition: background 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-btn:hover {
    background: var(--hover-bg);
}

.theme-btn:active {
    transform: scale(0.9);
}

.theme-btn span {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.theme-btn .sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.theme-btn .moon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-btn .sun {
    opacity: 1;
    transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-btn .moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.profile-container {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-img {
    width: 225px;
    height: 225px;
    border-radius: 50%;
    object-fit: cover;
    transition: transform 0.3s ease;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

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

.header-info {
    flex: 1;
}

.name-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 5px;
}

h1,
h2 {
    color: #0f172a;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2 {
    color: var(--text);
}

@media (prefers-color-scheme: dark) {

    :root:not([data-theme="light"]) h1,
    :root:not([data-theme="light"]) h2 {
        color: var(--text);
    }
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.03em;
}

.tagline {
    color: var(--meta);
    font-size: 1rem;
    margin: 0 0 15px 0;
}

.social-links {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.social-links a,
.social-links a:visited {
    color: var(--link);
    border: 1px solid rgba(29, 78, 216, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(29, 78, 216, 0.03);
}

.social-links a:hover,
.social-links a:focus,
.social-links a:active {
    border-color: var(--link) !important;
    color: #ffffff !important;
    background: var(--link) !important;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25);
    transform: translateY(-2px);
    text-decoration: none;
}

[data-theme="dark"] .social-links a,
[data-theme="dark"] .social-links a:visited {
    color: var(--link);
    border-color: rgba(88, 166, 255, 0.25);
    background: rgba(88, 166, 255, 0.03);
}

[data-theme="dark"] .social-links a:hover,
[data-theme="dark"] .social-links a:focus,
[data-theme="dark"] .social-links a:active {
    color: #0d1117 !important;
    background: var(--link) !important;
    border-color: var(--link) !important;
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.35);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .social-links a,
    :root:not([data-theme="light"]) .social-links a:visited {
        color: var(--link);
        border-color: rgba(88, 166, 255, 0.25);
        background: rgba(88, 166, 255, 0.03);
    }
    :root:not([data-theme="light"]) .social-links a:hover,
    :root:not([data-theme="light"]) .social-links a:focus,
    :root:not([data-theme="light"]) .social-links a:active {
        color: #0d1117 !important;
        background: var(--link) !important;
        border-color: var(--link) !important;
        box-shadow: 0 4px 12px rgba(88, 166, 255, 0.35);
    }
}

.main-text {
    margin: 40px 0;
    font-size: 1.05rem;
    color: var(--text);
}

.main-text p {
    margin-bottom: 20px;
}

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

h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 3.5rem;
    margin-bottom: 1.2rem;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

ul {
    list-style: none;
    padding: 0;
}

li {
    margin-bottom: 6px;
    display: flex;
    justify-content: flex-start;
    align-items: baseline;
    gap: 15px;
    padding: 8px 12px;
    border-radius: 6px;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

li:hover {
    background: var(--hover-bg);
    border-color: var(--border);
    transform: translateX(4px);
}

li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 3px;
    background: var(--link);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

li:hover::before {
    opacity: 1;
}

.item-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.item-link::after {
    content: "→";
    display: inline-block;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.item-link:hover {
    text-decoration: none;
}

.item-link:hover::after {
    transform: translateX(4px);
}

.item-meta {
    color: var(--meta);
    font-size: 0.85rem;
    min-width: 110px;
    font-family: monospace;
}

footer {
    margin-top: 120px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--meta);
    text-align: center;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #ffffff;
    margin: 40px auto;
    padding: 60px;
    width: 95%;
    max-width: 800px;
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="dark"] .modal-content {
    background: var(--bg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .modal-content {
        background: var(--bg);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-text {
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.8;
    font-size: 1.1rem;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 32px;
    cursor: pointer;
    color: var(--meta);
    transition: color 0.2s;
}

.close:hover {
    color: var(--text);
}

@media (max-width: 600px) {
    body {
        margin: 20px auto;
        padding: 0 20px;
    }

    .profile-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    li {
        flex-direction: column;
        gap: 5px;
    }

    .item-meta {
        min-width: unset;
    }

    .modal-content {
        padding: 30px;
        margin: 20px auto;
    }
}