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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; 
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', sans-serif;
    color: #333;
    line-height: 1.6;
}

/* <body>自体の背景は透明にして下の画像を見せる */
body {
    background-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- ページ全体に固定されるメイン画像 --- */
.fixed-main-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: url('images/hero.png') center/cover no-repeat fixed; /* 一括指定で短縮 */
    z-index: -2; 
}

/* 画像の上にうっすら暗いフィルターをかける */
.fixed-main-bg::before {
    content: '';
    position: absolute;
    inset: 0; /* top/left/width/heightを1行で指定 */
    background-color: rgba(0, 0, 0, 0.2); 
    z-index: -1;
}

/* --- ロゴとアニメーション --- */
.logo {
    font-family: 'Pinyon Script', cursive; 
    font-size: 70px;                     
    letter-spacing: 14px;                 
    color: #ffffff;                       
    display: inline-block;
    white-space: nowrap;
    clip-path: inset(0 100% 0 0); 
    animation: writeTextNew 2.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards; /* delayを一括化 */
}

/* 左から右へマスクを開いていくキーフレーム */
@keyframes writeTextNew {
    to { clip-path: inset(0 0% 0 0); } /* 0%は初期値と被るため削除 */
}

.text-switcher {
    position: relative;
    display: block;
    height: 1.5em; 
}

/* 2つのテキストの共通ベース */
.split-text {
    position: absolute;
    top: 0;
    white-space: nowrap;
    width: 100%;
    margin: 0;
    transform: translateX(-50%); /* 共通なのでここで一括指定 */
}

/* 1文目 */
.text-1 {
    left: calc(50% - 45px); 
    animation: textOut 0.6s ease-in-out 4.0s forwards;
}
/* 2文目 */
.text-2 {
    left: 50%;
    visibility: hidden;
}
.text-2.is-active {
    visibility: visible;
}

/* --- 1文目と2文目の文字アニメーション（共通化） --- */
.text-1 span, .text-2 span {
    display: inline-block;
    opacity: 0;
    animation: textFlow 0.5s ease-out forwards;
}

/* 固有のプロパティのみ個別に指定 */
.text-1 span {
    animation-delay: 3.0s;
    /* transform初期値は0なので記述を削除 */
}
.text-2 span {
    transform: translateX(-15px); /* スタート地点 */
}

/* 共通キーフレーム（1文目のその場フェードインにもこれで対応） */
@keyframes textFlow {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 1文目を消すアニメーション */
@keyframes textOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* ボタンが下から浮き上がるアニメーション */
.fade-in-btn {
    opacity: 0;
    transform: translateY(100px);
    animation: btnFadeIn 0.8s ease-out 5.8s forwards;
}

@keyframes btnFadeIn {
    to {
        transform: translateY(40px);
        opacity: 1;
    }
}


/* --- 2文目の文字アニメーション（元々の仕様：15px左から流れる） --- */
.text-2 span {
    display: inline-block;
    opacity: 0;
    transform: translateX(-15px);
    animation: textFlow 0.5s ease-out forwards;
}

@keyframes textFlow {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* 1文目を消すアニメーション */
@keyframes textOut {    
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* ボタンが下から浮き上がるアニメーション */
.fade-in-btn {
    opacity: 0;
    transform: translateY(100px);
    animation: btnFadeIn 0.8s ease-out 5.8s forwards;
}

@keyframes btnFadeIn {
    to {
        transform: translateY(40px);
        opacity: 1;
    }
}




/* --- レイアウト共通（ここが透けるボックスになります） --- */
.section {
    padding: 60px 30px;
    max-width: 900px;
    margin: 60px auto; /* セクション間に隙間を作って、背景画像を見せる */
    
    /* 【ポイント】白を85%の不透明度にして、背景を透けさせつつ文字をクッキリ見せる */
    background-color: rgba(255, 255, 255, 0.85); 
    border-radius: 12px; /* 角を丸く */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); 
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background-color: #333;
    margin: 10px auto 0;
}

/* --- ヘッダー --- */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.9); /* ヘッダーも少し透けさせる */
    backdrop-filter: blur(5px); /* 背景を少しボカすおしゃれエフェクト */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 100;
    /* 最初は透明にして、20px */
    opacity: 0;
    transform: translateY(-20px);
    animation: headerSlideIn 1.0s cubic-bezier(0.25, 1, 0.5, 1) 6.7s forwards;
    backface-visibility: hidden;
    will-change: transform, opacity;
}
@keyframes headerSlideIn {
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0); /*  Y(0)から3D指定に変更してブレを防止 */
    }
}


