/* ===================================================
   コーヒー用語集 - ツールチップ＆用語ページ
   =================================================== */

/* ========================================
   Tooltip Styles
======================================== */

.coffee-tooltip {
	position: absolute;
	z-index: var(--z-modal);
	max-width: 300px;
	background-color: #ffffff;
	border: 1px solid #e5e5e5;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
	padding: 1rem;
	pointer-events: none;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.coffee-tooltip.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.coffee-tooltip--below {
	transform-origin: top center;
}

.coffee-tooltip--above {
	transform-origin: bottom center;
}

.coffee-tooltip__arrow {
	position: absolute;
	width: 12px;
	height: 12px;
	background-color: #ffffff;
	border: 1px solid #e5e5e5;
	border-right: none;
	border-bottom: none;
	transform: rotate(45deg);
}

.coffee-tooltip__arrow--top {
	bottom: -7px;
	left: 50%;
	margin-left: -6px;
	transform: rotate(-135deg);
}

.coffee-tooltip__arrow--bottom {
	top: -7px;
	left: 50%;
	margin-left: -6px;
	transform: rotate(45deg);
}

.coffee-tooltip__term {
	font-size: 0.9rem;
	font-weight: 700;
	color: #1a1a1a;
	margin-bottom: 0.35rem;
}

.coffee-tooltip__ruby {
	font-size: inherit;
}

.coffee-tooltip__ruby rt {
	font-size: 0.65rem;
	color: #999;
}

.coffee-tooltip__def {
	font-size: 0.8rem;
	color: #555;
	line-height: 1.6;
	margin: 0;
}

.coffee-tooltip__link {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	margin-top: 0.5rem;
	font-size: 0.72rem;
	font-weight: 600;
	color: #8b5e3c;
	text-decoration: none;
	pointer-events: auto;
}

.coffee-tooltip__link:hover {
	color: #6d4830;
	text-decoration: underline;
}

/* Tooltip Trigger */
.coffee-tooltip-trigger {
	border-bottom: 1px dashed #c4a882;
	cursor: help;
	color: inherit;
	text-decoration: none;
	position: relative;
}

.coffee-tooltip-trigger:hover {
	border-bottom-color: #8b5e3c;
}

/* ========================================
   Glossary Page
======================================== */

.glossary-page {
	max-width: 800px;
	margin: 0 auto;
	padding: 2rem 1rem;
}

.glossary-page__header {
	text-align: center;
	margin-bottom: 2rem;
}

.glossary-page__title {
	font-size: 1.5rem;
	font-weight: 700;
	color: #1a1a1a;
	margin-bottom: 0.5rem;
}

.glossary-page__lead {
	font-size: 0.9rem;
	color: #999;
	line-height: 1.6;
}

/* --- あいうえお Navigation Bar --- */
.glossary-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	justify-content: center;
	padding: 1rem;
	background-color: #ffffff;
	border: 1px solid #e5e5e5;
	border-radius: 12px;
	margin-bottom: 1.5rem;
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.glossary-nav__link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 8px;
	font-size: 0.82rem;
	font-weight: 600;
	color: #555;
	text-decoration: none;
	transition: all 0.2s ease;
}

.glossary-nav__link:hover {
	background-color: #f0f0f0;
	color: #8b5e3c;
}

.glossary-nav__link.is-active {
	background-color: #8b5e3c;
	color: #ffffff;
}

.glossary-nav__link.is-disabled {
	color: #ccc;
	pointer-events: none;
}

/* --- Category Tabs --- */
.glossary-tabs {
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	scrollbar-width: none;
	margin-bottom: 1.5rem;
	padding-bottom: 0.25rem;
}

.glossary-tabs::-webkit-scrollbar {
	display: none;
}

