/*
KSO Interactive Kyushu Semiconductor Map
STEP 6 / Ver0.5 — Publication QA Candidate
*/

.kso-map-page {
	--kso-navy: #173a78;
	--kso-ink: #111827;
	--kso-muted: #64748b;
	max-width: none;
}

.kso-map-page__inner {
	width: min(100% - 24px, 1260px);
	margin: 0 auto;
	padding: 28px 0 48px;
}

.kso-map-page__header {
	margin: 0 0 16px;
}

.kso-map-page__title {
	margin: 0;
	color: var(--kso-navy);
	font-size: clamp(1.55rem, 3vw, 2.4rem);
	line-height: 1.15;
	font-weight: 800;
}

.kso-map-page__lead {
	margin: 8px 0 0;
	color: #334155;
	font-size: 0.98rem;
}

.kso-map-app { width: 100%; }

/* Filters / search */
.kso-controls {
	display: grid;
	gap: 10px;
	margin: 0 0 12px;
	padding: 12px;
	border: 1px solid #dbe3ee;
	border-radius: 10px;
	background: #f8fafc;
}

.kso-filter-block__label {
	display: block;
	margin: 0 0 6px;
	color: #475569;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.kso-filter-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.kso-filter,
.kso-reset-button,
.kso-search-clear {
	touch-action: manipulation;
}

.kso-filter {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 36px;
	padding: 5px 10px;
	border: 1px solid #cbd5e1;
	border-radius: 999px;
	background: #fff;
	color: #334155;
	font: 700 0.79rem/1.2 Arial, Helvetica, sans-serif;
	cursor: pointer;
}

.kso-filter:hover:not(:disabled),
.kso-filter:focus-visible:not(:disabled) {
	border-color: var(--kso-navy);
	color: var(--kso-navy);
	outline: none;
}

.kso-filter.is-active {
	border-color: var(--kso-navy);
	background: var(--kso-navy);
	color: #fff;
}

.kso-filter:disabled {
	opacity: 0.42;
	cursor: not-allowed;
}

.kso-filter__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 999px;
	background: #e2e8f0;
	color: #334155;
	font-size: 0.7rem;
	font-weight: 800;
	box-sizing: border-box;
}

.kso-filter.is-active .kso-filter__count {
	background: rgba(255,255,255,.2);
	color: #fff;
}

.kso-filter--secondary { font-size: 0.74rem; }

.kso-control-grid {
	display: grid;
	grid-template-columns: minmax(180px,.6fr) minmax(280px,1.4fr);
	gap: 10px;
	align-items: start;
}

.kso-field { display: block; min-width: 0; }

.kso-select,
.kso-search {
	width: 100%;
	height: 42px;
	border: 1px solid #cbd5e1;
	border-radius: 7px;
	background: #fff;
	color: #1e293b;
	font-size: 0.84rem;
	box-sizing: border-box;
}

.kso-select { padding: 0 32px 0 10px; }
.kso-search-wrap { position: relative; display: block; }
.kso-search { padding: 0 38px 0 11px; }

.kso-select:focus,
.kso-search:focus {
	border-color: var(--kso-navy);
	box-shadow: 0 0 0 2px rgba(23,58,120,.13);
	outline: none;
}

.kso-search-clear {
	position: absolute;
	top: 50%;
	right: 5px;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #64748b;
	font: 400 21px/1 Arial,sans-serif;
	transform: translateY(-50%);
	cursor: pointer;
}

.kso-search-clear:hover,
.kso-search-clear:focus-visible {
	background: #eef2f7;
	color: #111827;
	outline: none;
}

.kso-field__help {
	display: block;
	margin-top: 4px;
	color: #64748b;
	font-size: 0.68rem;
	line-height: 1.35;
}

/* Legend */
.kso-legend,
.kso-results {
	margin: 0 0 10px;
	border: 1px solid #dbe3ee;
	border-radius: 10px;
	background: #fff;
}

.kso-legend__summary,
.kso-results__summary {
	padding: 9px 12px;
	color: var(--kso-navy);
	font-size: 0.82rem;
	font-weight: 800;
	cursor: pointer;
	user-select: none;
}

.kso-legend__grid {
	display: grid;
	grid-template-columns: repeat(3,minmax(0,1fr));
	gap: 7px 16px;
	padding: 2px 12px 12px;
}

