/*
 * Gear List widget styles
 * Reuses the same visual language as the Trip/Venture gear widget
 * (grey shell, white media panels, badge treatment) but is namespaced
 * with its own gl- prefix and adds a sticky/floating filter sidebar.
 *
 * v0.5.0 (JJ's staging review):
 * - Product images clipped + centered inside their square (no overlap).
 * - Titles locked white, 2-line clamp, uniform card heights.
 * - Sticky tools bar; group headers land on it and stick until the next
 *   group (offset via --where-sticky-offset + measured --gl-tools-h).
 * - Sidebar: phase toggle, search, Group By / Sort By selects, multiselect
 *   checkbox filter lists in a clean scrollbox.
 * - Thumbnail grid capped at 3 columns; card view capped at 2.
 */

.gl-widget {
	--gl-accent: #3a759f;
	--gl-accent-soft: #e8f2f6;
	--gl-badge: #73c5c9;
	--gl-ink: #262827;
	--gl-muted: #6d726f;
	--gl-line: #dfe5e1;
	--gl-shell: #f2f4f1;
	--gl-sidebar: #ffffff;
	--gl-title-bg: #50514f;
	--gl-radius: 12px;
	--gl-gutter: clamp(18px, 3vw, 32px);
	--gl-sticky-offset: 0px;
	--where-sticky-offset: var(--gl-sticky-desktop, 100px);
	--gl-tools-h: 54px;
	/* container-type establishes inline-size containment only; it must not
	   gain overflow clipping or the sticky sidebar/tools bar below will stop
	   working. */
	container-type: inline-size;
	overflow: visible;
	padding: var(--gl-gutter);
	border: 1px solid var(--gl-line);
	border-radius: 16px;
	background: var(--gl-shell);
	color: var(--gl-ink);
	font-family: inherit;
	line-height: 1.45;
}
.gl-widget *,
.gl-widget *::before,
.gl-widget *::after { box-sizing: border-box; }
.gl-widget [hidden] { display: none !important; }
.gl-widget .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

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

/* Layout: sticky/floating sidebar + main content ------------------------- */
/* align-items: start is REQUIRED - a stretched sidebar column is as tall
   as the row, which leaves position: sticky no room to travel. */
.gl-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }

/* Sidebar shares --where-sticky-offset with the tools bar so both stop
   under the fixed site header (set the widget's Sticky Offset control to
   the header height). overflow-y: auto ON the sticky element is fine;
   only ANCESTOR overflow breaks sticky - apply .where-sticky-parent to
   that ancestor. */
.gl-sidebar { position: sticky; top: var(--where-sticky-offset, 100px); z-index: 10; align-self: start; max-height: calc(100vh - var(--where-sticky-offset, 0px) - 16px); overflow-y: auto; border: 1px solid var(--gl-line); border-radius: var(--gl-radius); background: var(--gl-sidebar); box-shadow: 0 10px 26px rgba(30, 45, 38, .06); }
.gl-sidebar-inner { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.gl-sidebar-heading { margin: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--gl-muted); }
.gl-facet { border-top: 1px solid var(--gl-line); padding-top: 16px; margin-top: 2px; }
.gl-facet-label { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--gl-ink); }

