/* ==========================================================================
   Kardo Iran — yearly archive, athletes, medals, results, gallery, lightbox.
   Loaded only on the views that use these parts (see inc/archive.php).
   ========================================================================== */

/* ---------- Year page ---------- */
.k-year .k-filter--years {
	margin-bottom: clamp(24px, 4vw, 48px);
}

.k-year__head {
	margin-bottom: 14px;
}

.k-year__title {
	margin: 4px 0 0;
	font-size: clamp(26px, 3.2vw, 44px);
	font-weight: 900;
	line-height: 1.35;
}

/* Two figures per row; a single last figure takes the whole row. */
.k-year .k-stats {
	display: flex;
	flex-wrap: wrap;
}

.k-year .k-story__media .k-stats .k-stat {
	flex: 1 1 34%;
	min-width: 130px;
	margin: 0 0 -1px;
	margin-inline-end: -1px;
	border: 0;
	border-inline-end: 1px solid var(--k-line);
	border-bottom: 1px solid var(--k-line);
}

.k-year .k-story__media .k-slot {
	flex-direction: column;
	align-items: flex-start;
	justify-content: flex-end;
	min-height: 260px;
}

/* Past events are the subject of a year page: no dimming here. */
.single-kardo_year .k-prog--done {
	opacity: 1;
}

/* ---------- Slot: content that will be added later ---------- */
.k-slot {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: clamp(16px, 2.2vw, 26px);
	border: 1px dashed var(--k-bd-2);
	border-radius: var(--k-radius);
	color: var(--k-fg-2);
}

.k-slot__icon {
	display: grid;
	place-items: center;
	flex: none;
	width: 52px;
	height: 52px;
	border: 1px solid var(--k-bd);
	border-radius: 14px;
	color: var(--k-orange);
}

.k-slot__icon .k-i {
	width: 24px;
	height: 24px;
}

.k-slot__body {
	flex: 1;
	min-width: 0;
}

.k-slot__title {
	display: block;
	color: var(--k-fg);
	font-family: var(--k-font-head);
	font-size: 16.5px;
	font-weight: 800;
	line-height: 1.6;
}

.k-slot__text {
	margin: 2px 0 0;
	font-size: 14px;
	line-height: 1.8;
}

.k-slot__edit {
	flex: none;
	padding: 5px 14px;
	border: 1px solid var(--k-orange);
	border-radius: 8px;
	color: var(--k-orange);
	font-size: 13px;
	font-weight: 700;
}

.k-slot__edit:hover {
	background: var(--k-orange);
	color: #fff;
}

.k-pending {
	display: inline-flex;
	margin-top: 8px;
	padding: 1px 10px;
	border-radius: 999px;
	background: rgba(242, 193, 78, 0.14);
	color: #f2c14e;
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.8;
}

.is-pending {
	border-style: dashed !important;
}

/* ---------- Athletes ---------- */
.k-aths {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(10px, 1.4vw, 18px);
}

.k-ath {
	display: flex;
	align-items: center;
	gap: clamp(12px, 1.4vw, 18px);
	min-width: 0;
	padding: clamp(14px, 1.8vw, 22px);
	border: 1px solid var(--k-line);
	border-radius: var(--k-radius);
	background: var(--k-card);
	transition: border-color 0.2s linear, transform 0.3s var(--k-ease);
}

.k-ath:hover {
	border-color: var(--k-orange);
	transform: translateY(-3px);
}

.k-ath__num {
	flex: none;
	color: var(--k-line-2);
	font-size: clamp(28px, 2.8vw, 42px);
	font-weight: 900;
	line-height: 1;
	transition: color 0.2s linear;
}

@supports (-webkit-text-stroke: 1px #000) {
	.k-ath__num {
		color: transparent;
		-webkit-text-stroke: 1px var(--k-line-2);
	}
}

.k-ath:hover .k-ath__num {
	color: var(--k-orange);
	-webkit-text-stroke-color: var(--k-orange);
}

