/**
 * ReleaseCalendar AI フロントエンドCSS
 *
 * テーマ衝突を避けるため htai- 接頭辞のクラスのみ対象。
 * CSS変数で色を管理し、!important は使わない。
 * PC=表 / スマホ(720px以下)=カード へレスポンシブに切り替える。
 */

.htai-calendar {
	--htai-accent: #2563eb;
	--htai-amazon: #ff9900;
	--htai-rakuten: #bf0000;
	--htai-mercari: #ea352d;
	--htai-border: #e2e8f0;
	--htai-muted: #64748b;
	--htai-badge-bg: #f1f5f9;
	max-width: 100%;
	box-sizing: border-box;
}

.htai-calendar * {
	box-sizing: border-box;
}

.htai-title {
	font-size: 1.5rem;
	line-height: 1.3;
	margin: 0 0 0.5em;
}

.htai-disclosure {
	font-size: 0.8rem;
	color: var(--htai-muted);
	background: var(--htai-badge-bg);
	padding: 0.6em 0.8em;
	border-radius: 6px;
	margin: 0 0 1.2em;
}

.htai-section {
	margin: 0 0 1.8em;
}

.htai-section > h2 {
	font-size: 1.2rem;
	border-left: 4px solid var(--htai-accent);
	padding-left: 0.5em;
	margin: 0 0 0.6em;
}

.htai-date {
	font-size: 1rem;
	margin: 1em 0 0.4em;
	color: var(--htai-accent);
}

.htai-table {
	width: 100%;
	border-collapse: collapse;
	table-layout: auto;
}

.htai-table th,
.htai-table td {
	border-bottom: 1px solid var(--htai-border);
	padding: 0.6em 0.5em;
	text-align: left;
	vertical-align: middle;
}

.htai-table thead th {
	font-size: 0.8rem;
	color: var(--htai-muted);
	white-space: nowrap;
}

.htai-name {
	font-weight: 600;
}

/* 名前セルの中身をひとまとまりにする(スマホのカード表示で名前とリンクを縦に積む) */
.htai-name-body {
	display: block;
}

/* 商品名リンク(中心記事へ)。表の文字色を継承し下線のみ付ける */
.htai-name-link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* 関連記事の小リンク群(当たり／収録／予約 等) */
.htai-refs {
	display: block;
	margin-top: 0.35em;
	line-height: 1.9;
}

.htai-ref {
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 600;
	padding: 0.35em 0.7em;
	margin: 0.15em 0.4em 0.15em 0;
	background: var(--htai-badge-bg);
	border: 1px solid var(--htai-border);
	border-radius: 999px;
	color: var(--htai-accent);
	text-decoration: none;
	white-space: nowrap;
}

.htai-ref:hover {
	background: #e2e8f0;
}

.htai-ref:focus {
	outline: 2px solid #111;
	outline-offset: 2px;
}

/* 商品サムネイル(楽天CDN配信)。名前セル内で左寄せ表示 */
.htai-thumb {
	display: inline-block;
	width: 72px;
	height: 72px;
	object-fit: contain;
	background: #fff;
	border: 1px solid var(--htai-border, #e2e8f0);
	border-radius: 6px;
	margin-right: 0.6em;
	vertical-align: middle;
	flex-shrink: 0;
}

.htai-edition {
	display: inline-block;
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--htai-muted);
}

.htai-badge {
	display: inline-block;
	font-size: 0.75rem;
	background: var(--htai-badge-bg);
	border-radius: 4px;
	padding: 0.15em 0.5em;
	white-space: nowrap;
}

.htai-postponed {
	display: inline-block;
	font-size: 0.72rem;
	color: #fff;
	background: #d97706;
	border-radius: 4px;
	padding: 0.1em 0.45em;
	margin-left: 0.3em;
}

.htai-buttons {
	white-space: nowrap;
}

.htai-btn {
	display: inline-block;
	font-size: 0.82rem;
	font-weight: 600;
	text-decoration: none;
	color: #fff;
	border-radius: 6px;
	padding: 0.45em 0.8em;
	margin: 0.15em 0.15em 0.15em 0;
	line-height: 1.2;
}

.htai-btn-amazon {
	background: var(--htai-amazon);
	color: #111;
}

.htai-btn-rakuten {
	background: var(--htai-rakuten);
}

.htai-btn-mercari {
	background: var(--htai-mercari);
}

.htai-btn-article {
	background: var(--htai-accent);
}

.htai-btn:focus {
	outline: 2px solid #111;
	outline-offset: 2px;
}

.htai-nolink {
	font-size: 0.8rem;
	color: var(--htai-muted);
}

.htai-updated {
	font-size: 0.75rem;
	color: var(--htai-muted);
	margin-top: 1.5em;
}

.htai-empty {
	padding: 1.5em;
	text-align: center;
	color: var(--htai-muted);
	background: var(--htai-badge-bg);
	border-radius: 6px;
}

/* スマートフォン: 表を積み重ねてカード表示にする(横スクロール不要・320px対応) */
@media screen and (max-width: 720px) {
	.htai-table,
	.htai-table thead,
	.htai-table tbody,
	.htai-table th,
	.htai-table td,
	.htai-table tr {
		display: block;
	}

	.htai-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.htai-table tr {
		border: 1px solid var(--htai-border);
		border-radius: 8px;
		margin: 0 0 0.8em;
		padding: 0.6em 0.8em;
	}

	.htai-table td {
		border: none;
		padding: 0.3em 0;
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: 0.8em;
	}

	.htai-table td::before {
		content: attr(data-label);
		font-size: 0.72rem;
		color: var(--htai-muted);
		flex: 0 0 auto;
	}

	.htai-table td.htai-name {
		font-size: 1.02rem;
	}

	/* カード表示では名前セルの中身(名前+関連リンク)を1つの列としてラベル横に収める */
	.htai-name-body {
		flex: 1 1 auto;
		min-width: 0;
	}

	.htai-buttons {
		white-space: normal;
	}

	/* 販売サイトの各ボタン(Amazon/楽天/メルカリ)は横幅いっぱいで縦積み。
	   3ボタン時に「2つ+1つだけ下段」の不揃いな折り返しにならないようにする。 */
	.htai-table td.htai-buttons {
		flex-direction: column;
		align-items: stretch;
		gap: 0.3em;
	}

	.htai-table td.htai-buttons .htai-btn {
		display: block;
		width: 100%;
		margin: 0;
		text-align: center;
		box-sizing: border-box;
	}
}