.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px 20px;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 50px;
    margin-left: auto;
}

.nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #0076df;
}

/* --- メインビジュアル (Hero) --- */
.hero {
    height: 75vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    margin-top: 50px;
    background: transparent; /* 背景は完全に透明にしてメイン画像を見せる */
}

.hero-name {
    position: absolute;
    left: 40px; 
}

.hero-content {
    color: #fff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); /* 画像に負けないよう文字に影をつける */
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 35px;
    opacity: 0.95;
}

.btn {
    display: inline-block;
    background-color: #fff;
    color: #333;
    padding: 14px 35px;
    border-radius: 25px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.btn:hover {
    background-color: #0076df;
    color: #fff;
    transform: translateY(-2px);
}

/* --- 自己紹介 (About) --- */
.about-container {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.text {
    margin-bottom: 30px;
}

.subtitle {
    color: #666;
    margin-bottom: 25px;
    font-size: 0.95rem;
}

/* 修正：文字全体を中央に寄せつつ、中身は左揃えにするベース */
.typing-text {
    display: inline-block; /* 全体は中央に寄せるための設定 */
    text-align: left;    
}

.typing-text .line {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    display: block;        /* 1行ずつしっかりと改行させる */
    margin-bottom: 10px;   /* 行間の調整 */
}

/* --- スクロール検知でクラスがついた時の動き --- */
.typing-text.is-animated .line {
    opacity: 1;
    transform: translateY(0);
}

/* --- 各行の時間差（ディレイ）設定 --- */
.typing-text.is-animated .line:nth-child(1) { transition-delay: 0s; }
.typing-text.is-animated .line:nth-child(2) { transition-delay: 0.4s; }
.typing-text.is-animated .line:nth-child(3) { transition-delay: 0.8s; }
.typing-text.is-animated .line:nth-child(4) { transition-delay: 1.2s; }

/* ==========================================================================
   1. 基本コンテナ & グリッド配置
   ========================================================================== */

/* セクション全体の回転用コンテナ */
.skills-flip-container {
    position: relative; /* ここを基準にトリガーを右下に固定します */
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

/* 表面と裏面を重ねるインナーグリッド */
.skills-flip-inner {
    display: grid;
    position: relative;
    width: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d; /* 3D回転を滑らかにするために追加推奨 */
}

/* スキルカードを並べる共通グリッド */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

/* ==========================================================================
   2. フリップ（回転）アニメーション
   ========================================================================== */

/* 表面と裏面の共通ルール（同一セルに重ねる） */
.skills-front, 
.skills-back {
    grid-area: 1 / 1 / 2 / 2;
    width: 100%;
    backface-visibility: hidden;
}

/* 各面の初期角度 */
.skills-front {
    transform: rotateY(0deg);
}

.skills-back {
    transform: rotateY(180deg);
}

/* 回転実行（JSでクラス付与） */
.skills-flip-container.flipped .skills-flip-inner {
    transform: rotateY(180deg);
}

/* ==========================================================================
   3. カードのデザイン
   ========================================================================== */

.card {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

.card h3 {
    margin-bottom: 12px;
    color: #0076df;
    font-size: 1.25rem;
}

/* ==========================================================================
   4. 右下のめくれ（トリガー）
   ========================================================================== */

.page-peel-trigger {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 20; /* 回転する要素(10)より前面に出すために20に修正 */
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-bottom-right-radius: 8px;
    background: linear-gradient(135deg, transparent 50%, rgba(0, 0, 0, 0.03) 50%, rgba(0, 0, 0, 0.08) 100%);
    transition: all 0.3s ease;
}

.page-peel-trigger::before {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 15px 15px;
    border-color: transparent transparent rgba(0, 0, 0, 0.05) rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

/* ホバー時の挙動 */
.page-peel-trigger:hover {
    background: linear-gradient(135deg, transparent 40%, rgba(0, 0, 0, 0.05) 40%, rgba(0, 0, 0, 0.1) 100%);
}

.page-peel-trigger:hover::before {
    border-width: 0 0 22px 22px;
}




/* --- 制作実績 (Works) --- */
#works {
    scroll-margin-top: 50px; /* ★ここの数字でWorksの止まる位置だけを下にズラせます */
}

.work-item {
    cursor: pointer;
    transition: transform 0.3s;
}

.work-item:hover {
    transform: translateY(-7px);
}

.work-item h3 {
    font-size: 1.15rem;
    margin-bottom: 5px;
}

.work-item p {
    color: #666;
    font-size: 0.85rem;
}

/* 画像を囲む枠を元のプレースホルダーのサイズ（横長）に固定する */
.work-thumb {
    width: 100%;
    aspect-ratio: 16 / 9; /* 横16 : 縦9 の比率に固定 */
    overflow: hidden; /* 枠からはみ出た画像を非表示にする */
    border-radius: 4px; 
}

/* 中の画像に対する指示 */
.work-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 画像の縦横比を崩さず、枠いっぱいに綺麗に収める（最重要） */
    object-position: center; /* 画像の中心が真ん中に来るようにする */
    display: block;
}

/* --- お問い合わせ (Contact) --- */
.contact-container {
    text-align: center;
}

.email {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 20px 0;
}

.contact {
    color: #0076df;
    text-decoration: underline;
}

/* --- フッター --- */
footer {
    background-color: rgba(51, 51, 51, 0.95);
    color: #fff;
    text-align: center;
    padding: 25px;
    font-size: 0.8rem;
    position: relative;
    z-index: 10;
}
/* --- メディアクエリ --- */
@media (max-width: 768px) {
    .section {
        width: 100%;
        margin: 30px  0px ; 
        padding: 40px 20px;
    }
    .fixed-main-bg {
        /* スマホでの表示バグの原因「fixed」を無効化（スクロール追従へ変更） */
        background-attachment: scroll; 

        /* スマホのブラウザのメニューバー（上下）が出し入れされても */
        /* 画像がガクガク揺れるのを防ぐために、高さを自動追従ではなく100%に固定 */
        height: 100%; 
        
        /* 画像が縦長に潰れたり、引き伸ばされたりするのを防ぐ */
        background-size: cover;
        background-position: center;
    }
    /* --- ヘッダー・ロゴの中央寄せ --- */
    header {
        width: 100%;
    }
    .hero-content {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
    }
    .nav-container {
        flex-direction: column;
        align-items: center;    
        gap: 15px;
        width: 100%;
        padding: 15px 0;        
    }
    .hero-name {
        position: static;       
        left: 10px;             
        text-align: center;     
        width: 100%;            
    }
    .logo {
        font-size: 36px;        
        letter-spacing: 6px;    
        white-space: nowrap;    
        display: inline-block;
        text-align: center;
        margin: 0 auto;         
    }
.text-1 {
    left: calc(50% - 70px); 
}
    .nav-links {
        display: flex;
        justify-content: center; 
        gap: 25px;              
        width: 100%;
        padding: 0;             
    }
    footer {
        width: 100%;
    }
    .section {
        width: 100%;
        margin: 30px 0;
        padding: 0 20px;
        background: none;
        box-shadow: none;
        border-radius: 0;
    }
    .section-head {
        background-color: rgba(255, 255, 255, 0.85);
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        padding: 30px 20px;
        margin-bottom: 20px;
    }
    .section-head .subtitle {
        margin-bottom: 0;
    }
}
