/* WHERE Custom Blocks - Trip & Local Venture Gear
   Matches prototype v8: grey widget shell, white media panels,
   product-scale imagery, full-card links, card view = featured style. */

.tvg-widget {
	--tvg-accent: #3a759f;
	--tvg-accent-soft: #e8f2f6;
	--tvg-badge: #73c5c9;
	--tvg-ink: #262827;
	--tvg-muted: #6d726f;
	--tvg-line: #dfe5e1;
	--tvg-shell: #f2f4f1;
	--tvg-title-bg: #50514f;
	--tvg-radius: 12px;
	--tvg-gutter: clamp(18px, 3vw, 32px);
	--tvg-sticky-offset: 0px;

	/* container-type establishes inline-size containment only; it does not
	   create a scroll container and must not gain overflow clipping, or
	   position: sticky below will silently stop working. */
	container-type: inline-size;
	overflow: visible;
	padding: var(--tvg-gutter);
	border: 1px solid var(--tvg-line);
	border-radius: 16px;
	background: var(--tvg-shell);
	box-shadow: 0 1px 2px rgba(25, 35, 30, .04), 0 8px 24px rgba(25, 35, 30, .05);
	color: var(--tvg-ink);
	font-family: inherit;
	line-height: 1.45;
}

.tvg-widget *,
.tvg-widget *::before,
.tvg-widget *::after { box-sizing: border-box; }

.tvg-widget [hidden] { display: none !important; }

