/* Glitch / Noise text effect */
.glitch-text {
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: -1;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 var(--accent-color);
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim 3s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 var(--light-gray);
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip: rect(20px, 9999px, 85px, 0);
    }

    5% {
        clip: rect(76px, 9999px, 14px, 0);
    }

    10% {
        clip: rect(10px, 9999px, 85px, 0);
    }

    15% {
        clip: rect(87px, 9999px, 12px, 0);
    }

    20% {
        clip: rect(98px, 9999px, 45px, 0);
    }

    25% {
        clip: rect(32px, 9999px, 90px, 0);
    }

    30% {
        clip: rect(43px, 9999px, 23px, 0);
    }

    35% {
        clip: rect(89px, 9999px, 85px, 0);
    }

    40% {
        clip: rect(12px, 9999px, 56px, 0);
    }

    45% {
        clip: rect(45px, 9999px, 23px, 0);
    }

    50% {
        clip: rect(67px, 9999px, 45px, 0);
    }

    55% {
        clip: rect(23px, 9999px, 89px, 0);
    }

    60% {
        clip: rect(78px, 9999px, 12px, 0);
    }

    65% {
        clip: rect(34px, 9999px, 56px, 0);
    }

    70% {
        clip: rect(90px, 9999px, 23px, 0);
    }

    75% {
        clip: rect(12px, 9999px, 78px, 0);
    }

    80% {
        clip: rect(56px, 9999px, 34px, 0);
    }

    85% {
        clip: rect(89px, 9999px, 90px, 0);
    }

    90% {
        clip: rect(23px, 9999px, 12px, 0);
    }

    95% {
        clip: rect(67px, 9999px, 56px, 0);
    }

    100% {
        clip: rect(34px, 9999px, 89px, 0);
    }
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

/* Hero Section */
.hero {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-bottom: 80px;
}

.hero-subtitle {
    font-size: 0.9rem;
    letter-spacing: 3px;
    color: var(--light-gray);
    margin-bottom: 24px;
    font-weight: 300;
}

.hero-title {
    font-size: clamp(3rem, 7vw, 7rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 40px;
    letter-spacing: -1px;
}

.hero-title .ts-small {
    font-size: 0.65em;
    font-weight: 300;
}

.hero-title .jp {
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    display: inline-block;
    margin-top: 15px;
    font-weight: 300;
    letter-spacing: 2px;
    color: #d0d0d0;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--light-gray);
    transform: rotate(-90deg);
    transform-origin: left bottom;
}

.scroll-line {
    width: 60px;
    height: 1px;
    background-color: var(--gray-color);
    position: relative;
    overflow: hidden;
}

.scroll-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-color: var(--accent-color);
    animation: scroll-anim 2s infinite ease-in-out;
}

@keyframes scroll-anim {
    0% {
        left: -100%;
    }

    50% {
        left: 0%;
    }

    100% {
        left: 100%;
    }
}

/* Projects Section */
.projects {
    padding: 120px 0;
}

.section-header {
    display: flex;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 80px;
    border-bottom: 1px solid var(--gray-color);
    padding-bottom: 20px;
}

.section-number {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 700;
    letter-spacing: 1px;
}

.section-title {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.project-grid {
    display: grid;
    /* PC・タブレットでは常に3列にする */
    grid-template-columns: repeat(3, 1fr);
    gap: 60px 40px;
}

.project-card {
    position: relative;
    cursor: pointer;
    display: block;
    text-decoration: none;
    color: inherit;
}

.project-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    background-color: var(--gray-color);
    overflow: hidden;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-image-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    transition: background-color 0.5s ease;
    pointer-events: none;
    z-index: 2;
}

.project-image {
    width: 100%;
    height: 100%;
    background-color: #111;
    position: relative;
    transition: transform 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);
}

/* 実際の画像を配置する場合のスタイル */
.project-image-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* 余白なく埋める場合はcover、全体を見せる場合はcontain */
    background-color: #fff;
    transition: transform 0.7s cubic-bezier(0.165, 0.84, 0.44, 1);

    /* 【ポイント】ダークトーンのサイトに完璧に馴染ませる魔法のCSS */
    /* 白背景の画像を黒背景・白文字に反転させます。不要な場合はコメントアウトしてください */
    filter: invert(1) hue-rotate(180deg);
}

/* 写真など、そのままの色で表示したい画像用のスタイル */
.project-image-content.no-invert {
    filter: none;
}

/* === 古びた写真のようなノイズフィルター（追加機能） === */
/* 画像を囲む親要素に with-vintage-noise クラスを付けると砂嵐が乗ります */
.project-image-wrapper.with-vintage-noise::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3; /* 画像より上に配置 */
    /* 砂嵐のようなノイズをSVGで生成 */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.25; /* ノイズの強さ */
    mix-blend-mode: overlay;
    transition: opacity 0.5s ease;
}

/* 画像自体を褪せた色合いにする場合（任意で vintage-tone クラスを追加） */
.project-image-content.vintage-tone {
    /* no-invert で反転を解除した上で、セピア調とコントラスト調整をかける */
    filter: sepia(0.4) saturate(0.6) contrast(0.85) brightness(0.9);
}

/* === ホバー時の変化 === */
/* ノイズがすっと晴れていくような演出 */
.project-card:hover .project-image-wrapper.with-vintage-noise::before {
    opacity: 0.05;
}

/* 画像自体の色味が少し鮮明に戻る演出 */
.project-card:hover .project-image-content.vintage-tone {
    filter: sepia(0.1) saturate(0.9) contrast(1) brightness(1);
}

/* Abstract shapes to represent noise/form */
.project-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #2a2a2a;
    transition: all 0.5s ease;
}

.p1::before {
    width: 50%;
    height: 50%;
    border-radius: 50%;
    filter: blur(10px);
}

.p2::before {
    width: 70%;
    height: 1px;
    box-shadow: 0 0 20px 5px rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%) rotate(45deg);
}

.p3::before {
    width: 40%;
    aspect-ratio: 1;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: linear-gradient(to top, transparent, #222);
}

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

.project-card:hover .project-image-wrapper::after {
    background-color: rgba(230, 57, 70, 0.15);
    mix-blend-mode: screen;
}

.project-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-title {
    font-size: 1.4rem;
    font-weight: 400;
    transition: color 0.3s ease;
    margin-bottom: 5px;
}

.project-category {
    font-size: 0.8rem;
    color: var(--light-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-card:hover .project-title {
    color: var(--accent-color);
}

/* About Section */
#about {
    padding-bottom: 160px;
}

.about-content {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    line-height: 2;
    font-weight: 300;
    max-width: 800px;
    color: var(--light-gray);
}

.about-content p {
    margin-bottom: 2em;
}

.highlight-text {
    color: var(--text-color);
    position: relative;
    display: inline-block;
}

.highlight-text::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 1px;
    background-color: var(--accent-color);
    opacity: 0.5;
}

.note-link {
    color: var(--light-gray);
    font-size: 0.8rem;
    text-decoration: none;
    letter-spacing: 1px;
    padding-bottom: 3px;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
    display: inline-block;
}

.note-link:hover {
    color: var(--text-color);
    border-bottom: 1px solid var(--accent-color);
}

.footer-links {
    text-align: right;
}

.footer-links p {
    color: var(--light-gray);
    font-size: 0.9rem;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.social-links {
    display: flex;
    gap: 30px;
}

.social-links a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 3.5rem;
    }

    .footer-links {
        text-align: left;
    }

    /* スマホでは縦1列にする */
    .project-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}
