:root {
    color-scheme: dark;
    --bg: #070816;
    --ink: #f8fbff;
    --muted: rgba(248, 251, 255, 0.68);
    --panel: rgba(14, 18, 34, 0.72);
    --panel-strong: rgba(255, 255, 255, 0.12);
    --line: rgba(255, 255, 255, 0.16);
    --accent: #5ef3ff;
    --accent-2: #ff4fd8;
    --accent-3: #fff05a;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.34);
    --radius: 30px;
    --font: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    transition: background 0.35s ease, color 0.35s ease;
}

body[data-theme="glass"] {
    color-scheme: light;
    --bg: #eaf4ff;
    --ink: #132035;
    --muted: rgba(19, 32, 53, 0.66);
    --panel: rgba(255, 255, 255, 0.62);
    --panel-strong: rgba(255, 255, 255, 0.88);
    --line: rgba(63, 98, 150, 0.18);
    --accent: #2563eb;
    --accent-2: #0ea5e9;
    --accent-3: #10b981;
    --shadow: 0 26px 70px rgba(61, 87, 124, 0.22);
    --radius: 26px;
}

body[data-theme="pixel"] {
    --bg: #100b2a;
    --ink: #fff9f2;
    --muted: rgba(255, 249, 242, 0.7);
    --panel: rgba(30, 18, 73, 0.82);
    --panel-strong: rgba(255, 255, 255, 0.11);
    --line: rgba(255, 255, 255, 0.18);
    --accent: #00ff99;
    --accent-2: #ffcc00;
    --accent-3: #ff3d81;
    --shadow: 12px 12px 0 rgba(0, 0, 0, 0.34);
    --radius: 12px;
}

body[data-theme="noir"] {
    --bg: #070707;
    --ink: #f6f0df;
    --muted: rgba(246, 240, 223, 0.66);
    --panel: rgba(18, 18, 18, 0.82);
    --panel-strong: rgba(255, 255, 255, 0.08);
    --line: rgba(246, 240, 223, 0.18);
    --accent: #f5d15f;
    --accent-2: #ff6b35;
    --accent-3: #f6f0df;
    --shadow: 0 26px 80px rgba(0, 0, 0, 0.5);
    --radius: 4px;
}

body[data-theme="solar"] {
    color-scheme: light;
    --bg: #fff6df;
    --ink: #20120c;
    --muted: rgba(32, 18, 12, 0.68);
    --panel: rgba(255, 255, 255, 0.72);
    --panel-strong: rgba(255, 248, 226, 0.94);
    --line: rgba(125, 73, 28, 0.18);
    --accent: #ff4d00;
    --accent-2: #7c3aed;
    --accent-3: #00a36c;
    --shadow: 0 28px 78px rgba(116, 67, 23, 0.18);
    --radius: 34px;
}

a {
    color: inherit;
}

.scene {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 20%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 30%),
        radial-gradient(circle at 88% 14%, color-mix(in srgb, var(--accent-2) 34%, transparent), transparent 28%),
        linear-gradient(135deg, color-mix(in srgb, var(--bg) 88%, #000), var(--bg));
}

.scene__beam,
.scene__grid,
.scene__grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.scene__beam {
    width: 54vmax;
    height: 54vmax;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    opacity: 0.35;
    transform: rotate(18deg);
    animation: drift 18s ease-in-out infinite alternate;
}

.scene__beam--one {
    left: -18vmax;
    top: 14vh;
}

.scene__beam--two {
    right: -24vmax;
    bottom: -14vmax;
    border-color: color-mix(in srgb, var(--accent-2) 28%, transparent);
    animation-duration: 24s;
    animation-delay: -6s;
}

.scene__grid {
    background-image:
        linear-gradient(color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 78%);
    opacity: 0.38;
}

.scene__grain {
    opacity: 0.12;
    background-image:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 3px);
    mix-blend-mode: overlay;
}

