.twwp-portal,
.twwp-wiki-entry-page { color: var(--twwp-ink); background: var(--twwp-paper); }
.twwp-portal-shell,
.twwp-entry-frame { width: min(1180px, calc(100% - 12vw)); margin: 0 auto; }
.twwp-portal-shell { padding: clamp(2rem, 5vw, 4.5rem) 0 clamp(5rem, 9vw, 8rem); }
.twwp-entry-frame { padding: clamp(1.2rem, 3vw, 2.1rem) 0 clamp(5rem, 8vw, 7rem); }

.twwp-kicker {
	margin: 0 0 0.65rem;
	color: var(--twwp-accent);
	font-size: 0.75rem;
	font-weight: 750;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.twwp-portal-hero { max-width: 790px; padding: clamp(2rem, 5vw, 4rem) 0 clamp(1.8rem, 4vw, 3rem); }
.is-category-hub .twwp-portal-hero { padding-top: clamp(1.5rem, 4vw, 3rem); }
.twwp-portal-hero h1,
.twwp-entry-header h1 {
	margin: 0;
	font-size: clamp(2.35rem, 7vw, 5.1rem);
	line-height: 0.98;
	letter-spacing: -0.055em;
}
.twwp-entry-header h1 { font-size: clamp(2.15rem, 5.4vw, 4.25rem); }
.twwp-portal-hero > p:last-child {
	max-width: 720px;
	margin: 1.2rem 0 0;
	color: var(--twwp-muted);
	font-size: clamp(1.02rem, 2vw, 1.23rem);
	line-height: 1.75;
}

.twwp-wiki-search {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	max-width: 760px;
	margin: 0 0 clamp(3rem, 7vw, 5.5rem);
	padding: 0.52rem;
	background: #fff;
	border: 1px solid var(--twwp-line);
	border-radius: 16px;
	box-shadow: 0 14px 42px rgba(45, 39, 54, 0.07);
}
.twwp-wiki-search label { padding: 0 0.5rem 0 0.65rem; color: var(--twwp-accent); font-size: 1.25rem; }
.twwp-wiki-search input {
	min-width: 0;
	padding: 0.78rem 0.25rem;
	border: 0;
	outline: 0;
	background: transparent;
	box-shadow: none;
	color: var(--twwp-ink);
	font: inherit;
}
.twwp-wiki-search button {
	padding: 0.82rem 1.2rem;
	border: 0;
	border-radius: 11px;
	background: var(--twwp-ink);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}
.twwp-wiki-search button:hover,
.twwp-wiki-search button:focus-visible { background: var(--twwp-accent); }

.twwp-portal-section { margin-top: clamp(3.25rem, 7vw, 6rem); }
.twwp-portal-section:first-of-type { margin-top: 0; }
.twwp-section-heading,
.twwp-related-heading {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.5rem;
	margin-bottom: 1.25rem;
}
.twwp-section-heading h2,
.twwp-related-heading h2,
.twwp-watch h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.15rem); letter-spacing: -0.035em; }
.twwp-section-heading p { margin: 0.4rem 0 0; color: var(--twwp-muted); }
.twwp-text-link,
.twwp-parent-topic { color: var(--twwp-accent); font-size: 0.9rem; font-weight: 700; text-decoration: none; }
.twwp-text-link:hover,
.twwp-parent-topic:hover { text-decoration: underline; text-underline-offset: 0.2em; }

