:root {
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --container: 1180px;
    --shadow-dark: 0 20px 60px rgba(0, 0, 0, 0.35);
    --shadow-light: 0 20px 50px rgba(15, 23, 42, 0.08);
    --transition: 0.3s ease;
}

body[data-theme="dark"] {
    --bg: #05070b;
    --bg-soft: #0b1220;
    --card: rgba(255, 255, 255, 0.04);
    --card-strong: rgba(255, 255, 255, 0.08);
    --text: #f8fbff;
    --muted: #9fb0c7;
    --line: rgba(148, 163, 184, 0.14);
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.16);
    --accent-soft-2: rgba(96, 165, 250, 0.12);
    --success: #60a5fa;
    --topbar-bg: rgba(5, 7, 11, 0.72);
    --footer-bg: rgba(255, 255, 255, 0.02);
    --tag-bg: rgba(255, 255, 255, 0.04);
    --btn-secondary-bg: rgba(255, 255, 255, 0.03);
    --btn-secondary-hover: rgba(255, 255, 255, 0.08);
    --hero-bg:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.2), transparent 30%),
        radial-gradient(circle at top right, rgba(96, 165, 250, 0.12), transparent 25%),
        linear-gradient(180deg, #04060a 0%, #0a101b 100%);
    --shadow: var(--shadow-dark);
}

body[data-theme="light"] {
    --bg: #eef4fb;
    --bg-soft: #ffffff;
    --card: rgba(255, 255, 255, 0.82);
    --card-strong: rgba(255, 255, 255, 0.94);
    --text: #0f172a;
    --muted: #526277;
    --line: rgba(15, 23, 42, 0.08);
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --accent-soft-2: rgba(96, 165, 250, 0.08);
    --success: #2563eb;
    --topbar-bg: rgba(255, 255, 255, 0.74);
    --footer-bg: rgba(255, 255, 255, 0.55);
    --tag-bg: rgba(15, 23, 42, 0.035);
    --btn-secondary-bg: rgba(15, 23, 42, 0.04);
    --btn-secondary-hover: rgba(15, 23, 42, 0.08);
    --hero-bg:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.1), transparent 30%),
        radial-gradient(circle at top right, rgba(147, 197, 253, 0.1), transparent 26%),
        linear-gradient(180deg, #f8fbff 0%, #eaf1f9 100%);
    --shadow: var(--shadow-light);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--hero-bg);
    color: var(--text);
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-shell {
    min-height: 100vh;
}

.container {
    width: min(calc(100% - 40px), var(--container));
    margin: 0 auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(14px);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--line);
    transition: background var(--transition), border-color var(--transition);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
    gap: 20px;
    position: relative;
}

.logo {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #1d4ed8, #60a5fa);
    color: white;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    z-index: 3;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3;
}

.nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav a,
.project-link,
.footer-links a {
    position: relative;
    display: inline-block;
}

.nav a {
    padding-bottom: 4px;
    color: var(--muted);
    font-weight: 600;
}

.nav a:hover,
.project-link:hover,
.footer-links a:hover {
    color: var(--accent);
}

.nav a::after,
.project-link::after,
.footer-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.25s ease;
}

.nav a::after {
    bottom: 0;
    height: 2px;
}

.nav a:hover::after,
.project-link:hover::after,
.footer-links a:hover::after {
    width: 100%;
}

.nav-toggle,
.theme-toggle {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--line);
    background: var(--btn-secondary-bg);
    color: var(--text);
    border-radius: 14px;
}