.k-ath__photo {
	flex: none;
	width: 72px;
	height: 72px;
	border-radius: 50%;
	background: var(--k-surface-2);
	overflow: hidden;
}

:root .k-ath__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.k-ath__body {
	min-width: 0;
}

.k-ath__name {
	margin: 0;
	font-size: clamp(17px, 1.5vw, 21px);
	font-weight: 800;
	line-height: 1.6;
}

.k-ath__role {
	margin: 2px 0 0;
	color: var(--k-muted);
	font-size: 13.5px;
	line-height: 1.8;
}

.k-ath__role a,
.k-medal__rank a {
	color: var(--k-orange);
}

.k-ath__note {
	margin: 4px 0 0;
	color: var(--k-dim);
	font-size: 13.5px;
	line-height: 1.8;
}

/* ---------- Medals, ranks and competition results ---------- */
.k-medals {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(10px, 1.4vw, 18px);
}

.k-medal {
	--k-medal: var(--k-line-2);
	display: flex;
	align-items: flex-start;
	gap: clamp(12px, 1.4vw, 18px);
	min-width: 0;
	padding: clamp(14px, 1.8vw, 22px);
	border: 1px solid var(--k-line);
	border-radius: var(--k-radius);
	background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 60%);
	transition: border-color 0.2s linear, transform 0.3s var(--k-ease);
}

.k-medal:hover {
	border-color: var(--k-medal);
	transform: translateY(-3px);
}

.k-medal--gold {
	--k-medal: #e9b824;
}

.k-medal--silver {
	--k-medal: #c8cdd3;
}

.k-medal--bronze {
	--k-medal: #cd8d52;
}

.k-medal__badge {
	display: grid;
	justify-items: center;
	flex: none;
	gap: 4px;
	width: 76px;
	padding: 10px 6px;
	border: 1px solid var(--k-medal);
	border-radius: 14px;
	color: var(--k-medal);
	text-align: center;
}

.k-medal__badge .k-i {
	width: 30px;
	height: 30px;
}

.k-medal__badge b {
	font-size: 11.5px;
	font-weight: 700;
	line-height: 1.5;
}

.k-medal__body {
	min-width: 0;
}

.k-medal__name {
	margin: 0;
	font-size: clamp(17px, 1.5vw, 20px);
	font-weight: 800;
	line-height: 1.6;
}

.k-medal__rank {
	margin: 2px 0 0;
	font-size: 14.5px;
	font-weight: 600;
	line-height: 1.8;
}

.k-medal__event {
	margin: 2px 0 0;
	color: var(--k-muted);
	font-size: 13.5px;
	line-height: 1.8;
}

.k-medal__source {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-top: 6px;
	color: var(--k-dim);
	font-size: 12.5px;
}

.k-medal__source:hover {
	color: var(--k-orange);
}

.k-medal__source .k-i {
	width: 13px;
	height: 13px;
}

.k-results {
	margin-top: clamp(24px, 3vw, 40px);
	padding-top: clamp(20px, 2.6vw, 32px);
	border-top: 1px solid var(--k-line);
}

.k-results__title {
	margin: 0 0 16px;
	font-size: clamp(20px, 2vw, 26px);
	font-weight: 900;
	line-height: 1.5;
}

.k-results .k-medals {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ---------- Gallery ---------- */
.k-gal {
	display: grid;
	gap: clamp(22px, 3vw, 40px);
}

.k-gal__title {
	display: flex;
	align-items: baseline;
	gap: 12px;
	margin: 0 0 14px;
	font-size: clamp(17px, 1.7vw, 22px);
	font-weight: 800;
	line-height: 1.6;
}

.k-gal__step {
	color: var(--k-orange);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
}

/* Rows of equal height; every picture keeps its own proportions. */
.k-gal__grid {
	--k-row: 230px;
	display: flex;
	flex-wrap: wrap;
	gap: clamp(6px, 1vw, 12px);
}

.k-gal__grid::after {
	content: "";
	flex-grow: 999999;
}

.k-gal__item {
	position: relative;
	flex: calc(var(--k-ratio, 1.5) * 100) 1 calc(var(--k-ratio, 1.5) * var(--k-row));
	min-width: 0;
	margin: 0;
	border-radius: 14px;
	background: var(--k-surface-2);
	overflow: hidden;
}

.k-gal__link {
	display: block;
	cursor: zoom-in;
}

:root .k-gal__img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--k-ratio, 1.5);
	object-fit: cover;
	transition: transform 0.6s var(--k-ease);
}

