/* なおきち複合検索 */
.afs {
	--afs-accent: #2563eb;
	--afs-border: #e2e5ea;
	--afs-text: #1f2430;
	--afs-muted: #6b7280;
	--afs-bg: #f7f8fa;
	--afs-hl: #fef08a;
	--afs-radius: 10px;
	color: var(--afs-text);
}

/* フォーム */
.afs-form {
	background: var(--afs-bg);
	border: 1px solid var(--afs-border);
	border-radius: var(--afs-radius);
	padding: 20px;
	margin-bottom: 28px;
}

.afs-field { margin-bottom: 16px; }
.afs-field:last-child { margin-bottom: 0; }

.afs-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}
.afs-row .afs-field {
	flex: 1 1 160px;
	margin-bottom: 0;
}
.afs-row + .afs-field { margin-top: 16px; }

.afs-label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--afs-muted);
	margin-bottom: 6px;
}

.afs-input,
.afs-select {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 12px;
	font-size: 15px;
	border: 1px solid var(--afs-border);
	border-radius: 8px;
	background: #fff;
	color: var(--afs-text);
	transition: border-color .15s, box-shadow .15s;
}
.afs-input:focus,
.afs-select:focus {
	outline: none;
	border-color: var(--afs-accent);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

/* タグ見出し行と一致条件切り替え */
.afs-field--tags { margin-top: 16px; }
.afs-label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
}
.afs-mode {
	display: inline-flex;
	border: 1px solid var(--afs-border);
	border-radius: 999px;
	background: #fff;
	padding: 2px;
}
.afs-mode__opt { cursor: pointer; }
.afs-mode__opt input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.afs-mode__opt span {
	display: inline-block;
	padding: 4px 12px;
	font-size: 12px;
	border-radius: 999px;
	color: var(--afs-muted);
	transition: all .15s;
}
.afs-mode__opt input:checked + span {
	background: var(--afs-accent);
	color: #fff;
}
.afs-mode__opt input:focus-visible + span {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .3);
}

/* タグ */
.afs-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}
.afs-tag { cursor: pointer; }
.afs-tag--hidden { display: none; }
.afs-tag input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.afs-tag span {
	display: inline-block;
	padding: 5px 12px;
	font-size: 13px;
	border: 1px solid var(--afs-border);
	border-radius: 999px;
	background: #fff;
	color: var(--afs-muted);
	transition: all .15s;
}
.afs-tag span small {
	font-size: 11px;
	opacity: .65;
}
.afs-tag input:checked + span {
	background: var(--afs-accent);
	border-color: var(--afs-accent);
	color: #fff;
}
.afs-tag input:focus-visible + span {
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .3);
}

.afs-tags-toggle {
	margin-top: 10px;
	background: none;
	border: none;
	padding: 2px 0;
	font-size: 13px;
	color: var(--afs-accent);
	cursor: pointer;
	text-decoration: underline;
}

/* アクション行 */
.afs-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 18px;
}
.afs-reset {
	background: none;
	border: none;
	padding: 4px 0;
	font-size: 13px;
	color: var(--afs-muted);
	text-decoration: underline;
	cursor: pointer;
}
.afs-reset:hover { color: var(--afs-accent); }
.afs-count {
	font-size: 14px;
	font-weight: 700;
	color: var(--afs-accent);
}

/* 結果一覧 */
.afs-results {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
	transition: opacity .2s;
}
.afs.is-loading .afs-results { opacity: .5; }

.afs-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--afs-border);
	border-radius: var(--afs-radius);
	overflow: hidden;
	background: #fff;
	text-decoration: none;
	color: inherit;
	transition: box-shadow .2s, transform .2s;
}
.afs-card:hover {
	box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
	transform: translateY(-2px);
}
.afs-card:focus-visible {
	outline: 3px solid var(--afs-accent);
	outline-offset: 2px;
}

.afs-card__img {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
}
.afs-card__img--empty {
	background: linear-gradient(135deg, #eef1f5, #dde3ec);
}

.afs-card__body { padding: 14px 16px 18px; }

.afs-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 8px;
}
.afs-card__date {
	font-size: 12px;
	color: var(--afs-muted);
}
.afs-badge {
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(37, 99, 235, .1);
	color: var(--afs-accent);
}

.afs-card__title {
	margin: 0 0 6px;
	font-size: 16px;
	line-height: 1.5;
}
.afs-card__excerpt {
	margin: 0;
	font-size: 13px;
	line-height: 1.7;
	color: var(--afs-muted);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* キーワードハイライト */
.afs-hl {
	background: var(--afs-hl);
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}

/* 空・読み込み・0件時おすすめ */
.afs-empty,
.afs-loading {
	grid-column: 1 / -1;
	text-align: center;
	padding: 48px 16px;
	color: var(--afs-muted);
}
.afs-empty-wrap {
	grid-column: 1 / -1;
}
.afs-empty-wrap .afs-empty { padding-bottom: 8px; }
.afs-empty-sub {
	text-align: center;
	margin: 0 0 20px;
	font-size: 14px;
	font-weight: 700;
	color: var(--afs-text);
}
.afs-fallback {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 20px;
}

/* もっと見る */
.afs-more-wrap {
	text-align: center;
	margin-top: 28px;
}
.afs-more {
	padding: 12px 40px;
	font-size: 15px;
	font-weight: 700;
	color: var(--afs-accent);
	background: #fff;
	border: 2px solid var(--afs-accent);
	border-radius: 999px;
	cursor: pointer;
	transition: all .15s;
}
.afs-more:hover {
	background: var(--afs-accent);
	color: #fff;
}

@media (prefers-reduced-motion: reduce) {
	.afs *, .afs { transition: none !important; }
}

@media (max-width: 480px) {
	.afs-form { padding: 16px; }
	.afs-results, .afs-fallback { grid-template-columns: 1fr; }
}
