/* Portfolio redesign: restrained type, clear hierarchy, and responsive surfaces. */
:root {
    color-scheme: light;
    --bg-primary: #f6f7f9;
    --bg-secondary: #eef1f5;
    --bg-card: #ffffff;
    --text-primary: #171b24;
    --text-secondary: #596273;
    --accent: #2457d6;
    --accent-hover: #1744b3;
    --accent-gradient: linear-gradient(135deg, #2457d6, #537df0);
    --border: #dfe4ec;
    --nav-bg: rgba(255, 255, 255, 0.84);
    --surface-alt: #edf1f6;
    --shadow-soft: 0 16px 50px rgba(23, 37, 68, 0.08);
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    --font-code: ui-monospace, "SFMono-Regular", Consolas, monospace;
    --radius: 24px;
    --max-width: 1180px;
    --transition: 0.22s ease;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg-primary: #0d1118;
    --bg-secondary: #161d29;
    --bg-card: #1a2330;
    --text-primary: #f3f6fc;
    --text-secondary: #b5c0d0;
    --accent: #a8c0ff;
    --accent-hover: #d0dcff;
    --accent-gradient: linear-gradient(135deg, #759aff, #a5bcff);
    --border: #334052;
    --nav-bg: rgba(24, 33, 46, 0.88);
    --surface-alt: #121a26;
    --shadow-soft: 0 20px 55px rgba(0, 0, 0, 0.25);
}

html {
    scroll-padding-top: 110px;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.58;
}

body::before,
body::after {
    display: none;
}

.animate-on-scroll {
    opacity: 1;
    transform: none;
}

.js .animate-on-scroll:not(.visible) {
    opacity: 0;
    transform: translateY(18px);
}

body > * {
    position: relative;
}

a:focus-visible,
button:focus-visible,
.arch-item--clickable:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

.container {
    max-width: var(--max-width);
    padding-inline: 24px;
}

.section {
    padding: 108px 20px;
}

.section-title {
    font-size: clamp(2.6rem, 4.5vw, 4.5rem);
    line-height: 1.08;
    letter-spacing: -0.055em;
    text-align: left;
    font-weight: 720;
    margin-bottom: 12px;
}

.section-title::after {
    display: none;
}

.section-subtitle {
    text-align: left;
    max-width: 760px;
    margin: 0 0 42px;
    font-size: 1.08rem;
    line-height: 1.55;
}

.gradient-text {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--accent);
}

.btn {
    border-radius: 999px;
    min-height: 50px;
    padding: 12px 22px;
    border-width: 1px;
    font-size: 0.94rem;
    font-weight: 640;
    letter-spacing: -0.01em;
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #2457d6;
    border-color: #2457d6;
    color: #fff;
    box-shadow: 0 10px 25px rgba(36, 87, 214, 0.18);
}

.btn-primary:hover {
    background: #1744b3;
    border-color: #1744b3;
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(36, 87, 214, 0.24);
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* A floating, legible navigation layer. */
.header {
    top: 14px;
    left: 18px;
    right: 18px;
    max-width: 1240px;
    margin-inline: auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--nav-bg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px) saturate(150%);
    -webkit-backdrop-filter: blur(22px) saturate(150%);
}

.header.header--scrolled,
[data-theme="light"] .header.header--scrolled {
    background: var(--nav-bg);
    box-shadow: var(--shadow-soft);
}

.header.header--hidden {
    transform: none;
}

.header__inner {
    height: 64px;
    padding-inline: 22px;
}

.logo.gradient-text {
    color: var(--text-primary);
    font-size: 1.34rem;
    font-weight: 780;
    letter-spacing: -0.055em;
    white-space: nowrap;
}

.nav__list {
    gap: clamp(10px, 1.4vw, 23px);
    align-items: center;
}

.nav__link {
    font-size: 0.82rem;
    font-weight: 590;
    white-space: nowrap;
}

.nav__link::after {
    background: var(--accent);
    bottom: -8px;
    height: 2px;
}

.theme-toggle {
    width: 38px;
    height: 38px;
    background: var(--bg-secondary);
    border-color: var(--border);
    font-size: 1.1rem;
}

/* Name and portrait carry the first screen. */
.hero {
    min-height: min(820px, 100svh);
    padding: 136px 20px 82px;
    text-align: left;
    background: radial-gradient(circle at 75% 30%, rgba(96, 145, 255, 0.14), transparent 38%);
}

.hero::before,
.hero::after {
    display: none;
}

.hero__inner {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(290px, 0.78fr);
    align-items: center;
    gap: clamp(34px, 6vw, 100px);
}

.hero__copy {
    min-width: 0;
}

.hero__greeting {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-card);
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.035em;
    margin-bottom: 28px;
}

.hero__title {
    font-size: clamp(4.1rem, 7.4vw, 7.5rem);
    line-height: 0.96;
    letter-spacing: -0.075em;
    font-weight: 760;
    color: var(--text-primary);
    margin-bottom: 30px;
}

.hero__title span {
    color: var(--accent);
}

