/*
Theme Name: HB Club
Theme URI: https://example.com/hb-club
Author: HB Club
Description: ハンドボールクラブ専用WordPressテーマ。カスタムブロック・カレンダー・アニメーション対応。
Version: 1.0.0
Requires at least: 6.5
Tested up to: 6.8
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: hb-club
Tags: sports, handball, custom-blocks, responsive
*/

/* ============================================
   CSS カスタムプロパティ（カスタマイザーで上書き可能）
   ============================================ */
:root {
    /* カラー */
    --hb-primary:        #2d6a4f;
    --hb-primary-light:  #40916c;
    --hb-primary-pale:   #d8f3dc;
    --hb-accent:         #52b788;
    --hb-dark:           #1b4332;
    --hb-text:           #333333;
    --hb-text-muted:     #666666;
    --hb-bg:             #ffffff;
    --hb-bg-alt:         #f8fffe;
    --hb-border:         #e0e0e0;
    --hb-white:          #ffffff;

    /* タイポグラフィ */
    --hb-font-base:      'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
    --hb-font-size-base: 16px;
    --hb-line-height:    1.8;

    /* レイアウト */
    --hb-content-width:  1100px;
    --hb-wide-width:     1400px;
    --hb-section-py:     80px;
    --hb-card-radius:    10px;
    --hb-border-radius:  6px;

    /* シャドウ */
    --hb-shadow-sm:  0 2px 8px rgba(0,0,0,.08);
    --hb-shadow-md:  0 4px 16px rgba(0,0,0,.12);
    --hb-shadow-lg:  0 8px 32px rgba(0,0,0,.16);
}

/* ============================================
   リセット & ベース
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: var(--hb-font-size-base); scroll-behavior: smooth; }

body {
    font-family: var(--hb-font-base);
    font-size: 1rem;
    line-height: var(--hb-line-height);
    color: var(--hb-text);
    background-color: var(--hb-bg);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--hb-primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--hb-primary-light); }

ul, ol { padding-left: 1.5em; }

/* ============================================
   レイアウト
   ============================================ */
.hb-container {
    max-width: var(--hb-content-width);
    margin-inline: auto;
    padding-inline: 20px;
}
.hb-container--wide {
    max-width: var(--hb-wide-width);
}

.site-main { min-height: 60vh; }

/* ============================================
   ヘッダー
   ============================================ */
.site-header {
    background: linear-gradient(135deg, var(--hb-dark) 0%, var(--hb-primary) 100%);
    box-shadow: var(--hb-shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.site-header__inner {
    max-width: var(--hb-content-width);
    margin-inline: auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 20px;
}
.site-logo a {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: .05em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-logo img { height: 44px; width: auto; }

/* ナビ */
.global-nav { display: flex; align-items: center; }
.global-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    gap: 4px;
}
.global-nav ul li a {
    color: rgba(255,255,255,.9);
    font-size: .9rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--hb-border-radius);
    transition: all .2s;
    white-space: nowrap;
}
.global-nav ul li a:hover,
.global-nav ul li.current-menu-item a {
    color: #fff;
    background: rgba(255,255,255,.15);
}

/* ハンバーガー */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}
.nav-toggle span {
    display: block;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all .3s;
}

/* ============================================
   フッター
   ============================================ */
.site-footer {
    background: var(--hb-dark);
    color: rgba(255,255,255,.85);
    padding: 50px 20px 20px;
    margin-top: 0;
}
.site-footer__inner {
    max-width: var(--hb-content-width);
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.site-footer__logo { color: #fff; font-size: 1.2rem; font-weight: 700; }
.site-footer__nav ul { list-style: none; padding: 0; }
.site-footer__nav ul li { margin-bottom: 8px; }
.site-footer__nav ul li a { color: rgba(255,255,255,.75); font-size: .9rem; }
.site-footer__nav ul li a:hover { color: var(--hb-accent); }
.site-footer__copy {
    text-align: center;
    padding-top: 20px;
    font-size: .82rem;
    color: rgba(255,255,255,.5);
}

/* ============================================
   セクション共通
   ============================================ */
.hb-section { padding: var(--hb-section-py) 20px; }
.hb-section--alt { background: var(--hb-bg-alt); }

.hb-section-heading {
    text-align: center;
    margin-bottom: 50px;
}
.hb-section-heading h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--hb-dark);
    position: relative;
    display: inline-block;
    padding-bottom: 14px;
}
.hb-section-heading h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--hb-primary), var(--hb-accent));
    border-radius: 2px;
}
.hb-section-heading p {
    margin-top: 14px;
    color: var(--hb-text-muted);
    font-size: .95rem;
}

/* ============================================
   ボタン
   ============================================ */