.kso-legend__item {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	color: #334155;
	font-size: 0.76rem;
	line-height: 1.25;
}

/* Toolbar / results */
.kso-map-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 34px;
	margin-bottom: 8px;
	color: #475569;
	font-size: 0.88rem;
}

.kso-reset-button {
	flex: 0 0 auto;
	min-height: 34px;
	padding: 5px 9px;
	border: 1px solid #cbd5e1;
	border-radius: 7px;
	background: #fff;
	color: #475569;
	font-size: 0.74rem;
	font-weight: 700;
	cursor: pointer;
}

.kso-reset-button:hover,
.kso-reset-button:focus-visible {
	border-color: var(--kso-navy);
	color: var(--kso-navy);
	outline: none;
}

.kso-results__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.kso-results__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	height: 22px;
	padding: 0 7px;
	border-radius: 999px;
	background: #e8eef9;
	color: var(--kso-navy);
	font-size: 0.72rem;
}

.kso-results__body { padding: 0 10px 10px; }

.kso-results__list {
	display: grid;
	grid-template-columns: repeat(2,minmax(0,1fr));
	gap: 6px;
	max-height: 280px;
	overflow: auto;
	padding: 2px;
}

.kso-result {
	display: grid;
	grid-template-columns: 42px minmax(0,1fr);
	gap: 8px;
	width: 100%;
	min-height: 48px;
	padding: 8px;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	background: #fff;
	color: #1e293b;
	text-align: left;
	cursor: pointer;
	box-sizing: border-box;
	touch-action: manipulation;
}

.kso-result:hover,
.kso-result:focus-visible {
	border-color: var(--kso-navy);
	background: #f8fafc;
	outline: none;
}

.kso-result.is-active {
	border-color: var(--kso-navy);
	box-shadow: inset 0 0 0 1px var(--kso-navy);
	background: #f5f8ff;
}

.kso-result__number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 28px;
	border-radius: 7px;
	background: var(--kso-navy);
	color: #fff;
	font-size: 0.72rem;
	font-weight: 800;
}

.kso-result__name {
	display: block;
	color: #0f172a;
	font-size: 0.78rem;
	font-weight: 800;
	line-height: 1.3;
}

.kso-result__meta {
	display: block;
	margin-top: 3px;
	color: #64748b;
	font-size: 0.68rem;
	line-height: 1.35;
}

.kso-results__empty {
	margin: 8px 2px 2px;
	color: #64748b;
	font-size: 0.8rem;
}

/* Map */
.kso-mobile-map-hint {
	margin: 0 0 7px;
	color: #64748b;
	font-size: 0.72rem;
	font-weight: 700;
}

.kso-map-scroll {
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable;
}

.kso-map-stage {
	position: relative;
	width: min(100%,1180px);
	min-width: 760px;
	margin: 0 auto;
	aspect-ratio: 1600 / 1869;
	background: #fff;
	isolation: isolate;
}

.kso-base-map {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	z-index: 1;
}

.kso-marker-layer {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
}

.kso-marker {
	position: absolute;
	left: calc(var(--x) * 1%);
	top: calc(var(--y) * 1%);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-height: 24px;
	padding: 3px 1px;
	border: 0;
	background: transparent;
	transform: translate(-50%,-50%);
	cursor: pointer;
	pointer-events: auto;
	white-space: nowrap;
	z-index: 1;
	touch-action: manipulation;
}

.kso-marker[hidden] { display: none !important; }

.kso-marker:hover,
.kso-marker:focus-visible,
.kso-marker[aria-expanded="true"] {
	z-index: 20;
	outline: none;
}

.kso-marker:hover .kso-symbol,
.kso-marker:focus-visible .kso-symbol,
.kso-marker[aria-expanded="true"] .kso-symbol {
	box-shadow: 0 0 0 2px #fff,0 0 0 4px var(--kso-navy);
}

.kso-marker__number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 16px;
	padding: 0 3px;
	border: 1px solid rgba(17,24,39,.78);
	border-radius: 7px;
	background: rgba(255,255,255,.97);
	color: #111;
	font: 700 9px/1 Arial,Helvetica,sans-serif;
	letter-spacing: -.15px;
	box-shadow: 0 1px 2px rgba(0,0,0,.14);
}

