/* ============================================================
   Takuto Kakeda — premium portfolio
   Design language: Linear × Apple × Arc × Vercel
   ============================================================ */

:root {
    --bg: #05060a;
    --bg-soft: #0a0c12;
    --ink: #f4f6fb;
    --ink-60: rgba(226, 232, 245, 0.62);
    --ink-40: rgba(226, 232, 245, 0.4);
    --line: rgba(226, 232, 245, 0.08);
    --line-strong: rgba(226, 232, 245, 0.16);
    --violet: #8b7cf7;
    --cyan: #4cc9f0;
    --coral: #ff9e64;
    --mint: #5eead4;
    --grad: linear-gradient(100deg, var(--cyan), var(--violet) 55%, var(--coral));
    --font-ui: "Inter", -apple-system, "Segoe UI", sans-serif;
    --font-serif: "Instrument Serif", Georgia, serif;
    --radius: 22px;
    --nav-h: 64px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.44, 1);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

::selection { background: rgba(139, 124, 247, 0.4); color: #fff; }

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

body.no-scroll { overflow: hidden; }

/* ---------- ambient background ---------- */
.ambient {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
        radial-gradient(1200px 800px at 80% -10%, rgba(139, 124, 247, 0.14), transparent 60%),
        radial-gradient(1000px 700px at 10% 20%, rgba(76, 201, 240, 0.1), transparent 55%),
        var(--bg);
}

.ambient-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(226, 232, 245, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(226, 232, 245, 0.035) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(1200px 900px at 50% 0%, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(1200px 900px at 50% 0%, black 30%, transparent 80%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.5;
    will-change: transform;
}
.orb-a { width: 520px; height: 520px; top: -12%; right: -8%; background: radial-gradient(circle at 30% 30%, rgba(139, 124, 247, 0.55), transparent 70%); animation: drift-a 26s ease-in-out infinite alternate; }
.orb-b { width: 460px; height: 460px; top: 34%; left: -14%; background: radial-gradient(circle at 60% 40%, rgba(76, 201, 240, 0.4), transparent 70%); animation: drift-b 32s ease-in-out infinite alternate; }
.orb-c { width: 380px; height: 380px; bottom: -10%; right: 18%; background: radial-gradient(circle at 50% 50%, rgba(255, 158, 100, 0.28), transparent 70%); animation: drift-a 38s ease-in-out infinite alternate-reverse; }

@keyframes drift-a { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(-60px, 50px, 0) scale(1.12); } }
@keyframes drift-b { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(70px, -40px, 0) scale(0.94); } }

.ambient-noise {
    position: absolute;
    inset: 0;
    opacity: 0.5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.05'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- shared primitives ---------- */
.glass {
    background: rgba(16, 19, 28, 0.55);
    border: 1px solid var(--line);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
}

.glass-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--line-strong);
    background: rgba(20, 24, 34, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--ink-60);
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6);
    animation: pulse 2.4s ease-out infinite;
    flex: none;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.55); }
    70% { box-shadow: 0 0 0 9px rgba(94, 234, 212, 0); }
    100% { box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}

.grad {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.accent-serif {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0;
}

/* buttons */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 26px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: transform 0.35s var(--ease-spring), box-shadow 0.35s ease, background 0.35s ease, border-color 0.35s ease;
    will-change: transform;
}
.btn-sm { padding: 9px 18px; font-size: 13.5px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }

.btn-primary {
    color: #0b0d14;
    background: linear-gradient(120deg, #e8ecf8, #ffffff);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 30px rgba(139, 124, 247, 0.2);
}
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 12px 42px rgba(139, 124, 247, 0.38); }

.btn-ghost {
    color: var(--ink);
    border: 1px solid var(--line-strong);
    background: rgba(226, 232, 245, 0.03);
}
.btn-ghost:hover { border-color: rgba(226, 232, 245, 0.34); background: rgba(226, 232, 245, 0.07); }

/* scroll progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 90;
    background: transparent;
}
.scroll-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: var(--grad);
    transform-origin: 0 50%;
    transform: scaleX(0);
}

/* ---------- nav ---------- */
.nav-wrap {
    position: fixed;
    top: 14px;
    left: 0;
    right: 0;
    z-index: 80;
    display: flex;
    justify-content: center;
    padding: 0 16px;
    transition: top 0.4s var(--ease-out);
}