.twwp-category-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.15rem; }
.twwp-category-card {
	display: flex;
	min-height: 184px;
	flex-direction: column;
	overflow: hidden;
	padding: 0;
	border: 1px solid var(--twwp-line);
	border-radius: 14px;
	background: linear-gradient(145deg, #fff, var(--twwp-soft));
	color: inherit;
	transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.twwp-category-card:hover,
.twwp-category-card:focus-within { transform: translateY(-2px); border-color: rgba(102, 80, 121, 0.38); box-shadow: 0 15px 34px rgba(45, 39, 54, 0.07); }
.twwp-category-media { position: relative; display: block; overflow: hidden; aspect-ratio: 3 / 1; background: #dcd5df; color: inherit; text-decoration: none; }
.twwp-category-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--wiki-image-position); transition: filter 220ms ease, transform 220ms ease; }
.twwp-category-media:hover img,
.twwp-category-media:focus-visible img { filter: saturate(1.04); transform: scale(1.025); }
.twwp-category-media:focus-visible { outline: 2px solid var(--twwp-accent); outline-offset: -3px; }
.twwp-category-copy { display: flex; min-height: 184px; flex: 1; flex-direction: column; padding: 1.25rem 1.4rem 1.35rem; }
.twwp-category-count { color: var(--twwp-accent); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.035em; }
.twwp-category-card h3 { margin: 1.05rem 0 0.4rem; font-size: 1.25rem; line-height: 1.2; }
.twwp-category-card h3 a { color: inherit; text-decoration: none; }
.twwp-category-card h3 a:hover,
.twwp-category-card h3 a:focus-visible { color: var(--twwp-accent); text-decoration: underline; text-underline-offset: 0.18em; }
.twwp-category-description { color: var(--twwp-muted); font-size: 0.88rem; line-height: 1.55; }
.twwp-explore-link { margin-top: auto; padding-top: 1rem; color: var(--twwp-accent); font-size: 0.86rem; font-weight: 750; text-decoration: none; }
.twwp-explore-tree,
.twwp-explore-tree ~ .twwp-portal-section { font-family: Roboto, Arial, sans-serif; }

.twwp-wiki-tree ul { margin: 0; padding: 0; list-style: none; }
.twwp-wiki-tree details > summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8rem;
	min-height: 38px;
	padding: 0.35rem 0.5rem 0.35rem 0;
	color: var(--twwp-ink);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}
