/**
 * Phone and tablet fixes, loaded after style.css.
 *
 * Each block names what was wrong. Desktop (1025px+) is untouched except
 * for the heading font in section 2, which was wrong everywhere.
 *
 * @package JJHElementor
 */

/* ==========================================================================
   1. Header — the ☰ button was pushed off the screen below 1200px.
   The logo and the right-hand actions each reserved a fixed 220px (for a
   centred desktop menu); on a 390px phone that's ~490px, so the menu
   button sat past the right edge.
   ========================================================================== */
@media (max-width: 1199px) {
	.jjh-brand-logo {
		flex: 0 1 auto;
		min-width: 0;
	}
	.jjh-brand-logo .jjh-logo-img,
	.jjh-brand-logo img {
		max-width: 100%;
	}
	.jjh-header-actions {
		flex: 0 0 auto;
	}
}

@media (max-width: 380px) {
	.jjh-header-container {
		padding-left: 14px !important;
		padding-right: 14px !important;
	}
	.jjh-logo-img {
		height: 34px;
	}
}

/* ==========================================================================
   2. Section headings in a fallback font.
   Elementor's heading widget defaults to the kit's "Roboto", which the theme
   no longer loads (inc/performance.php) — so headings like "Where To Start"
   or "Career Highlights" showed in the phone's plain system font. Point
   Elementor's heading fonts at the site's own Bitter. (Body-text fonts are
   left alone: switching them reflows a few desktop sections.)
   ========================================================================== */
body[class*="elementor-kit-"] {
	--e-global-typography-primary-font-family: "Bitter";
	--e-global-typography-secondary-font-family: "Bitter";
}

/* ==========================================================================
   3. Nested boxes kept getting narrower.
   style.css gives every container 16px side padding below 769px, which is
   right for page sections but stacks up inside cards (card → inner → image
   frame…), squeezing images and text. Nested containers keep their own
   padding instead, capped so nothing gets roomier than on desktop.
   ========================================================================== */
@media (max-width: 768px) {
	.e-con.e-child {
		padding-left: min(var(--padding-left, 0px), 20px) !important;
		padding-right: min(var(--padding-right, 0px), 20px) !important;
	}
}

/* ==========================================================================
   4. Page heroes — the portrait was ~80px wide on phones.
   Its column kept the desktop "48% wide" limit after the hero stacked.
   ========================================================================== */
@media (max-width: 1024px) {
	.jjh-target-hero-right {
		width: 100% !important;
		max-width: 100% !important;
		flex: 0 0 auto !important;
		justify-content: center !important;
		align-items: center !important;
	}
	.jjh-target-portrait-wrap {
		margin-left: auto !important;
		margin-right: auto !important;
		justify-content: center !important;
	}
	.jjh-target-portrait-img {
		width: 100% !important;
	}
	.jjh-target-portrait-img img {
		width: 100%;
		height: auto;
		margin: 0 auto;
	}
	.jjh-target-glass-grid {
		margin-top: 24px !important;
	}

	/* Hero cards: the photo didn't fill its frame (dark bands beside and below). */
	.jjh-tgcard-media {
		padding: 0 !important;
	}
	.jjh-tgcard-img,
	.jjh-tgcard-img > .elementor-widget-container {
		width: 100% !important;
		height: 100% !important;
	}
	.jjh-tgcard-img img {
		width: 100% !important;
		height: 100% !important;
		object-fit: cover;
	}
}

/* Tablets: an odd last card spans both columns — a fixed-height frame
   would crop its photo to a strip, so it gets a 16:9 frame instead. */
@media (min-width: 641px) and (max-width: 1024px) {
	.jjh-target-glass-card:last-child:nth-child(odd) .jjh-tgcard-media {
		height: auto !important;
		aspect-ratio: 16 / 9;
	}
}

/* ==========================================================================
   5. Cards with large empty space (Where To Start, Career Highlights,
   results, services…). The card and its inner wrapper both added top and
   bottom padding — 68px each side on a phone.
   ========================================================================== */
@media (max-width: 1024px) {
	.jjh-card.e-con-boxed > .e-con-inner {
		padding-top: 0 !important;
		padding-bottom: 0 !important;
	}
}

