@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root,
:root.dark {
    color-scheme: dark;
    --slate-100: 244 243 235;
    --slate-200: 223 222 211;
    --slate-300: 197 198 184;
    --slate-400: 164 168 153;
    --slate-500: 130 136 123;
    --slate-600: 103 110 99;
    --slate-700: 77 84 77;
    --slate-800: 54 62 58;
    --slate-850: 39 46 43;
    --slate-900: 29 35 33;
    --slate-950: 21 26 24;
    --cyan-400: 230 157 100;
    --cyan-500: 198 112 66;
    --cyan-600: 158 77 43;
}

:root.light {
    color-scheme: light;
    --slate-100: 32 31 27;
    --slate-200: 51 49 43;
    --slate-300: 69 66 58;
    --slate-400: 91 87 76;
    --slate-500: 116 111 99;
    --slate-600: 143 137 123;
    --slate-700: 181 175 159;
    --slate-800: 216 210 194;
    --slate-850: 235 231 218;
    --slate-900: 252 250 243;
    --slate-950: 246 243 234;
    --cyan-400: 165 76 41;
    --cyan-500: 183 91 51;
    --cyan-600: 135 59 32;
}

html {
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    overflow-x: hidden;
    font-family: 'IBM Plex Sans', sans-serif;
    transition: color 180ms ease;
}

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

::selection {
    background: rgb(var(--cyan-500) / 0.22);
    color: rgb(var(--slate-100));
}

h1,
h2,
h3 {
    letter-spacing: -0.025em;
}

main {
    width: 100%;
    min-width: 0;
}

main > * {
    min-width: 0;
}

html.light .text-white:not(.theme-keep-white) {
    color: #201f1b !important;
}

html.light .text-cyan-400,
html.light .text-cyan-500 {
    color: #a54c29 !important;
}

html.light .text-blue-400,
html.light .text-blue-500 {
    color: #715340 !important;
}

html.light .text-emerald-400 {
    color: #536642 !important;
}

html.light .text-amber-400 {
    color: #98612f !important;
}

html.light .text-purple-400 {
    color: #765d7e !important;
}

html.light .text-purple-500 {
    color: #765d7e !important;
}

html.light .text-blue-400,
html.light .text-blue-500,
html.light .text-emerald-400,
html.light .text-amber-400,
html.light .text-purple-400,
html.light .text-purple-500 {
    color: #8f4326 !important;
}

html.light [class~="bg-blue-500/10"],
html.light [class~="bg-emerald-500/10"],
html.light [class~="bg-amber-500/10"],
html.light [class~="bg-purple-500/10"] {
    background-color: rgb(165 76 41 / 0.08) !important;
}

html.light [class~="border-blue-500/30"],
html.light [class~="border-emerald-500/30"],
html.light [class~="border-amber-500/30"],
html.light [class~="border-purple-500/30"] {
    border-color: rgb(165 76 41 / 0.3) !important;
}

html:not(.light) .text-blue-400,
html:not(.light) .text-blue-500,
html:not(.light) .text-emerald-400,
html:not(.light) .text-amber-400,
html:not(.light) .text-purple-400,
html:not(.light) .text-purple-500 {
    color: rgb(var(--cyan-400)) !important;
}

html:not(.light) [class~="bg-blue-500/10"],
html:not(.light) [class~="bg-emerald-500/10"],
html:not(.light) [class~="bg-amber-500/10"],
html:not(.light) [class~="bg-purple-500/10"] {
    background-color: rgb(var(--cyan-500) / 0.1) !important;
}

html:not(.light) [class~="border-blue-500/30"],
html:not(.light) [class~="border-emerald-500/30"],
html:not(.light) [class~="border-amber-500/30"],
html:not(.light) [class~="border-purple-500/30"] {
    border-color: rgb(var(--cyan-500) / 0.3) !important;
}

.site-nav {
    background-color: rgb(var(--slate-950) / 0.98) !important;
    backdrop-filter: none !important;
}

.site-nav-inner {
    display: flex;
    min-height: 4rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding-block: 0.5rem;
}