.twwp-wiki-tree details > summary::-webkit-details-marker { display: none; }
.twwp-wiki-tree details > summary::before { content: '›'; flex: 0 0 auto; margin-right: 0.1rem; color: var(--twwp-accent); transition: transform 150ms ease; }
.twwp-wiki-tree details[open] > summary::before { transform: rotate(90deg); }
.twwp-wiki-tree .twwp-tree-term-label { display: inline-flex; align-items: center; gap: 0.55rem; min-width: 0; margin-right: auto; color: inherit; text-decoration: none; }
.twwp-tree-term-icon { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border: 1px solid rgba(102, 80, 121, 0.14); border-radius: 8px; background: #eee9f0; color: #665079; }
.twwp-tree-term-icon svg { display: block; width: 20px; height: 20px; fill: currentColor; }
.twwp-icon-martial-arts { background: #f3e9e8; color: #884f49; }
.twwp-icon-rituals-beliefs { background: #f5efe1; color: #8a6a2f; }
.twwp-icon-traditional-arts { background: #eee9f3; color: #705488; }
.twwp-icon-popular-culture { background: #e8eef5; color: #496b8a; }
.twwp-icon-people { background: #e8f1ed; color: #46745e; }
.twwp-icon-places { background: #f3e9ed; color: #8a4e64; }
.twwp-icon-everyday-life { background: #f2eee7; color: #7a6241; }
.twwp-wiki-tree .twwp-tree-term-label:hover,
.twwp-wiki-tree .twwp-tree-term-label:focus-visible { color: var(--twwp-accent); text-decoration: underline; text-underline-offset: 0.18em; }
.twwp-wiki-tree details > summary small { color: #8a818e; font-size: 0.7rem; font-weight: 650; }
.twwp-wiki-tree details > ul { margin-left: 0.55rem; padding-left: 0.95rem; border-left: 1px solid var(--twwp-line); }
.twwp-tree-entry a,
.twwp-tree-term-link {
	padding: 0.31rem 0.55rem;
	border-radius: 6px;
	color: #514a56;
	font-size: 0.88rem;
	line-height: 1.35;
	text-decoration: none;
}
.twwp-tree-entry a { display: block; }
.twwp-tree-term-link { display: flex; align-items: center; gap: 0.55rem; }
.twwp-tree-entry a:hover,
.twwp-tree-entry a:focus-visible,
.twwp-tree-term-link:hover { background: var(--twwp-soft); color: var(--twwp-accent); }
.twwp-tree-entry.is-current a { background: #eee7f3; color: var(--twwp-ink); font-weight: 750; }
.twwp-tree-entry.is-current a::before { content: '●'; margin-right: 0.45rem; color: var(--twwp-accent); font-size: 0.56rem; vertical-align: 0.14em; }
.twwp-explore-tree > .twwp-wiki-tree { padding: 1.1rem 1.3rem; border: 1px solid var(--twwp-line); border-radius: 14px; background: #fff; columns: 2; column-gap: 2.5rem; }
.twwp-explore-tree .twwp-wiki-tree-root > li { break-inside: avoid; margin-bottom: 0.75rem; }

.twwp-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.twwp-topic-card { border: 1px solid var(--twwp-line); border-radius: 12px; background: #fff; }
.twwp-topic-card a { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 1rem; height: 100%; padding: 1rem 1.1rem; color: inherit; text-decoration: none; }
.twwp-topic-card a:hover h3 { color: var(--twwp-accent); text-decoration: underline; text-underline-offset: 0.2em; }
.twwp-topic-image { display: block; width: 72px; height: 72px; overflow: hidden; border-radius: 9px; background: #eee9f0; }
.twwp-topic-image.is-empty { background: linear-gradient(145deg, #f4f0f5, #e6dfe9); }
.twwp-topic-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--wiki-image-position); transition: transform 180ms ease; }
.twwp-topic-card a:hover .twwp-topic-image img,
.twwp-topic-card a:focus-visible .twwp-topic-image img { transform: scale(1.045); }
.twwp-topic-copy { display: block; min-width: 0; }
.twwp-topic-category { color: var(--twwp-accent); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.045em; text-transform: uppercase; }
.twwp-topic-card h3 { margin: 0.35rem 0 0.25rem; font-size: 1.05rem; line-height: 1.25; }
.twwp-topic-card p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--twwp-muted); font-size: 0.84rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.twwp-empty { padding: 1rem 1.1rem; border-radius: 10px; background: var(--twwp-soft); color: var(--twwp-muted); }

.twwp-breadcrumb { overflow: hidden; color: #746c79; font-size: 0.78rem; }
.twwp-breadcrumb ol { display: flex; align-items: center; gap: 0; overflow-x: auto; margin: 0; padding: 0.2rem 0; list-style: none; scrollbar-width: none; white-space: nowrap; }
.twwp-breadcrumb ol::-webkit-scrollbar { display: none; }
.twwp-breadcrumb li { display: flex; align-items: center; }
.twwp-breadcrumb li + li::before { content: '›'; margin: 0 0.52rem; color: #aaa1ad; }
.twwp-breadcrumb a { color: #665d6b; text-decoration: none; }
.twwp-breadcrumb a:hover { color: var(--twwp-accent); text-decoration: underline; }

.twwp-entry-layout { display: grid; grid-template-columns: minmax(205px, 238px) minmax(0, 760px); gap: clamp(2rem, 4vw, 4rem); align-items: start; justify-content: center; margin-top: clamp(1.8rem, 4vw, 3.2rem); }
.twwp-tree-sidebar { position: sticky; top: calc(var(--twwp-header-height) + 1.4rem); max-height: calc(100vh - var(--twwp-header-height) - 2.8rem); overflow-y: auto; padding: 0 0.7rem 1rem 0; scrollbar-width: thin; }
.admin-bar .twwp-tree-sidebar { top: calc(var(--twwp-header-height) + 33px + 1.4rem); max-height: calc(100vh - var(--twwp-header-height) - 33px - 2.8rem); }
.twwp-sidebar-title { display: block; margin-bottom: 0.85rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--twwp-line); color: var(--twwp-ink); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.04em; text-decoration: none; text-transform: uppercase; }
.twwp-topic-map-link { margin: 0.85rem 0 0; }
.twwp-tree-sidebar > .twwp-topic-map-link { padding-top: 0.75rem; border-top: 1px solid var(--twwp-line); }
.twwp-mobile-tree > .twwp-topic-map-link { padding: 0 0.85rem 0.85rem; }

.twwp-tree-sidebar .twwp-wiki-tree details > summary { min-height: 32px; font-size: 0.82rem; }
.twwp-tree-sidebar .twwp-tree-entry a { font-size: 0.78rem; }
.twwp-mobile-tree { display: none; }
.twwp-wiki-article { width: 100%; min-width: 0; margin: 0; }
.twwp-entry-header { margin-bottom: clamp(1.6rem, 4vw, 2.6rem); }
.twwp-entry-category { margin: 0 0 0.7rem; color: var(--twwp-accent); font-size: 0.76rem; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; }
.twwp-entry-media { margin: 0 0 clamp(1.8rem, 4vw, 2.7rem); }
.twwp-entry-media img { display: block; width: 100%; height: auto; max-height: 520px; border-radius: 9px; object-fit: cover; object-position: var(--wiki-image-position); }
.twwp-entry-media figcaption { margin-top: 0.52rem; color: #817984; font-size: 0.69rem; line-height: 1.45; }
.twwp-entry-media figcaption a { color: inherit; }

.twwp-wiki-content { font-size: 1rem; line-height: 1.82; }
.twwp-wiki-content > p:first-child { color: #48414d; font-size: clamp(1.04rem, 1.5vw, 1.14rem); }
.twwp-wiki-content a { text-underline-offset: 0.18em; }
.twwp-wiki-content h2,
.twwp-wiki-content h3 { scroll-margin-top: calc(var(--twwp-header-height) + 1.5rem); }
.twwp-article-toc { margin: 1.6rem 0 2rem; padding: 1rem 1.1rem; border: 1px solid var(--twwp-line); border-radius: 10px; background: #faf8fb; }
.twwp-article-toc > strong { display: block; margin-bottom: 0.55rem; font-size: 0.9rem; }
.twwp-article-toc ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1.5rem; margin: 0; padding-left: 1.15rem; }
.twwp-article-toc a { color: #5e5365; font-size: 0.83rem; text-decoration: none; }
.twwp-article-toc a:hover { color: var(--twwp-accent); text-decoration: underline; }

.twwp-overview-box { float: right; width: min(340px, 44%); margin: 0 0 1.6rem 1.8rem; border: 1px solid #c1bac5; border-radius: 7px; background: #faf9fb; overflow: hidden; }
.twwp-overview-box > summary,
.twwp-content-section > summary { display: flex; align-items: center; gap: 0.65rem; cursor: pointer; list-style: none; }
.twwp-overview-box > summary::-webkit-details-marker,
.twwp-content-section > summary::-webkit-details-marker { display: none; }
.twwp-overview-box > summary { justify-content: space-between; padding: 0.7rem 0.8rem; border-bottom: 1px solid #c1bac5; background: #eeeaf1; font-weight: 750; }
.twwp-overview-box:not([open]) > summary { border-bottom: 0; }
.twwp-overview-box > summary::after { content: '−'; color: var(--twwp-accent); font-size: 0.8rem; }
.twwp-overview-box:not([open]) > summary::after { content: '+'; }
.twwp-overview-box .wp-block-table { margin: 0 !important; overflow-x: auto; }
.twwp-overview-box table { width: 100%; margin: 0; border-collapse: collapse; font-size: 0.82rem; line-height: 1.45; }
.twwp-overview-box th,
.twwp-overview-box td { padding: 0.58rem 0.6rem; border: 0; border-bottom: 1px solid #ddd8e0; text-align: left; vertical-align: top; }
.twwp-overview-box th { width: 35%; background: #f1eef3; }
.twwp-content-section { clear: both; margin-top: 2.25rem; }
.twwp-content-section > summary { padding: 0 0 0.55rem; border-bottom: 1px solid var(--twwp-line); font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.25rem, 2.8vw, 1.55rem); font-weight: 600; }
.twwp-content-section > summary > h2 { margin: 0; color: inherit; font: inherit; }
.twwp-content-section > summary::before { content: '▾'; color: var(--twwp-accent); font-family: sans-serif; font-size: 0.72em; transition: transform 150ms ease; }
.twwp-content-section:not([open]) > summary::before { transform: rotate(-90deg); }
.twwp-content-section-body { padding-top: 0.85rem; }
.twwp-content-section-body > :first-child { margin-top: 0; }
.twwp-wiki-content::after { display: table; clear: both; content: ''; }

.twwp-watch { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: 3rem; padding: 1.2rem 1.3rem; border: 1px solid var(--twwp-line); border-radius: 12px; background: var(--twwp-soft); }
.twwp-watch span { color: var(--twwp-muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.twwp-watch h2 { margin-top: 0.2rem; font-size: 1.3rem; }
.twwp-watch > a { padding: 0.7rem 0.9rem; border-radius: 9px; background: var(--twwp-ink); color: #fff; font-size: 0.84rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.twwp-revised { margin-top: 2.5rem; }

.twwp-related-topics { margin-top: clamp(3.5rem, 8vw, 6rem); padding-top: 2rem; border-top: 1px solid var(--twwp-line); }
.twwp-related-heading { align-items: flex-end; }
.twwp-related-heading .twwp-kicker { margin-bottom: 0.35rem; }
.twwp-related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }
.twwp-related-card { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 0.6rem; min-width: 0; padding: 0.45rem; border: 1px solid var(--twwp-line); border-radius: 9px; color: inherit; text-decoration: none; }
.twwp-related-card:hover { border-color: rgba(102, 80, 121, 0.4); background: #fbf9fc; }
.twwp-related-image { width: 58px; height: 52px; overflow: hidden; border-radius: 6px; background: var(--twwp-soft); }
.twwp-related-image img { width: 100%; height: 100%; object-fit: cover; object-position: var(--wiki-image-position); }
.twwp-related-copy { min-width: 0; }
.twwp-related-copy small { display: block; overflow: hidden; color: var(--twwp-accent); font-size: 0.62rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.twwp-related-copy strong { display: -webkit-box; overflow: hidden; margin-top: 0.18rem; font-size: 0.84rem; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.twwp-admin-link { margin-top: 2rem; font-size: 0.8rem; }
.twwp-admin-link a { color: var(--twwp-muted); }


/* Comfortable touch targets for the Wiki's compact navigation controls. */
.twwp-wiki-search button,
.twwp-wiki-tree details > summary,
.twwp-tree-entry a,
.twwp-tree-term-link,
.twwp-breadcrumb a,
.twwp-text-link,
.twwp-parent-topic,
.twwp-content-section > summary,
.twwp-overview-box > summary {
	min-height: 44px;
}
.twwp-tree-entry a,
.twwp-tree-term-link,
.twwp-breadcrumb a,
.twwp-text-link,
.twwp-parent-topic {
	align-items: center;
}
.twwp-text-link,
.twwp-parent-topic,
.twwp-breadcrumb a {
	display: inline-flex;
}

@media (max-width: 980px) {
	.twwp-category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.twwp-entry-layout { grid-template-columns: minmax(190px, 215px) minmax(0, 1fr); gap: 2rem; }
	.twwp-related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 782px) {
	.admin-bar .twwp-tree-sidebar { top: calc(var(--twwp-header-height) + 47px + 1rem); }
}

@media (max-width: 760px) {
	.twwp-portal-shell,
	.twwp-entry-frame { width: min(100% - 10vw, 680px); }
	.twwp-portal-hero h1 { font-size: clamp(2.45rem, 13vw, 4.2rem); }
	.twwp-wiki-search { grid-template-columns: auto minmax(0, 1fr); }
	.twwp-wiki-search button { grid-column: 1 / -1; width: 100%; }
	.twwp-explore-tree > .twwp-wiki-tree { columns: 1; }
	.twwp-entry-layout { display: block; margin-top: 1.5rem; }
	.twwp-tree-sidebar { display: none; }
	.twwp-mobile-tree { display: block; margin-top: 1rem; border: 1px solid var(--twwp-line); border-radius: 10px; background: #fff; }
	.twwp-mobile-tree > summary { display: flex; justify-content: space-between; padding: 0.8rem 0.9rem; color: var(--twwp-accent); font-size: 0.85rem; font-weight: 750; cursor: pointer; list-style: none; }
	.twwp-mobile-tree > summary::-webkit-details-marker { display: none; }
	.twwp-mobile-tree > .twwp-wiki-tree { max-height: 66vh; overflow-y: auto; padding: 0 0.85rem 0.9rem; border-top: 1px solid var(--twwp-line); }
	.twwp-overview-box { float: none; width: 100%; margin: 0 0 1.5rem; }
	.twwp-article-toc ol { grid-template-columns: 1fr; }
	.twwp-related-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
	.twwp-category-grid,
	.twwp-topic-grid,
	.twwp-related-grid { grid-template-columns: 1fr; }
	.twwp-category-card,
	.twwp-category-copy { min-height: 156px; }
	.twwp-topic-card a { grid-template-columns: 64px minmax(0, 1fr); gap: 0.8rem; padding: 0.9rem; }
	.twwp-topic-image { width: 64px; height: 64px; }
	.twwp-section-heading { align-items: flex-start; flex-direction: column; }
	.twwp-watch { align-items: flex-start; flex-direction: column; }
	.twwp-watch > a { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
	.twwp-category-card,
	.twwp-category-media img,
	.twwp-wiki-tree details > summary::before { transition: none !important; }
}