@media (max-width: 767px) {
	.jjh-card.e-con-boxed:not(.jjh-compact-card) {
		padding-top: 24px !important;
		padding-bottom: 24px !important;
	}

	/* Core values etc.: one short word per full-width row made a very long
	   list — two per row. */
	.e-con-inner:has(> .jjh-compact-card),
	.e-grid:has(> .jjh-compact-card) {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 12px !important;
	}
	.jjh-compact-card {
		max-width: none !important;
	}
}

/* ==========================================================================
   6. Home "Meet Jordan Jo": the photo ran past the card's right edge
   (fixed 340px inside a ~300px space).
   ========================================================================== */
@media (max-width: 767px) {
	.jjh-home-about-teaser {
		padding: 18px !important;
		gap: 24px !important;
	}
	.jjh-home-about-teaser > div {
		max-width: 100% !important;
		min-width: 0;
	}
}

/* ==========================================================================
   7. Photo galleries (Media photos, Athlete gallery).
   Phones: show each photo whole — portraits were cut to 200px-tall strips
   (heads cropped). Tablets: two per row, square, cropped from the top
   third where faces usually are.
   ========================================================================== */
@media (max-width: 640px) {
	.jjh-media-photo-slot-content.has-photo,
	.jjh-gallery-slot-content.has-photo {
		height: auto !important;
		min-height: 0 !important;
		aspect-ratio: auto !important;
	}
	.jjh-media-photo-slot-content.has-photo img,
	.jjh-gallery-slot-content.has-photo img {
		height: auto !important;
	}
}

@media (min-width: 641px) and (max-width: 1024px) {
	.jjh-media-photos-grid,
	.jjh-gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
	.jjh-media-photo-slot-content.has-photo,
	.jjh-gallery-slot-content.has-photo {
		height: auto !important;
		aspect-ratio: 1 / 1 !important;
	}
	.jjh-media-photo-slot-content.has-photo img,
	.jjh-gallery-slot-content.has-photo img {
		object-position: 50% 30%;
	}
}

/* ==========================================================================
   8. Reel players: the corner labels and "Reel coming soon" overlapped on
   phones (desktop-sized labels in a ~190px-tall frame).
   ========================================================================== */
@media (max-width: 640px) {
	.jjh-reel-card {
		padding: 12px !important;
	}
	.jjh-reel-canvas > .jjh-reel-gradient-overlay + div {
		top: 10px !important;
		left: 10px !important;
		right: 10px !important;
		gap: 8px;
	}
	.jjh-reel-canvas > .jjh-reel-gradient-overlay + div > span {
		font-size: 10px !important;
		padding: 4px 9px !important;
		white-space: nowrap;
	}
	.jjh-reel-center-cta {
		top: auto !important;
		bottom: 12px !important;
		transform: translateX(-50%) !important;
		gap: 8px !important;
	}
	.jjh-reel-play-btn {
		width: 56px !important;
		height: 56px !important;
	}
	.jjh-reel-cta-text {
		font-size: 11px !important;
		padding: 4px 12px !important;
		white-space: nowrap;
	}
}

/* ==========================================================================
   9. Home "In The LOOP" band on tablets: the text sat left in half the
   width while the episode card above it was centred.
   ========================================================================== */
@media (min-width: 641px) and (max-width: 1024px) {
	.jjh-podcast-info-col > .e-con-inner > .elementor-widget {
		width: 100%;
	}
}

/* 901–1024px (landscape tablets): the band is two columns here and the text
   column (a fixed 56%) ran 23px past the right edge. Let it take what's left. */
@media (min-width: 901px) and (max-width: 1024px) {
	.jjh-podcast-info-col {
		width: auto !important;
		max-width: none !important;
		flex: 1 1 0 !important;
		min-width: 0 !important;
	}
}

/* ==========================================================================
   10. Added sections (JJH Content → Show, Hide & Reorder → Add section).
   Phones: a gallery with an odd number of photos fell back to one photo per
   row (7 photos ≈ 2,400px of scrolling), and "Numbers" stacked one figure
   per row. Both are two per row now; an odd last item spans the row.
   ========================================================================== */