.site-nav-controls {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.site-nav-links {
    display: flex;
    min-width: 0;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.site-nav-link {
    white-space: nowrap;
    color: rgb(var(--slate-300));
    text-decoration: none;
}

.site-brand > div:first-child {
    border-radius: 2px !important;
    background: rgb(var(--cyan-600)) !important;
    box-shadow: none !important;
    font-family: 'IBM Plex Mono', monospace;
}

.site-brand-name {
    background: none !important;
    color: rgb(var(--slate-100)) !important;
    -webkit-text-fill-color: currentColor;
}

.theme-toggle {
    display: inline-flex;
    min-width: 2.5rem;
    min-height: 2.5rem;
    flex: none;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(var(--slate-800) / 0.9);
    border-radius: 9999px;
    background: rgb(var(--slate-900) / 0.82);
    color: rgb(var(--slate-300));
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.language-toggle {
    display: inline-flex;
    min-width: 2.5rem;
    min-height: 2.5rem;
    flex: none;
    align-items: center;
    justify-content: center;
    border: 1px solid rgb(var(--slate-800) / 0.9);
    border-radius: 2px;
    background: rgb(var(--slate-900));
    color: rgb(var(--cyan-400));
    font: 600 0.66rem 'IBM Plex Mono', monospace;
    cursor: pointer;
    transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.language-toggle:hover {
    border-color: rgb(var(--cyan-500) / 0.65);
    background: rgb(var(--cyan-500) / 0.08);
}

.theme-toggle:hover {
    border-color: rgb(var(--cyan-500) / 0.6);
    color: rgb(var(--cyan-400));
}

.theme-toggle:focus-visible,
.language-toggle:focus-visible,
.copy-button:focus-visible,
a:focus-visible {
    outline: 3px solid rgb(var(--cyan-500) / 0.65);
    outline-offset: 3px;
}

.home-hero {
    position: relative;
    display: grid;
    align-items: center;
    grid-template-columns: minmax(0, 1fr);
    padding-block: clamp(2rem, 5vw, 4.5rem);
    border-block: 1px solid rgb(var(--slate-800));
}

.home-hero-copy {
    min-width: 0;
    width: 100%;
    max-width: none;
}

.eyebrow,
.project-card-kicker,
.section-note,
.project-card-tags,
.project-visual-mark,
.project-card-visual figcaption,
.resume-date {
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 1.7rem;
    color: rgb(var(--slate-400));
    font-size: 0.72rem;
}

.eyebrow-mark {
    width: 0.55rem;
    height: 0.55rem;
    border: 1px solid rgb(var(--cyan-400));
    background: rgb(var(--cyan-400));
}

.eyebrow-divider {
    color: rgb(var(--cyan-400));
}

.home-hero h1 {
    margin: 0;
    color: rgb(var(--slate-100));
    font-size: clamp(3rem, 6vw, 5.7rem);
    font-weight: 600;
    line-height: 0.98;
    letter-spacing: -0.075em;
}

.home-hero h1 span {
    display: inline;
    color: rgb(var(--slate-300));
    font-weight: 400;
}

.hero-role {
    margin: 1.4rem 0 0;
    color: rgb(var(--cyan-400));
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    font-weight: 500;
}

.hero-intro {
    max-width: 62ch;
    margin: 0;
    color: rgb(var(--slate-300));
    font-size: 1rem;
    line-height: 1.75;
}

.hero-intro strong {
    color: rgb(var(--slate-100));
    font-weight: 600;
}

.hero-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(17rem, 0.7fr);
    align-items: end;
    gap: 1.5rem 3rem;
    margin-top: 1.35rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.7rem 1rem;
    margin: 0;
}

.hero-location {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgb(var(--slate-400));
    font-size: 0.83rem;
}

.hero-location i {
    color: rgb(var(--cyan-400));
}

.copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid rgb(var(--slate-700) / 0.9);
    border-radius: 2px;
    padding: 0.48rem 0.7rem;
    background: rgb(var(--slate-900));
    color: rgb(var(--slate-100));
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.copy-button:hover {
    transform: translateY(-1px);
    border-color: rgb(var(--cyan-500) / 0.65);
}

.copy-primary {
    border-color: rgb(var(--cyan-500));
    background: transparent;
    color: rgb(var(--cyan-400)) !important;
    box-shadow: none;
}

.copy-primary:hover {
    background: rgb(var(--cyan-500) / 0.1);
}

.copy-detail {
    display: block;
    overflow-wrap: anywhere;
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.85;
}

.media-frame {
    display: flex;
    width: 100%;
    min-height: 15rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 2px;
    background: rgb(var(--slate-950) / 0.7);
    padding: 0.5rem;
}

.media-frame > img,
.media-frame > video {
    display: block;
    width: 100%;
    height: clamp(15rem, 38vw, 27rem);
    border-radius: 0;
    object-fit: contain;
    object-position: center;
}

.media-frame-compact > img,
.media-frame-compact > video {
    height: clamp(17rem, 35vw, 26rem);
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    border-bottom: 1px solid rgb(var(--slate-800));
    padding-bottom: 0.85rem;
}

.section-heading h2 {
    margin: 0;
    color: rgb(var(--slate-100));
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    font-weight: 500;
}

.section-note {
    color: rgb(var(--slate-500));
    font-size: 0.65rem;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(1.25rem, 3vw, 2.5rem);
}

.project-card {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(8rem, 0.82fr);
    align-items: center;
    gap: 1.1rem;
    min-width: 0;
    border-top: 1px solid rgb(var(--slate-800));
    padding: 1.25rem 0;
    color: inherit;
    text-decoration: none;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.project-card:hover {
    border-color: rgb(var(--cyan-500));
    background: rgb(var(--slate-900) / 0.55);
}

.project-card-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
}

.project-card-kicker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: baseline;
    color: rgb(var(--slate-500));
    font-size: 0.62rem;
    line-height: 1.5;
}

.project-card-kicker span {
    color: rgb(var(--cyan-400));
}

.project-card h3 {
    margin: 0.65rem 0 0;
    color: rgb(var(--slate-100));
    font-size: clamp(1.03rem, 1.4vw, 1.25rem);
    font-weight: 600;
    line-height: 1.25;
}

.project-card p {
    margin: 0.6rem 0 0;
    color: rgb(var(--slate-400));
    font-size: 0.86rem;
    line-height: 1.55;
}

.project-card-tags {
    margin-top: 0.8rem;
    color: rgb(var(--slate-500));
    font-size: 0.6rem;
    line-height: 1.5;
}

.project-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.8rem;
    color: rgb(var(--cyan-400));
    font-size: 0.75rem;
    font-weight: 600;
}

.project-card-link svg,
.project-visual-mark svg {
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.project-card-visual {
    position: relative;
    display: grid;
    min-width: 0;
    align-self: stretch;
    grid-template-rows: minmax(8rem, 1fr) auto;
    margin: 0;
}

.project-card-visual img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 8rem;
    max-height: 12rem;
    border: 1px solid rgb(var(--slate-800));
    background-color: rgb(var(--slate-900));
    background-image:
        linear-gradient(rgb(var(--slate-700) / 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgb(var(--slate-700) / 0.12) 1px, transparent 1px);
    background-size: 18px 18px;
    object-fit: contain;
    object-position: center;
}

.project-visual-mark {
    position: absolute;
    right: 0.55rem;
    bottom: 2.1rem;
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid rgb(var(--slate-700));
    background: rgb(var(--slate-950) / 0.94);
    color: rgb(var(--cyan-400));
}

.project-visual-mark svg {
    width: 1.1rem;
    height: 1.1rem;
}

.project-card-visual figcaption {
    overflow: hidden;
    margin-top: 0.4rem;
    color: rgb(var(--slate-500));
    font-size: 0.55rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resume-section {
    display: grid;
    gap: 1.4rem;
}

.resume-list {
    border-top: 1px solid rgb(var(--slate-800));
}

.resume-item {
    display: grid;
    grid-template-columns: minmax(8.5rem, 0.35fr) minmax(0, 1.65fr);
    gap: 1rem 2rem;
    border-bottom: 1px solid rgb(var(--slate-800));
    padding: 1.15rem 0;
}

.resume-date {
    color: rgb(var(--cyan-400));
    font-size: 0.66rem;
    line-height: 1.55;
}

.resume-item h3 {
    margin: 0;
    color: rgb(var(--slate-100));
    font-size: 1rem;
    font-weight: 600;
}

.resume-item p {
    max-width: 52rem;
    margin: 0.4rem 0 0;
    color: rgb(var(--slate-400));
    font-size: 0.88rem;
    line-height: 1.6;
}

/* Keep the engineering notebook visual language on the project detail pages. */
.rounded-2xl,
.rounded-xl {
    border-radius: 4px !important;
}

.rounded-lg {
    border-radius: 3px !important;
}

.shadow-lg,
.shadow-xl,
.shadow-md {
    box-shadow: none !important;
}

.bg-gradient-to-tr.from-cyan-500 {
    background: rgb(var(--cyan-500)) !important;
}

.bg-gradient-to-r.from-slate-100 {
    background: none !important;
    color: rgb(var(--slate-100)) !important;
    -webkit-text-fill-color: currentColor;
}

.media-frame-source {
    min-height: 0;
    background: #fff;
    padding: 0.5rem;
}

.media-frame-source > img {
    width: 100%;
    height: auto;
    max-height: min(72vh, 38rem);
    object-fit: contain;
}

.source-figure {
    min-width: 0;
}

.source-figure figcaption {
    margin-top: 0.75rem;
    color: rgb(var(--slate-400));
    font-size: 0.8rem;
    line-height: 1.5;
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: rgb(var(--cyan-400));
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline;
}

.math-display {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-block: 0.35rem;
}

mjx-container[display='true'] {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-block: 0.35rem;
}

@media (min-width: 640px) {
    .site-nav-links {
        justify-content: flex-start;
        gap: 1.25rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 900px) {
    .hero-bottom {
        grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.8fr);
        gap: 1.25rem;
    }

    .project-card {
        grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.68fr);
        gap: 0.85rem;
    }
}

@media (min-width: 768px) {
    .site-nav-inner {
        flex-wrap: nowrap;
        padding-block: 0;
    }

    .site-nav-controls {
        width: auto;
        justify-content: flex-end;
        gap: 1.5rem;
    }

    .site-nav-links {
        flex: none;
        gap: 1.5rem;
    }
}

@media (max-width: 767px) {
    .home-hero {
        padding-block: 2rem;
    }

    .hero-bottom {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-actions {
        justify-content: flex-start;
    }

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

    .project-card {
        grid-template-columns: minmax(0, 1fr) minmax(8rem, 0.52fr);
        gap: 1rem;
    }

    .project-card-visual img {
        min-height: 8rem;
        max-height: 10rem;
    }
}

@media (max-width: 480px) {
    .site-nav-links {
        gap: 0.3rem;
        font-size: 0.62rem;
    }

    .site-nav-controls {
        gap: 0.35rem;
    }

    .theme-toggle,
    .language-toggle {
        min-width: 2.1rem;
        min-height: 2.1rem;
    }

    .home-hero h1 {
        font-size: clamp(2.8rem, 15vw, 4.2rem);
    }

    .project-card {
        grid-template-columns: minmax(0, 1fr) 6.4rem;
        gap: 0.7rem;
    }

    .project-card-kicker {
        font-size: 0.55rem;
    }

    .project-card p {
        font-size: 0.79rem;
    }

    .project-card-visual {
        grid-template-rows: 7rem auto;
    }

    .project-card-visual img {
        min-height: 7rem;
        max-height: 7rem;
    }

    .project-card-visual figcaption {
        font-size: 0.48rem;
    }

    .resume-item {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.35rem;
    }
}

@media (max-width: 359px) {
    .site-brand-name {
        font-size: 0.9rem;
    }

    .site-nav-links {
        gap: 0.2rem;
        font-size: 0.54rem;
    }

    .site-nav-controls {
        gap: 0.4rem;
    }
}

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