.k-gal__link:hover .k-gal__img,
.k-gal__link:focus-visible .k-gal__img {
	transform: scale(1.04);
}

.k-gal__cap {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	padding: 26px 12px 10px;
	background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.82));
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.7;
	pointer-events: none;
}

.k-gal__cap b,
.k-gal__cap span {
	display: block;
}

.k-gal__cap b {
	font-size: 14.5px;
	font-weight: 800;
}

.k-gal__cap span {
	font-weight: 500;
	opacity: 0.9;
}

/* Medal winners get taller rows: their captions carry name, discipline, rank and medal. */
.k-gal__group--medals .k-gal__grid {
	--k-row: 320px;
}

.k-gal__group--lead .k-gal__grid {
	display: block;
}

.k-gal__group--lead .k-gal__grid::after {
	content: none;
}

.k-gal__item--lead {
	width: 100%;
	max-width: min(100%, calc(var(--k-ratio, 1.5) * 76vh));
	margin-inline: auto;
	border-radius: var(--k-radius);
}

.k-gal__item--lead .k-gal__cap {
	padding: 40px clamp(14px, 2vw, 24px) 16px;
	font-size: 15px;
}

/* ---------- Lightbox ---------- */
.k-lb {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: flex;
	flex-direction: column;
	background: rgba(8, 8, 8, 0.96);
	color: #fff;
	opacity: 0;
	transition: opacity 0.2s linear;
}

.k-lb[hidden] {
	display: none;
}

.k-lb.is-open {
	opacity: 1;
}

.k-lb__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
}

.k-lb__count {
	color: var(--k-muted);
	font-size: 14px;
	font-weight: 600;
}

.k-lb__btn {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 12px;
	background: rgba(23, 22, 22, 0.7);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.2s linear, border-color 0.2s linear;
}

.k-lb__btn:hover,
.k-lb__btn:focus-visible {
	border-color: var(--k-orange);
	background: var(--k-orange);
}

.k-lb__btn svg {
	width: 20px;
	height: 20px;
}

.k-lb__stage {
	position: relative;
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 clamp(8px, 6vw, 84px);
}

:root .k-lb__img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: calc(100vh - 150px);
	max-height: calc(100dvh - 150px);
	border-radius: 10px;
	object-fit: contain;
}

.k-lb__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
}

.k-lb__nav--prev {
	right: 12px;
}

.k-lb__nav--next {
	left: 12px;
}

html:not([dir="rtl"]) .k-lb__nav--prev {
	right: auto;
	left: 12px;
}

html:not([dir="rtl"]) .k-lb__nav--next {
	right: 12px;
	left: auto;
}

.k-lb__cap {
	min-height: 54px;
	margin: 0;
	padding: 12px 16px 18px;
	font-size: 15px;
	line-height: 1.8;
	text-align: center;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
	.k-aths,
	.k-medals {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.k-aths,
	.k-medals,
	.k-results .k-medals {
		grid-template-columns: minmax(0, 1fr);
	}

	.k-gal__grid {
		--k-row: 132px;
	}

	.k-gal__group--medals .k-gal__grid {
		--k-row: 210px;
	}

	.k-slot {
		flex-wrap: wrap;
		gap: 12px;
	}

	.k-slot__icon {
		width: 44px;
		height: 44px;
	}

	.k-lb__btn {
		width: 42px;
		height: 42px;
	}

	.k-lb__nav {
		top: auto;
		bottom: -50px;
		transform: none;
	}

	.k-lb__cap {
		padding-inline: 112px;
		font-size: 13.5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.k-gal__img,
	.k-ath,
	.k-medal,
	.k-lb {
		transition: none;
	}
}
