/* =========================================================
 * GW Dictionary – フロントエンド CSS
 * Blocksy テーマの CSS 変数を利用
 * ========================================================= */

/* --- コンテナ --- */
.gw-dict-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}

/* --- 検索ボックス --- */
.gw-dict-search {
    margin-bottom: 24px;
}

.gw-dict-search input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.gw-dict-search input:focus {
    outline: none;
    border-color: var(--theme-palette-color-1, #076951);
    box-shadow: 0 0 0 3px rgba(7, 105, 81, 0.1);
}

/* --- 五十音ナビ --- */
.gw-dict-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 32px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
}

.gw-dict-nav-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-palette-color-1, #076951);
    background: #fff;
    border: 1px solid #e0e0e0;
    transition: all 0.15s;
}

.gw-dict-nav-item:hover {
    background: var(--theme-palette-color-1, #076951);
    color: #fff;
    border-color: var(--theme-palette-color-1, #076951);
}

.gw-dict-nav-disabled {
    color: #ccc;
    background: #f0f0f0;
    pointer-events: none;
    border-color: transparent;
}

/* --- セクション --- */
.gw-dict-section {
    margin-bottom: 32px;
}

.gw-dict-section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--theme-palette-color-1, #076951);
    border-bottom: 3px solid var(--theme-palette-color-1, #076951);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

/* --- 用語カード --- */
.gw-dict-terms {
    display: grid;
    gap: 12px;
}

.gw-dict-term-card {
    padding: 16px 20px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.gw-dict-term-card:hover {
    border-color: var(--theme-palette-color-1, #076951);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.gw-dict-term-card.gw-dict-hidden {
    display: none;
}

.gw-dict-term-title {
    font-size: 17px;
    margin: 0 0 6px;
}

.gw-dict-term-title a {
    color: var(--theme-palette-color-1, #076951);
    text-decoration: none;
}

.gw-dict-term-title a:hover {
    text-decoration: underline;
}

.gw-dict-term-excerpt {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.6;
}

.gw-dict-count {
    text-align: center;
    color: #999;
    font-size: 13px;
    margin-top: 24px;
}

.gw-dict-no-results {
    text-align: center;
    color: #999;
    padding: 40px 0;
    font-size: 15px;
}

/* ユーザー投稿 CTA（一覧ページ） */
.gw-dict-user-submit-cta {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.gw-dict-user-submit-cta-top {
    margin-top: 0;
    margin-bottom: 28px;
    padding-top: 0;
    border-top: none;
}

/* --- セクション非表示（検索フィルタ用） --- */
.gw-dict-section.gw-dict-section-hidden {
    display: none;
}

/* =========================================================
 * 個別用語ページ
 * ========================================================= */
.gw-dict-single {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.gw-dict-single-inner {
    /* Blocksy のコンテンツ幅に合わせる */
}

/* パンくず */
.gw-dict-breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    margin: 0 0 24px;
    font-size: 13px;
    color: #999;
}

.gw-dict-breadcrumb li::after {
    content: '>';
    margin-left: 8px;
    color: #ccc;
}

.gw-dict-breadcrumb li:last-child::after {
    content: '';
}

.gw-dict-breadcrumb a {
    color: var(--theme-palette-color-1, #076951);
    text-decoration: none;
}

.gw-dict-breadcrumb a:hover {
    text-decoration: underline;
}

/* ヘッダー */
.gw-dict-single-header {
    margin-top: 16px;
    margin-bottom: 32px;
}

.gw-dict-prefix-badge {
    display: inline-block;
    background: var(--theme-palette-color-1, #076951);
    color: #fff;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.gw-dict-single-title {
    font-size: 28px;
    font-weight: 700;
    color: #222;
    margin: 0;
    line-height: 1.4;
}

/* 本文 */
.gw-dict-single-body {
    line-height: 1.9;
    font-size: 16px;
    color: #333;
}

.gw-dict-single-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--theme-palette-color-1, #076951);
    margin-top: 28px;
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 4px solid var(--theme-palette-color-1, #076951);
}

.gw-dict-single-body h4 {
    font-size: 16px;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 8px;
}

.gw-dict-single-body ul {
    padding-left: 24px;
    margin: 12px 0;
}

.gw-dict-single-body li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.gw-dict-single-body blockquote {
    border-left: 4px solid #ddd;
    padding: 12px 16px;
    margin: 16px 0;
    background: #f9f9f9;
    color: #555;
    font-style: italic;
}

.gw-dict-cross-link {
    color: var(--theme-palette-color-1, #076951);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.gw-dict-cross-link:hover {
    text-decoration-style: solid;
}

/* =========================================================
 * YouTube動画ファサード（遅延読み込み）
 * ========================================================= */
.gw-dict-videos {
    margin-top: 36px;
}

.gw-dict-videos h2 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

.gw-dict-video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

/* 2本以上なら2カラム */
.gw-dict-video-grid:has(.gw-dict-video-facade:nth-child(2)) {
    grid-template-columns: repeat(2, 1fr);
}

.gw-dict-video-facade {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
    cursor: pointer;
}

.gw-dict-video-facade img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s;
}

.gw-dict-video-facade:hover img {
    opacity: 0.85;
}

.gw-dict-video-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    z-index: 1;
    transition: transform 0.15s;
}

.gw-dict-video-facade:hover .gw-dict-video-play {
    transform: translate(-50%, -50%) scale(1.1);
}

.gw-dict-video-play svg {
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

/* iframe 読み込み後 */
.gw-dict-video-facade iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 600px) {
    .gw-dict-video-grid,
    .gw-dict-video-grid:has(.gw-dict-video-facade:nth-child(2)) {
        grid-template-columns: 1fr;
    }
}

/* メタ情報 */
.gw-dict-single-meta {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #999;
}

.gw-dict-meta-sep {
    margin: 0 8px;
}

/* ユーザーアクション */
.gw-dict-user-actions {
    margin-top: 20px;
}

/* 関連用語 */
.gw-dict-related {
    margin-top: 40px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 8px;
}

.gw-dict-related h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 12px;
    color: #444;
}

.gw-dict-related ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gw-dict-related li a {
    display: inline-block;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    color: var(--theme-palette-color-1, #076951);
    text-decoration: none;
    transition: all 0.15s;
}

.gw-dict-related li a:hover {
    background: var(--theme-palette-color-1, #076951);
    color: #fff;
    border-color: var(--theme-palette-color-1, #076951);
}

/* 戻るナビ */
.gw-dict-back-nav {
    margin-top: 32px;
}

/* =========================================================
 * ボタン共通
 * ========================================================= */
.gw-dict-btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid var(--theme-palette-color-1, #076951);
    background: var(--theme-palette-color-1, #076951);
    color: #fff;
}

.gw-dict-btn:hover {
    opacity: 0.9;
}

.gw-dict-btn-outline {
    background: transparent;
    color: var(--theme-palette-color-1, #076951);
}

.gw-dict-btn-outline:hover {
    background: var(--theme-palette-color-1, #076951);
    color: #fff;
}

.gw-dict-btn-primary {
    background: var(--theme-palette-color-1, #076951);
    color: #fff;
}

/* =========================================================
 * ユーザー投稿フォーム
 * ========================================================= */
.gw-dict-submit-form {
    max-width: 700px;
    margin: 0 auto;
    padding: 32px 24px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
}

.gw-dict-submit-form h2 {
    font-size: 22px;
    margin: 0 0 8px;
}

.gw-dict-submit-desc {
    color: #666;
    font-size: 14px;
    margin-bottom: 24px;
}

.gw-dict-field {
    margin-bottom: 20px;
}

.gw-dict-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.gw-dict-field .required {
    color: #d63638;
}

.gw-dict-field input[type="text"],
.gw-dict-field select,
.gw-dict-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.gw-dict-field input[type="text"]:focus,
.gw-dict-field select:focus,
.gw-dict-field textarea:focus {
    outline: none;
    border-color: var(--theme-palette-color-1, #076951);
    box-shadow: 0 0 0 3px rgba(7, 105, 81, 0.1);
}

.gw-dict-field textarea {
    font-family: inherit;
    line-height: 1.6;
}

.gw-dict-field-help {
    margin-top: 4px;
    font-size: 12px;
    color: #999;
}

/* セクション入力 fieldset */
.gw-dict-sections {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
    background: #fafafa;
}

.gw-dict-sections legend {
    font-weight: 700;
    font-size: 15px;
    color: var(--theme-palette-color-1, #076951);
    padding: 0 8px;
}

.gw-dict-submit-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

/* 通知 */
.gw-dict-notice {
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.gw-dict-notice-info {
    background: #e8f4fd;
    border: 1px solid #c8e1f3;
    color: #1a5276;
}

.gw-dict-notice-success {
    background: #e8f8f0;
    border: 1px solid #b8e6c8;
    color: #1a6b3e;
}

.gw-dict-notice-error {
    background: #fde8e8;
    border: 1px solid #f3c8c8;
    color: #8b1a1a;
}

/* =========================================================
 * レスポンシブ
 * ========================================================= */
@media (max-width: 600px) {
    .gw-dict-nav {
        gap: 4px;
        padding: 12px;
    }

    .gw-dict-nav-item {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .gw-dict-single-title {
        font-size: 22px;
    }

    .gw-dict-single-body {
        font-size: 15px;
    }

    .gw-dict-related ul {
        gap: 6px;
    }
}
