/*
Theme Name: ViaTravelers Theme
Theme URI: https://viatravelers.com
Author: Black Bear Media Platform Team
Author URI: https://blackbearmedia.io
Description: Standalone FSE block theme for the ViaTravelers discovery engine. theme.json v3 design tokens, taxonomy hub and entity templates, graph-expressing blocks, WP Abilities API, and WPGraphQL schema integrations.
Version: 2.1.0
Requires at least: 6.9
Tested up to: 7.1
Requires PHP: 8.5
License: Proprietary
Text Domain: viatravelers-theme
Tags: block-theme, full-site-editing, custom-colors, custom-typography, wide-blocks
*/

/*
 * This file is the theme header plus the rules that must exist outside
 * theme.json: layout scaffolding, the header, cards, hubs and the discovery
 * hero. Presentation that an editor should be able to change lives in
 * theme.json; colour roles live in assets/css/color-scheme.css; every block
 * (plugin-rendered and theme-rendered) is styled in assets/css/blocks.css.
 *
 * Colour tokens:  assets/css/tokens.css        (raw brand scales)
 * Light/dark:     assets/css/color-scheme.css  (semantic roles, both schemes)
 * Blocks:         assets/css/blocks.css        (frontend + editor)
 * Editor parity:  assets/css/editor-style.css
 */