.nav {
    display: flex;
    align-items: center;
    gap: 26px;
    width: 100%;
    max-width: 760px;
    height: 54px;
    padding: 0 10px 0 16px;
    border-radius: 999px;
    justify-content: space-between;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    transition: box-shadow 0.4s ease, background 0.4s ease;
}
.nav-wrap.scrolled .nav { background: rgba(12, 14, 21, 0.78); box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5); }

.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.03em;
}
.nav-logo img { border-radius: 9px; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-60);
    transition: color 0.25s ease, background 0.25s ease;
}
.nav-links a:hover { color: var(--ink); background: rgba(226, 232, 245, 0.06); }
.nav-links a.active { color: var(--ink); background: rgba(226, 232, 245, 0.09); }

@media (max-width: 640px) {
    .nav-links { display: none; }
}

/* ---------- hero ---------- */
.hero {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: calc(var(--nav-h) + 40px) 24px 40px;
    position: relative;
}

.hero-inner { max-width: 1060px; }

.hero-badge { margin-bottom: 34px; }

.hero-title {
    font-size: clamp(2.7rem, 7.4vw, 6.4rem);
    line-height: 1.02;
    font-weight: 800;
    letter-spacing: -0.045em;
    text-wrap: balance;
}
.hero-title .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.hero-title .w {
    display: inline-block;
    transform: translateY(110%) rotate(2deg);
    animation: word-in 0.9s var(--ease-out) forwards;
}
.hero-title .line:nth-child(1) .w { animation-delay: calc(0.05s * var(--i, 0) + 0.1s); }
.hero-title .line:nth-child(2) .w { animation-delay: calc(0.05s * var(--i, 0) + 0.28s); }
.hero-title .line:nth-child(3) .w { animation-delay: calc(0.05s * var(--i, 0) + 0.46s); }
@keyframes word-in { to { transform: translateY(0) rotate(0); } }

.hero-title .accent-serif { font-size: 1.04em; margin-right: 0.04em; }

.hero-sub {
    margin: 30px auto 0;
    max-width: 560px;
    font-size: clamp(1.02rem, 1.6vw, 1.22rem);
    color: var(--ink-60);
    text-wrap: balance;
}

.hero-ctas {
    margin-top: 42px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.scroll-hint {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0.55;
    transition: opacity 0.3s ease;
}
.scroll-hint:hover { opacity: 1; }
.scroll-hint-track {
    width: 22px;
    height: 36px;
    border: 1.5px solid var(--ink-40);
    border-radius: 999px;
    display: flex;
    justify-content: center;
    padding-top: 6px;
}
.scroll-hint-thumb {
    width: 3px;
    height: 8px;
    border-radius: 3px;
    background: var(--ink);
    animation: hint 1.8s ease-in-out infinite;
}
@keyframes hint {
    0%, 100% { transform: translateY(0); opacity: 1; }
    60% { transform: translateY(10px); opacity: 0.2; }
}
.scroll-hint-label { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-40); }

/* ---------- story chapters ---------- */
.story { position: relative; overflow: clip; }

.story-rail {
    position: sticky;
    top: 0;
    height: 0;
    z-index: 5;
    display: none;
}
@media (min-width: 1100px) {
    .story-rail { display: block; }
    .story-rail-line {
        position: absolute;
        left: 48px;
        top: 18vh;
        width: 2px;
        height: 64vh;
        background: var(--line);
        border-radius: 2px;
        overflow: hidden;
        display: block;
    }
    .story-rail-line span {
        display: block;
        width: 100%;
        height: 100%;
        background: var(--grad);
        transform-origin: 0 0;
        transform: scaleY(0);
    }
}

.chapter {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 110px 24px;
    overflow: clip;
}

.chapter-ghost {
    position: absolute;
    top: 50%;
    right: 4vw;
    transform: translateY(-50%);
    font-size: clamp(14rem, 34vw, 30rem);
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1px rgba(226, 232, 245, 0.07);
    user-select: none;
    pointer-events: none;
}

.chapter-body { max-width: 720px; width: 100%; position: relative; z-index: 1; }

.chapter-kicker {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-40);
    margin-bottom: 22px;
}
.chapter-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 12.5px;
    letter-spacing: 0.04em;
    color: var(--ch);
    background: color-mix(in srgb, var(--ch) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--ch) 30%, transparent);
}

