/*
Theme Name: Protagonist Theme
Author: Yuki Tsuruta
Description: A custom theme for Protagonist Inc.
Version: 6.0
*/

/* =================================================================
    基本スタイル
    ================================================================= */
html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: #fafafa;
    color: #18181b;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    overflow-wrap: break-word;
}

@media (min-width: 768px) {
    h2, h3, h4 {
        word-break: keep-all;
    }
}

/* パーティクル背景 */
#tsparticles,
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    pointer-events: none;
}

/* =================================================================
    ヘッダー
    ================================================================= */
.header-scrolled {
    background: rgba(250, 250, 250, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.nav-link {
    position: relative;
    padding: 0.5rem 1rem;
    color: #3f3f46;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0.5rem;
}
.nav-link:hover {
    color: #18181b;
    background-color: rgba(24, 24, 27, 0.08);
    transform: translateY(-1px);
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #18181b 0%, #3f3f46 100%);
    transform: translateX(-50%);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover::after {
    width: 70%;
}

/* ハンバーガーメニュー */
.menu-open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.menu-open span:nth-child(2) {
    opacity: 0;
}
.menu-open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* =================================================================
    モダンカードデザイン
    ================================================================= */
.card-modern {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05),
                0 4px 12px rgba(0, 0, 0, 0.05),
                0 16px 24px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.card-modern:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08),
                0 12px 32px rgba(0, 0, 0, 0.12),
                0 24px 48px rgba(0, 0, 0, 0.08);
    border-color: rgba(255, 255, 255, 0.4);
}

/* =================================================================
    アニメーション & UI要素
    ================================================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* FAQアコーディオン */
details > summary { 
    list-style: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
details > summary::-webkit-details-marker { 
    display: none; 
}
details > summary:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
details[open] summary {
    background: rgba(255, 255, 255, 0.95);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
details[open] summary .plus-icon { 
    transform: rotate(45deg); 
}
details[open] {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-radius: 0.75rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* =================================================================
    トップへ戻るボタン
    ================================================================= */
#back-to-top-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: #18181b;
    color: white;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    z-index: 999;
}

#back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top-btn:hover {
    background-color: #3f3f46;
    transform: translateY(-2px);
}

#back-to-top-btn svg {
    width: 24px;
    height: 24px;
}

/* =================================================================
    汎用Contact Form 7 デザイン
    ================================================================= */
.wpcf7-form p, .wpcf7-form > div {
    margin-bottom: 0.75rem; 
}
.wpcf7-form-control:not(.wpcf7-submit) {
    width: 100% !important;
    background: #ffffff !important;
    border: 1px solid #d4d4d8 !important;
    color: #18181b !important;
    font-size: 0.875rem !important;
    border-radius: 0.75rem !important;
    padding: 0.875rem !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-sizing: border-box;
}
.wpcf7-form-control:not(.wpcf7-submit):focus {
    outline: none !important;
    border-color: #3f3f46 !important;
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.1),
                0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.wpcf7-response-output {
    margin: 1.5rem 0 0 !important;
    padding: 1rem 1.5rem !important;
    border-radius: 0.75rem !important;
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
}

.wpcf7-not-valid-tip {
    color: #ef4444;
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: block;
}

.wpcf7-form-control.wpcf7-not-valid {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.wpcf7-response-output.wpcf7-mail-sent-ok {
    background: #dcfce7 !important;
    border: 1px solid #86efac !important;
    color: #166534 !important;
}

.wpcf7-response-output.wpcf7-mail-sent-ng,
.wpcf7-response-output.wpcf7-validation-errors {
    background: #fef2f2 !important;
    border: 1px solid #fca5a5 !important;
    color: #991b1b !important;
}

/* --- 送信ボタンの共通スタイル --- */
.wpcf7-submit, .submit-button, .career-button {
    display: inline-block;
    width: 100%; 
    background: #18181b !important; 
    color: #fff !important; 
    font-weight: 600 !important;
    font-size: 1rem !important; 
    padding: 0.875rem 1rem !important; 
    border: none !important;
    border-radius: 0.5rem !important; 
    cursor: pointer !important;
    transition: all 0.2s ease !important; 
    -webkit-appearance: none;
    appearance: none;
    text-align: center;
}

.wpcf7-submit:hover, .submit-button:hover, .career-button:hover { 
    background: #3f3f46 !important; 
    transform: translateY(-2px); 
    box-shadow: 0 4px 20px rgba(0,0,0,0.1); 
}

.wpcf7-submit:active, .submit-button:active, .career-button:active {
    transform: translateY(0);
}

/* =================================================================
    キャリア相談・ウェイティングリストモーダル専用CSS
    ================================================================= */

/* --- モーダル本体 --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(24, 24, 27, 0.75);
    z-index: 1000; backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.modal-overlay.active {
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-content {
    background: #ffffff; border-radius: 1rem; width: 90%; max-width: 520px; max-height: 90vh;
    overflow: hidden; position: relative;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex; flex-direction: column;
}
.modal-header {
    padding: 1.25rem 1.75rem; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #f0f0f0;
}
.modal-title { font-size: 1.25rem; font-weight: 600; color: #18181b; }
.modal-close {
    background: transparent; border: 0; font-size: 1.5rem; cursor: pointer;
    color: #a1a1aa; transition: all 0.2s; padding: 0.5rem; line-height: 1;
}
.modal-close:hover { color: #18181b; transform: rotate(90deg); }
.modal-body { padding: 1.5rem 1.75rem 2rem; overflow-y: auto; }

/* --- モーダル内フォームのスタイル --- */
.modal-body .form-group {
    position: relative; margin-bottom: 1.75rem;
}

.modal-body .form-label {
    position: absolute; top: 0.875rem; left: 0.875rem;
    font-size: 1rem; color: #a1a1aa; pointer-events: none;
    transition: all 0.2s ease-out; background: #fff;
    padding: 0 0.25rem; z-index: 1;
}
.modal-body .form-group.is-filled .form-label {
    top: -0.5rem; font-size: 0.75rem; color: #71717a;
}
.modal-body .form-group.is-focused .form-label {
    color: #3b82f6;
}
.modal-body .form-label .required {
    color: #ef4444; margin-left: 0.25rem; font-weight: normal;
}
.modal-body .form-label.static {
    position: static; transform: none; margin-bottom: 0.75rem; display: block;
    padding: 0; font-weight: 600; color: #374151; font-size: 0.9rem;
}

.modal-body .form-input:focus, .modal-body .form-textarea:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}
.modal-body .form-textarea { min-height: 100px; resize: vertical; }

.modal-body .file-upload-wrapper { margin-bottom: 0.5rem; }
.modal-body .wpcf7-file {
    width: 100%; font-size: 0.9rem; color: #71717a;
    border: 1px solid #d4d4d8; border-radius: 0.5rem;
}
.modal-body .wpcf7-file::-webkit-file-upload-button {
    background: #f4f4f5; color: #3f3f46; border: none;
    border-right: 1px solid #e4e4e7; padding: 0.6rem 1rem;
    margin-right: 1rem; font-weight: 500; font-size: 0.8rem;
    border-radius: 0.375rem 0 0 0.375rem;
    cursor: pointer; transition: background-color 0.2s;
}
.modal-body .wpcf7-file::-webkit-file-upload-button:hover { background-color: #e4e4e7; }
.modal-body .form-group small {
    color: #a1a1aa; font-size: 0.75rem; margin-top: 0.5rem; display: block;
}

.modal-body .acceptance-group { 
    margin: 2rem 0 1.5rem; 
}
.modal-body .wpcf7-list-item { 
    display: flex; 
    align-items: flex-start;
    margin: 0;
    list-style: none;
}
.modal-body .wpcf7-list-item-label {
    margin: 0;
    font-size: 0.875rem; 
    color: #52525b; 
    line-height: 1.6;
    padding-top: 2px;
}
.modal-body input[type="checkbox"] {
    -webkit-appearance: none !important; 
    appearance: none !important; 
    background-color: transparent !important;
    margin: 0;
    width: 18px !important;
    height: 18px !important;
    border: 1.5px solid #a1a1aa !important;
    border-radius: 0.2rem !important;
    display: inline-block !important;
    margin-right: 0.5rem !important; 
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    vertical-align: middle;
    min-width: 18px !important;
    min-height: 18px !important;
}
.modal-body input[type="checkbox"]:hover {
    border-color: #71717a !important;
}
.modal-body input[type="checkbox"]:checked {
    background-color: #18181b !important;
    border-color: #18181b !important;
}
.modal-body input[type="checkbox"]:checked::after {
    content: '' !important;
    display: block !important;
    width: 4px !important;
    height: 8px !important;
    border: solid white !important;
    border-width: 0 1.5px 1.5px 0 !important;
    transform: rotate(45deg) !important;
    position: absolute !important;
    top: 2px !important;
    left: 5px !important;
}
.modal-body input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.08);
}
.modal-body .acceptance-group a { 
    color: #3b82f6; 
    text-decoration: none; 
    border-bottom: 1px solid #3b82f6;
    transition: color 0.2s;
}
.modal-body .acceptance-group a:hover { 
    color: #2563eb;
    border-bottom-color: #2563eb;
}
.modal-body .wpcf7-form-control.wpcf7-acceptance {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
}
.modal-body input[type="checkbox"].wpcf7-not-valid {
    border-color: #ef4444 !important;
}