.glossary-tab {
	padding: 0.5rem 1rem;
	border: 1.5px solid #e5e5e5;
	border-radius: 9999px;
	background-color: #ffffff;
	color: #1a1a1a;
	font-size: 0.8rem;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.glossary-tab:hover {
	border-color: #c4a882;
	background-color: #f0f0f0;
}

.glossary-tab.is-active {
	border-color: #8b5e3c;
	background-color: #8b5e3c;
	color: #ffffff;
}

/* --- Term Sections by Syllable Group --- */
.glossary-section {
	margin-bottom: 2rem;
	scroll-margin-top: 80px;
}

.glossary-section__heading {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid #e5e5e5;
}

.glossary-section__kana {
	font-size: 1.5rem;
	font-weight: 700;
	color: #8b5e3c;
	line-height: 1;
}

.glossary-section__count {
	font-size: 0.72rem;
	color: #999;
	background-color: #f0f0f0;
	padding: 0.2rem 0.6rem;
	border-radius: 9999px;
}

/* --- Term Definition Blocks --- */
.glossary-term {
	background-color: #ffffff;
	border: 1px solid #e5e5e5;
	border-radius: 12px;
	padding: 1.25rem;
	margin-bottom: 0.75rem;
	transition: box-shadow 0.2s ease;
	scroll-margin-top: 80px;
}

.glossary-term:hover {
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.glossary-term__header {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.glossary-term__title {
	font-size: 1rem;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0;
}

.glossary-term__reading {
	font-size: 0.75rem;
	color: #999;
}

.glossary-term__category {
	display: inline-block;
	font-size: 0.65rem;
	font-weight: 600;
	color: #8b5e3c;
	background-color: rgba(139, 94, 60, 0.08);
	padding: 0.15rem 0.5rem;
	border-radius: 9999px;
	margin-left: auto;
}

.glossary-term__definition {
	font-size: 0.88rem;
	color: #555;
	line-height: 1.7;
}

.glossary-term__anchor {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	margin-top: 0.5rem;
	font-size: 0.75rem;
	color: #8b5e3c;
	text-decoration: none;
	font-weight: 600;
}

.glossary-term__anchor:hover {
	color: #6d4830;
	text-decoration: underline;
}

/* --- Search (Glossary page local search) --- */
.glossary-search {
	position: relative;
	margin-bottom: 1.5rem;
}

.glossary-search__input {
	width: 100%;
	padding: 0.75rem 1rem 0.75rem 2.75rem;
	border: 1.5px solid #e5e5e5;
	border-radius: 12px;
	background-color: #ffffff;
	font-size: 0.9rem;
	color: #1a1a1a;
	font-family: inherit;
	box-sizing: border-box;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.glossary-search__input:focus {
	outline: none;
	border-color: #8b5e3c;
	box-shadow: 0 0 0 3px rgba(139, 94, 60, 0.1);
}

.glossary-search__icon {
	position: absolute;
	left: 0.85rem;
	top: 50%;
	transform: translateY(-50%);
	width: 18px;
	height: 18px;
	color: #999;
	pointer-events: none;
}

/* ========================================
   Mobile-friendly Tooltip (Larger touch targets)
======================================== */
@media (max-width: 768px) {
	.coffee-tooltip {
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
		top: auto;
		max-width: none;
		border-radius: 16px 16px 0 0;
		padding: 1.25rem;
		box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.12);
		transform: translateY(100%);
		z-index: var(--z-toast);
	}

	.coffee-tooltip.is-visible {
		transform: translateY(0);
	}

	.coffee-tooltip__arrow {
		display: none;
	}

	.coffee-tooltip__close {
		display: block;
		position: absolute;
		top: 0.75rem;
		right: 0.75rem;
		width: 32px;
		height: 32px;
		border-radius: 50%;
		background-color: #f0f0f0;
		border: none;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #999;
	}

	.coffee-tooltip-trigger {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
	}

	.glossary-nav__link {
		width: 40px;
		height: 40px;
	}

	.glossary-term {
		padding: 1rem;
	}
}

@media (min-width: 769px) {
	.coffee-tooltip__close {
		display: none;
	}
}

@media (max-width: 480px) {
	.glossary-page {
		padding: 1rem 0.75rem;
	}

	.glossary-page__title {
		font-size: 1.25rem;
	}

	.glossary-nav {
		padding: 0.5rem;
		gap: 0.15rem;
		border-radius: 8px;
	}

	.glossary-nav__link {
		width: 32px;
		height: 32px;
		font-size: 0.75rem;
	}

	.glossary-section__kana {
		font-size: 1.25rem;
	}
}
