:root {
    --background: #091a1b;
    --surface: #183536;
    --surface-dark: #0a1719;
    --accent: #ca5959;
    --text: #f5f1e9;
    --muted: #a9bcba;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(ellipse at bottom, #102d2e 0%, var(--background) 62%),
        var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    overflow-x: hidden;
}

body > :not(#star-background) {
    position: relative;
    z-index: 1;
}

#star-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

a {
    color: inherit;
}

/* Navigation */

#TopBar {
    max-width: 1260px;
    margin: auto;
    padding: 27px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.site-name {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-decoration: none;
}

nav {
    display: flex;
    gap: 30px;
}

nav a {
    color: var(--muted);
    font-size: 0.9rem;
    text-decoration: none;
}

nav a:hover,
nav a:focus-visible {
    color: var(--text);
}

#language-toggle {
    background: transparent;
    border: 1px solid #54706e;
    color: var(--text);
    padding: 8px 11px;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
}

#language-toggle:hover,
#language-toggle:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

/* Main layout */

#content {
    max-width: 1260px;
    margin: auto;
    padding: 0 48px;
}

.section-block {
    border-top: 1px solid #3a5757;
    padding: 86px 0 102px;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    margin: 0 0 22px;
}

h1 {
    max-width: 750px;
    margin: 0 0 32px;
    font-size: clamp(3.7rem, 7.5vw, 7rem);
    letter-spacing: -0.065em;
    line-height: 0.98;
}

h1 span:not(.heading-prefix) {
    color: var(--accent);
    background: linear-gradient(
        90deg,
        #ca5959 0%,
        #ca5959 25%,
        #77282e 45%,
        #9d383c 58%,
        #ca5959 78%
    );
    background-size: 250% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: hero-text 7s linear infinite;
}

h2 {
    margin: 0 0 34px;
    font-size: clamp(2.7rem, 5vw, 4.5rem);
    letter-spacing: -0.055em;
    line-height: 1;
}

/* Introduction */

.intro {
    min-height: 585px;
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    align-items: center;
    gap: 80px;
}

.intro-text > p:not(.eyebrow) {
    max-width: 540px;
    color: var(--muted);
    font-size: 1.15rem;
    line-height: 1.6;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.button a {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    background: var(--accent);
    border: 1px solid var(--accent);
    color: var(--surface-dark);
    padding: 14px 18px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-decoration: none;
}

.button.secondary a {
    background: transparent;
    border-color: #54706e;
    color: var(--text);
}

.button a:hover,
.button a:focus-visible {
    background: var(--text);
    border-color: var(--text);
    color: var(--surface-dark);
}

.portrait-placeholder {
    position: relative;
    width: 100%;
    max-height: 380px;
    aspect-ratio: 4 / 5;
    background: #050909;
    border: 1px solid rgba(202, 89, 89, 0.45);
    display: grid;
    place-items: center;
}

.portrait-placeholder::before,
.portrait-placeholder::after {
    content: "";
    position: absolute;
    inset: -7px;
    border: 2px solid var(--accent);
    filter: drop-shadow(0 0 4px rgba(202, 89, 89, 0.65));
    pointer-events: none;
    animation: portrait-border 8s linear infinite;
}

.portrait-placeholder::after {
    border-color: #77282e;
    animation-delay: -4s;
}

.portrait-placeholder img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.portrait-main {
    transition: opacity 0.35s ease;
}

.portrait-hover {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.portrait-placeholder:hover .portrait-main {
    opacity: 0;
}

.portrait-placeholder:hover .portrait-hover {
    opacity: 1;
}

/* About */

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
}

.about-lead {
    max-width: 590px;
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.5;
}

.about-info {
    align-self: start;
    border-left: 3px solid var(--accent);
    padding: 4px 0 4px 24px;
}

.about-info h3 {
    color: var(--accent);
    margin: 0 0 12px;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.about-info p {
    max-width: 500px;
    color: var(--muted);
    margin: 0;
    line-height: 1.7;
}

/* Skills */

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

.skill {
    background: var(--surface);
    border: 1px solid #315051;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.skill span:first-child {
    font-weight: 700;
}

.skill span:last-child {
    color: var(--accent);
    font-size: 0.85rem;
    text-align: right;
}

/* Projects */

.section-intro,
.projects-intro {
    color: var(--muted);
    margin: 0 0 34px;
    line-height: 1.6;
}

#projectsbox {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.projects {
    min-width: 0;
    background: var(--surface);
    border: 1px solid #315051;
}

.project-image {
    display: block;
    background: #091616;
    overflow: hidden;
}

.projects img {
    display: block;
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.project-copy {
    padding: 24px 27px 30px;
}

.project-copy h3 {
    margin: 10px 0;
    font-size: 1.5rem;
}

.project-copy h3 a {
    text-decoration: none;
}

.project-copy h3 a:hover,
.project-copy h3 a:focus-visible {
    color: var(--accent);
}

.project-copy p {
    color: var(--muted);
    margin: 0;
    line-height: 1.55;
}

.repo-link {
    display: inline-block;
    margin-top: 14px;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
}

.repo-link:hover,
.repo-link:focus-visible {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 20px;
}

.tags span {
    background: #254647;
    border: 1px solid #456162;
    color: var(--text);
    padding: 6px 9px;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Footer */

footer {
    max-width: 1260px;
    margin: auto;
    padding: 34px 48px 45px;
    border-top: 1px solid #3a5757;
    color: var(--muted);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-links a {
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    color: var(--accent);
}

/* Animations */

@keyframes hero-text {
    from {
        background-position: 200% center;
    }

    to {
        background-position: -50% center;
    }
}

@keyframes portrait-border {
    0%,
    100% {
        clip-path: inset(0 0 calc(100% - 2px) 0);
    }

    25% {
        clip-path: inset(0 calc(100% - 2px) 0 0);
    }

    50% {
        clip-path: inset(calc(100% - 2px) 0 0 0);
    }

    75% {
        clip-path: inset(0 0 0 calc(100% - 2px));
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    h1 span:not(.heading-prefix) {
        animation: none;
    }

    .portrait-placeholder::before,
    .portrait-placeholder::after {
        animation: none;
        clip-path: inset(0);
        opacity: 0.55;
    }
}

/* Mobile */

@media (max-width: 760px) {
    #TopBar {
        padding: 22px;
        align-items: flex-start;
    }

    nav {
        gap: 13px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    #content {
        padding: 0 22px;
    }

    .intro {
        min-height: 0;
        padding: 70px 0 85px;
        grid-template-columns: 1fr;
        gap: 45px;
    }

    .portrait-placeholder {
        width: min(100%, 350px);
        aspect-ratio: 4 / 3;
    }

    .section-block {
        padding: 66px 0 76px;
    }

    .about-grid,
    #projectsbox,
    .skills-list {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .about-lead {
        font-size: 1.18rem;
    }

    footer {
        padding: 30px 22px;
    }
}

@media (max-width: 450px) {
    #TopBar {
        display: block;
    }

    nav {
        justify-content: flex-start;
        margin-top: 17px;
    }

    h1 {
        font-size: 3.5rem;
    }

    .projects img {
        height: 210px;
    }
}

/* Supporting copy and keyboard navigation */
.projects-more {
    color: var(--muted);
    margin: 0 0 34px;
    line-height: 1.6;
}

.projects-more a {
    color: inherit;
    text-underline-offset: 4px;
}

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

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 5px;
}

.skill > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

#language-toggle {
    flex-shrink: 0;
}

@media (max-width: 450px) {
    #language-toggle {
        margin-top: 17px;
    }
}

.projects-intro {
    margin-bottom: 12px;
}
