/*
Theme Name: Silkway
Description: Block theme for Silkway Travel — travel stories and author tours.
Version: 1.0.2
Requires at least: 6.6
Requires PHP: 8.1
Text Domain: silkway
*/

/* ---------- Layout ---------- */
.sw-single > * { margin-block-start: 0; }

/* ---------- Header ---------- */
.sw-header { background: var(--wp--preset--color--base); }
.sw-header .wp-block-site-title a { color: var(--wp--preset--color--contrast); text-decoration: none; }
.sw-header .wp-block-navigation a { text-decoration: none; }
.sw-header .wp-block-navigation a:hover { color: var(--wp--preset--color--accent); }

/* ---------- Breadcrumbs ---------- */
.sw-breadcrumbs {
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	color: var(--wp--preset--color--muted);
}
.sw-breadcrumbs a { color: inherit; text-decoration: none; }
.sw-breadcrumbs a:hover { color: var(--wp--preset--color--accent); }

/* ---------- Post meta line ---------- */
.sw-post-meta { font-family: var(--wp--preset--font-family--lora); font-size: var(--wp--preset--font-size--small); }
.sw-post-meta .wp-block-avatar img { display: block; }
.sw-post-meta p, .sw-post-meta .wp-block-post-date, .sw-post-meta .wp-block-post-author-name { margin: 0; }
.sw-post-meta .wp-block-post-author-name { color: var(--wp--preset--color--contrast); }

/* ---------- Post content ---------- */
.sw-post-content h2 {
	margin-block-start: var(--wp--preset--spacing--60);
	padding-bottom: 0.45em;
	border-bottom: 2px solid var(--wp--preset--color--contrast);
}
.sw-post-content h3 { margin-block-start: var(--wp--preset--spacing--50); }
.sw-post-content h2, .sw-post-content h3 { scroll-margin-top: 1.5rem; }
.sw-post-content img { border-radius: 4px; }
.sw-post-content figure { margin-block: var(--wp--preset--spacing--40); }
.sw-post-content figcaption { text-align: left; margin-top: 0.5em; }
.sw-post-content .wp-block-gallery { gap: 0.5rem; }
.sw-post-content ul, .sw-post-content ol { padding-left: 1.3em; }
.sw-post-content li + li { margin-top: 0.35em; }

/* ---------- Table of contents ---------- */
.sw-toc {
	margin-block: var(--wp--preset--spacing--40);
	padding: 1.25rem 1.5rem;
	background: var(--wp--preset--color--surface);
	border-radius: 8px;
	font-size: 1rem;
	line-height: 1.5;
}
.sw-toc__title {
	margin: 0 0 0.6rem;
	font-family: var(--wp--preset--font-family--montserrat);
	font-weight: 700;
	font-size: 1rem;
}
.sw-toc ol { margin: 0; padding-left: 1.3em; }
.sw-toc li + li { margin-top: 0.3em; }
.sw-toc a { color: var(--wp--preset--color--contrast); text-decoration: none; border-bottom: 1px solid rgba(0, 0, 0, 0.15); }
.sw-toc a:hover { color: var(--wp--preset--color--accent); border-color: currentColor; }

/* ---------- Tags ---------- */
.sw-tags { margin-block-start: var(--wp--preset--spacing--50); font-family: var(--wp--preset--font-family--montserrat); font-size: var(--wp--preset--font-size--small); font-weight: 500; }
.sw-tags .wp-block-post-terms__prefix { margin-right: 0.4rem; color: var(--wp--preset--color--muted); }
.sw-tags a {
	display: inline-block;
	margin: 0 0.35rem 0.45rem 0;
	padding: 0.3rem 0.8rem;
	border: 1px solid #ddd6ca;
	border-radius: 999px;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}
.sw-tags a:hover { border-color: var(--wp--preset--color--accent); color: var(--wp--preset--color--accent); }
.sw-tags .wp-block-post-terms__separator { display: none; }

/* ---------- Telegram card ---------- */
.sw-telegram-card { margin-block-start: var(--wp--preset--spacing--50); }
.sw-telegram-card h3 { margin: 0; }

/* ---------- Section titles + cards ---------- */
.sw-section-title { margin-block: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40); font-size: var(--wp--preset--font-size--large); }
.sw-related-wrap .sw-section-title { margin-top: 0; }
.sw-card-cat { font-family: var(--wp--preset--font-family--montserrat); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 0.8rem; }
.sw-card-cat a { color: var(--wp--preset--color--accent); text-decoration: none; }
.wp-block-post-template .wp-block-post-title { margin-top: 0.35rem; font-size: 1.25rem; line-height: 1.3; font-weight: 700; letter-spacing: -0.01em; }
.wp-block-post-template .wp-block-post-title a { color: var(--wp--preset--color--contrast); text-decoration: none; }
.wp-block-post-template .wp-block-post-title a:hover { color: var(--wp--preset--color--accent); }
.wp-block-post-template .wp-block-post-featured-image img { border-radius: 6px; }
.sw-read-next .wp-block-post-excerpt { font-size: 1rem; color: var(--wp--preset--color--muted); }