/* Phase segmented toggle [All Gear | Reviewed] --------------------------- */
.gl-phase-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--gl-line); border-radius: 10px; background: #fff; }
.gl-phase-btn { min-height: 34px; padding: 7px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--gl-muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: background .12s ease, color .12s ease; }
.gl-phase-btn.is-active { background: var(--gl-accent); color: #fff; }

/* Search ------------------------------------------------------------------ */
.gl-search-input { width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--gl-line); border-radius: 9px; background: #fff; color: var(--gl-ink); font: inherit; font-size: 13px; }
.gl-search-input:focus { outline: 2px solid #83b9dc; outline-offset: 1px; border-color: var(--gl-accent); }

/* Group By / Sort By selects ---------------------------------------------- */
.gl-select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--gl-line); border-radius: 9px; background: #fff; color: var(--gl-ink); font: inherit; font-size: 13px; cursor: pointer; }

/* Multiselect checkbox filter lists + clean scrollbox --------------------- */
.gl-checklist { display: flex; flex-direction: column; }
.gl-check { display: flex; align-items: center; gap: 10px; padding: 7px 2px; font-size: 13px; color: var(--gl-ink); cursor: pointer; -webkit-user-select: none; user-select: none; }
.gl-check input { flex: 0 0 auto; width: 16px; height: 16px; margin: 0; accent-color: var(--gl-accent); cursor: pointer; }
.gl-check span { min-width: 0; }
.gl-check:hover span { color: var(--gl-accent); }
.gl-check input:checked ~ span { font-weight: 700; color: var(--gl-ink); }
.gl-checklist-scroll { max-height: 186px; overflow-y: auto; padding-right: 8px; scrollbar-width: thin; scrollbar-color: #c3cac5 transparent; }
.gl-checklist-scroll::-webkit-scrollbar { width: 6px; }
.gl-checklist-scroll::-webkit-scrollbar-track { background: transparent; }
.gl-checklist-scroll::-webkit-scrollbar-thumb { background: #c3cac5; border-radius: 999px; }

.gl-chip { min-height: 32px; padding: 6px 10px; border: 1px solid var(--gl-line); border-radius: 999px; background: #fff; color: var(--gl-ink); font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.gl-chip:hover { border-color: #aab7b0; }
.gl-chip.is-active { border-color: var(--gl-accent); background: var(--gl-accent); color: #fff; }
/* Group tab single-select buttons (replaces group checkboxes) */
.gl-group-tabs { display: flex; flex-direction: column; gap: 5px; }
.gl-group-tab { text-align: left; min-height: 34px; padding: 7px 12px; border: 1px solid var(--gl-line); border-radius: 8px; background: #fff; color: var(--gl-ink); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; transition: background .12s ease, border-color .12s ease, color .12s ease; }
.gl-group-tab:hover { border-color: #aab7b0; }
.gl-group-tab.is-active { border-color: var(--gl-accent); background: var(--gl-accent); color: #fff; }
.gl-group-tab:focus-visible { outline: 3px solid #83b9dc; outline-offset: 2px; }
/* Sort row: select + direction toggle */
.gl-sort-row { display: flex; gap: 6px; align-items: center; }
.gl-sort-row .gl-select { flex: 1 1 auto; }
.gl-sort-dir-btn { flex: 0 0 auto; min-width: 38px; min-height: 38px; padding: 0; border: 1px solid var(--gl-line); border-radius: 9px; background: #fff; color: var(--gl-ink); font-size: 11px; cursor: pointer; transition: background .12s ease, border-color .12s ease; }
.gl-sort-dir-btn:hover { border-color: #aab7b0; }
.gl-sort-dir-btn[data-gl-sort-dir="desc"] { border-color: var(--gl-accent); background: var(--gl-accent-soft); }
.gl-sort-dir-btn:focus-visible { outline: 3px solid #83b9dc; outline-offset: 2px; }
.gl-reset { align-self: flex-start; padding: 6px 0; border: 0; background: none; color: var(--gl-accent); font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; text-decoration: underline; }

.gl-main { min-width: 0; }

/* v0.5.0: the tools bar is sticky again per JJ - it stops under the fixed
   site header via --where-sticky-offset (Sticky Offset control), exactly
   like the sidebar. If an Elementor ancestor clips it, add the
   .where-sticky-parent helper class to that container. */
.gl-tools { position: sticky; top: var(--where-sticky-offset, 100px); z-index: 30; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin: 0 0 14px; padding: 10px 12px; background: var(--gl-shell); border: 1px solid var(--gl-line); border-radius: 10px; box-shadow: 0 6px 14px rgba(30, 45, 38, .05); }
/* v0.9.0: current-group chip (scroll-spy handoff), group jump carets, and a
   mask that hides cards scrolling past ABOVE the stuck bar (only while the
   bar is actually stuck, so it never covers the widget header at rest). */
.gl-tools::before { content: ""; position: absolute; left: -2px; right: -2px; bottom: calc(100% + 1px); height: 0; background: var(--gl-shell); pointer-events: none; }
.gl-widget.gl-is-stuck .gl-tools::before { height: calc(var(--where-sticky-offset, 100px) + 26px); }
.gl-tools-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.gl-tools-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.gl-current-chip { display: inline-flex; align-items: center; min-height: 34px !important; max-width: 300px; padding: 7px 14px !important; border-radius: 8px; background: var(--gl-accent); color: #fff !important; font-size: 13px !important; font-weight: 700 !important; line-height: 1 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-current-chip.gl-swap { animation: gl-chip-swap .18s ease; }
@keyframes gl-chip-swap { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.gl-group-nav { display: flex; align-items: center; gap: 4px; }
.gl-group-jump { min-width: 34px; min-height: 34px; padding: 0; border: 1px solid var(--gl-line); border-radius: 8px; background: #fff; color: var(--gl-ink); font-size: 11px; line-height: 1; cursor: pointer; transition: border-color .12s ease, color .12s ease; }
.gl-group-jump:hover { border-color: var(--gl-accent); color: var(--gl-accent); }
.gl-group-jump:focus-visible { outline: 3px solid #83b9dc; outline-offset: 2px; }
/* Matches .gl-section-count exactly - sits to the right of the jump carets. */
.gl-nav-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin-left: 2px; border-radius: 999px; background: var(--gl-accent-soft); color: var(--gl-accent); font-size: 11px; font-weight: 800; }
.gl-result-count { margin: 0; color: var(--gl-muted); font-size: 12px; }
.gl-view-switch { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--gl-line); border-radius: 9px; background: #fff; }
.gl-view-switch .gl-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 32px; padding: 6px; border: 0; border-radius: 6px; background: transparent; color: var(--gl-muted); }
.gl-view-switch .gl-chip.is-active { background: var(--gl-shell); color: var(--gl-ink); }
.gl-view-icon { display: grid; gap: 2px; width: 14px; height: 14px; }
.gl-view-icon i { display: block; background: currentColor; border-radius: 2px; }
.gl-view-icon-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.gl-view-icon-card { grid-template-columns: 1fr; grid-template-rows: repeat(2, 1fr); }
.gl-view-icon-card i { height: 4px; }

/* Sections + grid ---------------------------------------------------------*/
.gl-sections { display: grid; gap: 28px; }
/* v0.9.0: group heads are plain in-flow pills (styled like the All Gear
   button). The CURRENT group is mirrored into the sticky tools bar by the
   gear-list.js scroll-spy and hands off to the next group as you scroll. */
.gl-section-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; padding-left: 13px; }
.gl-section-title { display: inline-flex; align-items: center; margin: 0 !important; min-height: 34px !important; padding: 7px 14px !important; border-radius: 8px; background: var(--gl-accent); color: #fff !important; font-size: 13px !important; font-weight: 700 !important; line-height: 1 !important; letter-spacing: .01em; }
.gl-section-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--gl-accent-soft); color: var(--gl-accent); font-size: 11px; font-weight: 800; }

/* Thumbnail grid: 3 columns max, stepping down to 2 and 1 (see container
   queries below). Rows stretch so every box in a row is the same size. */
.gl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.gl-item { overflow: hidden; display: flex; border: 1px solid var(--gl-line); border-radius: var(--gl-radius); background: var(--gl-title-bg); transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.gl-item:hover { transform: translateY(-2px); border-color: #c4d2d7; box-shadow: 0 7px 18px rgba(35, 55, 45, .07); }
.gl-item-link { display: flex; flex-direction: column; flex: 1 1 auto; color: inherit; text-decoration: none !important; }

.gl-media { position: relative; flex: 0 0 auto; aspect-ratio: 1 / 1; overflow: visible; background: #fff; }
/* v0.5.0: the shell clips and centers the product image so it can never
   overlap the card frame or the title panel. Absolute centering with max
   constraints also survives theme-level `img { height: auto }` rules that
   broke the old height: 100% approach on staging. */
.gl-media-shell { position: relative; overflow: hidden; width: 100%; height: 100%; background: #fff; }
.gl-item-image { position: absolute; inset: 0; margin: auto; display: block; width: auto; height: auto; max-width: 84%; max-height: 84%; object-fit: contain; }
.gl-no-image { position: absolute; inset: 0; margin: auto; display: block; width: 62%; height: 62%; border-radius: 8px; background: linear-gradient(135deg, #f7f8f6, #e6eae6); }

.gl-item-info { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; min-height: 88px; padding: 18px 12px 12px; background: var(--gl-title-bg); color: #fff; }
/* !important: the WHERE theme's global heading/text colors were overriding
   the white title with near-black on staging - keep these locked. */
.gl-item-brand { margin-bottom: 4px; color: rgba(255, 255, 255, .82) !important; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.gl-item-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0; min-height: calc(2 * 1.3em); color: #fff !important; font-size: 13px; font-weight: 600; letter-spacing: .01em; line-height: 1.3; }
.gl-item-type { display: none; }

/* Badges: type = right, 5px corners, overlapping media/content boundary;
   review = opposite side (left), consistent with the Trip/Venture widget. */
.gl-review-badge { position: absolute; top: 0; left: 0; z-index: 4; padding: 7px 9px; border-radius: 9px 0 5px 0; background: var(--gl-badge); color: #263335; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; box-shadow: 0 1px 3px rgba(20, 35, 30, .14); }
.gl-type-badge { position: absolute; right: 8px; bottom: -12px; z-index: 4; padding: 6px 10px; border-radius: 5px; background: var(--gl-badge); color: #233235; font-size: 10px; font-weight: 800; box-shadow: 0 1px 3px rgba(20, 35, 30, .14); }

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

/* Card mode (list view): 2 columns max, 1 on smaller screens. Same parity
   rules as Trip/Venture (no excerpt, no view button). */
.gl-card-mode .gl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gl-card-mode .gl-item-link { display: grid; grid-template-columns: 132px minmax(0, 1fr); min-height: 132px; }
.gl-card-mode .gl-media { height: 100%; min-height: 132px; aspect-ratio: auto; }
.gl-card-mode .gl-item-info { min-height: 132px; padding: 16px; background: #fff; color: var(--gl-ink); align-items: flex-start; }
.gl-card-mode .gl-item { background: #fff; }
.gl-card-mode .gl-item-brand { margin-bottom: 8px; color: var(--gl-muted) !important; font-size: 12px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.gl-card-mode .gl-item-title { min-height: 0; color: var(--gl-ink) !important; font-weight: 600; font-size: 16px; line-height: 1.25; }
.gl-card-mode .gl-item-type { display: block; margin-top: 8px; padding-top: 12px; color: var(--gl-accent); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.gl-card-mode .gl-type-badge { display: none; }

.gl-chip:focus-visible,
.gl-item-link:focus-visible,
.gl-reset:focus-visible,
.gl-phase-btn:focus-visible,
.gl-select:focus-visible,
.gl-check input:focus-visible { outline: 3px solid #83b9dc; outline-offset: 3px; }

/* Container queries: below ~940px the layout goes single-column. With the
   filter rail on (the default), where-filters.js relocates the sidebar
   into a drawer at this same breakpoint; with the rail off the sidebar
   simply renders inline above the grid. */
@container (max-width: 940px) {
	.gl-layout { grid-template-columns: 1fr; }
	.gl-sidebar { position: static; max-height: none; }
}

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

@container (max-width: 640px) {
	.gl-head { flex-direction: column; align-items: flex-start; gap: 10px; }
	.gl-copy { max-width: none; }
	.gl-card-mode .gl-item-link { grid-template-columns: 96px minmax(0, 1fr); min-height: 96px; }
	.gl-card-mode .gl-media { min-height: 96px; }
}

@container (max-width: 460px) {
	.gl-grid { grid-template-columns: 1fr; gap: 9px; }
}

@container (max-width: 420px) {
	.gl-widget { --gl-gutter: 16px; padding: var(--gl-gutter); border-radius: 12px; }
	.gl-item-info { min-height: 70px; padding: 14px 10px 10px; }
	.gl-item-title { font-size: 12px; }
	.gl-type-badge { padding: 5px 7px; font-size: 9px; }
	.gl-review-badge { padding: 5px 6px; font-size: 8px; }
}

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

/* Inside the shared filter rail drawer the sidebar is plain content - the
   drawer provides the chrome. */
.where-rail-drawer .gl-sidebar { position: static; max-height: none; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.where-rail-drawer .gl-sidebar-inner { padding: 0; }

/* v0.9.0: separate mobile sticky offset (Mobile Sticky Offset control). The
   WHERE mobile header hides on scroll-down, so by default the tools bar and
   sidebar hug the very top of the phone screen - same pattern as the CPT
   sub-menus (-100px margin + Elementor top sticky on the main section). */
@media (max-width: 767px) {
	.gl-widget { --where-sticky-offset: var(--gl-sticky-mobile, 0px); }
}
