/* ===========================================================
   Rozumnyi Dim v2 — base + components + per-template styles.
   Depends on tokens.css (loaded first). Sections:
     base
     header / nav
     footer
     theme toggle
     cards
     meta badges
     single post (breadcrumb, TOC, article)
     hub (category)
     home
     tools / calculators
     footer link blocks
     mobile
   =========================================================== */

/* ---------------- base ---------------- */

/* Sticky footer: body becomes a column flex container so #page
   (GP's content wrapper) grows to fill remaining space and pushes
   the footer to the viewport edge on short pages. */
body {
	background: var(--rd-bg);
	color: var(--rd-text);
	font-family: var(--rd-font-body);
	line-height: var(--rd-lh-body);
	transition: background-color 0.2s ease, color 0.2s ease;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

#page.site {
	flex: 1 0 auto;
	width: 100%;
}

.site-footer {
	flex-shrink: 0;
}

.site {
	background: var(--rd-bg);
}

/* GP forces a hardcoded white background on these via
   ".separate-containers ..." in its own dynamic CSS regardless of theme
   — override with the toggleable card colour so dark mode has no white
   boxes (same fix dimopedia's v2 needed for the identical GP behavior). */
.separate-containers .inside-article,
.separate-containers .comments-area,
.separate-containers .page-header,
.separate-containers .paging-navigation,
.inside-page-header {
	background-color: var(--rd-card-bg);
}

a {
	color: var(--rd-accent);
	text-decoration: none;
}

a:hover {
	color: var(--rd-accent-hover);
}

/* ---------------- header / nav ---------------- */

.site-header,
.main-navigation {
	background: var(--rd-bg-alt);
	transition: background-color 0.2s ease, border-color 0.2s ease;
}

.site-header .inside-header {
	min-height: 64px;
	padding-top: 0;
	padding-bottom: 0;
	display: flex;
	align-items: center;
}

.site-header .site-description {
	display: none;
}

.site-header .main-title,
.site-header .main-title a {
	display: flex;
	align-items: center;
	gap: 0.6em;
}

.site-header .main-title a {
	color: var(--rd-text) !important;
	font-family: var(--rd-font-body);
	font-weight: 600;
	font-size: 1.125rem;
	letter-spacing: -0.01em;
}

.site-header .main-title a:hover {
	color: var(--rd-text) !important;
}

.rd-logo-badge {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	background: var(--rd-accent);
	color: var(--rd-accent-ink);
	flex-shrink: 0;
}

.rd-logo-badge svg {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
}

.main-navigation .main-nav > ul.menu > li > a,
.main-navigation .menu-toggle,
.main-navigation .mobile-menu-control-wrapper .menu-toggle {
	color: var(--rd-text-muted);
	font-family: var(--rd-font-body);
	font-size: 0.875rem;
	font-weight: 500;
}

.main-navigation .main-nav > ul.menu > li > a .gp-icon svg,
.main-navigation .menu-toggle .gp-icon svg {
	fill: var(--rd-text-muted);
}

.main-navigation .main-nav ul.menu > li:hover > a,
.main-navigation .main-nav ul.menu > li.current-menu-item > a,
.main-navigation .main-nav ul.menu > li.current-menu-parent > a,
.main-navigation .main-nav ul.menu > li.current-post-ancestor > a {
	color: var(--rd-accent);
}

.main-navigation .main-nav ul ul {
	background: var(--rd-bg-alt);
	border: 1px solid var(--rd-border);
	box-shadow: var(--rd-shadow);
}

.main-navigation .main-nav ul ul li a {
	color: var(--rd-text);
}

.main-navigation .mobile-menu {
	background: var(--rd-bg-alt);
}

/* Own inline nav search (replaces GP's native nav-search widget, which
   renders unstyled/unpositioned in this header — see functions.php
   rdv2_add_utilities_to_menu comment). */
.rd-nav-search-item {
	display: flex;
	align-items: center;
}

.rd-nav-search {
	display: flex;
	align-items: center;
	gap: 0.3em;
}

.rd-nav-search input[type="search"] {
	width: 140px;
	padding: 0.4em 0.7em;
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	background: var(--rd-bg);
	color: var(--rd-text);
	font-family: var(--rd-font-body);
	font-size: 0.8125rem;
}

.rd-nav-search button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border: none;
	border-radius: var(--rd-radius);
	background: transparent;
	color: var(--rd-text-muted);
	cursor: pointer;
}

.rd-nav-search button::before {
	content: '';
	width: 16px;
	height: 16px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat center / contain;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat center / contain;
}

.rd-nav-search button:hover {
	background: var(--rd-accent-soft);
	color: var(--rd-accent);
}

.mobile-menu .rd-nav-search-item {
	padding: 0.9em 1.2em;
}

