.project-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Works Section */
/* Works Section - Mobile First */
.works-section {
    padding: clamp(4rem, 10vw, 8rem) 5%;  /* Responsive padding */
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    isolation: isolate;
}

.works-section::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 100vw;
    transform: translateX(-50%);
    background: linear-gradient(
        180deg,
        rgba(232, 160, 32, 0) 0%,
        rgba(232, 160, 32, 0.14) 50%,
        rgba(232, 160, 32, 0) 100%
    );
    z-index: -1;
    pointer-events: none;
}

/* Main Section Title */
.main-section-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 300;
    letter-spacing: clamp(0.2em, 2vw, 0.75em);
    text-align: center;
    margin-bottom: clamp(4rem, 8vw, 8rem);
    position: relative;
}

.main-section-title::before {
    content: attr(data-ghost);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(6rem, 20vw, 16rem);
    font-weight: 400;
    letter-spacing: 0.05em;
    color: transparent;
    -webkit-text-stroke: 1px rgba(0, 0, 0, 0.12);
    white-space: nowrap;
    pointer-events: none;
    z-index: -1;
    user-select: none;
}

.main-section-title::after {
    content: '';
    position: absolute;
    bottom: -2rem;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(60px, 15vw, 120px);
    height: 2px;
    background: var(--accent);
}

/* Subsections */
.works-subsection {
    margin-bottom: clamp(6rem, 12vw, 10rem);
    padding-top: clamp(6rem, 12vw, 10rem);
}

.works-subsection:nth-child(even) {
    margin-bottom: 0;
}

.works-subsection:first-child {
    padding-top: 0;
    border-top: none;
}

.works-subsection:last-child {
    margin-bottom: 0;
}

.subsection-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 300;
    letter-spacing: clamp(0.15em, 1.5vw, 0.4em);
    margin-bottom: clamp(2rem, 5vw, 4rem);
    text-align: center;
    color: #666;
}

/* Projects Grid - Responsive */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: clamp(2rem, 5vw, 6rem);
}

.project-card {
    position: relative;
    height: clamp(350px, 60vw, 500px);  /* Scales with viewport */
    overflow: hidden;
    cursor: pointer;
    background: #f5f5f5;
    border-radius: clamp(12px, 3vw, 20px);
    transition: opacity 0.4s ease, transform 0.7s ease;
}

/* Radial spotlight overlay — position driven by JS via --mx / --my */
.project-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        300px circle at var(--mx, 50%) var(--my, 50%),
        rgba(255, 255, 255, 0.22),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 3;
    pointer-events: none;
    border-radius: inherit;
}

.project-card:hover::before {
    opacity: 1;
}

/* Project Overlay - Adjust padding for mobile */
.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.88) 0%, rgba(232, 160, 32, 0.55) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: clamp(1.5rem, 5vw, 3rem);
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.projects-grid:hover .project-card:not(:hover),
.personal-projects-grid:hover .project-card:not(:hover) {
    opacity: 0.4;
}

.project-title {
    font-size: clamp(1.2rem, 4vw, 2rem);
    font-weight: 300;
    letter-spacing: clamp(0.1em, 0.5vw, 0.2em);
    color: #fff;
    margin-bottom: 1rem;
    transform: translateY(20px);
    transition: transform 0.5s ease 0.1s;
    text-align: center;
}

.project-card:hover .project-title {
    transform: translateY(0);
}

.project-description {
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: #ccc;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 0.05em;
    transform: translateY(20px);
    transition: transform 0.5s ease 0.2s;
}

.project-card:hover .project-description {
    transform: translateY(0);
}

/* Coming Soon */
.coming-soon {
    min-height: clamp(250px, 50vw, 400px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #f8f8f8;
    border-radius: clamp(12px, 3vw, 20px);
    padding: clamp(2rem, 5vw, 4rem);
    text-align: center;
}

.coming-soon-text {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 300;
    letter-spacing: clamp(0.2em, 1vw, 0.5em);
    color: #000;
    margin-bottom: 1rem;
}

.coming-soon-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    letter-spacing: 0.1em;
    color: #999;
}

/* Responsive */
@media (max-width: 768px) {
    .main-section-title {
        font-size: 3rem;
        letter-spacing: 6px;
        margin-bottom: 5rem;
    }
    
    .subsection-title {
        font-size: 1.5rem;
        letter-spacing: 4px;
    }
    
    .works-subsection {
        margin-bottom: 6rem;
    }
    
    .coming-soon {
        min-height: 300px;
        padding: 3rem 2rem;
    }
    
    .coming-soon-text {
        font-size: 2rem;
        letter-spacing: 4px;
    }
    
    .coming-soon-subtitle {
        font-size: 1rem;
    }
}

