@import url("./site.css");
@import url("./filters.css");

/* ==========================================================================
   Projects page - timeline, cards, carousels, filters
   Extracted from site.css for page-specific scoping.
   ========================================================================== */

.tl-card-container {
	display: flex;
	flex-flow: row;
	position: relative;
	align-items: stretch;
}

.tl-header {
	display: flex;
	flex-flow: row;
	align-items: center;
	gap: var(--space-sm);
	padding: 0 0 0 var(--space-lg);
	min-height: var(--space-2xl);
	border: var(--border-rule);
	background: var(--bg);
	font-family: var(--font-mono);
	font-size: var(--text-label);
	letter-spacing: var(--tracking-label);
	white-space: nowrap;
	overflow: hidden;
	align-self: start;
	color: var(--ink);
	font-weight: 500;
	border-radius: var(--border-radius);
	border-bottom: none;
}

.box-header-name {
	font-weight: 500;
	width: calc(280px + var(--space-xl));
}

/* .tl-card-container:has(.tl-card-indicator) .box-header-name {
	width: calc(280px + var(--space-xl) - var(--space-2xl));
} */

.box-header-stats {
	display: flex;
	flex: 1;
	margin-left: auto;
	gap: 0;
	height: 100%;
	min-height: var(--space-2xl);
	flex-wrap: wrap;
	overflow: hidden;
}

.box-header-stats > .header-stat {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2ch;
	padding: 0 var(--space-md);
}

/* adds a 1px gap between stat blocks when stats overflow */
/* not ideal, but works good enough for a no-js solution */
.box-header-stats > .header-stat:nth-child(n+6) {
	border-top: 1px solid var(--border);
}

.box-header-stats > .header-stat .header-stat-label {
	color: var(--ink-dim);
	letter-spacing: 0.04em;
}

.box-header-stats > .header-stat .header-stat-val {
	margin-left: auto;
	color: var(--ink);
	font-weight: 500;
	white-space: nowrap;
}

/* ── Timeline ── */
.term-timeline {
	position: relative;
	padding: 0 0 0 44px;
	margin-top: var(--space-xl);
	&::before {
		content: "";
		position: absolute;
		left: 13px;
		top: 0;
		bottom: 0;
		width: 2px;
		background: var(--border);
	}
}
.tl-entry {
	position: relative;
	margin-bottom: var(--space-2xl);

	&:last-child {
		margin-bottom: 0;
	}

	&:target .tl-card-main-container {
		border: var(--border-rule);
		border-color: var(--accent);
	}
}
.tl-head {
	position: relative;
	height: var(--space-xl);
	display: flex;
	align-items: center;
	margin-bottom: var(--space-md);
	&::before {
		content: "";
		position: absolute;
		left: -31px;
		top: 50%;
		width: 22px;
		height: 2px;
		background: var(--border);
		transform: translateY(-50%);
	}
}

/* ── Status dots ── */
.tl-dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}
.tl-dot-shape {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	position: relative;
	flex-shrink: 0;
	overflow: hidden;
}
.tl-dot.active .tl-dot-shape {
	background: var(--ok);
}
.tl-dot.wip .tl-dot-shape {
	background: conic-gradient(var(--warn) 0deg 180deg, transparent 180deg 360deg);
	border: 1.5px solid var(--warn);
}
.tl-dot.archived .tl-dot-shape {
	border: 1.5px solid var(--ink-faint);
	background: transparent;
}
.tl-dot.archived .tl-dot-shape::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 2px;
	right: 2px;
	height: 1.5px;
	background: var(--ink-faint);
	transform: translateY(-50%);
}
.tl-year {
	font-family: var(--font-mono);
	font-size: var(--text-label);
	color: var(--ink-faint);
	font-variant-numeric: tabular-nums;
	margin-left: var(--space-sm);
}

.tl-card-container:has(.tl-card-indicator) > .tl-card-main-container {
	margin-left: var(--space-2xl);
}

.tl-card-main-container {
	flex: 1;
	min-width: 0;
}

/* ── Card ── */
.tl-card {
	display: flex;
	flex-direction: row;
	margin-top: 0;
	min-height: 250px;
	padding-top: var(--space-lg);
	align-items: stretch;
}

.project-kind {
	display: inline-flex;
	align-items: center;
	background: transparent;
	color: var(--ink-faint);
	letter-spacing: var(--tracking-label);
	flex-shrink: 0;

	&.backend  { border-color: var(--devlog);        color: var(--devlog); }
	&.devtool  { border-color: var(--note);          color: var(--note); }
	&.frontend { border-color: var(--essay);         color: var(--essay); }
	&.web      { border-color: var(--color-web);     color: var(--color-web); }
	&.gamedev  { border-color: var(--color-gamedev); color: var(--color-gamedev); }
	&.tool     { border-color: var(--color-tool);    color: var(--color-tool); }
}