@media (max-width: 767px) {
	.jjh-cs-gallery,
	.jjh-cs-gallery.jjh-cs-even {
		--cs-cols: 2 !important;
		gap: 10px;
	}
	.jjh-cs-gallery > li:last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
	.jjh-cs-gallery figcaption,
	.jjh-cs-gallery .jjh-cs-caption {
		font-size: 12.5px;
	}

	.jjh-cs-stats {
		--cs-cols: 2 !important;
		row-gap: 0;
	}
	.jjh-cs-stats li,
	.jjh-cs-stats li + li {
		border-left: 0;
		border-top: 0;
		padding: 18px 8px;
	}
	.jjh-cs-stats li:nth-child(even) {
		border-left: 1px solid var(--cs-line);
	}
	.jjh-cs-stats li:nth-child(n+3) {
		border-top: 1px solid var(--cs-line);
	}
	.jjh-cs-stats > li:last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
}

/* Card "Learn more" links: a comfortable finger-sized tap area. */
@media (max-width: 1024px) {
	.jjh-cs a.jjh-cs-card-link {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
	}
}

/* ==========================================================================
   11. Sponsors, social partners and codes on phones (Home, Athlete).
   The same full grids appeared on several pages and made phone pages very
   long. On phones they become a swipeable row (the next card peeks in at
   the edge to show there's more), and the codes list shows 3 with a
   "Show all" button (assets/js/sponsors.js). The Partnerships page keeps
   every full grid.
   ========================================================================== */
@media (max-width: 640px) {
	.jjh-sec:not([class*="jjh-sec--partnerships_"]) .jjh-spx-wall,
	.jjh-sec:not([class*="jjh-sec--partnerships_"]) .jjh-spx-socials {
		display: flex !important;
		flex-wrap: nowrap !important;
		justify-content: flex-start !important;
		gap: 12px !important;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		/* Run to the screen edges so cards slide in from the side. */
		margin-left: -16px !important;
		margin-right: -16px !important;
		padding: 4px 16px 16px !important;
		scroll-padding-inline: 16px;
	}
	.jjh-sec:not([class*="jjh-sec--partnerships_"]) .jjh-spx-wall::-webkit-scrollbar,
	.jjh-sec:not([class*="jjh-sec--partnerships_"]) .jjh-spx-socials::-webkit-scrollbar {
		display: none;
	}
	.jjh-sec:not([class*="jjh-sec--partnerships_"]) .jjh-spx-wall > .jjh-spx-brand {
		flex: 0 0 38% !important;
		scroll-snap-align: start;
	}
	.jjh-sec:not([class*="jjh-sec--partnerships_"]) .jjh-spx-socials > .jjh-spx-social {
		flex: 0 0 46% !important;
		scroll-snap-align: start;
	}

	/* Codes: first 3, then "Show all". */
	.jjh-spx--codes.is-collapsible:not(.is-open) .jjh-spx-ticket:nth-child(n+4) {
		display: none;
	}
	.jjh-spx--codes .jjh-spx-more {
		display: flex;
	}
}