/* --- アニメーション --- */
@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}
@keyframes slideUp { 
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* =================================================================
    追加の修正 & モバイルレスポンシブ
    ================================================================= */
/* スクロールに応じたヘッダーロゴの表示制御 */
#header-logo {
    opacity: 0;
    transition: opacity 0.3s ease;
}
.header-scrolled #header-logo {
    opacity: 1;
}

/* トップページ以外でロゴを最初から表示 */
body:not(.home) #header-logo {
    opacity: 1;
}

/* --- モバイル対応 (767px以下) --- */
@media (max-width: 767px) {
    /* 見出しが画面からはみ出さないように自動で改行させる */
    h1, h2, h3, h4 {
        word-break: break-word;
    }

    /* メインビジュアルのタイトルサイズ調整 */
    #home h1 {
        font-size: 3.5rem; /* 56px */
        line-height: 1.1;
    }

    /* 各セクションタイトルのサイズ調整 */
    #overview h2,
    #agent h2,
    #media h2,
    #about h2,
    #contact h2 {
        font-size: 3rem; /* 48px */
        line-height: 1.1;
    }

    /* 会社概要テーブルのモバイル対応 */
    #about table,
    #about tbody,
    #about tr,
    #about th,
    #about td {
        display: block;
        width: 100%;
        text-align: left !important;
    }
    #about tr {
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }
    #about tr:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }
    #about th {
        padding-bottom: 0;
        margin-bottom: 0.5rem;
        font-weight: 600;
        color: #374151;
    }
    #about td {
        padding-left: 0;
        padding-bottom: 0;
    }
}

/* --- モバイル対応 (640px以下) --- */
@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
    }
    
    .modal-body {
        padding: 1.25rem 1rem 1.5rem;
    }
    
    .modal-body .form-group {
        margin-bottom: 1.5rem;
    }
}

/* =================================================================
    外部リンク修正（アクセシビリティ対応）
    ================================================================= */
/* 外部リンクと新規タブリンクはスムーススクロール無効化 */
a[target="_blank"],
a[href^="https://plus-web3.com"],
a[href^="http"]:not([href*="protagonist-inc.jp"]) {
    scroll-behavior: auto !important;
}

/* 新しいタブで開くリンクは確実に動作させる */
a[target="_blank"] {
    pointer-events: auto;
}

/* スキップリンクのスタイル */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    z-index: 9999;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}