.chapter-title {
    font-size: clamp(3.2rem, 9vw, 7.4rem);
    font-weight: 800;
    line-height: 0.98;
    letter-spacing: -0.045em;
    background: linear-gradient(120deg, var(--ink) 30%, color-mix(in srgb, var(--ch) 75%, white));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.chapter-copy {
    margin-top: 28px;
    max-width: 560px;
    font-size: clamp(1.02rem, 1.5vw, 1.18rem);
    color: var(--ink-60);
}

.chapter-stats { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px; }

.stat-chip {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 550;
    color: color-mix(in srgb, var(--ch) 82%, white);
    background: color-mix(in srgb, var(--ch) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--ch) 26%, transparent);
}

/* ---------- generic section ---------- */
.section { padding: 140px 24px; max-width: 1180px; margin: 0 auto; }

.section-head { max-width: 720px; margin-bottom: 64px; }

.section-kicker {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-40);
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(2.2rem, 4.6vw, 3.6rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.04em;
}
.section-title .accent-serif { font-size: 1.06em; }

.section-sub { margin-top: 18px; color: var(--ink-60); font-size: 1.05rem; max-width: 540px; }

/* ---------- work grid ---------- */
.work-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 760px) { .work-grid { grid-template-columns: 1fr; } }

.work-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 26px;
    text-align: left;
    padding: 28px;
    min-height: 260px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(16, 19, 28, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    transition: transform 0.45s var(--ease-spring), border-color 0.35s ease, box-shadow 0.35s ease;
    will-change: transform;
}
.work-card:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--pc) 40%, transparent);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--pc) 18%, transparent) inset;
}

/* cursor spotlight */
.spotlight::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--pc, #8b7cf7) 13%, transparent), transparent 65%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}
.spotlight:hover::before { opacity: 1; }

.work-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.work-logo {
    width: 54px;
    height: 54px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: rgba(226, 232, 245, 0.06);
    border: 1px solid var(--line);
    overflow: hidden;
}
.work-logo img { width: 70%; height: 70%; object-fit: contain; }

.work-logo-mono {
    font-weight: 800;
    font-size: 24px;
    letter-spacing: -0.02em;
    color: #0b0d14;
    background: linear-gradient(135deg, var(--cyan), var(--violet));
    border: 0;
}

.work-expand {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-strong);
    color: var(--ink-60);
    transition: transform 0.4s var(--ease-spring), background 0.3s ease, color 0.3s ease;
}
.work-card:hover .work-expand {
    transform: scale(1.12) rotate(45deg);
    background: var(--ink);
    color: #0b0d14;
}

.work-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 13px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--mint);
    background: rgba(94, 234, 212, 0.08);
    border: 1px solid rgba(94, 234, 212, 0.25);
}

.work-card-main { margin-top: auto; }
.work-card-main h3 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.03em; }
.work-card-main p { margin-top: 8px; color: var(--ink-60); font-size: 0.97rem; max-width: 420px; }

.work-card-meta { display: flex; flex-wrap: wrap; gap: 8px; }

.tag {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 550;
    color: var(--ink-60);
    border: 1px solid var(--line);
    background: rgba(226, 232, 245, 0.03);
}

/* ---------- focus ---------- */
.focus-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 900px) { .focus-grid { grid-template-columns: 1fr; } }

.focus-card {
    position: relative;
    padding: 30px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(16, 19, 28, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
    transition: transform 0.45s var(--ease-spring), border-color 0.35s ease;
}
.focus-card:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--pc) 38%, transparent);
}