.topbar {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand__mark {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: var(--shadow);
    color: var(--accent);
    font-weight: 900;
}

.brand__text {
    display: grid;
    line-height: 1.1;
}

.brand__text strong {
    font-size: 16px;
    font-weight: 850;
}

.brand__text small {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.theme-switcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: color-mix(in srgb, var(--panel) 78%, transparent);
    backdrop-filter: blur(18px);
}

.theme-pill {
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: 800 13px/1 var(--font);
    cursor: pointer;
    transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.theme-pill:hover {
    color: var(--ink);
    transform: translateY(-1px);
}

.theme-pill.is-active {
    background: var(--ink);
    color: var(--bg);
}

.lab-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: end;
    gap: 28px;
}

.eyebrow,
.section-head__label {
    margin: 0 0 14px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.hero h1 {
    max-width: 920px;
    margin: 0;
    font-size: 54px;
    line-height: 0.98;
    letter-spacing: 0;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.hero__lead {
    max-width: 640px;
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 18px;
    line-height: 1.55;
}

.hero__panel {
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero__panel strong {
    font-size: 29px;
    line-height: 1;
}

.hero__panel span:last-child {
    color: var(--muted);
    font-weight: 750;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 18%, transparent);
    animation: pulse 1.9s ease-in-out infinite;
}

.projects {
    margin-top: 28px;
}

.section-head {
    display: grid;
    gap: 4px;
    margin-bottom: 18px;
}

.section-head h2 {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
    gap: 18px;
    perspective: 1400px;
}

.project-card {
    --tilt-x: 0deg;
    --tilt-y: 0deg;
    --hot-x: 50%;
    --hot-y: 50%;
    position: relative;
    display: grid;
    grid-template-rows: 210px 1fr;
    min-height: 430px;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        radial-gradient(circle at var(--hot-x) var(--hot-y), color-mix(in srgb, var(--accent) 28%, transparent), transparent 26%),
        var(--panel);
    box-shadow: var(--shadow);
    text-decoration: none;
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(0);
    transform-style: preserve-3d;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    animation: cardIn 0.55s calc(var(--card-index) * 0.1s) backwards cubic-bezier(.2, .8, .2, 1);
}

.project-card::before {
    content: '';
    position: absolute;
    inset: 14px;
    z-index: -1;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
    border-radius: calc(var(--radius) - 10px);
    opacity: 0.7;
}

.project-card:hover {
    border-color: color-mix(in srgb, var(--accent) 58%, white);
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(-7px);
}

.project-card:focus-visible {
    outline: 4px solid color-mix(in srgb, var(--accent) 42%, transparent);
    outline-offset: 4px;
}

.project-card__image-wrap {
    position: relative;
    overflow: hidden;
    margin: 14px 14px 0;
    border-radius: calc(var(--radius) - 12px);
    background: color-mix(in srgb, var(--accent) 16%, var(--bg));
}

.project-card__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.2) contrast(1.02);
    transform: scale(1.04);
    transition: transform 0.45s ease, filter 0.35s ease;
}

.project-card:hover .project-card__image {
    transform: scale(1.12) rotate(1deg);
    filter: saturate(1.45) contrast(1.08);
}

.project-card__scan {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.35), transparent 52%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px);
    mix-blend-mode: screen;
    transform: translateX(-120%);
    animation: scan 4s ease-in-out infinite;
}

.project-card__content {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 20px;
}

.project-card__meta {
    width: max-content;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 999px;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    font-size: 12px;
    font-weight: 900;
}

.project-card__title {
    font-size: 26px;
    line-height: 1.02;
    font-weight: 900;
    text-wrap: balance;
}

.project-card__description {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.45;
}

.project-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 4px;
}

.project-card__path {
    color: var(--accent-3);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.project-card__arrow {
    position: relative;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--ink);
    color: var(--bg);
    transition: transform 0.2s ease;
}

.project-card__arrow::before,
.project-card__arrow::after {
    content: '';
    position: absolute;
    background: currentColor;
}

.project-card__arrow::before {
    width: 18px;
    height: 2px;
    left: 15px;
    top: 23px;
}

.project-card__arrow::after {
    width: 9px;
    height: 9px;
    right: 15px;
    top: 18px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    background: transparent;
    transform: rotate(45deg);
}

.project-card:hover .project-card__arrow {
    transform: rotate(-18deg) scale(1.08);
}

body[data-theme="pixel"] .project-card,
body[data-theme="pixel"] .brand__mark,
body[data-theme="pixel"] .theme-switcher,
body[data-theme="pixel"] .hero__panel {
    border-width: 2px;
}

body[data-theme="pixel"] .project-card__image,
body[data-theme="pixel"] .project-card__image-wrap {
    image-rendering: auto;
    border-radius: 6px;
}

body[data-theme="noir"] .project-card__image {
    filter: grayscale(1) contrast(1.25);
}

body[data-theme="noir"] .project-card:hover .project-card__image {
    filter: grayscale(0.2) contrast(1.18) sepia(0.18);
}

body[data-theme="solar"] .project-card:nth-child(odd) {
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotate(-1deg);
}

body[data-theme="solar"] .project-card:nth-child(even) {
    transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) rotate(1deg);
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) rotate(18deg);
    }
    to {
        transform: translate3d(8vw, -5vh, 0) rotate(34deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.86);
        opacity: 0.72;
    }
    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

@keyframes scan {
    0%, 48% {
        transform: translateX(-120%);
    }
    70%, 100% {
        transform: translateX(120%);
    }
}

