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

:root {
    --color-bg: #0f1117;
    --color-bg-alt: #161b27;
    --color-surface: #1e2433;
    --color-border: #2a3147;
    --color-text: #cdd6f4;
    --color-text-muted: #6c7a9e;
    --color-heading: #ffffff;
    --color-accent: #89b4fa;
    --color-accent-hover: #b4d0fb;
    --color-nav-bg: rgba(15, 17, 23, 0.85);
    --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Fira Code', 'Cascadia Code', monospace;
    --max-width: 1000px;
    --nav-height: 64px;
}

[data-theme="light"] {
    --color-bg: #f5f7ff;
    --color-bg-alt: #eaecf7;
    --color-surface: #dde1f5;
    --color-border: #c8cde8;
    --color-text: #1e2433;
    --color-text-muted: #525c78;
    --color-heading: #0f1117;
    --color-accent: #1d6feb;
    --color-accent-hover: #1558c4;
    --color-nav-bg: rgba(245, 247, 255, 0.88);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    transition: background-color 0.3s, color 0.3s;
}

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

a:hover {
    color: var(--color-accent-hover);
}

/* ── Nav ── */

.nav-header {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: var(--color-nav-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-accent);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

/* ── Theme toggle ── */

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font-mono);
    padding: 0 0.65rem;
    height: 34px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

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

.theme-toggle-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.nav-links a {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.nav-links a:hover {
    color: var(--color-accent);
}

/* ── Sections ── */

.section {
    padding: 6rem 2rem;
}

.section-alt {
    background-color: var(--color-bg-alt);
}

.section-container {
    max-width: var(--max-width);
    margin: 0 auto;
}

.section-center {
    text-align: center;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
    margin-top: 0.4rem;
    opacity: 0.5;
}

/* ── Hero ── */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: calc(var(--nav-height) + 2rem) 2rem 2rem;
}

.hero-content {
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

.hero-greeting {
    font-family: var(--font-mono);
    color: var(--color-accent);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.hero-name {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--color-heading);
}

.hero-title {
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.hero-bio {
    max-width: 540px;
    margin-top: 1.5rem;
    color: var(--color-text-muted);
    font-size: 1.05rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

/* ── Buttons ── */

.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-bg);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    color: var(--color-bg);
}

.btn-secondary {
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
}

.btn-secondary:hover {
    background-color: rgba(137, 180, 250, 0.1);
}

/* ── About ── */

.about-grid {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 4rem;
    align-items: center;
}

.about-text p {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.about-image {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    border: 3px solid var(--color-border);
    overflow: hidden;
    flex-shrink: 0;
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* ── Projects ── */

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

.project-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Preview */

.project-preview {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 7;
    overflow: hidden;
    background-color: var(--color-bg);
    flex-shrink: 0;
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    display: block;
    transition: transform 0.3s;
}

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

.project-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-family: var(--font-mono);
    opacity: 0;
    transition: opacity 0.2s;
}

.project-card:hover .project-preview-overlay {
    opacity: 1;
}

.project-preview--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    border-bottom: 1px solid var(--color-border);
    background: repeating-linear-gradient(
        -45deg,
        var(--color-bg),
        var(--color-bg) 8px,
        var(--color-surface) 8px,
        var(--color-surface) 16px
    );
}

/* Body */

.project-body {
    padding: 1.25rem 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-grow: 1;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-heading);
}

.project-desc {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.project-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.project-tags li {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--color-accent);
    background-color: rgba(137, 180, 250, 0.1);
    padding: 0.15rem 0.55rem;
    border-radius: 3px;
}

/* Footer */

.project-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-private {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
}

.project-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-left: auto;
}

.project-action-link {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
}

.project-action-link:hover {
    color: var(--color-accent);
}

.project-action-btn {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    background-color: var(--color-accent);
    color: var(--color-bg);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.project-action-btn:hover {
    background-color: var(--color-accent-hover);
    color: var(--color-bg);
}

/* ── Testimonials ── */

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.testimonial-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-accent);
    border-radius: 6px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.testimonial-project-ref {
    display: inline-block;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--color-accent);
    margin-bottom: 0.75rem;
}