.focus-num {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: color-mix(in srgb, var(--pc) 85%, white);
}
.focus-card h3 { margin-top: 42px; font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.focus-card p { margin-top: 10px; font-size: 0.95rem; color: var(--ink-60); }

/* ---------- about ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 72px;
    align-items: start;
}
@media (max-width: 900px) { .about-grid { grid-template-columns: 1fr; gap: 48px; } }

.about-lede {
    margin-top: 26px;
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    line-height: 1.5;
    color: var(--ink);
    letter-spacing: -0.015em;
}
.about-copy { margin-top: 18px; color: var(--ink-60); max-width: 560px; }

.about-interests {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
}
.about-interests li {
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    color: var(--ink-60);
    border: 1px solid var(--line);
    background: rgba(226, 232, 245, 0.03);
    transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s var(--ease-spring);
}
.about-interests li:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-2px); }

.about-side { display: flex; flex-direction: column; gap: 20px; }

.about-photo {
    border-radius: var(--radius);
    overflow: hidden;
    padding: 12px;
}
.about-photo img {
    width: 100%;
    aspect-ratio: 1 / 1.05;
    object-fit: cover;
    border-radius: calc(var(--radius) - 8px);
}
.about-photo figcaption {
    padding: 16px 8px 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.about-photo strong { font-size: 1.02rem; letter-spacing: -0.01em; }
.about-photo span { font-size: 0.85rem; color: var(--ink-40); }

.about-timeline { border-radius: var(--radius); padding: 24px; }
.about-timeline h3 {
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-40);
    margin-bottom: 16px;
}
.about-timeline ol { list-style: none; display: flex; flex-direction: column; gap: 13px; }
.about-timeline li {
    display: flex;
    gap: 14px;
    font-size: 0.92rem;
    color: var(--ink-60);
    line-height: 1.45;
}
.about-timeline li span {
    flex: none;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--violet);
    width: 42px;
    padding-top: 1px;
}

/* ---------- contact ---------- */
.contact {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 140px 24px 0;
    position: relative;
}

.contact-inner { max-width: 860px; }

.contact-title {
    font-size: clamp(2.6rem, 6.4vw, 5.4rem);
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.045em;
    text-wrap: balance;
}
.contact-title .accent-serif { font-size: 1.05em; }

.contact-sub {
    margin: 24px auto 0;
    max-width: 480px;
    color: var(--ink-60);
    font-size: 1.08rem;
}

.contact-ctas {
    margin-top: 44px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.contact-socials {
    margin-top: 34px;
    display: flex;
    gap: 14px;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--ink-40);
}
.contact-socials a {
    color: var(--ink-60);
    border-bottom: 1px solid transparent;
    transition: color 0.25s ease, border-color 0.25s ease;
}
.contact-socials a:hover { color: var(--ink); border-color: var(--ink-40); }

.footer {
    width: 100%;
    max-width: 1180px;
    margin-top: auto;
    padding: 90px 0 34px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--ink-40);
}
.footer a { transition: color 0.25s ease; }
.footer a:hover { color: var(--ink); }

/* ---------- project overlay ---------- */
.project-overlay {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 20px;
}
.project-overlay[hidden] { display: none; }

.project-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 8, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.project-overlay.open .project-overlay-backdrop { opacity: 1; }

.project-overlay-card {
    position: relative;
    width: min(680px, 100%);
    max-height: min(82vh, 760px);
    border-radius: 26px;
    overflow: hidden;
    background: rgba(13, 15, 23, 0.92);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
    transform-origin: center;
    will-change: transform, opacity;
}

.project-overlay-scroll { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }

.project-overlay-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--ink);
    background: rgba(10, 12, 18, 0.55);
    border: 1px solid var(--line-strong);
    backdrop-filter: blur(8px);
    transition: transform 0.3s var(--ease-spring), background 0.3s ease;
}
.project-overlay-close:hover { transform: scale(1.08) rotate(90deg); background: rgba(226, 232, 245, 0.12); }

.project-overlay-band {
    height: 150px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--pc, #8b7cf7) 55%, #0b0d14), color-mix(in srgb, var(--pc, #8b7cf7) 18%, #0b0d14) 70%);
    position: relative;
}
.project-overlay-band::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(400px 160px at 85% 0%, rgba(255, 255, 255, 0.18), transparent 70%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.06'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.project-overlay-body { padding: 30px 34px 40px; }

.overlay-kicker {
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: color-mix(in srgb, var(--pc, #8b7cf7) 80%, white);
}
.project-overlay-body h3 {
    margin-top: 10px;
    font-size: clamp(1.7rem, 3.4vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}
.overlay-tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.overlay-desc { margin-top: 22px; color: var(--ink-60); font-size: 1rem; line-height: 1.7; white-space: pre-line; }

.overlay-stats {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.overlay-stat {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(226, 232, 245, 0.03);
}
.overlay-stat strong {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: color-mix(in srgb, var(--pc, #8b7cf7) 75%, white);
}
.overlay-stat span { font-size: 0.82rem; color: var(--ink-40); }

/* ---------- reveal on scroll ---------- */
.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
    transition-delay: var(--rd, 0s);
    will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
.d-1 { --rd: 0.1s; }
.d-2 { --rd: 0.2s; }
.d-3 { --rd: 0.3s; }
.d-4 { --rd: 0.4s; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal { opacity: 1; transform: none; }
    .hero-title .w { transform: none; animation: none; }
}