.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Section heads ---------------------------------------------------------- */
.tvg-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 16px; }
.tvg-eyebrow { color: var(--tvg-accent); font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.tvg-heading { margin: 7px 0 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.15; letter-spacing: -.025em; }
.tvg-copy { margin: 0; max-width: 42ch; color: var(--tvg-muted); font-size: 14px; }

/* Shared media panel (white, product-scale image) ------------------------ */
/* object-fit: cover (not contain) so every photo fills its padded frame
   edge-to-edge at the same visual scale no matter its native aspect ratio -
   contain let portrait/landscape/square source photos each keep their own
   proportions, so some products looked much bigger or smaller than others
   inside identically-sized square boxes. The 8% padding stays as a fixed
   frame; cover just makes the photo itself fill that frame consistently. */
.tvg-media-shell { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: inherit; padding: 8%; background: #fff; overflow: hidden; }
.tvg-featured-image,
.tvg-thumb-image { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: cover; object-position: center; }
.tvg-no-image { display: block; width: 62%; height: 62%; border-radius: 8px; background: linear-gradient(135deg, #f7f8f6, #e6eae6); }

/* Featured - hero-led layout ---------------------------------------------- */
/* Equal 3-up columns cramp horizontal cards. Layout keys off data-count:
   1 = full-width hero; 2 = 2-up; 3 = hero on top + 2-up beneath; 4 = 2x2.
   In narrow (half-width) containers everything stacks, hero first. No
   orphans, never a full-width card BELOW smaller ones. */
.tvg-featured-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.tvg-featured-card,
.tvg-gear-item { overflow: hidden; border: 1px solid var(--tvg-line); border-radius: var(--tvg-radius); background: #fff; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.tvg-featured-card:hover,
.tvg-gear-item:hover { transform: translateY(-2px); border-color: #c7d5db; box-shadow: 0 8px 22px rgba(40, 70, 60, .08); }

.tvg-featured-link,
.tvg-card-mode .tvg-item-link { display: grid; grid-template-columns: 132px minmax(0, 1fr); min-height: 132px; color: inherit; text-decoration: none !important; }
.tvg-featured-media,
.tvg-card-mode .tvg-thumb-media { position: relative; min-height: 132px; background: #fff; }

.tvg-featured-content,
.tvg-card-mode .tvg-thumb-info { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; min-width: 0; padding: 16px; background: #fff; color: var(--tvg-ink); }
.tvg-featured-brand,
.tvg-card-mode .tvg-item-brand { margin-bottom: 8px; color: var(--tvg-muted); font-size: 12px; font-weight: 700; line-height: 1.2; letter-spacing: 0; text-transform: none; }
.tvg-featured-title,
.tvg-card-mode .tvg-item-title { margin: 0; font-size: 17px; line-height: 1.25; }
.tvg-featured-summary { display: -webkit-box; overflow: hidden; margin: 0 0 12px; color: var(--tvg-muted); font-size: 13px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }

/* Type sits below the text, left aligned. */
.tvg-featured-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; width: 100%; margin-top: auto; padding-top: 12px; }
.tvg-featured-type,
.tvg-card-mode .tvg-item-type { margin: 0; color: var(--tvg-accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tvg-view-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 15px; border-radius: 6px; background: var(--tvg-accent); color: #fff !important; font-size: 12px; font-weight: 800; line-height: 1; text-decoration: none !important; }
.tvg-featured-link:hover .tvg-view-button { filter: brightness(.94); }

/* Badges ----------------------------------------------------------------- */
.tvg-review-badge { position: absolute; top: 0; left: 0; z-index: 4; padding: 7px 9px; border-radius: 9px 0 5px 0; background: var(--tvg-badge); color: #263335; box-shadow: 0 1px 3px rgba(20, 35, 30, .14); font-size: 9px; font-weight: 800; line-height: 1; letter-spacing: .05em; text-transform: uppercase; }
.tvg-type-badge { position: absolute; right: 8px; bottom: -12px; z-index: 4; padding: 6px 10px; border-radius: 5px; background: var(--tvg-badge); color: #233235; box-shadow: 0 1px 3px rgba(20, 35, 30, .14); font-size: 10px; font-weight: 800; line-height: 1; }

/* Tools ------------------------------------------------------------------ */
.tvg-all-gear.has-featured { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--tvg-line); }
.tvg-tools { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 16px 0 14px; }
.tvg-main-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.tvg-filter-button { min-height: 38px; padding: 8px 12px; border: 1px solid #d7dcd8; border-radius: 8px; background: #fff; color: #434845; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.tvg-filter-button:hover { border-color: #aab7b0; }
.tvg-filter-button.is-active { border-color: var(--tvg-accent); background: var(--tvg-accent); color: #fff; }

.tvg-view-switch { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--tvg-line); border-radius: 9px; background: #fff; }
.tvg-view-switch .tvg-filter-button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 34px; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--tvg-muted); }
.tvg-view-switch .tvg-filter-button.is-active { background: #fff; color: var(--tvg-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.tvg-view-switch .tvg-filter-button.is-active .tvg-view-icon i { background: var(--tvg-accent); }
.tvg-view-icon { display: grid; gap: 2px; width: 14px; height: 14px; }
.tvg-view-icon i { display: block; background: currentColor; border-radius: 2px; }
.tvg-view-icon-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.tvg-view-icon-card { grid-template-columns: 1fr; grid-template-rows: repeat(2, 1fr); }
.tvg-view-icon-card i { height: 4px; }

.tvg-brand-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 10px 12px; border: 1px solid var(--tvg-line); border-radius: 10px; background: #fff; }
.tvg-brand-label { flex: 0 0 auto; color: var(--tvg-muted); font-size: 11px; font-weight: 800; }
.tvg-brand-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: thin; }
.tvg-brand-chips .tvg-filter-button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; }
.tvg-result-count { margin-bottom: 16px; color: var(--tvg-muted); font-size: 12px; }

/* v0.4.0: the in-widget sticky filter bar was deleted per the master
   directive - it did not survive real Elementor containers. Filter
   collapse now lives in the shared filter rail (where-filters.js/css). */

/* Groups + thumbnails ---------------------------------------------------- */
.tvg-groups { display: grid; gap: 30px; }
.tvg-group-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--tvg-line); }
.tvg-group-title { margin: 0; font-size: 16px; }
.tvg-group-count { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 24px; border-radius: 999px; background: var(--tvg-accent-soft); color: var(--tvg-accent); font-size: 11px; font-weight: 800; }
.tvg-gear-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tvg-gear-item { min-width: 0; display: flex; background: var(--tvg-title-bg); }
.tvg-item-link { display: flex; flex-direction: column; flex: 1 1 auto; height: 100%; color: inherit; text-decoration: none !important; }
.tvg-thumb-media { flex: 0 0 auto; position: relative; overflow: visible; aspect-ratio: 1 / 1; background: #fff; }
.tvg-thumb-info { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; min-height: 70px; padding: 19px 10px 12px; background: var(--tvg-title-bg); color: #fff; }
.tvg-item-brand { margin-bottom: 4px; color: rgba(255, 255, 255, .78) !important; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tvg-item-title { margin: 0; color: #fff !important; font-size: 13px; font-weight: 400; letter-spacing: .01em; line-height: 1.25; }
.tvg-item-type { display: none; }

.tvg-empty { padding: 28px; border: 1px dashed #ccd4cf; border-radius: 10px; background: #fff; color: var(--tvg-muted); text-align: center; }

/* Card mode = featured styling, minus excerpt and View button ------------ */
.tvg-card-mode .tvg-gear-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tvg-card-mode .tvg-thumb-media { height: 100%; aspect-ratio: auto; }
.tvg-card-mode .tvg-thumb-info { min-height: 132px; background: #fff !important; color: var(--tvg-ink); }
.tvg-card-mode .tvg-item-brand { color: var(--tvg-muted) !important; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.tvg-card-mode .tvg-item-type { display: block; margin-top: 8px; padding-top: 12px; }
.tvg-card-mode .tvg-type-badge { display: none; }
.tvg-card-mode .tvg-gear-item { background: #fff; }
.tvg-card-mode .tvg-item-title { color: var(--tvg-ink) !important; font-weight: 600; }

.tvg-filter-button:focus-visible,
.tvg-item-link:focus-visible,
.tvg-featured-link:focus-visible { outline: 3px solid #83b9dc; outline-offset: 3px; }

/* Container queries ------------------------------------------------------ */
@container (min-width: 700px) {
	.tvg-featured-grid[data-count="2"],
	.tvg-featured-grid[data-count="3"],
	.tvg-featured-grid[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tvg-featured-grid[data-count="3"] .tvg-featured-card:first-child { grid-column: 1 / -1; }
}

@container (max-width: 940px) {
	.tvg-gear-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.tvg-card-mode .tvg-gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (max-width: 700px) {
	.tvg-section-head { align-items: flex-start; flex-direction: column; }
	.tvg-copy { max-width: none; }
	.tvg-tools { align-items: flex-start; flex-direction: column; }
	.tvg-main-filters { flex-wrap: nowrap; width: 100%; overflow-x: auto; padding: 2px 2px 6px; }
	.tvg-main-filters .tvg-filter-button { flex: 0 0 auto; }
	.tvg-view-switch { align-self: flex-end; margin-top: -52px; }
	.tvg-gear-grid,
	.tvg-card-mode .tvg-gear-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.tvg-featured-link,
	.tvg-card-mode .tvg-item-link { grid-template-columns: 112px minmax(0, 1fr); min-height: 112px; }
	.tvg-featured-media,
	.tvg-card-mode .tvg-thumb-media { min-height: 112px; }
	.tvg-featured-content,
	.tvg-card-mode .tvg-thumb-info { padding: 13px; }
	.tvg-featured-summary { display: none; }
}

@container (max-width: 440px) {
	.tvg-widget { --tvg-gutter: 16px; padding: var(--tvg-gutter); border-radius: 12px; }
	.tvg-featured-link,
	.tvg-card-mode .tvg-item-link { grid-template-columns: 96px minmax(0, 1fr); min-height: 104px; }
	.tvg-featured-media,
	.tvg-card-mode .tvg-thumb-media { min-height: 104px; }
	.tvg-featured-content,
	.tvg-card-mode .tvg-thumb-info { padding: 11px; }
	.tvg-featured-title,
	.tvg-card-mode .tvg-item-title { font-size: 14px; }
	.tvg-view-button { min-height: 32px; padding: 7px 12px; font-size: 11px; }
	.tvg-heading { font-size: 22px; }
	.tvg-view-switch { align-self: flex-start; margin-top: 0; }
	.tvg-gear-grid { gap: 9px; }
	.tvg-thumb-info { min-height: 66px; padding: 18px 9px 9px; }
	.tvg-item-title { font-size: 11px; }
	.tvg-type-badge { padding: 5px 7px; font-size: 9px; }
	.tvg-review-badge { padding: 5px 6px; font-size: 8px; }
	.tvg-card-mode .tvg-gear-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	.tvg-widget * { transition: none !important; }
}

/* Filter rail integration -------------------------------------------------- */
/* Inside the drawer (where-filters.css) the panel is plain stacked content.
   The drawer lives under document.body, outside this widget's container
   context, so the @container rules above never apply there - these do. */
.where-rail-drawer .tvg-tools { flex-direction: column; align-items: flex-start; margin: 0 0 14px; }
.where-rail-drawer .tvg-main-filters { width: 100%; }
.where-rail-drawer .tvg-brand-filter { flex-direction: column; align-items: flex-start; }
.where-rail-drawer .tvg-brand-chips { flex-wrap: wrap; overflow: visible; width: 100%; }