.hero__subtitle {
    max-width: 560px;
    margin: 0 0 30px;
    color: var(--text-secondary);
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    line-height: 1.55;
}

.hero__actions {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
}

.hero__portrait {
    position: relative;
    aspect-ratio: 0.86;
    max-height: 560px;
    border-radius: 34px;
    background: #d8e0e9;
    overflow: hidden;
    box-shadow: 0 28px 65px rgba(30, 47, 78, 0.18);
}

.hero__portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}

.hero__portrait-caption {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 15px;
    border-radius: 14px;
    background: rgba(13, 20, 29, 0.74);
    backdrop-filter: blur(12px);
    color: #fff;
    font-size: 0.79rem;
    font-weight: 600;
}

.hero__portrait-caption span {
    color: #c9d5e8;
}

/* Compact story and proof points. */
.about,
.video,
.experience,
.contact {
    background: var(--surface-alt);
}

.about__content {
    max-width: none;
}

.about__grid {
    display: block;
}

.about__info {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
    gap: 64px;
    align-items: center;
}

.about__text {
    color: var(--text-primary);
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    line-height: 1.65;
    letter-spacing: -0.025em;
}

.about__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.stat-card {
    min-height: 144px;
    align-items: flex-start;
    text-align: left;
    padding: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 19px;
}

.stat-card + .stat-card {
    border: 1px solid var(--border);
}

.stat-card:last-child {
    grid-column: 1 / -1;
    min-height: 112px;
}

.stat-card__number {
    font-size: 2.2rem;
    font-weight: 760;
    letter-spacing: -0.055em;
}

.stat-card__label {
    max-width: none;
    font-size: 0.85rem;
}

.skills__grid {
    gap: 14px;
}

.skill-category,
.video__card,
.timeline__card,
.contact__item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 6px 24px rgba(24, 39, 70, 0.035);
}

.skill-category {
    padding: 27px;
}

.skill-category:hover,
.video__card:hover,
.timeline__card:hover,
.contact__item:hover {
    transform: translateY(-3px);
    border-color: var(--border);
    box-shadow: var(--shadow-soft);
}

.skill-category__title {
    font-size: 1.08rem;
    letter-spacing: -0.025em;
}

.skill-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 0;
    border-radius: 8px;
    font-size: 0.8rem;
    padding: 6px 10px;
}

/* Featured work uses scale and placement, with abstract covers instead of fake screenshots. */
.projects__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.project-card {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--bg-card);
    box-shadow: 0 7px 26px rgba(24, 39, 70, 0.045);
    transition: transform 200ms ease, box-shadow 200ms ease;
}

.project-card:hover {
    transform: translateY(-4px);
    border-color: var(--border);
    box-shadow: var(--shadow-soft);
}

.project-card__placeholder {
    position: relative;
    height: 136px;
    border: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #e6edf8, #d4e0f4);
}

.project-card__placeholder::before {
    content: "";
    position: absolute;
    width: 240px;
    height: 240px;
    right: -44px;
    bottom: -145px;
    border: 44px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
}

.project-card__placeholder-icon {
    position: relative;
    z-index: 1;
    opacity: 1;
    font-size: 2.5rem;
    font-weight: 780;
    letter-spacing: -0.08em;
    color: #2b4f86;
}

.project-card:hover .project-card__placeholder-icon {
    opacity: 1;
    transform: none;
}

.project-card__body {
    padding: 26px;
    gap: 12px;
}

.project-card__tag--platform {
    border: 0;
    border-radius: 999px;
    background: var(--bg-secondary);
    font-size: 0.76rem;
    font-weight: 650;
}

.project-card__title {
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    line-height: 1.16;
    letter-spacing: -0.045em;
    font-weight: 720;
}

.project-card__description {
    font-size: 0.95rem;
}

.project-card__stack-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 7px;
}

.project-card__link {
    margin-top: 8px;
    min-height: 44px;
    padding-inline: 18px;
    font-size: 0.85rem;
}

.project-card--featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 410px;
    background: #142d57;
    border-color: #142d57;
}

