/*
 * TMTIC theme: responsive enhancements (mobile-first; this file only widens layouts).
 * Breakpoints: 600 (large phone), 768 (tablet), 1024 (desktop), 1280 (desktop navigation).
 */

@media (min-width: 600px) {
	.tmtic-hide-sm {
		display: inline-flex;
	}
}

@media (max-width: 782px) {
	body.admin-bar.has-sticky-header .site-header {
		top: 46px;
	}
}
@media (max-width: 600px) {
	/* The admin bar is not sticky on small screens: do not offset the header. */
	body.admin-bar.has-sticky-header .site-header {
		top: 0;
	}
}

@media (min-width: 768px) {
	.tmtic-hide-md {
		display: inline-flex;
	}
	.tmtic-grid--2 {
		grid-template-columns: repeat(2, 1fr);
	}
	.tmtic-grid--4 {
		grid-template-columns: repeat(2, 1fr);
	}
	.tmtic-split > .tmtic-container {
		grid-template-columns: 1fr 1fr;
		gap: clamp(2rem, 5vw, 4.5rem);
	}
	.tmtic-split.is-flipped .tmtic-split__media {
		order: -1;
	}
	.tmtic-contact {
		grid-template-columns: minmax(0, 1fr);
	}
	.tmtic-footer__grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.tmtic-postnav {
		grid-template-columns: 1fr 1fr;
	}
}