.jjh-spx-more {
	display: none;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 420px;
	min-height: 48px;
	margin: 18px auto 0;
	padding: 0 22px;
	border-radius: 999px;
	border: 1px solid rgba(212, 175, 55, 0.55);
	background: transparent;
	color: var(--spx-ink, #FAF6EF);
	font-family: var(--jjh-font-body);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background-color 0.2s ease, border-color 0.2s ease;
}
.jjh-spx-more:hover,
.jjh-spx-more:focus-visible {
	background: rgba(212, 175, 55, 0.12);
	border-color: #D4AF37;
}

/* ==========================================================================
   12. Card grids took a lot of scrolling (Where To Start, Highlights &
   Results, Listen On, Core Values, As Seen With).
   Phones: an icon card is a short row (icon beside the text, not above
   it), Core Values are two-per-row pills, partner logos two per row, and
   these sections sit closer together. Desktop: a little less padding
   inside each card, and the results list four across.
   Everywhere: a boxed card's padding was applied twice (card and its
   inner box), leaving tall empty space in each card; the inner copy is
   dropped. These sections get one even space above and below (it sits on
   the inner box, where Elementor puts a section's padding).
   ========================================================================== */
.jjh-card.e-con-boxed > .e-con-inner {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}
.jjh-sec:has(.e-grid .jjh-card, .jjh-brand-tiles-grid) {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}
.jjh-sec:has(.e-grid .jjh-card, .jjh-brand-tiles-grid) > .e-con-inner {
	padding-top: 72px !important;
	padding-bottom: 72px !important;
}
.jjh-sec:has(.e-grid .jjh-card, .jjh-brand-tiles-grid) > .e-con-inner > .elementor-widget-spacer {
	--spacer-size: 8px !important;
}

@media (min-width: 768px) {
	.jjh-card.e-con-boxed:not(.jjh-compact-card) {
		padding-top: 26px !important;
		padding-bottom: 26px !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-icon {
		margin-bottom: 14px !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-title {
		margin-bottom: 6px !important;
	}
}

@media (min-width: 1200px) {
	.jjh-sec--athlete_results .e-grid > .e-con-inner {
		grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	}
}

@media (max-width: 767px) {
	.jjh-sec:has(.e-grid .jjh-card, .jjh-brand-tiles-grid) > .e-con-inner {
		padding-top: 48px !important;
		padding-bottom: 48px !important;
	}
	.e-grid:has(.jjh-card:not(.jjh-compact-card)) > .e-con-inner {
		gap: 10px !important;
	}

	/* Icon cards: icon left, title and text right. */
	.jjh-card.e-con-boxed:not(.jjh-compact-card) {
		padding: 14px 16px !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-wrapper {
		flex-direction: row !important;
		align-items: center !important;
		text-align: left !important;
		gap: 14px !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-icon {
		margin: 0 !important;
		flex: 0 0 auto !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon {
		width: 44px !important;
		height: 44px !important;
		font-size: 18px !important;
		border-radius: 12px !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-content {
		flex: 1 1 auto !important;
		min-width: 0 !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-title {
		font-size: 17px !important;
		margin: 0 0 2px !important;
	}
	.jjh-card:not(.jjh-compact-card) .elementor-icon-box-description {
		font-size: 13.5px !important;
		line-height: 1.5 !important;
	}

	/* Core Values: two-per-row pills, icon beside the word. */
	.e-con-inner:has(> .jjh-compact-card),
	.e-grid:has(> .jjh-compact-card) {
		gap: 8px !important;
	}
	.jjh-core-values-section .jjh-card,
	.jjh-compact-card {
		padding: 10px 12px !important;
	}
	.jjh-compact-card .elementor-icon-box-wrapper {
		flex-direction: row !important;
		align-items: center !important;
		text-align: left !important;
		gap: 10px !important;
	}
	.jjh-core-values-section .elementor-icon-box-icon,
	.jjh-compact-card .elementor-icon-box-icon {
		margin: 0 !important;
		flex: 0 0 auto !important;
	}
	.jjh-compact-card .elementor-icon-box-content {
		align-self: center !important;
		height: auto !important;
	}
	.jjh-core-values-section .elementor-icon,
	.jjh-compact-card .elementor-icon {
		width: 34px !important;
		height: 34px !important;
		min-width: 34px !important;
		min-height: 34px !important;
		max-width: 34px !important;
		max-height: 34px !important;
	}
	.jjh-core-values-section .elementor-icon i,
	.jjh-core-values-section .elementor-icon svg,
	.jjh-compact-card .elementor-icon i,
	.jjh-compact-card .elementor-icon svg {
		font-size: 14px !important;
		width: 14px !important;
		height: 14px !important;
	}
	.jjh-core-values-section .elementor-icon-box-title,
	.jjh-compact-card .elementor-icon-box-title {
		font-size: 13.5px !important;
	}

	/* As Seen With: two logos per row, shorter tiles. */
	.jjh-brand-tiles-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 10px !important;
	}
	.jjh-brand-partner-tile {
		min-height: 0 !important;
		padding: 14px 10px 12px !important;
	}
	.jjh-brand-partner-tile .jjh-partner-category {
		font-size: 8.5px !important;
		letter-spacing: 0.08em !important;
	}
	.jjh-brand-partner-tile .jjh-partner-subtitle {
		font-size: 11.5px !important;
		line-height: 1.35 !important;
	}
}
