:root {
    /* Default (matches light theme) */
    --bg-color: #f5f3ff; /* soft light purple background */
    --text-color: #111827; /* near-black slate */
    --highlight-text-color: #7c3aed; /* highlight important text */
    --card-bg-color: #ffffff;
    --pill-bg-color: #f3e8ff;
    --card-border-color: rgba(124, 58, 237, 0.18);
    --card-shadow-color: rgba(124, 58, 237, 0.14);

    /* Header background (slightly translucent to show page gradient) */
    --header-bg-color: rgba(245, 243, 255, 0.9);

    --accent-color: #7c3aed; /* violet accent for links/buttons */
    --accent-color-soft: rgba(124, 58, 237, 0.08);
    --accent-border-soft: rgba(124, 58, 237, 0.24);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #020617; /* very dark blue-slate */
        --text-color: #e5e7eb; /* light gray */
        --highlight-text-color: #7c3aed; /* highlight important text */
        --card-bg-color: #020617;
        --pill-bg-color: #1a1a2e;
        --card-border-color: rgba(148, 163, 184, 0.4);
        --card-shadow-color: rgba(0, 0, 0, 0.5);

        --header-bg-color: rgba(2, 6, 23, 0.2);

        --accent-color: #a855f7; /* slightly brighter violet for dark */
        --accent-color-soft: rgba(168, 85, 247, 0.12);
        --accent-border-soft: rgba(168, 85, 247, 0.4);
    }
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-color: #f5f3ff;
        --text-color: #111827;
        --highlight-text-color: #7c3aed;
        --card-bg-color: #ffffff;
        --card-border-color: rgba(124, 58, 237, 0.18);
        --card-shadow-color: rgba(124, 58, 237, 0.14);

        --header-bg-color: rgba(245, 243, 255, 0.9);

        --accent-color: #7c3aed;
        --accent-color-soft: rgba(124, 58, 237, 0.08);
        --accent-border-soft: rgba(124, 58, 237, 0.24);
    }
}

html {
    scroll-behavior: smooth;
    /* Ensure anchor targets are not hidden behind the sticky header */
    scroll-padding-top: 10rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-size: 20px;
    line-height: 1.6;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.14) 0, transparent 55%),
        radial-gradient(
            at 100% 100%,
            rgba(37, 99, 235, 0.18) 0,
            transparent 55%
        );
    background-attachment: fixed;
    color: var(--text-color);
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

main {
    margin: 0 4rem;
}

strong {
    color: var(--highlight-text-color);
    font-weight: bolder;
}

.details-content {
    height: 0;
    overflow: hidden;
    transition: height 0.5s ease;
}

header,
footer {
    /* max-width: 900px; */
    /* margin: 0 auto; */
    padding: 1.5rem 1.25rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    margin: 0 0 0.5em;
}

h1 {
    font-size: 2.2rem;
}

header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--header-bg-color);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--card-border-color);
    box-shadow: 0 10px 30px -24px var(--card-shadow-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem 0;
}

header > * {
    width: 100%;
    max-width: 900px;
    padding: 0 4rem;
}

h1 {
    margin: 0;
}

h2 {
    font-size: 1.6rem;
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
}

a:hover,
a:focus {
    text-decoration: none;
}

/* Animated underline that slides in from the left and out to the right */
a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.1em;
    width: 100%;
    height: 2px;
    background-color: var(--accent-color);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.25s ease-out;
}

a:hover::after,
a:focus::after {
    transform: scaleX(1);
    transform-origin: left;
}

nav ul {
    margin: 0;
    list-style: none;
    display: flex;
    gap: 20px;
    padding: 0;
}

nav a {
    font-weight: 600;
}

details {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: var(--accent-color-soft);
    border: 1px solid var(--accent-border-soft);
}

summary {
    cursor: pointer;
    font-weight: 600;
}

/* Smoothly reveal and hide details content */
details > *:not(summary) {
    display: block; /* override UA display:none so we can animate */
    opacity: 0;
    transform: translateY(-4px);
    max-height: 0;
    overflow: hidden;
    transition:
        opacity 0.5s ease,
        transform 0.5s ease,
        max-height 0.6s ease;
}

details[open] > *:not(summary) {
    opacity: 1;
    transform: translateY(0);
    max-height: 2000px; /* large enough for content */
}

iframe {
    margin-top: 0.75rem;
    border-radius: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.15);
}

ul {
    padding-left: 1.25rem;
}

section {
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 1.5rem 1.25rem;
    border: 1px solid var(--card-border-color);
    border-top: 3px solid var(--accent-border-soft);
    border-radius: 1rem;
    background: var(--card-bg-color);
    box-shadow: 0 18px 45px -25px var(--card-shadow-color);
    position: relative;
    overflow: hidden;
    transition:
        transform 0.16s ease-out,
        box-shadow 0.16s ease-out,
        border-color 0.16s ease-out;
}

section:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 60px -32px var(--card-shadow-color);
}

.pills-menu {
    justify-content: center;
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 0.8rem 0.4rem;
    margin: 0.75rem 0.25rem 0.75rem;
}

.menu-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--accent-border-soft);
    background: var(--pill-bg-color);
    color: var(--text-color);
    font-size: 1.1rem;
    cursor: pointer;
}

details .menu-pill {
    background: var(--card-bg-color);
    color: var(--text-color);
}

.menu-pill.is-active {
    background: var(--accent-color-soft);
    border-color: var(--accent-border-soft);
    color: var(--accent-color);
    font-weight: 600;
}

/* Shared panel animations for skills & projects */
.skills-panel,
.project-panel {
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(4px);
    transition:
        opacity 0.5s ease,
        transform 0.5s ease;
}

.skills-panel {
    margin-left: 2rem;
}

.skills-panel.is-active,
.project-panel.is-active {
    opacity: 1;
    transform: translateY(0);
}

footer {
    font-size: 0.9rem;
    color: var(--text-color);
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin-right: 1rem;
    margin-top: 1rem;
    border-radius: 999px;
    background: var(--accent-color-soft);
    color: var(--accent-color);
    font-size: 1rem;
}

.floating-contact-button {
    position: fixed;
    right: 1.75rem;
    bottom: 1.75rem;
    padding: 0.85rem 1.4rem;
    border-radius: 999px;
    border: none;
    background-image: linear-gradient(135deg, #7c3aed, #2563eb);

    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

/* Do not show the animated underline on the floating contact button */
.floating-contact-button::after {
    content: none;
}

.floating-contact-button:hover,
.floating-contact-button:focus {
    filter: brightness(1.5);
    text-decoration: none;
}

.floating-contact-button span {
    font-size: 1.05rem;
}

.floating-contact-icon {
    display: inline-flex;
    align-items: center;
}

[hidden] {
    display: none !important;
}

@media (max-width: 640px) {
    body {
        font-size: 18px;
        margin: 0;
    }

    header {
        position: relative;
    }

    header > * {
        padding: 0 1rem;
    }

    main,
    section,
    footer {
        padding: 1.25rem 1rem;
    }

    nav ul {
        flex-wrap: wrap;
        row-gap: 0.5rem;
    }

    .floating-contact-button {
        display: none;
    }
}