.tl-card-indicator {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	right: var(--space-2xl);
	width: var(--space-2xl);
	--mix-factor-1: 45%;
	--mix-factor-2: 55%;
	background: repeating-linear-gradient(
		-45deg,
		color-mix(in srgb, var(--indicator-color, var(--warn)) var(--mix-factor-1), var(--bg)) 0,
		color-mix(in srgb, var(--indicator-color, var(--warn)) var(--mix-factor-1), var(--bg)) 4px,
		color-mix(in srgb, var(--indicator-color, var(--warn)) var(--mix-factor-2), var(--bg)) 4px,
		color-mix(in srgb, var(--indicator-color, var(--warn)) var(--mix-factor-2), var(--bg)) 8px
	);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	writing-mode: vertical-rl;
	text-orientation: sideways;
	transform: rotate(180deg);
	font-family: var(--font-mono);
	font-size: var(--text-base);
	letter-spacing: var(--tracking-label);
	color: var(--color-text-light);
	text-transform: uppercase;
	text-shadow: rgba(0, 0, 0, 0.25) -2px 2px 10px;
	font-weight: 800;
	padding: none;
}
.tl-card-indicator-track {
	display: flex;
	flex-direction: row;
	animation: indicator-scroll 16s linear infinite;
}
.tl-card-indicator-text {
	flex-shrink: 0;
	white-space: nowrap;
}
@keyframes indicator-scroll {
	0%   { transform: translateY(-50%); }
	100% { transform: translateY(0%); }
}
@media (prefers-reduced-motion: reduce) {
	.tl-card-indicator-track {
		animation: none;
	}
}

/* ── Card ── */
.tl-card-body {
	display: flex;
	flex-direction: column;
	font-family: var(--font-sans);
	font-size: var(--text-base);
	color: var(--ink-dim);
	line-height: var(--lh-base);
	flex-grow: 1;
	gap: var(--space-md);
	min-width: 0;
}
.tl-card-links {
	flex: 0 0 auto;
}
.tl-card-blurb {
	flex: 1;
	margin: 0;
	text-align: justify;
}
.tl-card-blurb p {
	margin: 0 0 0.5em;
}
.tl-card-blurb p:last-child {
	margin: 0;
}
.tl-card-blurb ul,
.tl-card-blurb ol {
	padding-left: 1.25em;
	margin: 0.5em 0;
}
.tl-card-blurb li {
	margin: 0;
}
.tl-card-links {
	display: flex;
	flex-direction: column;
	justify-content: space-evenly;
	align-self: stretch;
	align-items: flex-end;
	margin-left: var(--space-xl);
	padding-left: var(--space-xl);
	border-left: 1px dashed var(--border);
	min-width: 16ch;
	max-width: 16ch;
}
.tl-card-links a {
	display: flex;
	width: 100%;
	align-items: center;
	gap: 1ch;
	font-size: var(--text-label);
	font-family: var(--font-mono);
	letter-spacing: var(--tracking-label);
	color: var(--ink-dim);
	text-decoration: none;
	transition: color 0.12s;
	line-height: 1.8;
}
.tl-card-links a .label {
	flex: 1 1 auto;
	min-width: 0;
}
.tl-card-links a .arrow {
	flex: 0 0 auto;
	white-space: nowrap;
	color: var(--ink-faint);
}
.tl-card-links a:hover .arrow {
	color: var(--ink-dim);
}
.tl-card-links a:hover {
	color: var(--ink);
	text-decoration: none;
}
.tl-card-links a.primary {
	color: var(--ink);
}
.tl-card-links a.primary:hover {
	color: var(--accent);
}
.tl-card-links a.primary:hover .arrow {
	color: var(--accent);
}

/* ── Tags (rainbow) ── */
.tl-card-tags {
	display: flex;
	gap: var(--space-2xs);
	flex-wrap: wrap;
	margin-top: var(--space-md);
	font-size: var(--text-label);
	letter-spacing: var(--tracking-data);
	font-family: var(--font-mono);
}

.tl-card-tags span .hash {
	color: var(--ink-ghost);
}

