/* =========================================================
   Single course design clone — styles for tutor/single-course.php
   Tokens wired to Elementor globals (kit-55) with design-hex
   fallbacks. Scope: .gh-single
   ========================================================= */
.gh-single {
	--gh-accent:   var(--e-global-color-primary, #b8954f);
	--gh-accent-d: #9e7c3c;
	--gh-ink:      var(--e-global-color-secondary, #3a2c1e);
	--gh-body:     #5c5040;
	/* Was #8b7b67 — only 4.1:1 on white, i.e. below WCAG AA (4.5:1) at
	   every size it's used. #6f6252 keeps the warm grey but passes on
	   both surfaces: 5.92:1 on white, 4.91:1 on the cream panels. */
	--gh-muted:    #6f6252;
	/* Gold is a brand fill, not a text colour: #b8954f is 2.82:1 on
	   white and fails even the 3:1 large-text floor. This darker gold
	   (5.87:1) is for gold-coloured TEXT; --gh-accent stays as-is for
	   fills, borders and icons. */
	--gh-accent-ink: #7d6029;
	--gh-cream:    var(--e-global-color-cream-tint, #f2e9d8);
	--gh-white:    var(--e-global-color-white, #fff);
	--gh-save-bg:  #eaf3ec;
	--gh-save-fg:  var(--e-global-color-wa-green, #2e7d53);
	--gh-strike:   #b0a290;
	/* Use the site's own fonts (inherit from theme). */
	--gh-serif:    inherit;

	direction: rtl;
	color: var(--gh-body);
	max-width: 1120px;
	margin: 0 auto;
	padding: 8px clamp(16px, 4vw, 28px) 56px;
}

.gh-single img { max-width: 100%; }

.gh-single *,
.gh-single *::before,
.gh-single *::after { box-sizing: border-box; }

/* Back link.
   Scoped with .gh-single so the theme's own link colour can't win the
   specificity tie — it was rendering gold (2.82:1) instead of muted.
   min-height gets it to the 44px touch-target floor; the negative
   margin keeps the visual spacing unchanged. */
.gh-back-row { padding: 6px 0 4px; }
.gh-single .gh-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	margin-block: -11px;
	color: var(--gh-muted);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}
.gh-single .gh-back:hover,
.gh-single .gh-back:focus-visible { color: var(--gh-accent-ink); }

/* Grid.
   minmax(0, 1fr) — NOT plain 1fr. A bare `1fr` keeps the default
   min-width:auto floor, so a wide flex child (the Swiper track) can
   push the column past the viewport instead of being clamped by it.
   With Swiper that turns into a feedback loop: slide width follows the
   container, container follows content, and the layout runs away until
   it hits the browser's size cap. */
.gh-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

/* Same guard one level down, so the column can never be widened
   from the inside regardless of what it contains. */
.gh-main { min-width: 0; }
@media (min-width: 960px) {
	.gh-grid { grid-template-columns: minmax(0, 1fr) clamp(320px, 30vw, 360px); gap: clamp(28px, 4vw, 44px); }
	.gh-aside { position: sticky; top: 92px; }
}

/* Hero image */
.gh-hero {
	position: relative;
	aspect-ratio: 16 / 10;
	border-radius: 18px;
	overflow: hidden;
	background: var(--gh-cream);
	box-shadow: 0 14px 34px rgba(58, 44, 30, 0.14);
}
.gh-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gh-hero-badge {
	position: absolute;
	inset-block-start: 12px;
	inset-inline-end: 12px;
	background: rgba(255, 255, 255, 0.94);
	color: var(--gh-accent);
	font-size: 11px;
	font-weight: 700;
	padding: 5px 11px;
	border-radius: 999px;
}

/* =========================================================
   Hero gallery carousel (multi-image courses)
   Source: course featured image + WooCommerce product gallery.
   Dependency-free: CSS scroll-snap does the sliding, JS only
   drives arrows/thumbs. Without JS it stays a swipeable strip.
   ========================================================= */
/* max-width/min-width belt-and-braces: Swiper sizes its slides from the
   container, so the container must never be able to grow from content. */
.gh-gallery,
.gh-gallery__stage,
.gh-gallery__viewport {
	max-width: 100%;
	min-width: 0;
}

.gh-gallery__stage {
	position: relative;
	border-radius: 18px;
	overflow: hidden;
	background: var(--gh-cream);
	box-shadow: 0 14px 34px rgba(58, 44, 30, 0.14);
}

/* Fallback state: plain scroll-snap strip, used until Swiper boots
   (and permanently if Swiper is unavailable or JS is off). */
.gh-gallery__viewport {
	position: relative;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	/* Own the horizontal gesture so it never fights the page scroll. */
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	z-index: 1;
}

.gh-gallery__viewport::-webkit-scrollbar { display: none; }

.gh-gallery__viewport:focus-visible {
	outline: 3px solid var(--gh-accent);
	outline-offset: -3px;
}

.gh-gallery__track {
	display: flex;
	width: 100%;
	box-sizing: content-box;
}

.gh-gallery__slide {
	flex-shrink: 0;
	width: 100%;
	scroll-snap-align: center;
	scroll-snap-stop: always;
	/* Reserves height before images decode — no layout shift (CLS). */
	aspect-ratio: 16 / 10;
}

/* Swiper has taken over: it drives the track by transform, so the
   native scroller must stand down or the two fight each other.
   Only the core layout bits are declared here — that is all Swiper
   needs — so the gallery never depends on WoodMart's or Elementor's
   swiper stylesheet being present. */
.gh-gallery--swiper .gh-gallery__viewport {
	overflow: hidden;
	scroll-snap-type: none;
	touch-action: pan-y;
}

.gh-gallery--swiper .gh-gallery__track {
	position: relative;
	transition-property: transform;
	box-sizing: content-box;
}

.gh-gallery--swiper .gh-gallery__slide {
	position: relative;
	transition-property: transform;
	scroll-snap-align: none;
}

.gh-gallery__slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Arrows — 44px hit area, unhidden by JS once Swiper is up.
   NOTE the `.gh-gallery` prefix on every button rule below. WoodMart's
   base CSS carries
     :is(.btn, .button, button, [type="submit"], [type="button"]) { … }
   which is specificity 0,1,0 — a tie with a bare `.gh-gallery__nav`,
   and it loads later, so it was winning: our arrows and thumbs were
   inheriting the theme's gold button padding (17px 40px), 14px radius
   and static position. The extra class lifts us to 0,2,0. The explicit
   padding/background/min-height resets below are neutralising that
   same rule, not decoration. */
.gh-gallery .gh-gallery__nav {
	position: absolute;
	inset-block-start: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	min-width: 0;
	height: 44px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--gh-ink);
	box-shadow: 0 3px 12px rgba(58, 44, 30, 0.2);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.gh-gallery .gh-gallery__nav:hover,
.gh-gallery .gh-gallery__nav:focus-visible {
	background: var(--gh-accent);
	color: var(--gh-white);
}

.gh-gallery .gh-gallery__nav[hidden] { display: none; }

/* At either end: dimmed and click-through-proof. !important only to
   out-rank the theme's `button[disabled] { opacity: .6 !important }`. */
.gh-gallery .gh-gallery__nav[disabled] {
	opacity: 0.4 !important;
	cursor: default;
	pointer-events: none;
}

/* RTL-aware placement: "prev" sits at the start edge (right in RTL). */
.gh-gallery .gh-gallery__nav--prev { inset-inline-start: 12px; }
.gh-gallery .gh-gallery__nav--next { inset-inline-end: 12px; }

/* Chevrons are drawn LTR; flip them so they point the right way in RTL. */
[dir="rtl"] .gh-gallery__nav svg { transform: scaleX(-1); }

.gh-gallery .gh-hero-badge { z-index: 2; }

/* Thumbnail strip */
.gh-gallery__thumbs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	padding: 10px 2px 2px;
	scrollbar-width: none;
}

.gh-gallery__thumbs::-webkit-scrollbar { display: none; }

/* Same specificity story as the arrows — see the note above. Without
   the reset the theme's button padding collapsed the preview img to 0px. */
.gh-gallery .gh-gallery__thumb {
	flex: 0 0 auto;
	width: 62px;
	min-width: 0;
	height: 62px;
	min-height: 0;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 11px;
	overflow: hidden;
	background: var(--gh-cream);
	cursor: pointer;
	opacity: 0.62;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.gh-gallery .gh-gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.gh-gallery .gh-gallery__thumb:hover,
.gh-gallery .gh-gallery__thumb:focus-visible { opacity: 1; }

.gh-gallery .gh-gallery__thumb[aria-current="true"] {
	opacity: 1;
	border-color: var(--gh-accent);
}

@media (max-width: 575px) {
	.gh-gallery .gh-gallery__thumb { width: 54px; height: 54px; }
	/* Stays at 44px: the touch-target floor beats visual tidiness. */
	.gh-gallery .gh-gallery__nav--prev { inset-inline-start: 8px; }
	.gh-gallery .gh-gallery__nav--next { inset-inline-end: 8px; }
}

/* Motion is decorative here — honour the OS setting. */
@media (prefers-reduced-motion: reduce) {
	.gh-gallery__viewport { scroll-behavior: auto; }
	.gh-gallery .gh-gallery__nav,
	.gh-gallery .gh-gallery__thumb { transition: none; }
}

/* Head */
.gh-head { padding-top: clamp(14px, 3vw, 18px); }
.gh-cat {
	display: inline-block;
	background: rgba(184, 149, 79, 0.14);
	color: var(--gh-accent-d);
	font-size: 11.5px;
	font-weight: 700;
	padding: 4px 11px;
	border-radius: 999px;
}
.gh-title {
	font-family: var(--gh-serif);
	font-size: clamp(22px, 4.5vw, 28px);
	font-weight: 700;
	color: var(--gh-ink);
	line-height: 1.35;
	margin: 11px 0 12px;
}
.gh-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 16px;
	color: var(--gh-muted);
	font-size: 12.5px;
}
.gh-meta span { display: flex; align-items: center; gap: 5px; }
.gh-meta-star { color: var(--gh-accent); font-weight: 700; }
.gh-meta-muted { color: var(--gh-muted); font-weight: 400; }

/* Sections */
.gh-sec { padding-top: clamp(18px, 3.5vw, 26px); }
.gh-h2 {
	font-family: var(--gh-serif);
	font-size: clamp(18px, 3vw, 21px);
	font-weight: 700;
	color: var(--gh-ink);
	margin-bottom: 10px;
}
.gh-about { color: var(--gh-body); font-size: clamp(14px, 1.6vw, 15px); line-height: 1.95; }
.gh-about p { margin-bottom: 12px; }
.gh-about img { height: auto; border-radius: 12px; }

/* What you'll learn */
.gh-learn { display: flex; flex-direction: column; gap: 11px; }
.gh-learn-item { display: flex; gap: 10px; align-items: flex-start; }
.gh-learn-ic {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: rgba(184, 149, 79, 0.15);
	color: var(--gh-accent);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-top: 1px;
}
.gh-learn-item > span:last-child { color: var(--gh-body); font-size: 14px; line-height: 1.6; }

/* Curriculum */
.gh-curr-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.gh-curr {
	background: var(--gh-white);
	border: 1px solid rgba(184, 149, 79, 0.16);
	border-radius: 14px;
	overflow: hidden;
}
.gh-curr-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 13px 14px;
	border-bottom: 1px solid rgba(184, 149, 79, 0.12);
}
.gh-curr-row:last-child { border-bottom: 0; }
.gh-curr-num {
	flex-shrink: 0;
	width: 26px;
	height: 26px;
	border-radius: 8px;
	background: var(--gh-cream);
	color: var(--gh-accent-d);
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
}
.gh-curr-title { flex: 1; min-width: 0; color: var(--gh-ink); font-size: 13.5px; font-weight: 500; line-height: 1.4; }
.gh-curr-dur { color: var(--gh-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.gh-curr-ic { flex-shrink: 0; display: flex; }
.gh-curr-play { color: var(--gh-accent); }
.gh-curr-lock { color: #c3b49a; }

/* Instructor */
.gh-instructor {
	display: flex;
	align-items: center;
	gap: 13px;
	background: var(--gh-cream);
	border-radius: 14px;
	padding: 14px;
}
.gh-instructor-av {
	position: relative;
	flex-shrink: 0;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	overflow: hidden;
	background: #e2d6bf;
}
.gh-instructor-av img { width: 100%; height: 100%; object-fit: cover; }
.gh-instructor-name { font-family: var(--gh-serif); font-size: 15px; font-weight: 600; color: var(--gh-ink); }
.gh-instructor-role { color: var(--gh-muted); font-size: 12px; margin-top: 3px; }

/* Buy card = NATIVE Tutor entry box, skinned to the design.
   .gh-buycard is a transparent wrapper; the native .tutor-sidebar-card
   provides the card so all behaviour stays native. */
.gh-buycard .tutor-sidebar-card {
	background: var(--gh-white);
	border: 1px solid rgba(184, 149, 79, 0.2);
	border-radius: 16px;
	box-shadow: 0 12px 30px rgba(58, 44, 30, 0.09);
}

/* Native price → gold, larger */
/* --gh-accent-d (3.89:1) not --gh-accent (2.82:1): at this size and
   weight the price counts as large text, which still needs 3:1. */
.gh-single .tutor-course-sidebar-card-pricing .tutor-fs-4,
.gh-single .tutor-course-sidebar-card-pricing .woocommerce-Price-amount,
.gh-single .tutor-course-single-pricing {
	font-family: var(--gh-serif);
	font-weight: 700;
	color: var(--gh-accent-d);
	font-size: clamp(26px, 5vw, 32px);
}
.gh-single .tutor-course-single-pricing del,
.gh-single .tutor-course-single-pricing del * {
	color: var(--gh-strike);
	font-weight: 400;
	font-size: 14px;
}

/* Native enroll / add-to-cart button → gold, rounded, icon+label gap */
/* min-height lifts the native enrol/cart button off Tutor's 42px to
   the 44px touch-target floor. */
.gh-single .tutor-btn-primary {
	background: var(--gh-accent);
	border-color: var(--gh-accent);
	color: var(--gh-white);
	border-radius: 13px;
	font-weight: 700;
	min-height: 44px;
}
.gh-single .tutor-btn-primary:hover,
.gh-single .tutor-btn-primary:focus {
	background: var(--gh-accent-d);
	border-color: var(--gh-accent-d);
	color: var(--gh-white);
}
.gh-single .tutor-add-to-cart-button,
.gh-single .tutor-enroll-course-button {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

/* Native "course info" meta icons → gold */
.gh-single .tutor-sidebar-card .tutor-card-footer [class*="tutor-icon-"] {
	color: var(--gh-accent);
}
