/* General settings */

:root {
    --background: #ffffff;
    --alternate-background: #f4f6f8;
    --text: #172033;
    --secondary-text: #5b6474;
    --primary: #2257d6;
    --primary-dark: #1744ad;
    --border: #dfe4ea;
    --maximum-width: 1120px;
    --shadow: 0 18px 55px rgba(23, 32, 51, 0.08);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    background: var(--background);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

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

a {
    color: inherit;
}

.container {
    max-width: var(--maximum-width);
    margin: 0 auto;
    padding-left: 24px;
    padding-right: 24px;
}


/* Navigation */

header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

nav {
    align-items: center;
    display: flex;
    justify-content: space-between;
    min-height: 72px;
}

.logo {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: var(--secondary-text);
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

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


/* Hero */

.compact-hero {
    padding: 72px 0 56px;
}

.compact-hero-content {
    display: block;
}

.hero-text-block {
    max-width: 900px;
}

.hero-identity {
    align-items: center;
    display: flex;
    gap: 26px;
    margin-bottom: 26px;
}

.hero-profile-image {
    border: 1px solid var(--border);
    border-radius: 50%;
    flex-shrink: 0;
    height: 120px;
    object-fit: cover;
    object-position: center;
    width: 120px;
}

.compact-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin: 0;
}

.hero-summary {
    color: var(--secondary-text);
    font-size: 1.08rem;
    line-height: 1.75;
    max-width: 900px;
    text-align: justify;
    text-justify: inter-word;
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.button {
    border: 1px solid var(--primary);
    border-radius: 7px;
    display: inline-block;
    font-weight: 700;
    padding: 12px 20px;
    text-align: center;
    text-decoration: none;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.button:hover,
.button:focus-visible {
    transform: translateY(-2px);
}

.primary-button {
    background: var(--primary);
    color: white;
}

.primary-button:hover,
.primary-button:focus-visible {
    background: var(--primary-dark);
}

.secondary-button {
    color: var(--primary);
}

.secondary-button:hover,
.secondary-button:focus-visible {
    background: var(--primary);
    color: white;
}


/* General sections */

.section {
    padding: 96px 0;
}

.alternate-background {
    background: var(--alternate-background);
}

.section h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 30px;
}

.section-label,
.project-category {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 14px;
}

.section-description {
    color: var(--secondary-text);
    font-size: 1.08rem;
    margin-bottom: 18px;
    max-width: 900px;
    text-align: justify;
    text-justify: inter-word;
}


/* Featured project */

.featured-project {
    align-items: stretch;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns:
        minmax(0, 1.2fr)
        minmax(350px, 0.8fr);
    margin-bottom: 30px;
    overflow: hidden;
}

.featured-video-stack {
    background: #0d1422;
    display: grid;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.featured-video-frame {
    align-items: center;
    background: #0d1422;
    display: flex;
    justify-content: center;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

.featured-video-frame:not(:last-child) {
    border-bottom: 3px solid white;
}

.featured-video-frame video {
    background: #0d1422;
    display: block;
    height: 100%;
    inset: 0;
    object-fit: contain;
    object-position: center;
    position: absolute;
    width: 100%;
}


/* Featured project content */

.featured-project-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 5vw, 56px);
}

.featured-project-content h3 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 18px;
}

.featured-project-content > p:not(.project-category) {
    color: var(--secondary-text);
    margin-bottom: 16px;
    text-align: justify;
    text-justify: inter-word;
}


/* Project results */

.project-results {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 26px 0;
}

.project-results div {
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 14px;
}

.project-results strong,
.project-results span {
    display: block;
}

.project-results strong {
    font-size: 1.15rem;
    line-height: 1.2;
    margin-bottom: 6px;
}

.project-results span {
    color: var(--secondary-text);
    font-size: 0.78rem;
    line-height: 1.35;
}


/* Project links */

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.project-links a,
.project-content a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.project-links a:hover,
.project-content a:hover,
.project-links a:focus-visible,
.project-content a:focus-visible {
    text-decoration: underline;
}


/* Matching project action buttons */

.project-action-buttons {
    align-items: stretch;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.project-links .project-action-button {
    align-items: center;
    border: 1px solid var(--primary);
    border-radius: 7px;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    line-height: 1.2;
    min-height: 46px;
    min-width: 170px;
    padding: 11px 18px;
    text-align: center;
    text-decoration: none;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease;
}

.project-links .project-action-button:hover,
.project-links .project-action-button:focus-visible {
    text-decoration: none;
    transform: translateY(-2px);
}

.project-links .document-button {
    background: white;
    color: var(--primary);
}

.project-links .document-button:hover,
.project-links .document-button:focus-visible {
    background: var(--primary);
    color: white;
}

.project-links .repository-button {
    background: var(--primary);
    color: white;
}

.project-links .repository-button:hover,
.project-links .repository-button:focus-visible {
    background: var(--primary-dark);
    color: white;
}


/* Supporting projects */

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

.project-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition:
        box-shadow 0.25s ease,
        transform 0.25s ease;
}

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

.project-media {
    background: #0d1422;
    overflow: hidden;
}

.card-media {
    aspect-ratio: 16 / 10;
}

.card-media img,
.card-media video {
    height: 100%;
    object-fit: cover;
    object-position: center;
    width: 100%;
}

.simbot-media img {
    background: #0d1422;
    object-fit: contain;
}

.curious-robot-media video {
    background: #0d1422;
    object-fit: contain;
}


/* Fourth project */

.pathfinding-project {
    grid-column: 1 / -1;
}

.pathfinding-gallery {
    background: #0d1422;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 16px;
}

.pathfinding-image {
    background: #ffffff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
    overflow: hidden;
}

.pathfinding-image img {
    background: #ffffff;
    display: block;
    height: 170px;
    object-fit: contain;
    object-position: center;
    padding: 18px;
    width: 100%;
}

.pathfinding-image figcaption {
    background: #0d1422;
    color: white;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.3;
    padding: 8px 10px;
    text-align: center;
}


/* Supporting project content */

.project-content {
    padding: 26px;
}

.project-content h3 {
    font-size: 1.4rem;
    line-height: 1.25;
    margin-bottom: 14px;
}

.project-content > p:not(.project-category) {
    color: var(--secondary-text);
    margin-bottom: 16px;
    text-align: justify;
    text-justify: inter-word;
}

.project-tech {
    border-top: 1px solid var(--border);
    font-size: 0.86rem;
    font-weight: 700;
    margin-top: 20px;
    padding-top: 16px;
}


/* Skills */

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

.skill-group {
    border-top: 2px solid var(--text);
    padding-top: 18px;
}

.skill-group h3 {
    margin-bottom: 10px;
}

.skill-group p {
    color: var(--secondary-text);
}


/* Contact */

.contact-section {
    background: var(--text);
    color: white;
}

.contact-section .section-label {
    color: #9bb8ff;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 10px;
}

.contact-links a {
    color: white;
    font-weight: 700;
    text-decoration: none;
}

.contact-links a:hover,
.contact-links a:focus-visible {
    text-decoration: underline;
}


/* Footer */

footer {
    background: #0d1422;
    color: #aeb6c5;
    padding: 24px 0;
    text-align: center;
}


/* Tablet layout */

@media (max-width: 900px) {

    .featured-project {
        grid-template-columns: 1fr;
    }

    .featured-video-stack {
        grid-template-rows: auto auto auto;
    }

    .featured-video-frame {
        aspect-ratio: 2486 / 1424;
    }

    .featured-video-frame video {
        height: 100%;
        object-fit: contain;
        width: 100%;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .pathfinding-project {
        grid-column: auto;
    }

    .pathfinding-gallery {
        gap: 8px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 10px;
    }

    .pathfinding-image img {
        height: 140px;
        padding: 10px;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }
}


/* Mobile layout */

@media (max-width: 600px) {

    .container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .nav-links {
        display: none;
    }

    .compact-hero {
        padding: 52px 0 42px;
    }

    .hero-identity {
        align-items: center;
        gap: 16px;
    }

    .hero-profile-image {
        height: 85px;
        width: 85px;
    }

    .compact-hero h1 {
        font-size: clamp(1.9rem, 10vw, 2.7rem);
    }

    .hero-buttons,
    .project-links,
    .project-action-buttons {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .button,
    .project-links .project-action-button {
        width: 100%;
    }

    .section {
        padding: 68px 0;
    }

    .project-results {
        grid-template-columns: 1fr;
    }

    .pathfinding-gallery {
        gap: 5px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        padding: 6px;
    }

    .pathfinding-image {
        border-radius: 5px;
    }

    .pathfinding-image img {
        height: 95px;
        padding: 4px;
    }

    .pathfinding-image figcaption {
        font-size: 0.62rem;
        padding: 5px 2px;
    }

    .featured-project-content,
    .project-content {
        padding: 24px;
    }

    .hero-summary,
    .featured-project-content > p:not(.project-category),
    .project-content > p:not(.project-category),
    .section-description {
        text-align: left;
    }
}


/* Very small mobile screens */

@media (max-width: 420px) {

    .hero-identity {
        gap: 12px;
    }

    .hero-profile-image {
        height: 72px;
        width: 72px;
    }

    .compact-hero h1 {
        font-size: 1.8rem;
    }

    .pathfinding-gallery {
        gap: 3px;
        padding: 4px;
    }

    .pathfinding-image img {
        height: 82px;
        padding: 3px;
    }

    .pathfinding-image figcaption {
        font-size: 0.55rem;
        padding: 4px 1px;
    }
}


/* Reduced-motion preferences */

@media (prefers-reduced-motion: reduce) {

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}