/*
 * Hybrid Timeline — Stylesheet
 * Version:  1.0.0
 * Author:   Hybrid Studios LLC | hybriddc.com
 *
 * Layout logic:
 *   • .ht-outer          Clips content, anchors nav buttons
 *   • .ht-track          Horizontal scroll container
 *   • .ht-rail           Flex row of .ht-item columns; holds .ht-axis-line
 *   • .ht-item           Absolute-positioned children relative to a fixed height
 *   • .ht-item__card     Card tile (above: anchored from top→50%; below: 50%→bottom)
 *   • .ht-connector      Vertical rule connecting card edge to dot
 *   • .ht-dot            Circular point centered on the axis line (top:50%)
 *   • .ht-date-label     Date badge — below dot for "above" items, above for "below"
 *   • .ht-axis-line      Full-width horizontal rule at 50% of .ht-rail
 */

/* ── Custom properties ──────────────────────────────────────────────────────
   These can be overridden by placing them on a parent selector in your theme.
   e.g.  .my-wrapper .ht-outer { --ht-dot-color: #e00; }
   ──────────────────────────────────────────────────────────────────────── */

.ht-outer {
	/* Layout — overridable via shortcode inline style */
	--ht-height:       640px;
	--ht-card-width:   280px;
	--ht-h-padding:    72px;   /* breathing room before first / after last card */
	--ht-card-pad-v:   22px;   /* vertical breathing room between card and rail edge */
	--ht-gap:          0px;    /* additional horizontal gap between cards */

	/* Dot */
	--ht-dot-size:     16px;
	--ht-dot-color:    #1e87f0;
	--ht-dot-ring:     #fff;

	/* Lines */
	--ht-axis-color:   rgba(255,255,255,0.22);
	--ht-conn-color:   rgba(255,255,255,0.38);
	--ht-conn-h:       44px;   /* connector (vertical rule) height */

	/* Date label */
	--ht-date-bg:      rgba(0,0,0,0.28);
	--ht-date-color:   #fff;
	--ht-date-gap:     9px;    /* gap between dot edge and date badge */

	/* Navigation buttons */
	--ht-nav-size:     40px;
	--ht-nav-bg:       rgba(10,10,10,0.42);
	--ht-nav-color:    #fff;
	--ht-nav-hover-bg: rgba(10,10,10,0.72);

	/* Animation */
	--ht-anim-y:       26px;   /* fade-up translate distance */
	--ht-anim-dur:     0.6s;
	--ht-delay:        0ms;    /* per-item, set inline */

	/* Derived — do not override */
	--ht-half-dot:     calc(var(--ht-dot-size) / 2);
	--ht-card-offset:  calc(var(--ht-half-dot) + var(--ht-conn-h));
}

/* ────────────────────────────────────────────────────────────────────────────
   Outer wrapper
   ──────────────────────────────────────────────────────────────────────── */

.ht-outer {
	position: relative;
	width: 100%;
	overflow: hidden;
}

/* ────────────────────────────────────────────────────────────────────────────
   Scroll track
   ──────────────────────────────────────────────────────────────────────── */

.ht-track {
	overflow-x: scroll;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;       /* Firefox */
	-ms-overflow-style: none;    /* IE/Edge */
	outline: none;
}

.ht-track::-webkit-scrollbar {
	display: none;
}

/* ────────────────────────────────────────────────────────────────────────────
   Rail — flex row that contains all items
   ──────────────────────────────────────────────────────────────────────── */

.ht-rail {
	display: flex;
	flex-direction: row;
	position: relative;
	height: var(--ht-height);
	/* Expands to fit all items; min-width ensures it fills narrow viewports */
	width: max-content;
	min-width: 100%;
	padding: 0 var(--ht-h-padding);
	box-sizing: border-box;
}

/* ────────────────────────────────────────────────────────────────────────────
   Horizontal axis line
   ──────────────────────────────────────────────────────────────────────── */

.ht-axis-line {
	position: absolute;
	inset-inline: 0;
	top: 50%;
	height: 2px;
	transform: translateY(-50%);
	background: var(--ht-axis-color);
	z-index: 0;
	pointer-events: none;
}

/* ────────────────────────────────────────────────────────────────────────────
   Individual item column
   ──────────────────────────────────────────────────────────────────────── */

.ht-item {
	position: relative;
	width: var(--ht-card-width);
	flex-shrink: 0;
	height: 100%;
}

