/**
 * TripWays Theme – Header & Footer (pure PHP)
 * Uses theme.json palette via CSS variables. Applies to all pages including tours.
 */

/* === Sticky footer – footer at bottom on short pages === */
html {
	height: 100%;
}

body {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

body > main,
body > #primary {
	flex: 1;
}

/* === Header === */
.tripways-header {
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #1a1a1a);
	width: 100%;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.tripways-header__inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1.5rem;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin: 0 auto;
	padding: 1rem 1.5rem;
}

.tripways-header__brand {
	justify-self: start;
}

.tripways-header__actions {
	justify-self: end;
}

.tripways-header__burger {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	flex-direction: column;
	gap: 5px;
	-webkit-tap-highlight-color: transparent;
}

.tripways-header__burger-bar {
	display: block;
	width: 22px;
	height: 2px;
	background: currentColor;
	border-radius: 1px;
	transition: transform 0.2s, opacity 0.2s;
}

.tripways-header__burger[aria-expanded="true"] .tripways-header__burger-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.tripways-header__burger[aria-expanded="true"] .tripways-header__burger-bar:nth-child(2) {
	opacity: 0;
}

.tripways-header__burger[aria-expanded="true"] .tripways-header__burger-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

.tripways-header__brand img {
	display: block;
	width: 200px;
	height: auto;
}

.tripways-header__title {
	color: inherit;
	text-decoration: none;
	font-weight: 600;
	font-size: 1.25rem;
}

.tripways-header__title:hover {
	opacity: 0.9;
}

/* Nav centered in middle column */
.tripways-header__nav {
	display: flex;
	justify-content: center;
	min-width: 0;
}