.section-title {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 4px;
    margin-bottom: 4rem;
    text-align: center;
}

/* (duplicate .projects-grid / .project-card rules removed — the responsive
   versions above use clamp() and auto-fit which already handle mobile.) */

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.88) 0%, rgba(232, 160, 32, 0.55) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 2;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-title {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: #fff;
    margin-bottom: 1rem;
    transform: translateY(20px);
    transition: transform 0.5s ease 0.1s;
}

.project-card:hover .project-title {
    transform: translateY(0);
}

.project-description {
    font-size: 1rem;
    color: #ccc;
    text-align: center;
    line-height: 1.6;
    letter-spacing: 1px;
    transform: translateY(20px);
    transition: transform 0.5s ease 0.2s;
}

.project-card:hover .project-description {
    transform: translateY(0);
}

.hover-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.project-card:hover .hover-image {
    opacity: 1;
    transform: scale(1.05);
}

/* Film strip — horizontal scroll row */
.film-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: clamp(1rem, 2vw, 1.5rem);
    padding-bottom: 1.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.film-strip::-webkit-scrollbar {
    display: none;
}

.film-strip:active {
    cursor: grabbing;
}

.film-strip .project-link {
    flex: 0 0 auto;
    width: clamp(260px, 28vw, 420px);
    scroll-snap-align: start;
}

.film-strip .project-card {
    height: clamp(380px, 55vw, 560px);
}