/* ── Card wrapper ───────────────────────────────────────────────────────────
   ABOVE items: card occupies the top half (top → 50%−offset)
   BELOW items: card occupies the bottom half (50%+offset → bottom)
   ──────────────────────────────────────────────────────────────────────── */

.ht-item__card {
	position: absolute;
	left: 14px;
	right: 14px;
	overflow: hidden;
	border-radius: 6px;
	/* Subtle lift shadow that layers nicely over UIkit secondary tiles */
	box-shadow:
		0 2px 8px  rgba(0,0,0,0.12),
		0 8px 24px rgba(0,0,0,0.18);
}

.ht-item--above .ht-item__card {
	top:    var(--ht-card-pad-v);
	bottom: calc(50% + var(--ht-card-offset));
	overflow-y: auto;
}

.ht-item--below .ht-item__card {
	top:    calc(50% + var(--ht-card-offset));
	bottom: var(--ht-card-pad-v);
	overflow-y: auto;
}

/* Scrollbar inside card — subtle */
.ht-item__card::-webkit-scrollbar {
	width: 3px;
}
.ht-item__card::-webkit-scrollbar-thumb {
	background: rgba(255,255,255,0.25);
	border-radius: 2px;
}

/* ── UIkit tile overrides ───────────────────────────────────────────────────
   Strip default UIkit tile padding; we apply our own per-zone padding.
   ──────────────────────────────────────────────────────────────────────── */

.ht-card.uk-tile {
	padding: 0;
	height: 100%;
	display: flex;
	flex-direction: column;
	border-radius: 6px;
	overflow: hidden;
}

/* ── Featured image ─────────────────────────────────────────────────────────
   Always full width, fixed height, object-fit cropped.
   ──────────────────────────────────────────────────────────────────────── */

.ht-card__thumb {
	width: 100%;
	flex-shrink: 0;
	overflow: hidden;
	height: clamp(100px, 38%, 160px);
}

.ht-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s ease;
}

.ht-item:hover .ht-card__thumb img {
	transform: scale(1.04);
}

/* ── Card body ──────────────────────────────────────────────────────────────
   Flex-grows to fill remaining card height.
   ──────────────────────────────────────────────────────────────────────── */

.ht-card__body {
	padding: 14px 16px 16px;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	gap: 7px;
	overflow: hidden;
}

/* h3 title — reset UIkit heading margins; keep it compact */
.ht-card__title {
	margin: 0 !important;
	padding: 0 !important;
	font-size: 0.92rem !important;
	line-height: 1.35 !important;
	font-weight: 700 !important;
}

.ht-card__title a {
	color: inherit;
	text-decoration: none;
}