/* Skip link — present for keyboard and screen-reader users on every template. */
.skip-link {
	background: var(--vt-surface, #fff);
	color: var(--vt-text, #0f172a);
	left: 50%;
	padding: 0.75rem 1.25rem;
	position: absolute;
	transform: translate(-50%, -200%);
	transition: transform 0.15s ease-in-out;
	z-index: 999999;
	font-weight: 600;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.skip-link:focus {
	transform: translate(-50%, 0);
}

/* Screen-reader-only text used by landmarks and accessibility affordances. */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

.screen-reader-text:focus {
	clip-path: none;
	height: auto;
	width: auto;
}

/* Base layout & typography resets */
html {
	box-sizing: border-box;
	scroll-behavior: smooth;
	/* The header is sticky; anchors and the skip-link target must land below it. */
	scroll-padding-top: 5.5rem;
}

*, *::before, *::after {
	box-sizing: inherit;
}

body {
	font-family: var(--vt-font-sans, 'Inter', system-ui, -apple-system, sans-serif);
	background-color: var(--vt-surface, #ffffff);
	color: var(--vt-text, #0f172a);
	line-height: 1.65;
	margin: 0;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

/* Focus visibility for WCAG 2.2 — one ring, everywhere, only on keyboard focus. */
:focus-visible {
	outline: 2px solid var(--vt-focus, #0047cc);
	outline-offset: 2px;
}

#main-content:focus {
	outline: none;
}

[id] {
	scroll-margin-top: 5.5rem;
}

/* Headings */
h1, h2, h3, h4, h5, h6,
.wp-block-post-title,
.wp-block-query-title {
	font-family: var(--vt-font-display, 'Fraunces', Georgia, serif);
	color: var(--vt-text, #0f172a);
	line-height: 1.25;
	margin-top: 0;
	font-weight: 600;
	text-wrap: balance;
}

/* Header & Navigation — translucent chrome so the blur has something to blur. */
.vt-header {
	background-color: var(--vt-surface-translucent, rgba(255, 255, 255, 0.86));
	border-bottom: 1px solid var(--vt-border, #e2e8f0);
	position: sticky;
	top: 0;
	z-index: 1000;
	backdrop-filter: blur(12px) saturate(140%);
	-webkit-backdrop-filter: blur(12px) saturate(140%);
}

.vt-header-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.875rem 1.5rem;
	max-width: 1280px;
	margin: 0 auto;
	gap: 1rem;
}

.vt-brand-link {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	text-decoration: none;
	color: var(--vt-text, #0f172a);
	font-weight: 700;
	font-size: 1.25rem;
	letter-spacing: -0.02em;
}

.vt-brand-text {
	font-family: var(--vt-font-display, 'Fraunces', Georgia, serif);
	font-size: 1.35rem;
}

.vt-brand-icon svg {
	display: block;
}

.vt-nav-container {
	display: flex;
	align-items: center;
	gap: 1.25rem;
}

.vt-main-nav .wp-block-navigation__container {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.vt-main-nav .wp-block-navigation-item__content {
	color: var(--vt-text, #0f172a);
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9375rem;
	padding: 0.5rem 0.875rem;
	border-radius: 8px;
	transition: background-color 0.15s ease, color 0.15s ease;
	display: inline-block;
}

.vt-main-nav .wp-block-navigation-item__content:hover,
.vt-main-nav .wp-block-navigation-item__content:focus-visible {
	color: var(--vt-link, #0047cc);
	background-color: var(--vt-surface-elevated, #f8fafc);
}

.vt-header-actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.vt-header-actions > p {
	margin: 0;
}

.vt-header-search-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem 0.875rem;
	border-radius: 9999px;
	background-color: var(--vt-surface-elevated, #f8fafc);
	border: 1px solid var(--vt-border, #e2e8f0);
	color: var(--vt-text-muted, #475569);
	text-decoration: none;
	font-size: 0.875rem;
	font-weight: 500;
	min-height: 40px;
	transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.vt-header-search-btn:hover,
.vt-header-search-btn:focus-visible {
	border-color: var(--vt-border-strong, #cbd5e1);
	background-color: var(--vt-surface-sunken, #f1f5f9);
	color: var(--vt-text, #0f172a);
}

.vt-kbd-shortcut {
	display: inline-flex;
	align-items: center;
	padding: 0.15rem 0.4rem;
	font-size: 0.75rem;
	font-family: var(--vt-font-sans, system-ui, sans-serif);
	font-variant-numeric: tabular-nums;
	background: var(--vt-surface, #ffffff);
	border: 1px solid var(--vt-border, #e2e8f0);
	border-radius: 4px;
	color: var(--vt-text-muted, #475569);
}

@media (max-width: 640px) {
	.vt-header-search-label,
	.vt-kbd-shortcut,
	.vt-theme-toggle__label {
		display: none;
	}
}

/* Theme toggle button */
.vt-theme-toggle {
	background: var(--vt-surface-elevated, #f8fafc);
	border: 1px solid var(--vt-border, #e2e8f0);
	border-radius: 9999px;
	color: var(--vt-text, #0f172a);
	cursor: pointer;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
	padding: 0.5rem 0.875rem;
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.vt-theme-toggle:hover {
	background-color: var(--vt-surface-sunken, #f1f5f9);
	border-color: var(--vt-border-strong, #cbd5e1);
}

/* Discovery Hero — every colour comes from a scheme-aware role, so there is
   no light-only or dark-only rule to get wrong. */
.vt-hero {
	padding: 4.5rem 2rem 3.5rem;
	text-align: center;
	background: radial-gradient(circle at 50% 0%, var(--vt-hero-glow, #e6eeff) 0%, var(--vt-surface-elevated, #f8fafc) 70%);
	border: 1px solid var(--vt-border, #e2e8f0);
	border-radius: 24px;
	margin-bottom: 3.5rem;
	position: relative;
	overflow: hidden;
}

/* Entity variant: the same surface, sized for a page that is not the front door. */
.vt-hero--entity {
	padding: 2.5rem 2rem 2rem;
	text-align: left;
	margin-bottom: 2rem;
}

.vt-hero--entity .vt-taxonomy-chips {
	justify-content: flex-start;
}

.vt-hero__badge {
	margin-bottom: 1.25rem;
}

.vt-badge-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	background-color: var(--vt-surface, #ffffff);
	border: 1px solid var(--vt-border, #e2e8f0);
	padding: 0.35rem 1rem;
	border-radius: 9999px;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--vt-brand-text, #0047cc);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

/* Display weight stays inside the variable font's 400–700 range; 800 would be synthesised. */
.vt-hero__title {
	font-size: clamp(2.25rem, 5.5vw, 4rem);
	line-height: 1.12;
	margin-bottom: 1.25rem;
	letter-spacing: -0.03em;
	font-weight: 700;
	text-wrap: balance;
}

.vt-gradient-accent {
	background: linear-gradient(135deg, var(--vt-ocean-600, #0047cc) 0%, var(--vt-aqua-500, #0ea5e9) 60%, var(--vt-coral-500, #f97316) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.vt-hero__subtitle {
	font-size: 1.2rem;
	color: var(--vt-text-muted, #475569);
	max-width: 68ch;
	margin: 0 auto 2rem auto;
	line-height: 1.6;
	text-wrap: pretty;
}

/* Discovery Search Console — the pill is the inside wrapper only; the form itself stays unstyled. */
.vt-hero-search-console {
	max-width: 680px;
	margin: 0 auto 2rem auto;
}

.wp-block-search.vt-search-bar .wp-block-search__inside-wrapper {
	display: flex;
	align-items: center;
	background: var(--vt-surface, #ffffff);
	border: 1px solid var(--vt-border-strong, #cbd5e1);
	border-radius: 9999px;
	padding: 0.35rem 0.5rem 0.35rem 1.25rem;
	box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wp-block-search.vt-search-bar:focus-within .wp-block-search__inside-wrapper {
	border-color: var(--vt-link, #0047cc);
	box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.15), 0 12px 28px -4px rgba(0, 0, 0, 0.12);
}

.wp-block-search.vt-search-bar .wp-block-search__input {
	flex: 1;
	border: none;
	background: transparent;
	font-size: 1rem;
	color: var(--vt-text, #0f172a);
	outline: none;
	min-width: 0;
	padding: 0.5rem 0;
}

.wp-block-search.vt-search-bar .wp-block-search__input::placeholder {
	color: var(--vt-text-muted, #475569);
}

.wp-block-search.vt-search-bar .wp-block-search__button {
	background-color: var(--vt-accent, #f97316);
	color: var(--vt-on-accent, #0f172a);
	border: none;
	font-weight: 600;
	font-size: 0.9375rem;
	padding: 0.65rem 1.5rem;
	border-radius: 9999px;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.15s ease;
	min-height: 42px;
}

.wp-block-search.vt-search-bar .wp-block-search__button:hover {
	background-color: var(--vt-coral-600, #ea580c);
	transform: translateY(-1px);
}

/* Quick filters under the search console are a vt/taxonomy-terms block. */
.vt-quick-filters {
	margin-top: 1rem;
}

.vt-quick-filters .vt-term-list__items {
	justify-content: center;
}

/* ==========================================================================
   Button Hierarchy & Contrast System (WCAG AA >= 4.5:1 compliant)
   ========================================================================== */

/* Primary Button: Ocean Blue #0047cc on White text (7.57:1) */
.vt-btn-explore a,
.vt-btn-primary a,
.wp-block-button.vt-btn-explore .wp-block-button__link,
.wp-block-button.vt-btn-primary .wp-block-button__link,
.wp-block-button.is-style-vt-primary .wp-block-button__link {
	background-color: var(--vt-ocean-600, #0047cc);
	color: #ffffff;
	font-family: var(--vt-font-sans, 'Inter', sans-serif);
	font-weight: 600;
	padding: 0.875rem 1.75rem;
	border-radius: 9999px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	box-shadow: 0 4px 12px rgba(0, 71, 204, 0.25);
	transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
	border: none;
	cursor: pointer;
}

.vt-btn-explore a:hover,
.vt-btn-primary a:hover,
.wp-block-button.vt-btn-explore .wp-block-button__link:hover,
.wp-block-button.vt-btn-primary .wp-block-button__link:hover,
.wp-block-button.is-style-vt-primary .wp-block-button__link:hover {
	opacity: 0.94;
	transform: translateY(-1px);
	color: #ffffff;
}

/* Accent Button: Coral #f97316 with Navy #0f172a text (6.37:1) */
.vt-btn-accent a,
.wp-block-button.vt-btn-accent .wp-block-button__link,
.wp-block-button.is-style-vt-accent .wp-block-button__link,
.wp-block-button.is-style-accent .wp-block-button__link {
	background-color: var(--vt-accent, #f97316);
	color: var(--vt-on-accent, #0f172a);
	font-family: var(--vt-font-sans, 'Inter', sans-serif);
	font-weight: 600;
	padding: 0.875rem 1.75rem;
	border-radius: 9999px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
	transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
	border: none;
	cursor: pointer;
}

.vt-btn-accent a:hover,
.wp-block-button.vt-btn-accent .wp-block-button__link:hover,
.wp-block-button.is-style-vt-accent .wp-block-button__link:hover,
.wp-block-button.is-style-accent .wp-block-button__link:hover {
	background-color: var(--vt-coral-600, #ea580c);
	color: var(--vt-on-accent, #0f172a);
	transform: translateY(-1px);
}

/* Secondary Button: Outlined Neutral */
.vt-btn-secondary a,
.wp-block-button.vt-btn-secondary .wp-block-button__link,
.wp-block-button.is-style-vt-secondary .wp-block-button__link,
.wp-block-button.is-style-outline .wp-block-button__link {
	background-color: transparent;
	color: var(--vt-text, #0f172a);
	border: 1px solid var(--vt-border-strong, #cbd5e1);
	font-family: var(--vt-font-sans, 'Inter', sans-serif);
	font-weight: 600;
	padding: 0.875rem 1.75rem;
	border-radius: 9999px;
	text-decoration: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.vt-btn-secondary a:hover,
.wp-block-button.vt-btn-secondary .wp-block-button__link:hover,
.wp-block-button.is-style-vt-secondary .wp-block-button__link:hover,
.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background-color: var(--vt-surface-elevated, #f8fafc);
	border-color: var(--vt-text, #0f172a);
	color: var(--vt-text, #0f172a);
	transform: translateY(-1px);
}

/* Section headers on the front page and hubs */
.vt-section-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
}

.vt-section-header h2 {
	margin: 0;
}

.vt-view-all {
	font-weight: 600;
	font-size: 0.9375rem;
	text-decoration: none;
	white-space: nowrap;
}

.vt-view-all:hover,
.vt-view-all:focus-visible {
	text-decoration: underline;
}

/* 3-Column Hub Grids & Cards */
.vt-grid-3,
.vt-discovery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 2rem;
	list-style: none;
	padding: 0;
	margin: 0 0 2.5rem 0;
}

@media (max-width: 768px) {
	.vt-grid-3,
	.vt-discovery-grid {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}
}

/* One card, one link: the title link is stretched over the whole card, so the
   image is not a second link to the same URL and the hover promise is honoured. */
.vt-card {
	background: var(--vt-surface, #ffffff);
	border: 1px solid var(--vt-border, #e2e8f0);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	position: relative;
	transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vt-card:hover,
.vt-card:focus-within {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
	border-color: var(--vt-border-strong, #cbd5e1);
}

.vt-card__image {
	aspect-ratio: 3 / 2;
	background-color: var(--vt-surface-sunken, #f1f5f9);
	overflow: hidden;
	position: relative;
	margin: 0;
}

.vt-card__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.vt-card:hover .vt-card__image img {
	transform: scale(1.03);
}

.vt-card__body {
	padding: 1.25rem;
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	gap: 0.5rem;
}

.vt-card__title {
	font-family: var(--vt-font-sans, 'Inter', sans-serif);
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.35;
	margin: 0;
}

.vt-card__title a {
	color: var(--vt-text, #0f172a);
	text-decoration: none;
}

.vt-card__title a::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 1;
}

.vt-card__title a:hover {
	color: var(--vt-link, #0047cc);
}

/* Chips inside a card sit above the stretched link so their own hrefs stay clickable. */
.vt-card .vt-taxonomy-chips,
.vt-card .wp-block-post-date {
	position: relative;
	z-index: 2;
}

.vt-card .vt-taxonomy-chips {
	margin: 0;
}

.vt-card__excerpt {
	color: var(--vt-text-muted, #475569);
	font-size: 0.9375rem;
	line-height: 1.5;
	margin: 0;
	flex-grow: 1;
}

/* Hub header: title, description and the count strip */
.vt-roundup__intro {
	max-width: 68ch;
}

.vt-roundup__description {
	color: var(--vt-text-muted, #475569);
	font-size: 1.0625rem;
}

/* Entity page scaffolding */

/*
 * Entity pages with a sidebar mark their <article> `alignwide`, so the
 * constrained <main> sizes it to wideSize (1200px) instead of contentSize
 * (768px) -- at 768px the 33% aside is 248px and its facts values wrap one
 * character per line. The hero and header groups inside that article are
 * constrained groups of their own (nested twice on destinations); release
 * their children so the hero and title span the same width as the two-column
 * body beneath them. Post content keeps its own constrained prose measure.
 */
article.alignwide .is-layout-constrained:not(.wp-block-post-content, .wp-block-post-content *) > * {
	max-width: none;
}

.vt-entity-hero {
	margin-bottom: 1.5rem;
}

.vt-entity-hero .vt-media-hero__image {
	border-radius: 16px;
}

.vt-entity-header {
	margin-bottom: 2rem;
}

.vt-entity-header .wp-block-post-title {
	margin-bottom: 0.75rem;
}

.vt-entity-aside {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

@media (max-width: 781px) {
	.wp-block-columns.vt-entity-columns {
		flex-direction: column;
	}
}

/* Facts Table Block (theme-authored facts layouts on entity pages) */
.vt-facts-table {
	background: var(--vt-surface-elevated, #f8fafc);
	border: 1px solid var(--vt-border, #e2e8f0);
	border-radius: 12px;
	padding: 1.5rem;
	margin: 0 0 2rem 0;
}

.vt-facts-table h3 {
	font-family: var(--vt-font-sans, 'Inter', sans-serif);
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--vt-text-muted, #475569);
	margin: 0 0 1rem 0;
}

.vt-facts-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
}

.vt-fact-item {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.vt-fact-label {
	font-size: 0.8125rem;
	color: var(--vt-text-muted, #475569);
}

.vt-fact-value {
	font-size: 0.9375rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	color: var(--vt-text, #0f172a);
}

/* Empty States & Search Zero-Results (rendered by parts/empty-state.html) */
.vt-empty-state {
	text-align: center;
	padding: 3rem 1.5rem;
	background: var(--vt-surface-elevated, #f8fafc);
	border-radius: 12px;
	border: 1px dashed var(--vt-border-strong, #cbd5e1);
	margin: 2rem 0;
}

.vt-empty-state h3,
.vt-empty-state .vt-empty-state__title {
	font-size: 1.5rem;
	margin: 0 0 0.5rem;
}

.vt-empty-state p {
	color: var(--vt-text-muted, #475569);
	max-width: 50ch;
	margin: 0 auto 1.25rem auto;
}

.vt-empty-state .vt-term-list {
	margin-top: 1.5rem;
}

.vt-empty-state .vt-term-list__items {
	justify-content: center;
}

/* Article footer & author */
.vt-article-footer {
	border-top: 1px solid var(--vt-border, #e2e8f0);
}

/* Footer */
.vt-footer {
	background: var(--vt-surface-elevated, #f8fafc);
	border-top: 1px solid var(--vt-border, #e2e8f0);
	padding: 4rem 1.5rem 2rem 1.5rem;
	margin-top: 4rem;
}

.vt-footer-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 2.5rem;
	max-width: 1200px;
	margin: 0 auto 3rem auto;
}

.vt-footer-col h4,
.vt-footer-col .vt-term-list__title {
	font-family: var(--vt-font-sans, 'Inter', sans-serif);
	font-size: 0.875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin: 0 0 1rem;
}

.vt-footer-col ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.vt-footer-col a {
	color: var(--vt-text-muted, #475569);
	text-decoration: none;
	font-size: 0.9375rem;
	transition: color 0.15s ease;
}

.vt-footer-col a:hover,
.vt-footer-col a:focus-visible {
	color: var(--vt-link, #0047cc);
}

.vt-footer-bottom {
	text-align: center;
	padding-top: 2rem;
	border-top: 1px solid var(--vt-border, #e2e8f0);
	color: var(--vt-text-muted, #475569);
	font-size: 0.875rem;
}