/* ── Stat segment colors ── */
.header-stat {
	--header-stat-blend: 45%;
	&.seg-0 { background: color-mix(in oklab, var(--essay) var(--header-stat-blend), var(--bg)); }
	&.seg-1 { background: color-mix(in oklab, var(--devlog) var(--header-stat-blend), var(--bg)); }
	&.seg-2 { background: color-mix(in oklab, var(--warn) var(--header-stat-blend), var(--bg)); }
	&.seg-3 { background: color-mix(in oklab, var(--review) var(--header-stat-blend), var(--bg)); }
	&.seg-4 { background: color-mix(in oklab, var(--note) var(--header-stat-blend), var(--bg)); }
}

/* ── Combo gallery (hover-scrub + radio thumbs) ── */
.combo-gallery {
	flex: 0 0 auto;
	width: 280px;
	margin-right: var(--space-xl);
}
.combo-gallery input { display: none; }

.combo-gallery .cg-stage {
	position: relative;
	aspect-ratio: 16/9;
	display: flex;
	border: var(--border-rule);
	border-radius: var(--border-radius);
	overflow: hidden;
	background: var(--bg-alt);
	margin-bottom: var(--space-sm);
}
.combo-gallery .cg-stage img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	pointer-events: none;
	transition: opacity .5s;
}

.combo-gallery .cg-slice {
	flex: 1;
	position: relative;
	z-index: 2;
	text-decoration: none;
}

.combo-gallery .cg-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
}
.combo-gallery .cg-thumbs label {
	width: calc(33.33% - var(--space-sm) * 2/3);
	display: block;
	border: var(--border-rule);
	border-radius: var(--border-radius);
	overflow: hidden;
	cursor: pointer;
	transition: box-shadow .15s, transform .15s;
	aspect-ratio: 16/9;
	position: relative;
}
.combo-gallery .cg-thumbs label::after {
	content: '';
	position: absolute;
	inset: 0;
	border: 2px solid transparent;
	border-radius: var(--border-radius);
	transition: border-color .15s;
}
.combo-gallery .cg-thumbs label:hover { transform: scale(1.03); }
.combo-gallery .cg-thumbs label.active::after { border-color: var(--accent); }
.combo-gallery .cg-thumbs label img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Counter overlay (inside stage, bottom-right) ── */
.combo-gallery .cg-counter {
	position: absolute;
	bottom: 0;
	right: 0;
	z-index: 3;
	pointer-events: none;
}
.combo-gallery .cg-counter span {
	position: absolute;
	right: 0;
	bottom: 0;
	font-family: var(--font-mono);
	font-size: var(--text-label);
	color: var(--ink-faint);
	background: color-mix(in srgb, var(--bg) 50%, transparent);
	padding: var(--space-2xs) var(--space-xs);
	border-radius: var(--border-radius) 0 0 0;
	opacity: 0;
	transition: opacity 0.1s;
	white-space: nowrap;
}

/* ── Hover hint ── */
.combo-gallery .cg-hint {
	position: absolute;
	top: 0;
	z-index: 3;
	pointer-events: none;
	font-family: var(--font-mono);
	font-size: var(--text-label);
	color: var(--ink-faint);
	background: color-mix(in srgb, var(--bg) 66%, transparent);
	padding: var(--space-2xs) var(--space-xs);
	border-radius: 0 var(--border-radius) 0 0;
	line-height: 1.4;
	opacity: 1;
	transition: opacity 0.35s;
}
.combo-gallery:has(:hover) .cg-hint {
	opacity: 0;
}

.single-shot {
	position: relative;
	flex: 0 0 auto;
	width: 280px;
	margin-right: var(--space-xl);
	aspect-ratio: 16/9;
	align-self: center;
	border: var(--border-rule);
	border-radius: var(--border-radius);
	overflow: hidden;
	background: var(--bg-alt);
}
.single-shot a {
	display: block;
	text-decoration: none;
	position: absolute;
	inset: 0;
}
.single-shot img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: filter .15s;
}
.single-shot a:hover img {
	filter: brightness(1.15);
}

@media (max-width: 820px) {
	.combo-gallery { width: 100%; margin-right: 0; }
	.single-shot { width: 100%; margin-right: 0; }
}

.lightbox {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 10;
}
.lightbox:target,
.lightbox:has(.gallery-frame:target) {
	display: block;
}

.lightbox-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: color-mix(in oklab, var(--bg) 85%, transparent);
}

.lightbox-strip {
	position: relative;
	z-index: 1;
	display: flex;
	overflow-x: auto;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	height: 100%;
	align-items: center;
	pointer-events: none;
	gap: 10vw;
}
.lightbox-strip a,
.lightbox-strip button {
	pointer-events: auto;
}
.lightbox-strip::-webkit-scrollbar {
	display: none;
}
.lightbox-strip .strip-pad {
	flex-shrink: 0;
	width: 50vw;
	height: 1px;
}