.ht-card__title a:hover,
.ht-card__title a:focus {
	opacity: 0.8;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Excerpt — clamped, small */
.ht-card__excerpt {
	flex: 1 1 auto;
	min-height: 0;
	font-size: 0.78rem;
	line-height: 1.55;
	opacity: 0.78;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
}

.ht-card__excerpt p {
	margin: 0;
}

/* ── Connector — vertical rule from dot edge to card edge ──────────────────
   Position: always starts at the dot edge (50% ± half-dot),
   extends toward the card by --ht-conn-h pixels.
   ──────────────────────────────────────────────────────────────────────── */

.ht-connector {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	width: 2px;
	height: var(--ht-conn-h);
	background: linear-gradient(
		to bottom,
		var(--ht-conn-color),
		var(--ht-conn-color)
	);
	z-index: 1;
	border-radius: 1px;
}

/* Above item: connector runs UPWARD from dot toward card bottom */
.ht-item--above .ht-connector {
	bottom: calc(50% + var(--ht-half-dot));
}

/* Below item: connector runs DOWNWARD from dot toward card top */
.ht-item--below .ht-connector {
	top: calc(50% + var(--ht-half-dot));
}

/* ── Dot — centered on the axis line ───────────────────────────────────────
   Double box-shadow creates the ring + outer glow effect.
   ──────────────────────────────────────────────────────────────────────── */

.ht-dot {
	position: absolute;
	top:  50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width:  var(--ht-dot-size);
	height: var(--ht-dot-size);
	border-radius: 50%;
	background: var(--ht-dot-color);
	box-shadow:
		0 0 0 3px var(--ht-dot-ring),
		0 0 0 5px var(--ht-dot-color),
		0 0 12px 2px rgba(30,135,240,0.35);
	z-index: 2;
	transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.ht-item:hover .ht-dot {
	transform: translate(-50%, -50%) scale(1.3);
}

/* ── Date label ─────────────────────────────────────────────────────────────
   A small pill badge that appears:
     • BELOW the dot for items whose card is ABOVE the line
     • ABOVE the dot for items whose card is BELOW the line
   This mirrors the card, keeping both date and card in the same half.
   ──────────────────────────────────────────────────────────────────────── */

.ht-date-label {
	position: absolute;
	left: 50%;
	transform: translateX(-50%);
	white-space: nowrap;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ht-date-color);
	background: var(--ht-date-bg);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	padding: 3px 10px 3px;
	border-radius: 20px;
	border: 1px solid rgba(255,255,255,0.12);
	z-index: 3;
	pointer-events: none;
	/* Line-height so the pill height is predictable (~22px) */
	line-height: 1.7;
}

/* Date appears IN THE EMPTY LOWER HALF for above-items */
.ht-item--above .ht-date-label {
	top: calc(50% + var(--ht-half-dot) + var(--ht-date-gap));
}

/* Date appears IN THE EMPTY UPPER HALF for below-items */
.ht-item--below .ht-date-label {
	bottom: calc(50% + var(--ht-half-dot) + var(--ht-date-gap));
}

/* ────────────────────────────────────────────────────────────────────────────
   Navigation arrow buttons
   ──────────────────────────────────────────────────────────────────────── */

.ht-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 20;
	width:  var(--ht-nav-size);
	height: var(--ht-nav-size);
	border-radius: 50%;
	border: 1px solid rgba(255,255,255,0.15);
	background: var(--ht-nav-bg);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: var(--ht-nav-color);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	box-shadow: 0 2px 12px rgba(0,0,0,0.3);
	transition:
		background   0.2s ease,
		transform    0.2s cubic-bezier(0.34,1.56,0.64,1),
		opacity      0.2s ease,
		border-color 0.2s ease;
}

.ht-nav:hover {
	background: var(--ht-nav-hover-bg);
	border-color: rgba(255,255,255,0.3);
	transform: translateY(-50%) scale(1.1);
}

.ht-nav:focus-visible {
	outline: 2px solid var(--ht-dot-color);
	outline-offset: 2px;
}

.ht-nav:disabled {
	opacity: 0.25;
	cursor: default;
	pointer-events: none;
}

.ht-nav--prev { left: 10px; }
.ht-nav--next { right: 10px; }

/* ────────────────────────────────────────────────────────────────────────────
   Fade-up animation
   Items start invisible & shifted down; IntersectionObserver adds .ht-visible.
   ──────────────────────────────────────────────────────────────────────── */

.ht-fade-up {
	opacity: 0;
	transform: translateY(var(--ht-anim-y));
	transition:
		opacity   var(--ht-anim-dur) ease,
		transform var(--ht-anim-dur) cubic-bezier(0.22,1,0.36,1);
	transition-delay: var(--ht-delay, 0ms);
	will-change: opacity, transform;
}

.ht-fade-up.ht-visible {
	opacity: 1;
	transform: translateY(0);
}

/* ────────────────────────────────────────────────────────────────────────────
   Empty-state fallback
   ──────────────────────────────────────────────────────────────────────── */

.ht-no-posts {
	text-align: center;
	padding: 3rem 1rem;
	opacity: 0.55;
	font-style: italic;
}

/* ────────────────────────────────────────────────────────────────────────────
   Accessibility — respect prefers-reduced-motion
   ──────────────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.ht-fade-up {
		opacity: 1 !important;
		transform: none !important;
		transition: none !important;
	}
	.ht-dot,
	.ht-nav,
	.ht-card__thumb img {
		transition: none !important;
	}
}

/* ────────────────────────────────────────────────────────────────────────────
   Responsive adjustments
   ──────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
	.ht-outer {
		--ht-height:      540px;
		--ht-card-width:  230px;
		--ht-h-padding:   52px;
		--ht-nav-size:    34px;
		--ht-conn-h:      36px;
	}
}

@media (max-width: 480px) {
	.ht-outer {
		--ht-height:      500px;
		--ht-card-width:  200px;
		--ht-h-padding:   44px;
		--ht-nav-size:    30px;
		--ht-conn-h:      30px;
	}

	.ht-card__body {
		padding: 10px 12px 12px;
	}

	.ht-card__title {
		font-size: 0.82rem !important;
	}

	.ht-card__excerpt {
		display: none; /* hide excerpt on very small screens to keep card compact */
	}
}