@keyframes cardIn {
    from {
        transform: translateY(18px) rotateX(5deg);
    }
    to {
        transform: translateY(0) rotateX(0);
    }
}

@media (max-width: 920px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .theme-switcher {
        width: 100%;
        justify-content: flex-start;
        border-radius: 22px;
    }

    .lab-shell {
        padding-top: 48px;
    }

    .hero {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .hero h1 {
        font-size: 44px;
        line-height: 1.02;
    }

    .hero h1 span {
        display: block;
    }

    .hero__panel {
        min-height: 0;
        grid-template-columns: auto auto 1fr;
        align-items: center;
    }

    .hero__panel strong {
        font-size: 22px;
    }

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

@media (max-width: 560px) {
    .topbar,
    .lab-shell {
        width: min(100% - 24px, 460px);
    }

    .brand__text small {
        display: none;
    }

    .theme-switcher {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
        padding: 6px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .theme-switcher::-webkit-scrollbar {
        display: none;
    }

    .theme-pill {
        min-width: 0;
        padding: 0 6px;
        font-size: 11px;
    }

    .hero h1 {
        font-size: 32px;
        line-height: 1.07;
        width: 100%;
        max-width: 100%;
        text-wrap: wrap;
    }

    .hero__lead {
        font-size: 16px;
    }

    .project-card {
        grid-template-rows: 180px 1fr;
        min-height: 0;
    }

    .project-card__title {
        font-size: 24px;
    }

    .project-card__content {
        padding: 20px;
    }
}

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

.project-card[data-tone="control"] .project-card__image-wrap{background:linear-gradient(135deg,rgba(255,106,61,.16),rgba(22,166,168,.14));}

/* 2026-07-15 mobile-first refinement */
@media (max-width: 640px) {
    body { min-height: 100svh; }
    .scene__beam { width: 70vmax; height: 70vmax; opacity: 0.22; }
    .scene__grid { background-size: 34px 34px; opacity: 0.22; }
    .topbar,
    .lab-shell { width: min(100% - 20px, 460px); }
    .topbar { padding-top: 14px; gap: 12px; }
    .brand { width: 100%; gap: 10px; }
    .brand__mark { width: 44px; height: 44px; border-radius: 15px; }
    .brand__text strong { font-size: 18px; }
    .theme-switcher {
        position: sticky;
        top: 8px;
        z-index: 10;
        display: flex;
        width: 100%;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 6px;
        padding: 6px;
        border-radius: 22px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .theme-pill { flex: 0 0 auto; min-width: 68px; min-height: 38px; padding: 0 10px; font-size: 12px; }
    .lab-shell { padding: 22px 0 34px; }
    .hero { gap: 14px; }
    .eyebrow, .section-head__label { margin-bottom: 10px; font-size: 11px; letter-spacing: .1em; }
    .hero h1 { font-size: clamp(35px, 10vw, 46px); line-height: .96; letter-spacing: -.035em; }
    .hero__lead { margin-top: 14px; font-size: 15px; line-height: 1.45; }
    .hero__panel { min-height: 0; padding: 12px 14px; border-radius: 20px; grid-template-columns: auto auto 1fr; }
    .hero__panel strong { font-size: 18px; }
    .status-dot { width: 10px; height: 10px; box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 18%, transparent); }
    .projects { margin-top: 22px; }
    .section-head h2 { font-size: 34px; letter-spacing: -.04em; }
    .project-grid { gap: 12px; }
    .project-card {
        display: grid;
        grid-template-columns: 112px minmax(0, 1fr);
        grid-template-rows: auto;
        min-height: 0;
        border-radius: 24px;
        transform: none !important;
    }
    .project-card::before { inset: 8px; border-radius: 18px; }
    .project-card__image-wrap { height: 112px; margin: 10px 0 10px 10px; border-radius: 18px; }
    .project-card__image { transform: none; }
    .project-card__scan { display: none; }
    .project-card__content { gap: 7px; padding: 12px 12px 12px 14px; }
    .project-card__meta { padding: 5px 8px; font-size: 10px; }
    .project-card__title { font-size: 18px; line-height: 1.05; }
    .project-card__description {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 12px;
        line-height: 1.35;
    }
    .project-card__footer { margin-top: 0; gap: 8px; }
    .project-card__path { font-size: 11px; }
    .project-card__arrow { width: 34px; height: 34px; }
    .project-card__arrow::before { width: 13px; left: 10px; top: 16px; }
    .project-card__arrow::after { width: 7px; height: 7px; right: 10px; top: 12px; }
}

@media (max-width: 380px) {
    .project-card { grid-template-columns: 96px minmax(0, 1fr); }
    .project-card__image-wrap { height: 96px; }
    .project-card__title { font-size: 16px; }
    .project-card__description { -webkit-line-clamp: 1; }
}