/* ---------- Footer ---------- */
.sw-footer .wp-block-site-title a { text-decoration: none; }
.sw-footer h6 { opacity: 0.6; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; }
.sw-footer-links { list-style: none; padding: 0; }
.sw-footer-links a { text-decoration: none; }
.sw-footer-links a:hover { text-decoration: underline; }
.sw-copyright { opacity: 0.6; }

/* ---------- Fixes ---------- */
h1, h2, h3, .wp-block-post-title { overflow-wrap: break-word; }
@media (max-width: 600px) { h1.wp-block-post-title { hyphens: auto; -webkit-hyphens: auto; } }
.sw-header .wp-block-search__button {
	background: transparent;
	color: var(--wp--preset--color--contrast);
	border: 0;
	padding: 0.35rem;
}
.sw-header .wp-block-search__button:hover { color: var(--wp--preset--color--accent); }
.sw-header .wp-block-search__button svg { width: 22px; height: 22px; }
.wp-site-blocks > .wp-block-template-part:last-child,
.wp-site-blocks > footer { margin-block-start: 0; }
.sw-single + .sw-related-wrap, main + .sw-related-wrap { margin-block-start: 0; }
.sw-read-next .wp-block-column:first-child:not(:has(img)) { display: none; }

/* ---------- Hand-made TOC inside posts ---------- */
.sw-post-content .sw-toc h2 {
	margin: 0 0 0.6rem;
	padding: 0;
	border: 0;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0;
}