.kso-symbol {
	position: relative;
	flex: 0 0 auto;
	display: inline-block;
	width: 15px;
	height: 15px;
	box-sizing: border-box;
	background: #fff;
	border: 1.5px solid #111;
}

.kso-symbol--integrated { border-radius: 50%; background: #111; }
.kso-symbol--front-end { border-radius: 50%; background: linear-gradient(to bottom,#111 0 50%,#fff 50% 100%); }
.kso-symbol--back-end { border-radius: 50%; background: linear-gradient(to bottom,#fff 0 50%,#111 50% 100%); }
.kso-symbol--design { border-radius: 50%; background: repeating-linear-gradient(60deg,#fff 0,#fff 2px,#111 2px,#111 3px); }
.kso-symbol--electronics-products { border: 0; background: #111; clip-path: polygon(50% 0%,61% 34%,98% 35%,68% 57%,79% 94%,50% 72%,21% 94%,32% 57%,2% 35%,39% 34%); }
.kso-symbol--solar-cells { border: 0; background: #111; transform: skewX(-18deg) scaleX(.92); }
.kso-symbol--electronic-components { border: 0; background: #111; clip-path: polygon(50% 0%,100% 100%,0% 100%); }
.kso-symbol--equipment { background: #fff; border-radius: 0; }
.kso-symbol--materials { width: 12px; height: 12px; margin: 1.5px; background: #fff; transform: rotate(45deg); }
.kso-symbol--device { border-radius: 50%; background: #fff; }

/* Info card */
.kso-info-card {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 50;
	width: min(330px,calc(100% - 24px));
	max-height: 430px;
	overflow: auto;
	padding: 14px 14px 13px;
	border: 1px solid rgba(23,58,120,.3);
	border-radius: 10px;
	background: rgba(255,255,255,.985);
	color: var(--kso-ink);
	box-shadow: 0 10px 28px rgba(15,23,42,.22);
	transform: translate(var(--card-x,12px),var(--card-y,12px));
	box-sizing: border-box;
}

.kso-info-card[hidden] { display: none !important; }

.kso-info-card::before {
	content: "";
	position: absolute;
	inset: 0 auto 0 0;
	width: 4px;
	border-radius: 10px 0 0 10px;
	background: var(--kso-navy);
}

.kso-info-card__close {
	position: absolute;
	top: 6px;
	right: 7px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #475569;
	font: 400 24px/1 Arial,sans-serif;
	cursor: pointer;
	touch-action: manipulation;
}

.kso-info-card__close:hover,
.kso-info-card__close:focus-visible {
	background: #eef2f7;
	color: #111827;
	outline: none;
}

.kso-info-card__eyebrow {
	padding-right: 36px;
	color: var(--kso-navy);
	font-size: .73rem;
	font-weight: 800;
	letter-spacing: .05em;
	text-transform: uppercase;
}

.kso-info-card__title {
	margin: 4px 36px 0 0;
	color: #0f172a;
	font-size: 1rem;
	line-height: 1.3;
	font-weight: 800;
}

.kso-info-card__ja {
	margin-top: 4px;
	color: #475569;
	font-size: .78rem;
	line-height: 1.4;
}

.kso-info-card__details { margin: 12px 0 0; }

.kso-info-card__row {
	display: grid;
	grid-template-columns: 64px minmax(0,1fr);
	gap: 8px;
	padding: 7px 0;
	border-top: 1px solid #e2e8f0;
}

.kso-info-card__row dt {
	margin: 0;
	color: #64748b;
	font-size: .7rem;
	font-weight: 700;
	text-transform: uppercase;
}

.kso-info-card__row dd {
	margin: 0;
	color: #1e293b;
	font-size: .78rem;
	line-height: 1.45;
	overflow-wrap: anywhere;
}

.kso-info-card__actions { margin-top: 10px; }

.kso-info-card__maps {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 42px;
	padding: 7px 12px;
	border-radius: 7px;
	background: var(--kso-navy);
	color: #fff !important;
	text-decoration: none !important;
	font-size: .82rem;
	font-weight: 800;
	box-sizing: border-box;
	touch-action: manipulation;
}

.kso-info-card__maps:hover,
.kso-info-card__maps:focus-visible {
	filter: brightness(.92);
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.kso-map-note {
	margin: 10px 0 0;
	color: var(--kso-muted);
	font-size: .78rem;
	line-height: 1.45;
}

.kso-data-note {
	margin: 14px 0 0;
	padding: 10px 12px;
	border-left: 3px solid #cbd5e1;
	background: #f8fafc;
	color: #64748b;
	font-size: .7rem;
	line-height: 1.5;
}

.kso-map-error { color: #b42318; font-weight: 700; }

@media (max-width: 900px) {
	.kso-legend__grid,
	.kso-results__list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 780px) {
	.kso-map-page__inner {
		width: min(100% - 16px,1260px);
		padding-top: 20px;
	}

	.kso-control-grid { grid-template-columns: 1fr; }

	/*
	 * QA adjustment:
	 * keep the map physically large enough on phones for 151 numbers
	 * and symbols to remain readable. The user pans horizontally.
	 */
	.kso-map-stage { min-width: 1000px; }

	.kso-map-scroll {
		border-top: 1px solid #e2e8f0;
		border-bottom: 1px solid #e2e8f0;
	}

	.kso-info-card {
		width: 310px;
		max-height: 410px;
	}

	.kso-mobile-map-hint { display: block !important; }

	.kso-filter { min-height: 40px; }

	.kso-results__list { max-height: 340px; }
}

@media (max-width: 600px) {
	.kso-results__list,
	.kso-legend__grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	* { scroll-behavior: auto !important; }
}


/* ---------- Ver0.62: Prefecture Auto-Zoom / Pan ---------- */

.kso-zoom-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 8px;
	padding: 7px 8px;
	border: 1px solid #dbe3ee;
	border-radius: 9px;
	background: #f8fafc;
}

.kso-zoom-button,
.kso-zoom-reset {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1px solid #cbd5e1;
	border-radius: 7px;
	background: #fff;
	color: #173a78;
	font-weight: 800;
	cursor: pointer;
	touch-action: manipulation;
}

.kso-zoom-button {
	font-size: 1.15rem;
	line-height: 1;
}

.kso-zoom-reset {
	font-size: 0.75rem;
}

.kso-zoom-button:hover,
.kso-zoom-button:focus-visible,
.kso-zoom-reset:hover,
.kso-zoom-reset:focus-visible {
	border-color: #173a78;
	outline: none;
}

.kso-zoom-level {
	min-width: 54px;
	color: #334155;
	font-size: 0.78rem;
	font-weight: 800;
	text-align: center;
}

.kso-zoom-region {
	margin-left: 4px;
	padding-left: 9px;
	border-left: 1px solid #cbd5e1;
	color: #173a78;
	font-size: 0.78rem;
	font-weight: 800;
}

.kso-map-scroll.is-zoomed {
	position: relative;
	height: min(78vh, 860px);
	overflow: auto;
	border: 1px solid #dbe3ee;
	border-radius: 10px;
	background: #fff;
	overscroll-behavior: contain;
	scrollbar-gutter: stable;
	touch-action: pan-x pan-y;
}

.kso-map-scroll.is-pinching {
	scroll-behavior: auto !important;
}

.kso-map-stage {
	transform-origin: top left;
}

.kso-prefecture-hotspots {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.kso-prefecture-hotspot {
	fill: rgba(23, 58, 120, 0);
	stroke: rgba(23, 58, 120, 0);
	stroke-width: 8;
	vector-effect: non-scaling-stroke;
	pointer-events: all;
	cursor: zoom-in;
	outline: none;
	transition: fill 120ms ease, stroke 120ms ease;
}

.kso-prefecture-hotspot:hover,
.kso-prefecture-hotspot:focus-visible,
.kso-prefecture-hotspot.is-active {
	fill: rgba(23, 58, 120, 0.075);
	stroke: rgba(23, 58, 120, 0.45);
}

.kso-marker-layer {
	z-index: 3;
}

.kso-info-card {
	z-index: 60;
}

@media (max-width: 780px) {
	.kso-map-scroll.is-zoomed {
		height: min(68vh, 650px);
	}

	.kso-zoom-bar {
		position: sticky;
		top: 0;
		z-index: 80;
	}

	.kso-zoom-button,
	.kso-zoom-reset {
		min-width: 42px;
		height: 42px;
	}

	.kso-prefecture-hotspot {
		stroke-width: 12;
	}
}