.project-card--featured .project-card__placeholder {
    height: 100%;
    background: radial-gradient(circle at 26% 32%, #6ca9ff 0, #326fdc 37%, #17376d 100%);
}

.project-card--featured .project-card__placeholder::before {
    width: 280px;
    height: 280px;
    right: auto;
    left: 12%;
    bottom: 12%;
    border: 0;
    border-radius: 48px;
    transform: rotate(-14deg);
    background: repeating-conic-gradient(#fff 0% 25%, transparent 0% 50%) 50% / 50px 50px;
    opacity: 0.17;
}

.project-card--featured .project-card__placeholder-icon {
    font-size: clamp(7rem, 17vw, 13rem);
    color: #fff;
    text-shadow: 0 16px 44px rgba(8, 38, 94, 0.25);
}

.project-card--featured .project-card__body {
    justify-content: center;
    padding: clamp(30px, 5vw, 64px);
    gap: 20px;
}

.project-card--featured .project-card__title {
    color: #fff;
    font-size: clamp(3rem, 5vw, 5rem);
}

.project-card--featured .project-card__description {
    color: #d7e3f6;
    flex: 0;
    font-size: 1.14rem;
}

.project-card--featured .project-card__tag--platform,
.project-card--featured .project-card__stack-tag {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.project-card--featured .project-card__link {
    background: #fff;
    border-color: #fff;
    color: #17376d;
    box-shadow: none;
}

.project-card--featured .project-card__link:hover {
    background: #e6eeff;
}

.project-card--spotlight .project-card__placeholder {
    height: 215px;
}

.project-card--spotlight:nth-child(2) .project-card__placeholder {
    background: linear-gradient(135deg, #a5dce7, #5898bd);
}

.project-card--spotlight:nth-child(3) .project-card__placeholder {
    background: linear-gradient(135deg, #e7cfcc, #b8757c);
}

.project-card--spotlight .project-card__placeholder-icon {
    font-size: 5.2rem;
    color: rgba(255, 255, 255, 0.88);
}

.video__grid {
    gap: 18px;
}

.video__card {
    overflow: hidden;
}

.video__title {
    text-align: left;
    padding: 19px 20px;
    border: 0;
    background: var(--bg-card);
    font-size: 0.96rem;
}

.video__embed {
    border-radius: 0;
}

.code__diagram {
    margin-top: 40px;
}

.arch-layer {
    border-radius: 16px;
}

.arch-item {
    border-radius: 8px;
}

.code__examples pre,
.code__examples pre code.hljs {
    border-radius: 18px;
}

.experience__timeline {
    max-width: 900px;
}

.experience__timeline::before {
    background: var(--border);
}

.timeline__marker {
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--bg-primary);
}

.timeline__card {
    padding: 28px;
}

.timeline__title {
    font-size: 1.16rem;
    letter-spacing: -0.025em;
}

.timeline__period {
    font-size: 0.85rem;
    font-weight: 650;
}

.education__directions {
    color: var(--text-secondary);
}

.contact__grid {
    max-width: none;
}

.contact__info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.contact__item {
    min-height: 76px;
    padding: 18px 21px;
}

.contact__link {
    color: var(--text-primary);
}

.scroll-top {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

@media (max-width: 1080px) {
    .nav__list {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 22px;
        background: var(--nav-bg);
        box-shadow: var(--shadow-soft);
        backdrop-filter: blur(22px);
        flex-direction: column;
        gap: 0;
    }

    .nav__list.active {
        display: flex;
    }

    .nav__list li,
    .nav__link {
        width: 100%;
    }

    .nav__link {
        display: block;
        padding: 10px 16px;
        font-size: 0.93rem;
    }

    .nav-toggle {
        display: flex;
    }
}

@media (max-width: 860px) {
    .section {
        padding: 78px 16px;
    }

    .hero {
        min-height: auto;
        padding: 128px 16px 72px;
    }

    .hero__inner {
        grid-template-columns: 1fr 0.72fr;
        gap: 28px;
    }

    .hero__title {
        font-size: clamp(3.7rem, 8vw, 5.6rem);
    }

    .about__info {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .video__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .container {
        padding-inline: 4px;
    }

    .header {
        left: 10px;
        right: 10px;
        top: 10px;
    }

    .header__inner {
        padding-inline: 16px;
        height: 58px;
    }

    .hero {
        padding-top: 110px;
    }

    .hero__inner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .hero__title {
        font-size: clamp(3.6rem, 13vw, 5.5rem);
    }

    .hero__portrait {
        aspect-ratio: 1.1;
        max-height: 380px;
        border-radius: 24px;
    }

    .hero__portrait img {
        object-position: center 25%;
    }

    .hero__actions {
        flex-direction: row;
        align-items: stretch;
    }

    .hero__actions .btn {
        width: auto;
        max-width: none;
    }

    .section-title {
        font-size: clamp(2.3rem, 9vw, 3.4rem);
    }

    .about__stats,
    .skills__grid,
    .projects__grid,
    .video__grid,
    .contact__info {
        grid-template-columns: 1fr;
    }

    .stat-card:last-child {
        grid-column: auto;
    }

    .stat-card,
    .stat-card:last-child {
        min-height: 90px;
    }

    .project-card--featured {
        grid-column: auto;
        display: flex;
        min-height: 0;
    }

    .project-card--featured .project-card__placeholder {
        height: 230px;
    }

    .project-card--featured .project-card__placeholder-icon {
        font-size: 7rem;
    }

    .project-card--featured .project-card__body {
        padding: 26px;
    }

    .project-card--featured .project-card__title {
        font-size: 3rem;
    }

    .project-card--spotlight .project-card__placeholder {
        height: 170px;
    }
}

@media (max-width: 390px) {
    .hero__actions {
        flex-direction: column;
    }

    .hero__actions .btn {
        width: 100%;
    }

    .hero__portrait-caption span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .header {
        background: var(--bg-card);
        backdrop-filter: none;
    }
}

@media (prefers-contrast: more) {
    .header,
    .project-card,
    .skill-category,
    .timeline__card {
        border-color: var(--text-primary);
    }
}