/* Logo card — centered logo with falling petals */
.project-card--logo {
    background: linear-gradient(180deg, #fafafa 0%, #f3e7ea 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    isolation: isolate;
}

.project-logo-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card--logo:hover .project-logo-inner {
    transform: scale(1.05);
}

[data-theme="dark"] .project-card--logo {
    background: linear-gradient(180deg, #18181b 0%, #2a1f24 100%);
}

/* ── Falling cherry blossom petals ── */
.falling-petals {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    container-type: size;
}

.petal {
    position: absolute;
    top: -24px;
    width: 16px;
    height: 16px;
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0;
    animation: petal-fall linear infinite;
    will-change: transform, opacity;
}

/* Petal shape variants (SVG data URIs — match the logo's petal library) */
.petal--1, .petal--5, .petal--9 {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-6 -12 12 12'><path d='M 0 0 Q -5 -4 -4 -9 Q -3 -11 -1.5 -10 Q 0 -9 1.5 -10 Q 3 -11 4 -9 Q 5 -4 0 0 Z' fill='%23e8a0b4'/></svg>");
}
.petal--2, .petal--6, .petal--10 {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-6 -12 12 12'><path d='M 0 0 Q -5 -3 -5 -8 Q -3 -11 0 -11 Q 3 -11 5 -8 Q 5 -3 0 0 Z' fill='%23f4c2d0'/></svg>");
}
.petal--3, .petal--7 {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-5 -12 10 12'><path d='M 0 0 Q -4 -4 -3 -9 Q -1 -12 0 -11.5 Q 1 -12 3 -9 Q 4 -4 0 0 Z' fill='%23d4607e'/></svg>");
}
.petal--4, .petal--8 {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-5 -13 10 13'><path d='M 0 0 Q -4 -4 -2 -10 Q 0 -13 2 -10 Q 4 -4 0 0 Z' fill='%23fce4ec'/></svg>");
}

/* Individual petal positions, timings and sway */
.petal--1  { left: 6%;  animation-duration: 9s;  animation-delay: 0s;   --sway: 20px; }
.petal--2  { left: 18%; animation-duration: 12s; animation-delay: 1.5s; --sway: -25px; }
.petal--3  { left: 30%; animation-duration: 8s;  animation-delay: 3s;   --sway: 15px; }
.petal--4  { left: 42%; animation-duration: 14s; animation-delay: 2s;   --sway: -30px; }
.petal--5  { left: 54%; animation-duration: 10s; animation-delay: 0.5s; --sway: 25px; }
.petal--6  { left: 66%; animation-duration: 13s; animation-delay: 4s;   --sway: -20px; }
.petal--7  { left: 76%; animation-duration: 9s;  animation-delay: 6s;   --sway: 18px; }
.petal--8  { left: 86%; animation-duration: 11s; animation-delay: 2.5s; --sway: -22px; }
.petal--9  { left: 94%; animation-duration: 15s; animation-delay: 5s;   --sway: 12px; }
.petal--10 { left: 12%; animation-duration: 10s; animation-delay: 7s;   --sway: -16px; width: 12px; height: 12px; }

@keyframes petal-fall {
    0% {
        transform: translate3d(0, -24px, 0) rotate(0deg);
        opacity: 0;
    }
    8% {
        opacity: 0.9;
    }
    50% {
        transform: translate3d(var(--sway, 20px), 50cqh, 0) rotate(270deg);
    }
    92% {
        opacity: 0.9;
    }
    100% {
        transform: translate3d(0, calc(100cqh + 24px), 0) rotate(540deg);
        opacity: 0;
    }
}

/* ── Japanese Learning card — white background with floating hiragana ── */
.project-card--japanese {
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    isolation: isolate;
}

[data-theme="dark"] .project-card--japanese {
    background: #18181b;
}

.floating-hiragana {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.kana {
    position: absolute;
    font-family: 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
    color: rgba(232, 160, 32, 0.45);
    font-weight: 300;
    line-height: 1;
    animation: kana-drift ease-in-out infinite;
    will-change: transform, opacity;
}

[data-theme="dark"] .kana {
    color: rgba(232, 160, 32, 0.55);
}

/* Kanji are visually heavier — render them at lower opacity so they don't dominate */
.kana--kanji {
    color: rgba(232, 160, 32, 0.35);
    font-weight: 400;
}

[data-theme="dark"] .kana--kanji {
    color: rgba(232, 160, 32, 0.42);
}

/* Katakana — angular, contrast against the rounder hiragana */
.kana--katakana {
    color: rgba(232, 160, 32, 0.40);
    font-weight: 400;
}

[data-theme="dark"] .kana--katakana {
    color: rgba(232, 160, 32, 0.50);
}

/* Each character has a unique position, size, timing, and drift */
.kana--1  { left: 8%;   top: 14%;  font-size: 3.6rem; animation-duration: 11s; animation-delay: 0s;   }
.kana--2  { left: 76%;  top: 18%;  font-size: 4.4rem; animation-duration: 13s; animation-delay: 2s;   }
.kana--3  { left: 42%;  top: 8%;   font-size: 2.8rem; animation-duration: 9s;  animation-delay: 1s;   }
.kana--4  { left: 18%;  top: 56%;  font-size: 5rem;   animation-duration: 14s; animation-delay: 3s;   }
.kana--5  { left: 64%;  top: 64%;  font-size: 3.2rem; animation-duration: 10s; animation-delay: 4s;   }
.kana--6  { left: 88%;  top: 48%;  font-size: 2.6rem; animation-duration: 12s; animation-delay: 0.5s; }
.kana--7  { left: 4%;   top: 78%;  font-size: 3.8rem; animation-duration: 15s; animation-delay: 5s;   }
.kana--8  { left: 50%;  top: 82%;  font-size: 2.4rem; animation-duration: 11s; animation-delay: 2.5s; }
.kana--9  { left: 32%;  top: 36%;  font-size: 3rem;   animation-duration: 13s; animation-delay: 6s;   }
.kana--10 { left: 80%;  top: 86%;  font-size: 3.4rem; animation-duration: 9s;  animation-delay: 1.5s; }
.kana--11 { left: 58%;  top: 28%;  font-size: 2.6rem; animation-duration: 12s; animation-delay: 3.5s; }
.kana--12 { left: 24%;  top: 24%;  font-size: 3.4rem; animation-duration: 14s; animation-delay: 7s;   }
.kana--13 { left: 92%;  top: 10%;  font-size: 2.4rem; animation-duration: 10s; animation-delay: 4.5s; }
.kana--14 { left: 14%;  top: 88%;  font-size: 2.8rem; animation-duration: 13s; animation-delay: 1.8s; }
.kana--15 { left: 70%;  top: 4%;   font-size: 3rem;   animation-duration: 11s; animation-delay: 6.5s; }

@keyframes kana-drift {
    0%, 100% {
        transform: translate3d(0, 0, 0) rotate(0deg);
        opacity: 0.35;
    }
    50% {
        transform: translate3d(8px, -14px, 0) rotate(6deg);
        opacity: 0.7;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .petal,
    .kana {
        animation: none;
    }
    .petal {
        display: none;
    }
}

.film-strip-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.strip-btn {
    background: none;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.strip-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Card metadata — category/location label below each card */
.card-meta {
    padding: 0.75rem 0.25rem 0;
}

.card-location {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: #999;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

@media (max-width: 600px) {
    .card-location {
        font-size: 0.7rem;
        letter-spacing: 0.05em;
    }

    .card-meta {
        padding: 0.5rem 0.25rem 0;
    }
}

/* Personal Projects - Full-width single column layout */
.personal-projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(2rem, 5vw, 4rem);
}

.personal-project-card {
    height: clamp(220px, 30vw, 380px);
}

.project-tag {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    color: #aaa;
    margin-bottom: 0.75rem;
}