/* =====================================================================
   community.php — page-specific styles
   Reuses shared tokens & classes from style.css (.card / .timeline / etc.).
   Only decorative additions unique to the Community page live here.
   ===================================================================== */

/* イントロ文
   V14: 70ch 直書き → refine.css :root の --measure に統一。 */
.community-lead {
    max-width: var(--measure, 70ch);
}

.community-lead .hl {
    color: var(--text);
    font-weight: 600;
}

/* セクション内の小見出し。font-size は refine.css の見出しスケール (var(--fs-h3))
   が最終決定するためここでは指定しない (旧 1.25rem は恒常上書きされる死宣言だった)。 */
.community-subtitle {
    font-weight: 700;
    color: var(--text);
    margin: 44px 0 18px;
}

/* =====================================================================
   規模サマリ（統計カード）
   ===================================================================== */
/* 5カラム: ヒーロータイル(2) + 通常タイル(1×3) が1行に収まる */
.community-stats {
    /* list reset: style.css :where() で一元管理 */
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px 16px;
    gap: 6px;
}

/* 先頭のヒーロータイル（累計メンバー）: 2カラム分を占める横型タイル */
.stat-card.is-hero {
    grid-column: span 2;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: start;
    column-gap: 20px;
    text-align: left;
    padding: 24px 28px;
}

.stat-card.is-hero .stat-icon {
    grid-row: 1 / span 2;
    width: 60px;
    height: 60px;
    margin-bottom: 0;
}

.stat-card.is-hero .stat-icon .fa-icon {
    font-size: 1.5rem;
}

.stat-card.is-hero .stat-label {
    font-size: 0.95rem;
}

/* 土台 (inline-flex 中央 + radius-sm + accent-soft 地) は style.css V17 の
   アイコンタイル基底に集約。ここは寸法差分のみ。 */
.stat-icon {
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
}

.stat-icon .fa-icon {
    width: 1.15em;
    height: 1.15em;
    font-size: 1.1rem;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat-unit {
    font-size: 1rem;
    font-weight: 600;
    margin-left: 2px;
    color: var(--muted);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--muted);
}

/* 注釈2行は上下連結の「ガラス脚注ブロック」として統計の台座にする。
   ペアの <p> が連続する前提（間に要素を挟むと角丸の分担が破綻する）。 */
.community-note,
.community-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
    border: 1px solid var(--glass-border, var(--border));
    background: rgba(255, 255, 255, 0.02);
}

.community-note {
    margin: 16px 0 0;
    color: var(--dim);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    border-bottom: none;
}

.community-note .fa-icon {
    flex: 0 0 auto;
    color: var(--accent);
}

/* 内訳注記（運営中 / 終了） */
.community-breakdown {
    margin: 0;
    color: var(--muted);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.community-breakdown .fa-icon {
    flex: 0 0 auto;
    color: var(--accent);
}

.community-breakdown strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* タイムライン見出しのアンカー着地（固定ヘッダーに隠れないように） */
#timeline-heading {
    scroll-margin-top: calc(var(--header-height) + 16px);
}

/* =====================================================================
   運営での取り組み（役割カード）
   ===================================================================== */
.community-roles {
    /* list reset: style.css :where() で一元管理 */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

/* アイコン左・テキスト右の横型2カラム（stat=縦・中央 との構図差を作る） */
.role-card {
    display: grid;
    grid-template-columns: 40px 1fr;
    column-gap: 16px;
    row-gap: 4px;
    align-items: start;
}

/* 土台は style.css V17 のアイコンタイル基底。ここは寸法・配置差分のみ。 */
.role-icon {
    width: 40px;
    height: 40px;
    grid-row: 1 / span 2;
    margin-top: 2px;
}

.role-icon .fa-icon {
    width: 1.1em;
    height: 1.1em;
    font-size: 1rem;
}

.role-card .card-title {
    align-self: center;
    margin: 0;
    font-size: 1.05rem;
}

.role-card .card-text {
    grid-column: 2;
    margin: 0;
}

/* =====================================================================
   レスポンシブ
   ===================================================================== */
/* 5カラムが成立する（ヒーローの「5,000人超」が1行で収まる）のは約790px以上。
   それ未満は2カラム + ヒーロー全幅に畳む（iPad縦 744/768px の破綻帯を回避）。
   V14: 800 → 860 に丸めて style.css 冒頭のブレークポイント方針 (380/600/768/860)
   に統一。790px 閾値は 768 の下、860 の上のため 860 に寄せる方が破綻帯が広くなる
   ことなく policy 内に収まる。 */
@media (max-width: 860px) {
    .community-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card.is-hero {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .community-roles {
        grid-template-columns: 1fr;
    }

    /* .stat-value の縮小は refine.css の clamp が引き受ける */
}

/* =====================================================================
   タイムライン: ヘッダー画像帯（任意）
   content.json の communities[].image に相対パスが設定されていると、
   カード上部にバナー画像を横帯で敷く。無ければ従来通り画像帯なし。
   ===================================================================== */
.timeline-item.has-header .timeline-content {
    padding: 0;
}

.timeline-item.has-header .timeline-body {
    padding: 20px 22px 22px;
}

.timeline-header-img {
    position: relative;
    aspect-ratio: 3 / 1;
    overflow: hidden;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}

.timeline-header-img img,
.timeline-header-img picture {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.timeline-header-img picture img {
    width: 100%;
    height: 100%;
}

/* 下端に自然な暗フェードを重ね、本文タイポと画像の縁を分ける */
.timeline-header-img::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 62%, rgba(var(--shade-rgb), 0.38));
}
