/* ==========================================================
   ArchPlan News — front end
   ========================================================== */
.apn-news,
.apn-single {
	--apn-accent: #0d6efd;
	--apn-overlay: rgba(95, 95, 95, .72);
	--apn-heading: #6b6b6b;
	--apn-text: #2b2b2b;
	--apn-muted: #777;
	--apn-line: #e6e6e6;
	box-sizing: border-box;
}
.apn-news *, .apn-single * { box-sizing: border-box; }
/* card defaults live on the outermost wrapper only, so settings set on the page wrapper reach inner sections */
.apn-single,
.apn-news:not(.apn-single .apn-news) {
	--apn-card-h: 420px;
	--apn-gap: 30px;
	--apn-per-row: 4;
	--apn-title-size: 22px;
}

/* ---------- Section ---------- */
.apn-news {
	width: 100%;
	max-width: 1500px;
	margin: 0 auto;
	padding: 24px 40px 40px;
}
.apn-news__heading {
	margin: 0 0 30px;
	color: var(--apn-heading);
	font-size: clamp(26px, 2.6vw, 38px);
	font-weight: 600;
	line-height: 1.2;
}
.apn-news__empty { color: var(--apn-muted); }

/* ---------- Slider: one row, 4 / 2 / 1 ---------- */
.apn-slider {
	position: relative;
	padding: 0 60px;
}
.apn-track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - (var(--apn-per-row) - 1) * var(--apn-gap)) / var(--apn-per-row));
	gap: var(--apn-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
	padding: 4px 2px 14px;
	-webkit-overflow-scrolling: touch;
}
.apn-track::-webkit-scrollbar { display: none; }
.apn-track:focus-visible { outline: 2px solid var(--apn-accent); outline-offset: 4px; }
.apn-track > .apn-card { scroll-snap-align: start; }

.apn-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 46px;
	height: 46px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid #dcdcdc;
	background: #fff;
	color: #333;
	display: grid;
	place-items: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
	transition: background .2s, color .2s, opacity .2s, border-color .2s;
}
.apn-arrow:hover:not(:disabled),
.apn-arrow:focus-visible {
	background: var(--apn-accent);
	border-color: var(--apn-accent);
	color: #fff;
}
.apn-arrow:disabled { opacity: .35; cursor: default; box-shadow: none; }
.apn-arrow--prev { inset-inline-start: 0; }
.apn-arrow--next { inset-inline-end: 0; }
.apn-arrow--next svg { transform: scaleX(-1); }
[dir="rtl"] .apn-arrow--prev svg { transform: scaleX(-1); }
[dir="rtl"] .apn-arrow--next svg { transform: none; }
.apn-slider.is-static .apn-arrow { display: none; }

.apn-count {
	text-align: center;
	color: #888;
	font-size: 14px;
	margin-top: 22px;
	min-height: 1.4em;
	font-variant-numeric: tabular-nums;
}