@media (min-width: 1024px) {
	.tmtic-grid--4 {
		grid-template-columns: repeat(4, 1fr);
	}
	.tmtic-layout.has-side {
		grid-template-columns: minmax(0, 1fr) 320px;
		align-items: start;
	}
	.tmtic-side {
		position: sticky;
		top: 7.5rem;
	}
	.tmtic-footer__grid--4 {
		grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr;
	}
	.tmtic-footer__grid--3 {
		grid-template-columns: repeat(3, 1fr);
	}
	.tmtic-footer__grid--2 {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ---------- Desktop navigation + mega menu ---------- */
@media (min-width: 1280px) {
	/* Top-level desktop navigation lives in header.css; panels below. */
	/* Panels */
	.tmtic-panel {
		position: absolute;
		top: 100%;
		z-index: 50;
		padding: 0;
		background: var(--color-surface);
		color: var(--color-text);
		border-top: 4px solid var(--nav-accent);
		border-radius: 0 0 var(--radius) var(--radius);
		box-shadow: var(--shadow-md);
	}
	.tmtic-panel .tmtic-link {
		padding: 0.5rem 0.6rem;
		border-radius: var(--radius-sm);
		color: var(--color-text);
		font-weight: 500;
		box-shadow: none;
	}
	.tmtic-panel a.tmtic-link:hover,
	.tmtic-panel a.tmtic-link:focus-visible {
		background: rgba(33, 134, 91, 0.1);
		color: var(--color-secondary-hover);
		text-decoration: none;
	}
	.tmtic-panel .tmtic-link.is-heading {
		padding: 0.25rem 0.6rem 0.5rem;
		margin-bottom: 0.4rem;
		border-bottom: 2px solid var(--color-border);
		border-radius: 0;
		color: var(--color-heading);
		font-weight: 700;
	}
	.tmtic-panel .tmtic-link__desc {
		color: var(--color-muted);
		opacity: 1;
	}
	.tmtic-panel .is-featured > .tmtic-link {
		color: var(--color-tanzanite);
		font-weight: 700;
	}

	/* Dropdown */
	.tmtic-item.has-dropdown {
		position: relative;
	}
	.tmtic-panel--dropdown {
		left: 0;
		min-width: 270px;
		max-width: 360px;
		padding: 0.6rem;
	}
	.tmtic-dropdown {
		display: grid;
		gap: 0.1rem;
	}
	.tmtic-sub {
		padding-left: 0.75rem;
	}

	/* Mega menu (positioned against .tmtic-mainbar__inner) */
	.tmtic-item.has-mega {
		position: static;
	}
	.tmtic-panel--mega {
		left: 0;
		right: 0;
	}
	.tmtic-mega-full .tmtic-panel--mega {
		left: 50%;
		right: auto;
		width: 100vw;
		margin-left: -50vw;
		border-radius: 0;
	}
	.tmtic-panel__inner {
		padding: 1.5rem 1.75rem 1.75rem;
		max-height: calc(100vh - 11rem);
		overflow-y: auto;
	}
	.tmtic-mega-full .tmtic-panel__inner {
		max-width: var(--container);
		margin-inline: auto;
		padding-inline: var(--gutter);
	}
	.tmtic-mega {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
		gap: 1.5rem 2rem;
	}
	.tmtic-mega[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
	.tmtic-mega[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
	.tmtic-mega[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }
	.tmtic-mega[data-cols="5"] { grid-template-columns: repeat(5, 1fr); }
	.tmtic-mega > .tmtic-item {
		display: block;
		min-width: 0;
	}
	.tmtic-mega .tmtic-sub {
		display: grid;
		gap: 0.1rem;
		padding-left: 0;
	}
	.tmtic-link__img img {
		height: 110px;
	}

	/* Dark mega panel */
	.tmtic-mega-dark .tmtic-panel {
		background: var(--color-primary-hover);
		color: #fff;
	}
	.tmtic-mega-dark .tmtic-panel .tmtic-link {
		color: #fff;
	}
	.tmtic-mega-dark .tmtic-panel .tmtic-link.is-heading {
		color: var(--nav-accent);
		border-bottom-color: rgba(255, 255, 255, 0.25);
	}
	.tmtic-mega-dark .tmtic-panel a.tmtic-link:hover,
	.tmtic-mega-dark .tmtic-panel a.tmtic-link:focus-visible {
		background: rgba(255, 255, 255, 0.12);
		color: #fff;
	}
	.tmtic-mega-dark .tmtic-panel .tmtic-link__desc {
		color: rgba(255, 255, 255, 0.78);
	}
}

@media (max-width: 480px) {
	.tmtic-cta__actions .tmtic-btn {
		width: 100%;
	}
	.tmtic-lb__bar {
		min-height: 64px;
	}
}

/* Phones: hero buttons small, two per row */
@media (max-width: 767px) {
	.tmtic-hero__actions { gap: 0.5rem; }
	.tmtic-hero__actions .tmtic-btn {
		flex: 1 1 calc(50% - 0.25rem);
		width: auto;
		min-width: 0;
		justify-content: center;
		padding: 0.65em 0.5em;
		font-size: 11px;
		letter-spacing: 0.03em;
		text-align: center;
	}
}

/* Hero button stays small on phones (not stretched). */
@media (max-width: 767px) {
	.tmtic-hero__actions .tmtic-btn { flex: 0 0 auto; padding: 0.55em 1.3em; font-size: 11px; }
}

/* Phones: subscribe strip keeps the e-mail field and Sign up button on one row. */
@media (max-width: 767px) {
	.tmtic-finder__signup { flex-wrap: nowrap; gap: 0.5rem; }
	.tmtic-finder__signup input { flex: 1 1 0; min-width: 0; padding: 0 0.75rem; font-size: 0.95rem; }
	.tmtic-finder .tmtic-finder__btn { flex: 0 0 auto; width: auto; max-width: none; padding: 0 1rem; font-size: 0.8rem; letter-spacing: 0.04em; }
}
@media (max-width: 767px) {
	.tmtic-finder__form, .tmtic-finder__signup { min-width: 0; width: 100%; box-sizing: border-box; }
	.tmtic-finder__signup input { width: 0; }
}

/* Hero button: always compact on phones, never stretched. */
@media (max-width: 767px) {
	.tmtic-hero .tmtic-hero__actions { justify-content: flex-start; }
	.tmtic-hero .tmtic-hero__actions .tmtic-btn { flex: 0 0 auto; width: auto; max-width: max-content; padding: 0.5em 1.1em; font-size: 10.5px; }
}