.gallery-frame {
	flex-shrink: 0;
	width: 75vw;
	height: 90vh;
	display: flex;
	align-items: center;
	justify-content: center;
	scroll-snap-align: center;
	position: relative;
	overflow: hidden;
	touch-action: pinch-zoom;
}
.gallery-frame img {
	max-height: 90vh;
	max-width: 100%;
	object-fit: contain;
	pointer-events: auto;
	touch-action: pinch-zoom;
}

/* ── Alt text box (per-frame, CSS toggle via checkbox, truncated to 1 line, expands on click) ── */
.gallery-alt-box {
	position: absolute;
	bottom: calc(var(--space-3xl) * 2 + var(--space-xl));
	left: 50%;
	transform: translateX(-50%);
	z-index: 90;
	width: 66%;
	max-width: 500px;
	background: rgba(0,0,0,0.65);
	color: #e0e0e0;
	padding: var(--space-sm) var(--space-lg);
	border-radius: var(--space-sm);
	font-family: var(--font-sans);
	font-size: var(--text-label);
	line-height: 1.6;
	cursor: pointer;
	pointer-events: auto;
	user-select: none;
	transition: background 0.15s;
	display: flex;
	align-items: center;
	gap: 6px;
}
.gallery-alt-box::after {
	content: "\f106";
	font-family: var(--font-nerd);
	margin-left: auto;
	font-size: 1.8rem;
	line-height: 1;
	opacity: 0.6;
	transition: transform 0.2s;
	flex-shrink: 0;
	pointer-events: none;
}
.alt-toggle:checked ~ .gallery-alt-box::after {
	transform: rotate(180deg);
	align-self: flex-start;
	margin-top: var(--space-sm);
}
.gallery-alt-text {
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.alt-toggle:checked ~ .gallery-alt-box .gallery-alt-text {
	-webkit-line-clamp: unset;
	overflow: visible;
}
.alt-toggle:checked ~ .gallery-alt-box {
	background: rgba(0,0,0,0.8);
}

.gallery-nav {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	width: 10vw;
	min-width: 64px;
	height: 10vw;
	min-height: 64px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 3rem;
	color: rgba(255, 255, 255, 0.4);
	text-decoration: none;
	z-index: 101;
	transition: color 0.15s, background 0.15s;
}
.gallery-frame:not(:target) .gallery-nav {
	display: none;
}
.lightbox:target .gallery-frame:first-of-type .gallery-nav {
	display: flex;
}
.gallery-frame.js-current .gallery-nav {
	display: flex;
}
.gallery-nav.prev { left: 0; }
.gallery-nav.next { right: 0; }
.gallery-nav:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.06);
	text-decoration: none;
}

/* ── Lightbox nav strip ── */
html.lb-open { overflow: hidden; }

.lightbox-nav {
	position: fixed;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 110;
	display: flex;
	gap: 8px;
	padding: 8px 12px;
	background: rgba(0,0,0,0.5);
	border-radius: 10px;
	pointer-events: auto;
	max-width: 90vw;
	overflow-x: auto;
	scrollbar-width: none;
}
.lightbox-nav::-webkit-scrollbar {
	display: none;
}
.lightbox-nav a {
	display: block;
	width: clamp(56px, 10vw, 100px);
	height: clamp(38px, 6.5vw, 65px);
	border-radius: 4px;
	overflow: hidden;
	border: 2px solid transparent;
	opacity: 0.5;
	transition: border-color 0.15s, opacity 0.15s;
}
.lightbox-nav a:hover {
	opacity: 1;
}
.lightbox-nav a.active {
	border-color: var(--accent);
	opacity: 1;
}
.lightbox-nav img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ── Responsive ── */
@media (max-width: 820px) {
	.tl-card-container {
		min-width: 0;
	}
	.tl-card-main-container {
		min-width: 0;
		overflow: hidden;
	}
	.tl-card {
		flex-direction: column;
		gap: var(--space-lg);
		min-width: 0;
	}
	.tl-card-main {
		flex-direction: column;
		min-width: 0;
	}
	.tl-card-links {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		border-left: none;
		padding-left: 0;
		border-top: 1px dashed var(--border);
		padding-top: var(--space-sm);
	}

	.tl-header {
		padding: 0;
		flex-flow: column;
		gap: 0;
	}

	.box-header-stats > .header-stat {
		margin-left: none;
	}

	.box-header-name {
		width: auto;
	}

	.gallery-alt-box {
		width: 100%;
		max-width: none;
	}
}