/* ---------- Cards (shared) ---------- */
.apn-card { position: relative; margin: 0; min-width: 0; height: var(--apn-card-h); }
.apn-card .apn-card__link {
	display: block;
	height: 100%;
	color: inherit !important;
	text-decoration: none !important;
}
.apn-card .apn-card__link:focus-visible { outline: 3px solid var(--apn-accent); outline-offset: 3px; }
.apn-card .apn-card__img { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; transition: transform .6s ease; }
.apn-card .apn-card__title {
	margin: 0;
	font-size: var(--apn-title-size);
	font-weight: 700;
	line-height: 1.25;
	overflow-wrap: anywhere;
	hyphens: auto;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.apn-card .apn-card__date { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; white-space: nowrap; }
.apn-card .apn-card__excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
	color: #666;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.apn-card .apn-card__more { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--apn-accent); }
.apn-card__media { position: relative; overflow: hidden; background: #ddd; }
.apn-card--noimg .apn-card__media, .apn-card--noimg.apn-card--a, .apn-card--noimg.apn-card--d { background: linear-gradient(135deg, #555, #2c2c2c); }
.apn-ico { flex: none; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A: classic overlay band */
.apn-card--a { overflow: hidden; background: #3a3a3a; }
.apn-card--a .apn-card__link { color: #fff !important; }
.apn-card--a .apn-card__img { position: absolute; inset: 0; }
.apn-card--a .apn-card__overlay {
	position: absolute;
	inset: auto 0 0 0;
	min-height: 52%;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 12px;
	padding: 20px 22px;
	background: var(--apn-overlay);
	transition: background .3s ease;
}
.apn-card--a .apn-card__title { color: #fff; }
.apn-card--a:hover .apn-card__img { transform: scale(1.06); }
.apn-card--a:hover .apn-card__overlay { background: rgba(50, 50, 50, .85); }

/* B: image on top + white card */
.apn-card--b { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06); transition: transform .3s, box-shadow .3s; }
.apn-card--b .apn-card__link { display: flex; flex-direction: column; }
.apn-card--b .apn-card__media { flex: 0 0 56%; }
.apn-card--b .apn-card__body { flex: 1; min-height: 0; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.apn-card--b .apn-card__date { color: #888; font-size: 13px; }
.apn-card--b .apn-card__title { color: #1d1d1d; -webkit-line-clamp: 2; }
.apn-card--b .apn-card__more { margin-top: auto; }
.apn-card--b:hover { transform: translateY(-4px); box-shadow: 0 2px 4px rgba(0,0,0,.05), 0 16px 32px rgba(0,0,0,.1); }
.apn-card--b:hover .apn-card__img { transform: scale(1.05); }

/* C: date box, no card box */
.apn-card--c .apn-card__link { display: flex; flex-direction: column; gap: 14px; }
.apn-card--c .apn-card__media { flex: 0 0 62%; }
.apn-card--c .apn-card__badge {
	position: absolute;
	top: 0;
	left: 0;
	background: #fff;
	color: #1d1d1d;
	text-align: center;
	padding: 10px 14px 8px;
	line-height: 1;
}
[dir="rtl"] .apn-card--c .apn-card__badge { left: auto; right: 0; }
.apn-card--c .apn-card__badge b { display: block; font-size: 30px; font-weight: 800; }
.apn-card--c .apn-card__badge span { display: block; margin-top: 5px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #666; }
.apn-card--c .apn-card__line { display: block; height: 2px; width: 36px; background: #1d1d1d; transition: width .35s, background .35s; }
.apn-card--c .apn-card__title { color: #1d1d1d; -webkit-line-clamp: 2; }
.apn-card--c:hover .apn-card__img { transform: scale(1.05); }
.apn-card--c:hover .apn-card__line { width: 80px; background: var(--apn-accent); }

/* D: full image + gradient, excerpt reveals on hover */
.apn-card--d { overflow: hidden; background: #222; }
.apn-card--d .apn-card__link { color: #fff !important; }
.apn-card--d .apn-card__img { position: absolute; inset: 0; transition: transform .7s; }
.apn-card--d .apn-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,.55) 60%, rgba(0,0,0,.9) 100%);
}
.apn-card--d .apn-card__body { position: absolute; z-index: 1; inset: auto 0 0 0; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.apn-card--d .apn-card__date { font-size: 13px; opacity: .85; }
.apn-card--d .apn-card__title { color: #fff; }
.apn-card--d .apn-card__reveal { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s; }
.apn-card--d .apn-card__reveal > div { overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.apn-card--d .apn-card__excerpt { color: rgba(255,255,255,.85); }
.apn-card--d .apn-card__more { color: #fff; }
.apn-card--d:hover .apn-card__img { transform: scale(1.07); }
.apn-card--d:hover .apn-card__reveal, .apn-card--d:focus-within .apn-card__reveal { grid-template-rows: 1fr; }
@media (hover: none) { .apn-card--d .apn-card__reveal { grid-template-rows: 1fr; } }

/* ---------- Archive grid ---------- */
.apn-grid {
	display: grid;
	grid-template-columns: repeat(var(--apn-per-row), minmax(0, 1fr));
	row-gap: calc(var(--apn-gap) + 16px);
	gap: var(--apn-gap);
}
.apn-pagination {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 60px;
}
.apn-pagination .page-numbers {
	min-width: 48px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #e1e1e1;
	border-radius: 4px;
	background: #f1f1f1;
	color: #555;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}
.apn-pagination .page-numbers.current {
	background: var(--apn-accent);
	border-color: var(--apn-accent);
	color: #fff;
}

/* ==========================================================
   Single news page — layouts A / B / C / D
   ========================================================== */
.apn-single {
	color: var(--apn-text);
	padding-bottom: 70px;
	/* themes that place content in a flex row would otherwise shrink us to nothing */
	display: block;
	width: 100%;
	max-width: 100%;
	flex: 1 1 100%;
	min-width: 0;
}
.apn-single .apn-wrap-x,
.apn-single .apn-news,
.apn-single .apn-grid,
.apn-single .apn-cols { width: 100%; }
/* top space: its height is the "top space" setting; it can carry a color or image */
.apn-top {
	height: var(--apn-top, 55px);
	width: 100vw;
	position: relative;
	left: 50%;
	transform: translateX(-50%);
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
}
.apn-single.has-top-bg .apn-wrap-x { padding-top: 36px; }
body.single-apn_news { overflow-x: clip; }
.apn-wrap-x { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.apn-cols {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 56px;
	align-items: start;
}
.apn-article { min-width: 0; }
.apn-article--narrow { max-width: 860px; }

.apn-head { margin-bottom: 24px; }
.apn-crumbs { display: flex; gap: 8px; margin-bottom: 12px; font-size: 14px; color: var(--apn-muted); }
.apn-crumbs a { color: var(--apn-muted) !important; text-decoration: none; }
.apn-crumbs a:hover { color: var(--apn-accent) !important; }
.apn-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.apn-tag {
	padding: 4px 14px;
	border-radius: 999px;
	background: var(--apn-accent);
	color: #fff !important;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}
.apn-title {
	margin: 0 0 16px;
	color: #1d1d1d;
	font-size: clamp(30px, 3.6vw, 48px);
	font-weight: 700;
	line-height: 1.15;
	text-wrap: balance;
}
.apn-meta { display: flex; flex-wrap: wrap; gap: 22px; font-size: 15px; color: #666; }
.apn-meta span { display: inline-flex; align-items: center; gap: 8px; }

.apn-figure { margin: 0 0 8px; }
.apn-figure__img {
	display: block;
	width: 100%;
	max-width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	background: #ddd;
}
.apn-layout-d .apn-figure__img { aspect-ratio: 21 / 9; }
.apn-layout-d .apn-cols { margin-top: 36px; }

.apn-lead {
	margin: 28px 0;
	padding-inline-start: 20px;
	border-inline-start: 4px solid var(--apn-accent);
	font-size: 21px;
	line-height: 1.6;
	color: #444;
}
.apn-layout-d .apn-lead { margin-top: 0; }
.apn-content { font-size: 18px; line-height: 1.85; }
.apn-content > * + * { margin-top: 1.2em; }
.apn-content h2, .apn-content h3, .apn-content h4 { margin-top: 1.8em; line-height: 1.3; color: #1e1e1e; }
.apn-content h2 { font-size: 30px; }
.apn-content h3 { font-size: 24px; }
.apn-content img, .apn-content figure { max-width: 100%; height: auto; border-radius: 8px; }
.apn-content figcaption { font-size: 14px; color: var(--apn-muted); text-align: center; margin-top: 8px; }
.apn-content a { color: var(--apn-accent); }
.apn-content blockquote {
	margin: 2em 0;
	padding: 24px 28px;
	background: #f1f1f1;
	border-inline-start: 4px solid var(--apn-accent);
	border-radius: 4px;
	font-size: 20px;
	font-style: italic;
}
.apn-content ul, .apn-content ol { padding-inline-start: 1.4em; }
.apn-content iframe, .apn-content video { max-width: 100%; }

.apn-article__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-top: 48px;
	padding: 22px 0;
	border-top: 1px solid var(--apn-line);
	border-bottom: 1px solid var(--apn-line);
}
.apn-share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.apn-share__label { font-weight: 600; margin-inline-end: 6px; }
.apn-share__btn {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--apn-line);
	background: #fff;
	color: #444 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	transition: background .2s, color .2s, border-color .2s;
}
.apn-share__btn:hover, .apn-share__btn.is-copied {
	background: var(--apn-accent);
	border-color: var(--apn-accent);
	color: #fff !important;
}
.apn-back {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 22px;
	border-radius: 4px;
	background: var(--apn-accent);
	color: #fff !important;
	font-weight: 600;
	text-decoration: none !important;
}
.apn-back:hover { filter: brightness(1.1); }
[dir="rtl"] .apn-back span { display: inline-block; transform: scaleX(-1); }

/* side column */
.apn-side { position: sticky; top: var(--apn-sticky, 24px); min-width: 0; }
.apn-side__h { margin: 0 0 18px; font-size: 22px; font-weight: 600; color: var(--apn-heading); }
.apn-side__list { display: flex; flex-direction: column; gap: 16px; }
.apn-item {
	display: grid;
	grid-template-columns: 104px minmax(0, 1fr);
	gap: 14px;
	align-items: center;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--apn-line);
	color: inherit !important;
	text-decoration: none !important;
}
.apn-item:last-child { border-bottom: 0; padding-bottom: 0; }
.apn-item__img { width: 104px; height: 78px; max-width: none; object-fit: cover; display: block; background: #ddd; }
.apn-item__img--empty { background: linear-gradient(135deg, #555, #2c2c2c); }
.apn-item__body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.apn-item__title {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.35;
	color: #222;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color .2s;
}
.apn-item__date { font-size: 13px; color: #888; }
.apn-item:hover .apn-item__title { color: var(--apn-accent); }
.apn-layout-b .apn-side .apn-card { height: 330px; }
.apn-layout-b .apn-side .apn-card--a, .apn-layout-b .apn-side .apn-card--d { height: 240px; }
.apn-layout-b .apn-side .apn-card .apn-card__title { font-size: 19px; }

/* layout C: slider under the article */
.apn-single .apn-more { padding: 0; margin-top: 64px; max-width: none; }

.apn-archive .apn-news { padding: 0; max-width: none; }
.apn-archive .apn-news__heading { margin-top: 24px; }

/* fixed card width (setting "card width" > 0) */
.apn-fixed-w .apn-track { grid-auto-columns: min(var(--apn-card-w), 100%); }
.apn-fixed-w .apn-grid { grid-template-columns: repeat(auto-fill, min(var(--apn-card-w), 100%)); justify-content: start; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.apn-cols { grid-template-columns: minmax(0, 1fr) 290px; gap: 36px; }
}
@media (max-width: 900px) {
	.apn-cols { grid-template-columns: 1fr; gap: 48px; }
	.apn-side { position: static; }
}
@media (max-width: 1024px) {
	.apn-track { grid-auto-columns: calc((100% - var(--apn-gap)) / 2); }
	.apn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.apn-fixed-w .apn-grid { grid-template-columns: repeat(auto-fill, min(var(--apn-card-w), 100%)); }
}
@media (max-width: 640px) {
	.apn-news { padding: 20px 16px 32px; }
	.apn-slider { padding: 0; }
	.apn-track, .apn-fixed-w .apn-track { grid-auto-columns: 100%; gap: 16px; }
	.apn-grid, .apn-fixed-w .apn-grid { grid-template-columns: 1fr; }
	.apn-arrow { width: 40px; height: 40px; top: 24%; }
	.apn-arrow--prev { inset-inline-start: 10px; }
	.apn-arrow--next { inset-inline-end: 10px; }
	.apn-wrap-x { padding: 0 16px; }
	.apn-lead { font-size: 18px; }
	.apn-content { font-size: 17px; }
	.apn-layout-d .apn-figure__img { aspect-ratio: 16 / 10; }
}
@media (prefers-reduced-motion: reduce) {
	.apn-news *, .apn-single * { transition: none !important; }
}