.nav-toggle {
    display: none;
    cursor: pointer;
    position: relative;
    transition:
        background var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.theme-toggle {
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition:
        background var(--transition),
        color var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.nav-toggle:hover,
.theme-toggle:hover {
    transform: translateY(-2px);
    background: var(--btn-secondary-hover);
}

.nav-toggle span {
    position: absolute;
    left: 50%;
    width: 20px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    transform: translateX(-50%);
    transition: transform 0.25s ease, opacity 0.25s ease, top 0.25s ease;
}

.nav-toggle span:nth-child(1) {
    top: 18px;
}

.nav-toggle span:nth-child(2) {
    top: 25px;
}

.nav-toggle span:nth-child(3) {
    top: 32px;
}

.nav-toggle.is-active span:nth-child(1) {
    top: 25px;
    transform: translateX(-50%) rotate(45deg);
}

.nav-toggle.is-active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-active span:nth-child(3) {
    top: 25px;
    transform: translateX(-50%) rotate(-45deg);
}

.theme-icon {
    position: absolute;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    transition: opacity var(--transition), transform var(--transition);
}

.theme-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

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

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

body[data-theme="light"] .theme-icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}

body[data-theme="light"] .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.hero {
    padding: 72px 0 40px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 32px;
    align-items: center;
}

.hero-text,
.hero-card,
.info-card,
.skill-card,
.project-card,
.cta-box {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero-text {
    padding: 42px;
    border-radius: var(--radius-xl);
}

.eyebrow,
.section-label {
    display: inline-block;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero-text h1 {
    font-size: clamp(2.7rem, 6vw, 5.4rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
    margin-bottom: 20px;
    max-width: 12ch;
}

.hero-text h1 span {
    color: var(--accent);
}

.hero-description {
    max-width: 58ch;
    color: var(--muted);
    font-size: 1.08rem;
    margin-bottom: 28px;
}

.hero-tags,
.hero-actions,
.cta-actions,
.footer-links {
    display: flex;
    flex-wrap: wrap;
}

.hero-tags {
    gap: 12px;
    margin-bottom: 28px;
}

.hero-tags span {
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--tag-bg);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.95rem;
}

.hero-actions,
.cta-actions {
    gap: 14px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0 20px;
    border-radius: 12px;
    font-weight: 700;
    transition: 0.25s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    color: white;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.2), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-secondary {
    border: 1px solid var(--line);
    color: var(--text);
    background: var(--btn-secondary-bg);
}

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

.hero-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    padding: 20px;
    max-width: 520px;
    width: 100%;
    justify-self: center;
}

.hero-image-wrap {
    border-radius: 22px;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    margin-bottom: 18px;
    width: 100%;
}

.hero-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
}

.hero-card:hover .hero-image-wrap img {
    transform: scale(1.05);
}

.mini-card {
    padding: 18px;
    background: var(--tag-bg);
    border-radius: 18px;
    border: 1px solid var(--line);
}

.mini-label,
.section-text,
.info-card p,
.skill-card p,
.project-card p,
.cta-box p,
.footer p {
    color: var(--muted);
}

.mini-label {
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.mini-card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.section {
    padding: 42px 0;
}

.section-alt {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.section-heading {
    max-width: 820px;
    margin-bottom: 28px;
}

.section-heading h2,
.cta-box h2 {
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.section-heading h2 {
    margin-bottom: 14px;
}

.section-text {
    font-size: 1.04rem;
}

.about-grid,
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.info-card,
.skill-card,
.project-card {
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        background 0.25s ease,
        box-shadow 0.25s ease;
}

.info-card,
.skill-card {
    padding: 28px;
    border-radius: var(--radius-lg);
}

.skill-card {
    min-height: 220px;
}

.info-card:hover,
.skill-card:hover,
.project-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 130, 246, 0.35);
}

.info-card h3,
.skill-card h3 {
    font-size: 1.18rem;
    margin-bottom: 10px;
}

.skill-number {
    display: inline-flex;
    margin-bottom: 18px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
    font-size: 0.92rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 20px;
}

.project-card {
    padding: 28px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 280px;
    position: relative;
    overflow: hidden;
}

.project-card a {
    align-self: flex-start;
}

.project-card.featured {
    background:
        linear-gradient(180deg, var(--accent-soft), rgba(255, 255, 255, 0.03)),
        var(--card);
}

.project-top {
    margin-bottom: 18px;
}

.project-badge {
    display: inline-block;
    margin-bottom: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--tag-bg);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
}

.project-card h3 {
    font-size: 1.35rem;
    line-height: 1.2;
}

.project-card p {
    margin-bottom: 22px;
}

.project-link {
    width: fit-content;
    font-weight: 700;
    color: var(--accent);
}

.project-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, var(--accent-soft), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.project-card:hover {
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35);
}

.project-card:hover::after {
    opacity: 1;
}

.cta-section {
    padding-bottom: 80px;
}

.cta-box {
    border-radius: 32px;
    padding: 42px;
    text-align: center;
}

.cta-box h2 {
    margin-bottom: 16px;
}

.cta-box p {
    max-width: 700px;
    margin: 0 auto 26px;
}

.cta-actions {
    justify-content: center;
}