.testimonial-project-ref:hover {
    color: var(--color-accent-hover);
}

.testimonial-quote {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.7;
    flex-grow: 1;
}

.testimonial-quote::before {
    content: '\201C';
    font-size: 2rem;
    color: var(--color-accent);
    line-height: 0;
    vertical-align: -0.5rem;
    margin-right: 0.15rem;
    font-style: normal;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.testimonial-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.testimonial-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-heading);
}

.testimonial-role {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--color-text-muted);
}

/* ── Skills ── */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.skill-group h3 {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

.skill-group ul {
    list-style: none;
}

.skill-group li {
    padding: 0.35rem 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--color-border);
}

/* ── Contact ── */

.contact-text {
    color: var(--color-text-muted);
    max-width: 460px;
    margin: 0 auto 2rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

/* ── Footer ── */

.footer {
    text-align: center;
    padding: 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border);
}

/* ── Hamburger ── */

.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    width: 38px;
    height: 38px;
    padding: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s;
}

.nav-hamburger:hover {
    border-color: var(--color-accent);
}

.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--color-text-muted);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s, background-color 0.2s;
}

.nav-hamburger:hover span {
    background-color: var(--color-accent);
}

/* Hamburger → X when open */
.nav-header.nav-open .nav-hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-header.nav-open .nav-hamburger span:nth-child(2) {
    opacity: 0;
}
.nav-header.nav-open .nav-hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Only apply card hover lift on pointer devices */
@media (hover: hover) {
    .project-card:hover {
        transform: translateY(-4px);
        border-color: var(--color-accent);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    }
    .project-card:hover .project-img {
        transform: scale(1.03);
    }
    .project-card:hover .project-preview-overlay {
        opacity: 1;
    }
}

/* ── Tablet  (≤ 768px) ── */

@media (max-width: 768px) {

    /* Nav — collapse to hamburger */
    .nav-hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background-color: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        padding: 0 1.5rem;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        z-index: 99;
    }

    .nav-header.nav-open .nav-links {
        max-height: 320px;
        padding: 0.5rem 1.5rem 1rem;
    }

    .nav-links li {
        border-bottom: 1px solid var(--color-border);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block;
        padding: 0.85rem 0;
        font-size: 1rem;
    }

    /* Sections */
    .section {
        padding: 4rem 1.25rem;
    }

    .section-title {
        margin-bottom: 2rem;
    }

    /* About */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-image {
        width: 180px;
        height: 180px;
        margin: 0 auto;
    }

    /* Skills */
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* ── Mobile (≤ 480px) ── */

@media (max-width: 480px) {

    /* Nav */
    .nav-container {
        padding: 0 1rem;
    }

    .nav-logo {
        font-size: 1rem;
    }

    /* Hero */
    .hero {
        padding: calc(var(--nav-height) + 1.5rem) 1.25rem 2rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-actions .btn {
        width: 100%;
        text-align: center;
    }

    /* Sections */
    .section {
        padding: 3rem 1rem;
    }

    /* Projects — full-width cards */
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .project-actions {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .project-action-btn {
        flex: 1;
        text-align: center;
    }

    /* Skills — single column */
    .skills-grid {
        grid-template-columns: 1fr;
    }

    /* Contact */
    .btn-primary {
        width: 100%;
        text-align: center;
    }

    .social-links {
        gap: 1.25rem;
    }

    /* Theme toggle — hide label on small screens except in Auto mode */
    .theme-toggle-label {
        display: none;
    }

    .theme-toggle {
        width: 38px;
        justify-content: center;
        padding: 0;
    }

    .theme-toggle[data-mode="auto"] {
        width: auto;
        padding: 0 0.6rem;
    }

    .theme-toggle[data-mode="auto"] .theme-toggle-label {
        display: inline;
    }
}