.hb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--hb-primary);
    color: #fff !important;
    font-weight: 600;
    padding: 13px 32px;
    border-radius: 50px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .25s;
    font-size: .95rem;
    text-decoration: none;
}
.hb-btn:hover {
    background: var(--hb-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--hb-shadow-md);
}
.hb-btn--outline {
    background: transparent;
    color: var(--hb-primary) !important;
    border-color: var(--hb-primary);
}
.hb-btn--outline:hover {
    background: var(--hb-primary);
    color: #fff !important;
}
.hb-btn--white {
    background: #fff;
    color: var(--hb-primary) !important;
}
.hb-btn--white:hover {
    background: var(--hb-primary-pale);
}
.hb-btn--lg { padding: 16px 44px; font-size: 1.05rem; }

/* ============================================
   カード共通
   ============================================ */
.hb-card {
    background: #fff;
    border-radius: var(--hb-card-radius);
    box-shadow: var(--hb-shadow-sm);
    overflow: hidden;
    transition: transform .25s, box-shadow .25s;
}
.hb-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hb-shadow-md);
}
.hb-card__img { width: 100%; height: 200px; object-fit: cover; }
.hb-card__body { padding: 20px; }
.hb-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.hb-card__meta { font-size: .82rem; color: var(--hb-text-muted); margin-bottom: 10px; }

/* ============================================
   バッジ・ラベル
   ============================================ */
.hb-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--hb-primary);
    color: #fff;
}
.hb-badge--win  { background: #1a7f37; }
.hb-badge--lose { background: #cf222e; }
.hb-badge--draw { background: #6e7781; }
.hb-badge--practice { background: var(--hb-primary); }
.hb-badge--match    { background: #cf222e; }
.hb-badge--event    { background: #9b59b6; }

/* ============================================
   アニメーション
   ============================================ */
[data-hb-animate] {
    opacity: 0;
    transition-property: opacity, transform;
    transition-timing-function: cubic-bezier(.4, 0, .2, 1);
}
[data-hb-animate].hb-animated { opacity: 1; transform: none !important; }

[data-hb-animate="fadeIn"]    { }
[data-hb-animate="slideUp"]   { transform: translateY(40px); }
[data-hb-animate="slideLeft"] { transform: translateX(-40px); }
[data-hb-animate="slideRight"]{ transform: translateX(40px); }
[data-hb-animate="zoomIn"]    { transform: scale(.92); }

/* エディター内は常に表示 */
.block-editor-block-list__layout [data-hb-animate] {
    opacity: 1 !important;
    transform: none !important;
}

/* ============================================
   ページヘッダー
   ============================================ */
.page-hero {
    background: linear-gradient(135deg, var(--hb-dark), var(--hb-primary));
    color: #fff;
    padding: 60px 20px;
    text-align: center;
}
.page-hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; }
.page-hero .breadcrumb {
    margin-top: 12px;
    font-size: .85rem;
    opacity: .75;
}
.page-hero .breadcrumb a { color: rgba(255,255,255,.85); }

/* ============================================
   投稿一覧・アーカイブ
   ============================================ */
.hb-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}
.hb-posts-grid .hb-card__img { height: 220px; }

/* ============================================
   ページネーション
   ============================================ */
.hb-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 50px;
    flex-wrap: wrap;
}
.hb-pagination a,
.hb-pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: .9rem;
    font-weight: 600;
    border: 2px solid var(--hb-border);
    color: var(--hb-text);
    transition: all .2s;
}
.hb-pagination a:hover,
.hb-pagination .current {
    background: var(--hb-primary);
    border-color: var(--hb-primary);
    color: #fff;
}

/* ============================================
   ウィジェット・サイドバー
   ============================================ */
.hb-sidebar-widget {
    background: #fff;
    border-radius: var(--hb-card-radius);
    box-shadow: var(--hb-shadow-sm);
    padding: 24px;
    margin-bottom: 28px;
}
.hb-sidebar-widget h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--hb-dark);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--hb-primary);
    margin-bottom: 16px;
}

/* ============================================
   レスポンシブ
   ============================================ */
@media (max-width: 1024px) {
    .site-footer__inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    :root { --hb-section-py: 50px; }

    .nav-toggle { display: flex; }
    .global-nav {
        display: none;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        background: var(--hb-dark);
        padding: 16px 0;
        box-shadow: var(--hb-shadow-md);
    }
    .global-nav.is-open { display: block; }
    .global-nav ul { flex-direction: column; gap: 0; }
    .global-nav ul li a {
        display: block;
        padding: 12px 24px;
        border-radius: 0;
    }
    .site-header { position: relative; }

    .hb-posts-grid { grid-template-columns: 1fr; }
    .site-footer__inner { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 480px) {
    .hb-btn { padding: 11px 24px; font-size: .9rem; }
    .hb-btn--lg { padding: 13px 32px; font-size: 1rem; }
}

/* フッター直前のブロックの下余白を完全に0に */
.site-main > *:last-child,
.site-main > *:last-child > section,
.site-main > section:last-child {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}
.site-main > *:last-child > .hb-container,
.site-main > *:last-child > section > .hb-container,
.site-main > section:last-child > .hb-container,
.site-main > *:last-child .hb-block-join-cta,
.site-main > *:last-child .hb-section {
    padding-bottom: 0 !important;
}

/* JSで付与される最後のブロッククラス */
.is-last-block,
.is-last-block > .hb-container {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}