.footer {
    border-top: 1px solid var(--line);
    padding: 24px 0;
    background: var(--footer-bg);
    transition: background var(--transition), border-color var(--transition);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.footer-links {
    align-items: center;
    gap: 20px;
}

.footer-links a {
    color: var(--muted);
}

@media (max-width: 1100px) {
    .hero-grid,
    .about-grid,
    .skills-grid,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .hero-text h1 {
        max-width: 100%;
    }

    .hero-card {
        justify-self: center;
    }
}

@media (max-width: 768px) {
    .container {
        width: min(calc(100% - 24px), var(--container));
    }

    .topbar-inner {
        min-height: auto;
        padding: 14px 0;
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
    }

    .logo {
        width: 54px;
        height: 54px;
        border-radius: 16px;
    }

    .header-actions {
        gap: 10px;
    }

    .nav-toggle {
        display: inline-block;
    }

    .theme-toggle {
        width: 50px;
        height: 50px;
    }

    .nav {
        position: absolute;
        top: calc(100% + 10px);
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: var(--bg-soft);
        box-shadow: var(--shadow);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px);
        transition:
            opacity 0.25s ease,
            visibility 0.25s ease,
            transform 0.25s ease;
        z-index: 20;
    }

    .nav.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .nav a {
        width: 100%;
        padding: 14px 16px;
        border-radius: 12px;
    }

    .nav a::after {
        display: none;
    }

    .nav a:hover {
        background: var(--btn-secondary-bg);
    }

    .hero {
        padding: 24px 0;
    }

    .hero-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .hero-text {
        padding: 24px;
        border-radius: 24px;
    }

    .hero-text h1 {
        font-size: clamp(2.15rem, 10vw, 3.4rem);
        line-height: 1.02;
        margin-bottom: 18px;
    }

    .hero-description {
        font-size: 1rem;
        margin-bottom: 22px;
    }

    .hero-tags {
        gap: 10px;
    }

    .hero-tags span {
        font-size: 0.95rem;
        padding: 9px 13px;
    }

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

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

    .hero-card {
        width: 100%;
        max-width: 420px;
        margin: 0 auto;
        padding: 16px;
    }

    .hero-image-wrap {
        aspect-ratio: 4 / 4.8;
        margin-bottom: 16px;
    }

    .mini-card {
        padding: 16px;
    }

    .section {
        padding: 28px 0;
    }

    .section-heading {
        margin-bottom: 22px;
    }

    .section-heading h2,
    .cta-box h2 {
        font-size: clamp(1.8rem, 7vw, 2.5rem);
    }

    .info-card,
    .skill-card,
    .project-card,
    .cta-box {
        padding: 22px;
    }

    .projects-grid {
        gap: 16px;
    }

    .project-card {
        min-height: auto;
    }

    .project-card h3 {
        font-size: 1.6rem;
    }

    .project-card p {
        margin-bottom: 18px;
        font-size: 1rem;
    }

    .footer {
        padding: 24px 0 28px;
    }

    .footer-inner {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        gap: 14px;
    }

    .footer-links {
        justify-content: center;
        gap: 16px;
    }

    .footer-links a {
        font-size: 0.98rem;
    }
}

.contact-page {
    padding: 56px 0 80px;
}

.contact-grid {
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    gap: 24px;
    align-items: start;
}

.contact-info-card,
.contact-form-card {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 32px;
}

.contact-info-card h1 {
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.04em;
    margin-bottom: 18px;
}

.contact-lead {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 28px;
    max-width: 52ch;
}

.contact-info-list {
    display: grid;
    gap: 18px;
}

.contact-info-item {
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--tag-bg);
}

.contact-info-label {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}

.contact-info-item p,
.contact-info-item a {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.6;
    word-break: break-word;
}

.contact-form {
    display: grid;
    gap: 18px;
}

.form-row {
    display: grid;
    gap: 8px;
}

.form-row label {
    font-weight: 700;
    color: var(--text);
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--tag-bg);
    color: var(--text);
    color-scheme: dark light;
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
    color: var(--muted);
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.form-row textarea {
    resize: vertical;
    min-height: 160px;
}

.form-row select option {
    background: var(--bg-soft);
    color: var(--text);
}

body[data-theme="dark"] .form-row input,
body[data-theme="dark"] .form-row select,
body[data-theme="dark"] .form-row textarea {
    background: rgba(15, 23, 42, 0.72);
    color: #f8fbff;
}

body[data-theme="dark"] .form-row input::placeholder,
body[data-theme="dark"] .form-row textarea::placeholder {
    color: rgba(159, 176, 199, 0.88);
}

body[data-theme="dark"] .form-row input:-webkit-autofill,
body[data-theme="dark"] .form-row input:-webkit-autofill:hover,
body[data-theme="dark"] .form-row input:-webkit-autofill:focus,
body[data-theme="dark"] .form-row textarea:-webkit-autofill,
body[data-theme="dark"] .form-row textarea:-webkit-autofill:hover,
body[data-theme="dark"] .form-row textarea:-webkit-autofill:focus,
body[data-theme="dark"] .form-row select:-webkit-autofill,
body[data-theme="dark"] .form-row select:-webkit-autofill:hover,
body[data-theme="dark"] .form-row select:-webkit-autofill:focus {
    -webkit-text-fill-color: #f8fbff;
    -webkit-box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.96) inset;
    box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.96) inset;
    caret-color: #f8fbff;
    transition: background-color 9999s ease-out 0s;
}

.form-actions {
    padding-top: 6px;
}

.form-actions .btn {
    min-width: 180px;
}

.form-actions .btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.form-status {
    min-height: 24px;
    font-weight: 600;
}

.form-status.is-success {
    color: #16a34a;
}

.form-status.is-error {
    color: #dc2626;
}

@media (max-width: 900px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .contact-page {
        padding: 28px 0 40px;
    }

    .contact-info-card,
    .contact-form-card {
        padding: 22px;
    }

    .contact-info-card h1 {
        font-size: clamp(2rem, 9vw, 3rem);
    }

    .form-actions .btn {
        width: 100%;
    }
}