.tripways-header__menu {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem 1.5rem;
	flex-wrap: wrap;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tripways-header__menu a {
	color: inherit;
	text-decoration: none;
	font-size: 0.9375rem;
	font-weight: 700;
}

.tripways-header__menu a:hover {
	opacity: 0.85;
}

.tripways-header__menu li {
	list-style: none;
}

@media (min-width: 768px) {
	.tripways-header__menu > li {
		position: relative;
	}

	.tripways-header__menu .menu-item-has-children > a {
		display: inline-flex;
		align-items: center;
		gap: 0.35rem;
	}

	.tripways-header__menu .menu-item-has-children > a::after {
		content: "";
		width: 0.45rem;
		height: 0.45rem;
		border-right: 1.5px solid currentColor;
		border-bottom: 1.5px solid currentColor;
		transform: rotate(45deg) translateY(-1px);
		opacity: 0.7;
	}

	.tripways-header__menu .sub-menu {
		position: absolute;
		top: calc(100% + 0.45rem);
		left: 0;
		min-width: 13rem;
		margin: 0;
		padding: 0.4rem 0;
		list-style: none;
		background: var(--wp--preset--color--base, #fff);
		border: 1px solid rgba(0, 0, 0, 0.08);
		border-radius: 0.5rem;
		box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
		opacity: 0;
		visibility: hidden;
		transform: translateY(0.3rem);
		transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
		z-index: 120;
	}

	.tripways-header__menu .sub-menu li {
		width: 100%;
	}

	.tripways-header__menu .sub-menu a {
		display: block;
		padding: 0.5rem 0.85rem;
		font-size: 0.875rem;
		font-weight: 600;
		white-space: nowrap;
	}

	.tripways-header__menu li:hover > .sub-menu,
	.tripways-header__menu li:focus-within > .sub-menu,
	.tripways-header__menu li.is-open > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}
}

/* Mobile nav */
.tripways-header__mobile-nav {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: var(--wp--preset--color--base, #fff);
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
	padding: 1rem 1.5rem;
	z-index: 100;
}

.tripways-header__mobile-nav.is-open {
	display: block;
}

.tripways-header__mobile-menu {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
}

.tripways-header__mobile-menu li {
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tripways-header__mobile-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 0.22s ease, opacity 0.22s ease;
}

.tripways-header__mobile-menu .sub-menu a {
	font-size: 0.9375rem;
	font-weight: 500;
	padding: 0.5rem 0 0.5rem 1rem;
}

.tripways-header__mobile-menu a {
	display: block;
	padding: 0.75rem 0;
	color: inherit;
	text-decoration: none;
	font-size: 1rem;
	font-weight: 700;
}

.tripways-header__mobile-menu .menu-item-has-children {
	position: relative;
}

.tripways-mobile-submenu-toggle {
	position: absolute;
	top: 0.35rem;
	right: 0;
	width: 2rem;
	height: 2rem;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

.tripways-mobile-submenu-toggle::before {
	content: "";
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
	opacity: 0.75;
}

.tripways-header__mobile-menu .menu-item-has-children.is-open > .sub-menu {
	max-height: 20rem;
	opacity: 1;
}

.tripways-header__mobile-menu .menu-item-has-children.is-open > .tripways-mobile-submenu-toggle::before {
	transform: rotate(-135deg) translate(-2px, -2px);
}

.tripways-header__mobile-actions {
	padding-top: 0.5rem;
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

@media (max-width: 767px) {
	.tripways-header {
		position: relative;
	}

	.tripways-header__inner {
		grid-template-columns: 1fr auto;
	}

	.tripways-header__nav,
	.tripways-header__actions {
		display: none !important;
	}

	.tripways-header__burger {
		display: flex;
	}
}

@media (min-width: 768px) {
	.tripways-header__mobile-nav {
		display: none !important;
	}
}

/* === Footer links row (white, above black footer) === */
.tripways-footer-links {
	background: var(--wp--preset--color--base, #fff);
	color: var(--wp--preset--color--contrast, #1a1a1a);
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.tripways-footer-links__inner {
	display: grid;
	grid-template-columns: minmax(260px, 2.2fr) repeat(4, minmax(0, 1fr));
	gap: 2.5rem 1.5rem;
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin: 0 auto;
	padding: 2.5rem 1.5rem;
	align-items: start;
}

.tripways-footer-links__brand {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-items: center;
	text-align: center;
}

.tripways-footer-links__logo {
	display: inline-block;
	line-height: 0;
}

.tripways-footer-links__logo-img {
	display: block;
	width: 260px;
	height: 70px;
	max-width: 100%;
	object-fit: contain;
}

.tripways-footer-links__tagline {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--wp--preset--color--muted, #64748b);
}

.tripways-footer-links__social {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	justify-content: center;
}

.tripways-footer-links__social-link {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	color: var(--wp--preset--color--primary, #2563eb);
	transition: color 0.2s, opacity 0.2s;
}

.tripways-footer-links__social-link:hover {
	opacity: 0.8;
}

.tripways-footer-links__social-link svg {
	flex-shrink: 0;
}

.tripways-footer-links__title {
	margin: 0 0 0.75rem;
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.tripways-footer-links__col ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tripways-footer-links__col li {
	margin-bottom: 0.5rem;
}

.tripways-footer-links__col a {
	color: inherit;
	text-decoration: none;
	font-size: 0.875rem;
	transition: color 0.2s;
}

.tripways-footer-links__col a:hover {
	color: var(--wp--preset--color--primary, #2563eb);
}

@media (max-width: 1023px) {
	.tripways-footer-links__inner {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 599px) {
	.tripways-footer-links__inner {
		grid-template-columns: 1fr;
		gap: 2rem;
		padding: 2rem 1.5rem;
	}
}

/* === Footer (black bar) === */
.tripways-footer {
	background: var(--wp--preset--color--contrast, #1a1a1a);
	color: var(--wp--preset--color--base, #fff);
	width: 100%;
	margin-top: 0;
}

.tripways-footer__inner {
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin: 0 auto;
	padding: 0.9rem 1.5rem;
	text-align: center;
}

.tripways-footer__copy {
	margin: 0;
	font-size: 0.875rem;
}

/* === Blockquote – legacy website look === */
blockquote,
.wp-block-quote {
	position: relative;
	margin: 1.5rem 0;
	padding: 1.5rem 1.5rem 1.5rem 4rem;
	background: #f5f5f5;
	border-radius: 0.5rem;
	border: none;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

blockquote::before,
.wp-block-quote::before {
	content: '"';
	position: absolute;
	left: 1.25rem;
	top: 1rem;
	font-size: 3.5rem;
	line-height: 1;
	color: #d3d3d3;
	font-family: Georgia, serif;
	font-weight: 700;
}

blockquote p,
.wp-block-quote p {
	margin: 0 0 0.75rem;
	color: var(--wp--preset--color--contrast, #1a1a1a);
}

blockquote p:last-child,
.wp-block-quote p:last-child {
	margin-bottom: 0;
}

blockquote cite,
.wp-block-quote cite {
	display: block;
	margin-top: 0.5rem;
	font-size: 0.875rem;
	font-style: normal;
	color: var(--wp--preset--color--muted, #64748b);
}

/* Page content layout – block-editor compatible (alignfull, alignwide) */
.tripways-page-content {
	--tripways-content-padding-x: 1.5rem;
	padding: 2rem var(--tripways-content-padding-x);
}

/* Full-width container – do not constrain here so alignfull/alignwide work */
.tripways-page-content .entry-content {
	/* No max-width on container */
}

/* Constrain default blocks to content size */
.tripways-page-content .entry-content > *:not(.alignfull):not(.alignwide) {
	max-width: var(--wp--style--global--content-size, 720px);
	margin-left: auto;
	margin-right: auto;
}

/* Wide blocks use wide size */
.tripways-page-content .entry-content > .alignwide {
	max-width: var(--wp--style--global--wide-size, 1200px);
	margin-left: auto;
	margin-right: auto;
}

/* Full-width blocks extend edge-to-edge (break out of main padding, no horizontal scroll) */
.tripways-page-content .entry-content > .alignfull {
	width: calc(100% + 2 * var(--tripways-content-padding-x));
	max-width: none;
	margin-left: calc(-1 * var(--tripways-content-padding-x));
	margin-right: calc(-1 * var(--tripways-content-padding-x));
}

.tripways-page-content .page-header {
	margin-bottom: 1.5rem;
}

/* Pages only: no auto title (add manually when needed), no top padding (manage spacing in blocks) */
.page .tripways-page-content {
	padding-top: 0;
}

.page .tripways-page-content .entry-content > *:first-child {
	margin-top: 0;
	margin-block-start: 0;
}

/* === 404 page === */
.tripways-404 {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
}

.tripways-404 .error-404 {
	width: 100%;
	max-width: 32rem;
}

.tripways-404 .entry-title {
	font-size: 1.75rem;
	margin-bottom: 0.5rem;
}

.tripways-404 .entry-content p {
	margin: 0.5rem 0;
}

.tripways-404__cta {
	display: inline-block;
	margin-top: 1rem;
	padding: 0.5rem 1rem;
	background: var(--wp--preset--color--primary, #2563eb);
	color: #fff !important;
	text-decoration: none;
	border-radius: 0.25rem;
	font-weight: 500;
}

.tripways-404__cta:hover {
	background: var(--wp--preset--color--primary-dark, #0f172a);
	color: #fff !important;
	opacity: 1;
}
