/*
 * ファンツールコラムの OGP カード（ColumnHistory.html とトップページで共通）。
 * 表示内容は lib/column_cards.php で作る。
 */

/* OGP カード */
.ch-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ch-grid li {
    display: flex;
    min-width: 0;
}

.ch-ogp {
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 共通CSSの a[target=_blank]（背景に外部リンクアイコン）より優先させる。 */
a.ch-ogp[target] {
    padding: 0;
    background: #ffffff;
}

.ch-ogp:hover {
    border-color: #93c5fd;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.14);
    transform: translateY(-2px);
}

.ch-ogp__thumb {
    position: relative;
    display: block;
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    background: #e8f1ff;
}

.ch-ogp__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.ch-ogp:hover .ch-ogp__thumb img {
    transform: scale(1.03);
}

/* 記事画像がないときの代わりの絵 */
.ch-ogp__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 18px 24px;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.35), transparent 40%),
        linear-gradient(135deg, #1d4ed8, #60a5fa);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.5;
    text-align: center;
}

.ch-ogp__new {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ch-ogp__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px 12px;
}

.ch-ogp__date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.ch-ogp__title {
    color: #0f172a;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.55;
}

.ch-ogp:hover .ch-ogp__title {
    color: #1d4ed8;
}

.ch-ogp__subtitle {
    color: #2563eb;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.55;
}

.ch-ogp__date i {
    color: #93c5fd;
    font-size: 0.8rem;
}

/* ダークテーマ（共通CSSが文字色を !important で上書きするため明示する） */
html[data-theme="dark"] a.ch-ogp[target] { border-color: #334669; background: #111c36; box-shadow: none; }
html[data-theme="dark"] a.ch-ogp[target]:hover { border-color: #5f8ed9; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35); }
html[data-theme="dark"] .ch-ogp__thumb { background: #172544; }
html[data-theme="dark"] .ch-ogp__placeholder { background: radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.18), transparent 40%), linear-gradient(135deg, #1e3a8a, #2563eb); }
html[data-theme="dark"] .ch-ogp__date { color: #9fb0cc; }
html[data-theme="dark"] .ch-ogp__title { color: #e8eefc; }
html[data-theme="dark"] .ch-ogp:hover .ch-ogp__title { color: #a9c5ff; }
html[data-theme="dark"] .ch-ogp__subtitle { color: #90b6ff; }
html[data-theme="dark"] .ch-ogp__date i { color: #6ea0ff; }

@media (prefers-reduced-motion: reduce) {
    .ch-ogp, .ch-ogp__thumb img { transition: none; }
    .ch-ogp:hover, .ch-ogp:hover .ch-ogp__thumb img { transform: none; }
}

@media (max-width: 960px) {
    .ch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .ch-ogp__new { top: 6px; left: 6px; padding: 2px 8px; font-size: 0.62rem; }
    .ch-ogp__placeholder { padding: 10px 12px; font-size: 0.86rem; }
}

@media (max-width: 480px) {
    .ch-grid { gap: 10px; }
    .ch-ogp__body { padding: 8px 10px 10px; }
    .ch-ogp__title { font-size: 0.84rem; }
    .ch-ogp__subtitle { font-size: 0.72rem; }
}
/* トップページ（最新3件）：スマホでは画像を左、文字を右にした横長カードを縦に並べる。 */
.ch-grid--top {
    margin-bottom: 24px;
}

@media (max-width: 960px) {
    .ch-grid--top { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .ch-grid--top { grid-template-columns: 1fr; gap: 10px; }
    .ch-grid--top .ch-ogp { flex-direction: row; align-items: stretch; }
    .ch-grid--top .ch-ogp__thumb { flex: 0 0 42%; aspect-ratio: auto; min-height: 84px; }
    .ch-grid--top .ch-ogp__thumb img { position: absolute; inset: 0; }
    .ch-grid--top .ch-ogp__body { justify-content: center; padding: 8px 12px; }
    .ch-grid--top .ch-ogp__placeholder { font-size: 0.72rem; padding: 6px 8px; }
}