.mobile-menu .rd-nav-search input[type="search"] {
	width: 100%;
}

/* ---------------- footer ---------------- */

.site-footer,
.site-footer .site-info {
	background: var(--rd-bg-alt);
	border-top: 1px solid var(--rd-border);
}

.site-footer .copyright,
.site-footer .copyright-bar,
.site-footer a {
	color: var(--rd-text-muted);
	font-family: var(--rd-font-body);
	font-size: 0.875rem;
}

.site-footer a:hover {
	color: var(--rd-accent);
}

/* ---------------- theme toggle ---------------- */

.rd-theme-toggle-item {
	display: flex;
	align-items: center;
}

.rd-theme-toggle {
	display: flex;
	align-items: center;
	gap: 0.4em;
	width: auto;
	height: auto;
	padding: 0.5em 0.7em;
	border: 1px solid transparent;
	border-radius: var(--rd-radius);
	background: transparent;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.rd-theme-toggle .rd-toggle-icon svg {
	width: 18px;
	height: 18px;
	stroke: var(--rd-text-muted);
	display: block;
}

.rd-theme-toggle .rd-toggle-label {
	display: none;
	color: var(--rd-text-muted);
	font-family: var(--rd-font-body);
	font-size: 0.875rem;
	font-weight: 500;
}

.rd-theme-toggle:hover {
	background: var(--rd-accent-soft);
	border-color: var(--rd-border);
}

.mobile-menu .rd-theme-toggle-item {
	justify-content: flex-start;
}

.mobile-menu .rd-theme-toggle {
	width: 100%;
	padding: 0.9em 1.2em;
	border-radius: 0;
}

.mobile-menu .rd-theme-toggle .rd-toggle-label {
	display: inline;
}

/* ---------------- cards (border-only, no fill until hover) ---------------- */

.rd-card,
.content-area article.post {
	background: var(--rd-card-bg);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	margin-bottom: 1rem;
	overflow: hidden;
	transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.rd-card:hover,
.content-area article.post:hover {
	border-color: var(--rd-accent);
	box-shadow: var(--rd-shadow);
}

.rd-card .inside-article,
.content-area article.post .inside-article {
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.rd-card .entry-summary,
.content-area article.post .entry-summary {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}

.rd-card .entry-title,
.content-area article.post .entry-title {
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.35;
	margin-bottom: 0.5rem;
}

.rd-card .entry-title a,
.content-area article.post .entry-title a {
	color: var(--rd-text);
}

.rd-card .entry-title a:hover,
.content-area article.post .entry-title a:hover {
	color: var(--rd-accent);
}

.rd-card .post-image,
.content-area article.post .post-image {
	margin: 0 0 1.1rem;
	border-radius: var(--rd-radius);
	overflow: hidden;
}

.rd-card .post-image img,
.content-area article.post .post-image img {
	width: 100%;
	max-height: 320px;
	object-fit: cover;
	display: block;
}

.entry-summary p {
	color: var(--rd-text-muted);
}

.entry-summary .read-more,
a.read-more {
	display: inline-block;
	align-self: flex-start;
	background: var(--rd-accent);
	color: var(--rd-accent-ink);
	font-family: var(--rd-font-body);
	font-size: 0.8125rem;
	font-weight: 600;
	padding: 0.4rem 1rem;
	border-radius: 999px;
	text-decoration: none;
	/* pin to the bottom of the (flex-column) excerpt regardless of
	   excerpt length, so buttons line up across a card row — same fix
	   dimopedia's v2 needed */
	margin-top: auto;
	align-self: flex-start;
}

.entry-summary .read-more:hover,
a.read-more:hover {
	background: var(--rd-accent-hover);
	color: var(--rd-accent-ink);
}

/* ---------------- meta badges ---------------- */

.entry-meta,
.rd-meta-row {
	font-family: var(--rd-font-body);
	font-size: 0.8125rem;
	color: var(--rd-text-muted);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
}

.entry-meta a,
.rd-meta-row a {
	color: var(--rd-text-muted);
}

.entry-meta .cat-links a,
.entry-meta .tags-links a,
.rd-meta-row .rd-category-badge {
	display: inline-block;
	background: var(--rd-accent-soft);
	color: var(--rd-accent);
	padding: 0.15rem 0.6rem;
	border-radius: 999px;
	font-size: 0.74rem;
	margin: 0.15rem 0.3rem 0.15rem 0;
	text-decoration: none;
}

.entry-meta .cat-links a:hover,
.entry-meta .tags-links a:hover,
.rd-meta-row .rd-category-badge:hover {
	background: var(--rd-accent);
	color: var(--rd-accent-ink);
}

.rd-reading-time {
	display: inline-flex;
	align-items: center;
	gap: 0.3em;
}

/* ---------------- single post ---------------- */

.rd-breadcrumb {
	font-family: var(--rd-font-body);
	font-size: 0.8125rem;
	color: var(--rd-text-muted);
	margin-bottom: 1.5rem;
}

.rd-breadcrumb a {
	color: var(--rd-text-muted);
}

.rd-breadcrumb a:hover {
	color: var(--rd-accent);
}

.single .featured-image img,
.featured-image.page-header-image-single img {
	border-radius: var(--rd-radius);
	max-height: 440px;
	object-fit: cover;
}

/* The article body is a comfortable reading column, centred — same
   mechanism as dimopedia's v2 (.single .inside-article, not just
   .entry-content, so the breadcrumb/H1/meta-row/TOC/related all share
   the same centred column instead of only the body text). */
/* Article column matches the same width used everywhere else on the
   site (homepage tiles, hub grid) — no separate narrower "reading
   measure", per owner request to keep widths consistent across pages. */
.single .inside-article {
	max-width: var(--rd-wide);
	margin-inline: auto;
}

.single .entry-content {
	font-size: 1.05rem;
}

.single .entry-content h2 {
	font-size: var(--rd-fs-lg);
	font-weight: 600;
	letter-spacing: -0.015em;
	margin-top: 2.2em;
	padding-bottom: 0.4em;
	border-bottom: 1px solid var(--rd-border);
}

.single .entry-content h3 {
	font-size: var(--rd-fs-md);
	font-weight: 600;
}

.rd-quick-facts {
	background: var(--rd-card-bg);
	border: 1px solid var(--rd-border);
	border-left: 3px solid var(--rd-accent);
	border-radius: var(--rd-radius);
	padding: var(--rd-space-4) var(--rd-space-6);
	margin-bottom: var(--rd-space-6);
	color: var(--rd-text);
}

/* Table of contents — full-width, IN-FLOW block at the top of the
   content (NOT a sticky side rail — that layout was tried and
   explicitly rejected by the owner in July 2026; do not reintroduce
   it, see research.md D3). */
.rd-toc {
	background: var(--rd-bg-alt);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	padding: var(--rd-space-4) var(--rd-space-6);
	margin-bottom: var(--rd-space-6);
}

.rd-toc-title {
	font-family: var(--rd-font-mono);
	font-size: 0.8125rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--rd-text-muted);
	margin: 0 0 0.6em;
}

.rd-toc ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35em;
}

.rd-toc li a {
	color: var(--rd-text);
	font-size: 0.9rem;
}

.rd-toc li.rd-toc-active a,
.rd-toc a:hover {
	color: var(--rd-accent);
}

/* FAQ (auto-faq-schema plugin — same plugin/output shapes as dimopedia):
   - classic FAQ block: #rank-math-faq.rank-math-block > .rank-math-list-item
   - Gutenberg FAQ block: .wp-block-rank-math-faq-block > .rank-math-faq-item
   Style both; schema stays the plugin's job. */
.entry-content .rank-math-block,
.entry-content .wp-block-rank-math-faq-block {
	margin-top: var(--rd-space-8);
	max-width: var(--rd-measure);
}

.entry-content .rank-math-list-item,
.entry-content .rank-math-faq-item {
	background: var(--rd-bg-alt);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	padding: var(--rd-space-4) var(--rd-space-6);
	margin-bottom: var(--rd-space-3);
}

.entry-content .rank-math-question {
	color: var(--rd-text);
	font-weight: 700;
}

.entry-content .rank-math-answer {
	color: var(--rd-text-muted);
}

.entry-content .rank-math-answer > :last-child {
	margin-bottom: 0;
}

.rd-related-title {
	font-size: var(--rd-fs-lg);
	font-weight: 600;
	margin-bottom: var(--rd-space-4);
}

/* ---------------- hub (category) ---------------- */

.rd-hub-wrap {
	max-width: var(--rd-wide);
	margin-inline: auto;
}

.rd-hub-header {
	margin-bottom: var(--rd-space-8);
}

.rd-hub-description {
	color: var(--rd-text-muted);
	max-width: var(--rd-measure);
}

.rd-hub-children {
	display: flex;
	flex-wrap: wrap;
	gap: var(--rd-space-3);
	margin: var(--rd-space-4) 0;
}

.rd-hub-child-tile {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	padding: 0.5em 1em;
	background: var(--rd-bg-alt);
	border: 1px solid var(--rd-border);
	border-radius: 999px;
	color: var(--rd-text);
	font-size: 0.875rem;
}

.rd-hub-child-tile:hover {
	border-color: var(--rd-accent);
	color: var(--rd-accent);
}

.rd-hub-title {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.rd-hub-icon {
	display: inline-flex;
	width: 1.4em;
	height: 1.4em;
	flex: 0 0 auto;
	color: var(--rd-accent);
}

.rd-hub-icon svg {
	width: 100%;
	height: 100%;
}

.rd-hub-featured {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
	align-items: stretch;
	min-height: 200px;
	background: var(--rd-card-bg);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	box-shadow: var(--rd-shadow);
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	margin-bottom: var(--rd-space-6);
}

.rd-hub-featured:hover {
	border-color: var(--rd-accent);
}

.rd-hub-featured:not(:has(.rd-hub-featured-media)) {
	grid-template-columns: 1fr;
}

.rd-hub-featured-media {
	display: block;
	position: relative;
	background: var(--rd-bg-alt);
}

.rd-hub-featured-media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.rd-hub-featured-body {
	padding: var(--rd-space-6);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.5rem;
}

.rd-hub-featured-kicker {
	font-family: var(--rd-font-mono);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-size: 0.75rem;
	color: var(--rd-accent-hover);
}

.rd-hub-featured-title {
	font-size: var(--rd-fs-lg);
	font-weight: 700;
	line-height: 1.3;
	color: var(--rd-text);
}

.rd-hub-featured-excerpt {
	color: var(--rd-text-muted);
	font-size: 0.875rem;
}

.rd-hub-empty {
	background: var(--rd-bg-alt);
	border: 1px dashed var(--rd-border);
	border-radius: var(--rd-radius);
	padding: var(--rd-space-8);
	text-align: center;
	color: var(--rd-text-muted);
}

.rd-card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: var(--rd-space-4);
	max-width: var(--rd-wide);
	margin-inline: auto;
}

/* ---------------- home ---------------- */

.rd-home-wrap {
	max-width: var(--rd-wide);
	margin-inline: auto;
}

.rd-home-hero {
	padding: var(--rd-space-12) 0 var(--rd-space-8);
	text-align: center;
}

.rd-home-hero-title {
	font-size: var(--rd-fs-2xl);
	font-weight: 700;
	letter-spacing: -0.02em;
}

.rd-home-hero-lede {
	color: var(--rd-text-muted);
	max-width: 640px;
	margin: 0 auto;
}

.rd-tile-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--rd-space-4);
}

