/* ================================================================
   Minoka Webmaster Tools — HTML Sitemap (v2)

   Visitor-facing component. Sits outside the .mwt-container card
   shell so it can use the full width of the host theme's content
   column. Uses the design tokens defined in mwt-base.css.
   ================================================================ */

.mwt-html-sitemap {
	font-family: var(--mwt-font-family, -apple-system, sans-serif);
	color: var(--mwt-text-primary, #1d1d1f);
	margin-block: clamp(16px, 3vw, 32px);
	/* Columns var — the root [data-cols] attribute overrides this on desktop. */
	--mwt-sitemap-cols: 1;
}

.mwt-html-sitemap *,
.mwt-html-sitemap *::before,
.mwt-html-sitemap *::after {
	box-sizing: border-box;
}

.mwt-html-sitemap a {
	color: var(--mwt-text-primary, #1d1d1f);
	text-decoration: none;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.mwt-html-sitemap a:hover,
.mwt-html-sitemap a:focus-visible {
	color: var(--mwt-primary, #007aff);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}

/* ================================================================
   Toolbar (search + section nav)
   ================================================================ */

.mwt-html-sitemap__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: clamp(8px, 2vw, 16px);
	padding: 12px clamp(12px, 2vw, 16px);
	margin-bottom: var(--mwt-spacing-lg, 24px);
	background: var(--mwt-bg-white, #ffffff);
	border: 1px solid var(--mwt-border-light, rgba(0, 0, 0, 0.08));
	border-radius: var(--mwt-radius-md, 12px);
	position: sticky;
	top: 0;
	z-index: 2;
	backdrop-filter: saturate(180%) blur(8px);
	-webkit-backdrop-filter: saturate(180%) blur(8px);
	background: rgba(255, 255, 255, 0.92);
}

.mwt-html-sitemap__search-label {
	flex: 1 1 220px;
	min-width: 0;
	display: block;
}

.mwt-html-sitemap__search {
	display: block;
	width: 100%;
	max-width: 360px;
	padding: 8px 12px;
	font-size: 14px;
	font-family: inherit;
	color: inherit;
	background: var(--mwt-bg-white, #ffffff);
	border: 1px solid var(--mwt-border, #d1d1d6);
	border-radius: var(--mwt-radius-sm, 6px);
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mwt-html-sitemap__search:focus {
	border-color: var(--mwt-primary, #007aff);
	box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.mwt-html-sitemap__search::placeholder {
	color: var(--mwt-text-secondary, #6e6e73);
}

/* Section-nav pill strip */
.mwt-html-sitemap__nav {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	flex: 1 1 auto;
	margin-left: auto;
	justify-content: flex-end;
	overflow-x: auto;
	scrollbar-width: thin;
}

.mwt-html-sitemap__nav::-webkit-scrollbar { height: 4px; }
.mwt-html-sitemap__nav::-webkit-scrollbar-thumb { background: var(--mwt-border, #d1d1d6); border-radius: 2px; }

.mwt-html-sitemap__nav-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 10px;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
	background: var(--mwt-bg, #f5f5f7);
	color: var(--mwt-text-secondary, #6e6e73) !important;
	border-radius: 999px;
	border: 1px solid transparent;
	text-decoration: none !important;
}

.mwt-html-sitemap__nav-item:hover,
.mwt-html-sitemap__nav-item:focus-visible {
	background: var(--mwt-primary-light, #f0f7ff);
	color: var(--mwt-primary, #007aff) !important;
	border-color: var(--mwt-primary, #007aff);
}

.mwt-html-sitemap__count {
	font-size: 0.85em;
	font-weight: 500;
	color: var(--mwt-text-secondary, #6e6e73);
	font-variant-numeric: tabular-nums;
}

/* ================================================================
   Section (<details>)
   ================================================================ */

.mwt-html-sitemap__section {
	margin-bottom: var(--mwt-spacing-lg, 24px);
	background: var(--mwt-bg-white, #ffffff);
	border: 1px solid var(--mwt-border-light, rgba(0, 0, 0, 0.08));
	border-radius: var(--mwt-radius-md, 12px);
	overflow: hidden;
	/* Land the in-page anchor below the sticky toolbar */
	scroll-margin-top: 72px;
}

.mwt-html-sitemap__summary {
	cursor: pointer;
	padding: 14px 18px;
	font-size: 18px;
	font-weight: 600;
	color: var(--mwt-text-primary, #1d1d1f);
	display: flex;
	align-items: center;
	gap: 10px;
	list-style: none;
	position: relative;
	user-select: none;
	transition: background-color 0.15s ease;
}

.mwt-html-sitemap__summary::-webkit-details-marker { display: none; }
.mwt-html-sitemap__summary::marker { content: ''; }

.mwt-html-sitemap__summary:hover,
.mwt-html-sitemap__summary:focus-visible {
	background: var(--mwt-primary-light, #f0f7ff);
	outline: none;
}

.mwt-html-sitemap__summary::after {
	content: '';
	width: 10px;
	height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	margin-left: auto;
	opacity: 0.5;
	transition: transform 0.2s ease, opacity 0.15s ease;
}

.mwt-html-sitemap__section[open] > .mwt-html-sitemap__summary::after {
	transform: rotate(45deg);
	opacity: 0.8;
}

.mwt-html-sitemap__icon {
	font-size: 20px;
	line-height: 1;
	flex-shrink: 0;
}

.mwt-html-sitemap__label {
	flex: 0 1 auto;
}

/* Inner wrapper around the list — padding lives here so the summary hover
   can paint the full header width without affecting list padding. */
.mwt-html-sitemap__list-wrap {
	padding: 8px 18px 18px;
	border-top: 1px solid var(--mwt-border-light, rgba(0, 0, 0, 0.08));
}

/* ================================================================
   Lists
   ================================================================ */

.mwt-html-sitemap__list,
.mwt-html-sitemap ul {
	list-style: none;
	padding: 0;
	margin: 0;
}

.mwt-html-sitemap__list li {
	margin: 4px 0;
	padding: 2px 4px;
	border-radius: var(--mwt-radius-sm, 6px);
	break-inside: avoid;
}

.mwt-html-sitemap__list li:hover {
	background: var(--mwt-bg, #f5f5f7);
}

/* lastmod chip */
.mwt-html-sitemap__date {
	margin-left: 8px;
	font-size: 11px;
	font-weight: 500;
	color: var(--mwt-text-secondary, #6e6e73);
	background: var(--mwt-bg, #f5f5f7);
	padding: 1px 6px;
	border-radius: 999px;
	font-variant-numeric: tabular-nums;
	vertical-align: middle;
	white-space: nowrap;
}

.mwt-html-sitemap__list li a:hover .mwt-html-sitemap__date,
.mwt-html-sitemap__list li a:focus-visible .mwt-html-sitemap__date {
	color: var(--mwt-text-secondary, #6e6e73);
	text-decoration: none;
}

/* ================================================================
   Hierarchical (page) list — tree guides
   ================================================================ */

.mwt-html-sitemap__list--tree {
	padding-left: 0;
}

.mwt-html-sitemap__list--tree .mwt-html-sitemap__list--tree {
	padding-left: 18px;
	margin-top: 4px;
	border-left: 1px solid var(--mwt-border-light, rgba(0, 0, 0, 0.08));
}

.mwt-html-sitemap__list--tree li {
	position: relative;
}

/* ================================================================
   Column layout (desktop only)
   ================================================================ */

.mwt-html-sitemap[data-cols="1"] { --mwt-sitemap-cols: 1; }
.mwt-html-sitemap[data-cols="2"] { --mwt-sitemap-cols: 2; }
.mwt-html-sitemap[data-cols="3"] { --mwt-sitemap-cols: 3; }

@media (min-width: 768px) {
	.mwt-html-sitemap__list {
		column-count: var(--mwt-sitemap-cols, 2);
		column-gap: clamp(16px, 3vw, 32px);
	}
	/* Tree lists stay single-column — nesting breaks across columns otherwise */
	.mwt-html-sitemap__list--tree {
		column-count: 1;
	}
}

/* Never multi-column when the visitor is filtering — filtered results
   should stack top-to-bottom so matches are easy to scan. */
.mwt-html-sitemap.is-filtering .mwt-html-sitemap__list {
	column-count: 1;
}

/* ================================================================
   Empty state
   ================================================================ */

.mwt-html-sitemap__empty {
	padding: 24px;
	text-align: center;
	color: var(--mwt-text-secondary, #6e6e73);
	font-style: italic;
	border: 1px dashed var(--mwt-border, #d1d1d6);
	border-radius: var(--mwt-radius-md, 12px);
	background: var(--mwt-bg, #f5f5f7);
}

/* ================================================================
   Mobile
   ================================================================ */

@media (max-width: 560px) {
	.mwt-html-sitemap__toolbar {
		padding: 10px 12px;
	}
	.mwt-html-sitemap__nav {
		margin-left: 0;
		justify-content: flex-start;
	}
	.mwt-html-sitemap__summary {
		font-size: 16px;
		padding: 12px 14px;
	}
	.mwt-html-sitemap__list-wrap {
		padding: 6px 14px 14px;
	}
}

/* ================================================================
   Print
   ================================================================ */

@media print {
	.mwt-html-sitemap__toolbar { display: none !important; }
	.mwt-html-sitemap__summary::after { display: none; }
	.mwt-html-sitemap__section {
		break-inside: avoid;
		border: none;
		box-shadow: none;
		page-break-inside: avoid;
	}
	.mwt-html-sitemap__section,
	.mwt-html-sitemap__section[open] { display: block; }
	.mwt-html-sitemap__list,
	.mwt-html-sitemap__list-wrap { display: block !important; column-count: 1 !important; }
	.mwt-html-sitemap details > *:not(summary) { display: block !important; }
	.mwt-html-sitemap__summary {
		font-size: 14pt;
		padding: 6px 0;
		border-bottom: 1pt solid #000;
	}
	.mwt-html-sitemap__list li a::after {
		content: " (" attr(href) ")";
		font-size: 0.85em;
		color: #555;
		word-break: break-all;
	}
	.mwt-html-sitemap__date { border: none; background: none; padding: 0; margin-left: 4px; }
}