/* ---------- Tables ---------- */
.sw-post-content table {
	width: 100%;
	margin-block: var(--wp--preset--spacing--40);
	border-collapse: collapse;
	font-size: 1rem;
	line-height: 1.45;
}
.sw-post-content th,
.sw-post-content td {
	padding: 0.65rem 0.8rem;
	border-bottom: 1px solid #e6e0d5;
	text-align: left;
	vertical-align: top;
}
.sw-post-content thead th {
	background: var(--wp--preset--color--surface);
	border-bottom: 2px solid var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.875rem;
	font-weight: 600;
}
.sw-post-content tbody tr:hover { background: #faf8f4; }
@media (max-width: 700px) {
	.sw-post-content table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

/* ---------- Home: hero ---------- */
.sw-hero .wp-block-post-template { margin: 0; }
.sw-hero .wp-block-cover { margin: 0; }
.sw-hero__kicker {
	margin: 0 0 0.75rem;
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	opacity: 0.85;
}
.sw-hero .wp-block-post-title { margin: 0 0 1rem; }
.sw-hero .wp-block-post-title a { color: #fff; text-decoration: none; }
.sw-hero .wp-block-post-excerpt { max-width: 640px; font-size: 1.125rem; }
.sw-hero .wp-block-post-excerpt__more-link {
	display: inline-block;
	margin-top: 0.5rem;
	font-family: var(--wp--preset--font-family--montserrat);
	font-weight: 600;
	font-size: 0.95rem;
	color: #fff;
	text-decoration: none;
	border-bottom: 2px solid currentColor;
}
.sw-hero .wp-block-cover__background { background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,.1) 100%) !important; opacity: 1 !important; }

/* ---------- Sections ---------- */
.sw-home > .sw-section { margin: 0; }
.sw-section-head { margin-bottom: var(--wp--preset--spacing--40); }
.sw-section-head .sw-section-title { margin: 0; }
.sw-more-link { margin: 0; font-family: var(--wp--preset--font-family--montserrat); font-size: 0.95rem; font-weight: 600; }
.sw-more-link a { text-decoration: none; }

/* ---------- Region tiles ---------- */
.sw-regions .wp-block-term-template { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; list-style: none; margin: 0; padding: 0; }
.sw-regions .wp-block-term-template > li {
	position: relative;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	padding: 1.4rem 1.5rem;
	border: 1px solid #e6e0d5;
	border-radius: 10px;
	transition: border-color .15s, transform .15s;
}
.sw-regions .wp-block-term-template > li:hover { border-color: var(--wp--preset--color--accent); transform: translateY(-2px); }
.sw-regions .wp-block-term-name { margin: 0; font-family: var(--wp--preset--font-family--montserrat); font-weight: 700; font-size: 1.25rem; }
.sw-regions .wp-block-term-name a { color: var(--wp--preset--color--contrast); text-decoration: none; }
.sw-regions .wp-block-term-name a::after { content: ""; position: absolute; inset: 0; }
.sw-regions .wp-block-term-count { margin: 0; font-family: var(--wp--preset--font-family--montserrat); font-size: 0.85rem; color: var(--wp--preset--color--muted); }
.sw-regions .wp-block-term-count::after { content: " статей"; }

/* ---------- Listings ---------- */
.sw-listing-title { margin-top: var(--wp--preset--spacing--20); margin-bottom: 0.75rem; }
.sw-listing-lead { margin-top: 0; max-width: 720px; color: var(--wp--preset--color--muted); }
.sw-listing .wp-block-query { margin-top: var(--wp--preset--spacing--50); }
.sw-card-excerpt { margin-top: 0.4rem; font-size: 1rem; line-height: 1.5; color: var(--wp--preset--color--muted); }
.sw-card-excerpt .wp-block-post-excerpt__more-text { display: none; }

/* Category pills */
.sw-pills { margin-top: var(--wp--preset--spacing--40); }
.sw-pills .wp-block-term-template { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.sw-pills .wp-block-term-name { margin: 0; font-family: var(--wp--preset--font-family--montserrat); font-size: 0.875rem; font-weight: 500; }
.sw-pills .wp-block-term-name a {
	display: inline-block;
	padding: 0.45rem 1rem;
	border: 1px solid #ddd6ca;
	border-radius: 999px;
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
}
.sw-pills .wp-block-term-name a:hover { border-color: var(--wp--preset--color--accent); color: var(--wp--preset--color--accent); }

/* Pagination */
.sw-pagination { margin-top: var(--wp--preset--spacing--60); font-family: var(--wp--preset--font-family--montserrat); font-weight: 500; font-size: 0.95rem; gap: 0.35rem; }
.sw-pagination a, .sw-pagination .page-numbers { text-decoration: none; color: var(--wp--preset--color--contrast); }
.sw-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 2.4rem; height: 2.4rem; padding: 0 0.6rem; border-radius: 999px; }
.sw-pagination .page-numbers.current { background: var(--wp--preset--color--contrast); color: var(--wp--preset--color--base); }
.sw-pagination a.page-numbers:hover { background: var(--wp--preset--color--surface); }

/* Search form */
.sw-search-form { max-width: 640px; margin-top: var(--wp--preset--spacing--30); }
.sw-search-form .wp-block-search__input { padding: 0.75rem 1rem; border: 1px solid #ddd6ca; border-radius: 8px 0 0 8px; font-size: 1rem; }
.sw-search-form .wp-block-search__button { margin-left: 0; border-radius: 0 8px 8px 0; background: var(--wp--preset--color--contrast); color: var(--wp--preset--color--base); font-family: var(--wp--preset--font-family--montserrat); }

/* Tour cards */
.sw-tour-card-facts { margin-top: 0.5rem; font-size: 0.95rem; }
.sw-tour-card-facts p { margin: 0; }
.sw-tour-card-facts strong { font-weight: 500; color: var(--wp--preset--color--muted); }

/* ---------- Fixes: hero, placeholder, regions ---------- */
.sw-hero .wp-block-cover__inner-container { width: 100%; max-width: var(--wp--style--global--wide-size); margin-inline: auto; }
.sw-hero .sw-hero__text { margin-inline: 0 !important; max-width: 820px; }
.sw-hero .wp-block-post-title { font-size: clamp(2rem, 4.2vw, 3.4rem) !important; line-height: 1.08; }
.sw-placeholder { margin: 0; background: var(--wp--preset--color--surface); border-radius: 6px; overflow: hidden; }
.sw-placeholder a { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.sw-placeholder__logo { width: 72px !important; height: 72px !important; opacity: 0.35; filter: grayscale(1); border-radius: 0 !important; }
.sw-regions .wp-block-term-template > li { margin: 0 !important; align-items: center; }
.sw-regions .wp-block-term-count { white-space: nowrap; }
.sw-regions .wp-block-term-count::after { content: none; }
.sw-hero .wp-block-cover.has-custom-content-position .wp-block-cover__inner-container { width: 100% !important; max-width: var(--wp--style--global--wide-size) !important; margin-inline: auto !important; }
.sw-regions .wp-block-term-template { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.sw-home .sw-telegram-card { max-width: var(--wp--style--global--wide-size) !important; }
.sw-pills .wp-block-term-template > li { margin: 0 !important; }