.rd-tile {
	display: flex;
	flex-direction: column;
	gap: var(--rd-space-2);
	padding: var(--rd-space-6);
	background: var(--rd-card-bg);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	color: var(--rd-text);
}

.rd-tile:hover {
	border-color: var(--rd-accent);
	box-shadow: var(--rd-shadow);
}

.rd-tile.rd-tile-empty {
	opacity: 0.6;
	border-style: dashed;
}

.rd-tile-icon svg {
	width: 24px;
	height: 24px;
	stroke: var(--rd-accent);
	fill: none;
}

.rd-tile-count {
	font-family: var(--rd-font-mono);
	font-size: 0.8125rem;
	color: var(--rd-text-muted);
}

/* ---------------- tools / calculators ---------------- */

.rd-calc {
	background: var(--rd-card-bg);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	padding: var(--rd-space-6);
	margin-bottom: var(--rd-space-6);
	max-width: var(--rd-measure);
}

.rd-calc-heading {
	font-weight: 600;
	margin-bottom: var(--rd-space-3);
}

.rd-calc-field {
	display: flex;
	flex-direction: column;
	gap: 0.3em;
	margin-bottom: var(--rd-space-3);
}

.rd-calc-field label {
	font-size: 0.875rem;
	color: var(--rd-text-muted);
}

