:root {
    --bg: #050505;
    --panel: rgba(17, 17, 17, 0.86);
    --panel-strong: #101010;
    --accent: #ff3e3e;
    --accent-soft: rgba(255, 62, 62, 0.14);
    --text: #ffffff;
    --text-dim: #ababab;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top, rgba(255, 62, 62, 0.12), transparent 28%),
        linear-gradient(180deg, #111 0%, #050505 22%, #050505 100%);
    font-family: "Space Grotesk", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

.hero {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    transition: background 220ms ease, backdrop-filter 220ms ease, border-color 220ms ease;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(12px);
    pointer-events: none;
}

.hero::before {
    width: 420px;
    height: 420px;
    top: -140px;
    right: -110px;
    background: radial-gradient(circle, rgba(255, 62, 62, 0.18), transparent 68%);
}

.hero::after {
    width: 340px;
    height: 340px;
    bottom: -180px;
    left: -120px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.06), transparent 70%);
}

.hero-shell,
.container,
.site-footer {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.hero-shell {
    min-height: 100vh;
    padding: 40px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    z-index: 1;
    transition: min-height 240ms ease, padding 240ms ease, gap 240ms ease, align-items 240ms ease;
}

.tech-stack,
.project-category {
    font-family: "IBM Plex Mono", monospace;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(3rem, 8vw, 5.6rem);
    line-height: 0.94;
    letter-spacing: -0.05em;
    max-width: none;
    margin-bottom: 18px;
    transition: font-size 240ms ease, margin-bottom 240ms ease;
}

.hero-subtitle {
    max-width: 420px;
    color: var(--text-dim);
    font-size: 1rem;
    margin-bottom: 24px;
    transition: opacity 180ms ease, max-width 240ms ease, margin-bottom 240ms ease, font-size 240ms ease;
}

.hero-quote {
    max-width: 720px;
    margin-top: 18px;
    margin-bottom: 0;
    color: #f0f0f0;
    font-size: clamp(1rem, 2vw, 1.18rem);
    font-style: italic;
    letter-spacing: -0.02em;
    transition: opacity 180ms ease, margin-bottom 240ms ease, font-size 240ms ease;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    transition: gap 240ms ease;
}

.filter-button,
.project-link {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.filter-button {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.filter-button-all {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffe6e6;
    box-shadow: inset 0 0 0 1px rgba(255, 62, 62, 0.08);
}

.filter-button-gallery {
    background: rgba(255, 255, 255, 0.015);
    color: #ffdede;
}

.filter-divider {
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.16);
}

.filter-button:hover,
.filter-button:focus-visible,
.project-link:hover,
.project-link:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(255, 62, 62, 0.5);
}

.filter-button.is-active {
    background: var(--accent);
    color: #050505;
    border-color: var(--accent);
}

.container {
    padding: 0 0 96px;
}

body.has-selection .hero {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(5, 5, 5, 0.78);
    backdrop-filter: blur(18px);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

body.has-selection .hero-shell {
    min-height: auto;
    padding: 18px 0 16px;
}

body.has-selection h1 {
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    margin-bottom: 8px;
}

body.has-selection .hero-quote {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
}

body.has-selection .hero-subtitle {
    max-width: none;
    margin-bottom: 12px;
    font-size: 0.92rem;
    opacity: 0;
    max-height: 0;
    margin: 0;
    overflow: hidden;
}

body.has-selection .filter-buttons {
    gap: 10px;
}

body.has-selection .container {
    padding-top: 28px;
}

.section-heading h2 {
    margin-bottom: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.03;
    letter-spacing: -0.04em;
}

.section-caption,
.project-description {
    color: var(--text-dim);
}

.section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    margin-bottom: 22px;
}

.section-caption {
    margin-bottom: 10px;
    text-align: right;
}

.projects-section[hidden] {
    display: none;
}

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

.cad-grid {
    column-count: 2;
    column-gap: 22px;
}

.projects-tail {
    grid-column: 1 / -1;
    padding: 14px 0 4px;
    text-align: center;
    color: var(--text-dim);
    font-size: 1rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.92), rgba(9, 9, 9, 0.96));
    box-shadow: var(--shadow);
}

.project-card.is-hidden {
    display: none;
}

.project-media {
    position: relative;
    height: 280px;
    background: #000;
}

.project-media img,
.project-media iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.project-media img {
    object-fit: contain;
    object-position: center;
}

.project-media.placeholder {
    display: grid;
    place-items: end start;
    padding: 22px;
    background:
        linear-gradient(135deg, rgba(255, 62, 62, 0.85), rgba(255, 62, 62, 0.12)),
        linear-gradient(120deg, #151515, #060606);
}

.project-media.tweet-media {
    height: auto;
    min-height: 320px;
    padding: 12px;
    overflow: hidden;
}

.project-media.placeholder span {
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    font-weight: 700;
    letter-spacing: -0.05em;
}

.project-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
}

.tech-stack {
    color: var(--accent);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.project-card h3 {
    margin-bottom: 0;
    font-size: 1.85rem;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-category {
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #ffd0d0;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.project-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    text-decoration: none;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.02);
}

.project-link.live {
    background: linear-gradient(135deg, #ff5656, #ff2f2f);
    border-color: rgba(255, 98, 98, 0.95);
    color: #fff7f7;
    box-shadow: 0 0 0 1px rgba(255, 110, 110, 0.14), 0 18px 36px rgba(255, 62, 62, 0.24);
}

.project-link.live:hover,
.project-link.live:focus-visible {
    box-shadow: 0 0 0 1px rgba(255, 110, 110, 0.2), 0 24px 42px rgba(255, 62, 62, 0.34);
}

.project-link.secondary {
    color: var(--text-dim);
}

.cad-card {
    margin: 0;
    margin-bottom: 22px;
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(20, 20, 20, 0.92), rgba(9, 9, 9, 0.96));
    box-shadow: var(--shadow);
    break-inside: avoid;
    display: inline-block;
    width: 100%;
}

.cad-media {
    background:
        radial-gradient(circle at top, rgba(255, 62, 62, 0.12), transparent 32%),
        linear-gradient(180deg, #101010 0%, #050505 100%);
    padding: 14px;
}

.cad-media img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
}

.cad-caption {
    padding: 0 20px 20px;
    color: var(--text-dim);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.site-footer {
    padding: 48px 0 80px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-dim);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 28px;
    margin-bottom: 18px;
}

.footer-links a {
    text-decoration: none;
    font-weight: 700;
}

@media (max-width: 900px) {
    .section-heading,
    .project-grid {
        grid-template-columns: 1fr;
    }

    .cad-grid {
        column-count: 1;
    }

    .section-caption {
        text-align: left;
        margin-bottom: 0;
    }
}

@media (max-width: 640px) {
    .hero-shell {
        padding: 32px 0;
    }

    body.has-selection .hero-shell {
        padding: 14px 0;
    }

    .filter-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        align-items: stretch;
    }

    .filter-divider {
        width: 1px;
        height: 22px;
    }

    .filter-button {
        width: auto;
        padding: 9px 12px;
        font-size: 0.83rem;
    }

    body.has-selection .filter-button {
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    body.has-selection .filter-buttons {
        gap: 5px;
    }

    .project-link {
        width: 100%;
    }
}
