/*
 * Downloads page ([pejvak_downloads] list + the page template). Loaded only on pages that contain the shortcode.
 * Same tokens as the Services pages: #233A7A / #29AAE1, page #F5F7FA, white cards, 14px radii, a 1120px column.
 * Header/footer: the same shared templates as /projects/ (white header at the top, navy when sticky); nothing here offsets for them.
 */

.pjd-page,
.pjd-list {
	--pjd-primary: #233A7A;
	--pjd-secondary: #29AAE1;
	--pjd-bg: #F5F7FA;
	--pjd-line: #E1E8F0;
	--pjd-text: #243951;
	--pjd-muted: #56677C;
	--pjd-gutter: clamp(16px, 3vw, 32px);
	--pjd-radius: 14px;
	font-family: var(--pejvak-font);
	direction: rtl;
	text-align: start;
	color: var(--pjd-text);
	line-height: 1.8;
	word-spacing: normal;
}
.pjd-page *, .pjd-page *::before, .pjd-page *::after,
.pjd-list *, .pjd-list *::before, .pjd-list *::after { box-sizing: border-box; }
.pjd-page { background: var(--pjd-bg); width: 100%; font-size: 16px; }
/* the parent theme sets p { margin: 0 0 30px; word-spacing: 1px } */
.pjd-page p, .pjd-list p { margin: 0; word-spacing: normal; }
.pjd-page h1, .pjd-list h2 { margin: 0; letter-spacing: normal; word-spacing: normal; unicode-bidi: isolate; }

.pjd-inner {
	max-width: calc(1140px + 2 * var(--pjd-gutter)); /* same 1140px container as the Projects page */
	margin: 0 auto;
	padding: 40px var(--pjd-gutter);                 /* Projects section padding: 40px */
}

/* ---- page shell: header / flexible main / footer. On a short page the (shared) footer sits at the bottom of the
   viewport; on a long page it simply follows the content. The footer stays in normal flow. ---- */
body.pejvak-downloads-page {
	display: flex;
	flex-direction: column;
	min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
	min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
}
body.pejvak-downloads-page > #pj-downloads { flex: 1 0 auto; }
body.pejvak-downloads-page > footer.iteck-custom-footer { flex: 0 0 auto; }

/* ---- heading + intro (normal flow, right below the header) ---- */
.pjd-hero { margin: 0 0 16px; text-align: center; }
.pjd-hero h1 {
	font-size: 2rem; /* Projects heading: 2rem, bold, #233A7A, centred */
	font-weight: 700;
	line-height: 1.45;
	color: var(--pjd-primary);
	text-wrap: balance;
}
.pjd-content > p:first-child,
.pjd-content .pjd-intro { max-width: 900px; margin: 0 auto 36px; font-size: 17px; line-height: 1.7; text-align: center; color: #475569; } /* Projects intro */

/* ---- grid: up to 3 columns on wide screens, 2 on tablets, 1 on phones; cards never stretch ---- */
.pjd-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 352px));
	gap: 24px;
	justify-content: center; /* auto-fit drops empty tracks, so one card is centred under the centred heading */
	align-items: stretch;
}
.pjd-grid > * { min-width: 0; }

.pjd-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 20px;
	background: #fff;
	border: 1px solid var(--pjd-line);
	border-radius: var(--pjd-radius);
	box-shadow: 0 1px 2px rgba(35, 58, 122, 0.05);
}
.pjd-card[hidden] { display: none; }

.pjd-card-head { display: flex; align-items: center; gap: 14px; }
.pjd-icon {
	flex: 0 0 56px; width: 56px; height: 56px;
	display: inline-flex; align-items: center; justify-content: center;
	color: var(--pjd-primary);
	background: rgba(41, 170, 225, 0.12);
	border-radius: 14px;
}
/* A supplied app logo: shown as it is (its own colours, proportions and transparency), never inside the tinted
   generic-icon box, never recoloured, stretched or cropped. */
.pjd-icon--logo { flex: 0 0 auto; width: auto; height: auto; background: none; border-radius: 0; }
.pjd-logo { display: block; width: 72px; height: 72px; padding: 4px; object-fit: contain; background: none; border: 0; }
.pjd-name { font-size: 1.1875rem; font-weight: 700; line-height: 1.5; color: var(--pjd-primary); }
.pjd-desc { font-size: 1rem; color: var(--pjd-text); }

.pjd-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pjd-meta li {
	display: inline-flex; align-items: baseline; gap: 6px;
	padding: 4px 10px;
	background: #F0F5FA; border: 1px solid #E3EBF4; border-radius: 10px;
	font-size: 0.8125rem; line-height: 1.7;
}
.pjd-meta span { color: var(--pjd-muted); }
.pjd-meta strong { font-weight: 600; color: var(--pjd-primary); unicode-bidi: isolate; }

/* ---- the one prominent action ---- */
.pjd-download {
	display: flex; align-items: center; justify-content: center; gap: 10px;
	margin-top: auto;
	min-height: 48px; padding: 12px 20px;
	background: var(--pjd-primary); color: #fff;
	border-radius: 12px;
	font-size: 1rem; font-weight: 700; line-height: 1.4; text-decoration: none;
	transition: background-color 0.15s ease;
}
.pjd-download svg { flex: 0 0 auto; }
.pjd-download:hover { background: #36549A; color: #fff; text-decoration: none; }
.pjd-download:focus-visible { outline: 3px solid var(--pjd-secondary); outline-offset: 2px; color: #fff; }

/* ---- optional expandable parts ---- */
.pjd-details { border-top: 1px solid #EDF1F6; }
.pjd-details summary {
	display: flex; align-items: center;
	min-height: 44px;
	font-size: 0.9375rem; font-weight: 600; color: var(--pjd-primary);
	cursor: pointer;
}
.pjd-details summary:focus-visible { outline: 2px solid var(--pjd-secondary); outline-offset: 2px; border-radius: 6px; }
.pjd-detail-body { padding: 0 0 12px; font-size: 0.9375rem; color: var(--pjd-text); }

/* ---- empty state + filters (filters exist only with more than 6 apps) ---- */
.pjd-empty, .pjd-none {
	padding: 24px; max-width: 520px;
	background: #fff; border: 1px solid var(--pjd-line); border-radius: var(--pjd-radius);
	color: var(--pjd-muted);
}
.pjd-filters { display: flex; flex-wrap: wrap; gap: 16px; margin: 0 0 24px; }
.pjd-filter { display: grid; gap: 4px; min-width: min(100%, 220px); font-size: 0.875rem; color: var(--pjd-muted); }
.pjd-filter input, .pjd-filter select {
	min-height: 44px; padding: 8px 12px; width: 100%;
	font: inherit; color: var(--pjd-text);
	background: #fff; border: 1px solid #CBD8E5; border-radius: 10px;
}
.pjd-filter input:focus-visible, .pjd-filter select:focus-visible { outline: 2px solid var(--pjd-secondary); outline-offset: 2px; }

@media (max-width: 600px) {
	.pjd-logo { width: 56px; height: 56px; padding: 3px; }
	.pjd-inner { padding-top: 24px; padding-bottom: 48px; }
	.pjd-grid { gap: 16px; }
	.pjd-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	.pjd-download { transition: none; }
}