.rd-calc-field input,
.rd-calc-field select {
	background: var(--rd-bg-alt);
	border: 1px solid var(--rd-border);
	border-radius: var(--rd-radius);
	color: var(--rd-text);
	padding: 0.6em 0.8em;
	font-family: var(--rd-font-body);
	width: 100%;
}

.rd-calc-field input[aria-invalid="true"] {
	border-color: #f87171;
}

.rd-calc-hint {
	color: #f87171;
	font-size: 0.8125rem;
}

.rd-calc-result {
	margin-top: var(--rd-space-4);
	padding-top: var(--rd-space-4);
	border-top: 1px solid var(--rd-border);
	font-size: 1.05rem;
}

.rd-calc-result-value {
	color: var(--rd-accent);
	font-weight: 700;
}

.rd-calc-warning {
	color: #fbbf24;
	font-weight: 600;
}

.rd-calc-noscript {
	color: var(--rd-text-muted);
}

/* ---------------- footer link blocks ---------------- */

.site-footer .rd-footer-links,
.site-footer .rd-footer-legal-links {
	display: block;
	margin-top: 0.35rem;
}

/* ---------------- mobile ---------------- */

@media (max-width: 782px) {
	.rd-tile-grid {
		grid-template-columns: 1fr;
	}

	.rd-card-grid {
		grid-template-columns: 1fr;
	}

	.rd-hub-children {
		flex-direction: column;
		align-items: flex-start;
	}
}
