/* ══════════════════════════════════════════════════════
   Risorse archive (page-risorse.php)
   Light page throughout. Radius rule: covers are books (3/6px),
   panels and cover plates 12px, every control is a pill.
   ══════════════════════════════════════════════════════ */
.rsr-page {
	/* Theme hooks: set --reslib-* in the theme, or let them fall back to the
	   ali-blocks --block-* tokens, then to neutral defaults. */
	--rsr-navy: var(--reslib-ink, var(--block-dark, #1f2933));
	--rsr-teal: var(--reslib-accent, var(--block-accent, #4f9d8f));          /* fills only */
	--rsr-teal-text: var(--reslib-accent-text, var(--block-accent-text, #2c6b61)); /* accent as ink */
	--rsr-btn-ink: var(--reslib-accent-ink, var(--block-accent-ink, #1f2933));   /* text on accent fills */
	--rsr-cream: var(--reslib-bg, var(--block-bg, #f8f7f4));
	--rsr-text: var(--reslib-text, var(--block-text, #2c2c2c));
	--rsr-muted: var(--reslib-muted, var(--block-text-secondary, #5c6370));
	--rsr-font-heading: var(--reslib-font-heading, var(--block-font-heading, Georgia, 'Times New Roman', serif));
	--rsr-font-body: var(--reslib-font-body, var(--block-font-body, inherit));
	--rsr-plate: #f1efea;
	--rsr-line: rgba(26, 35, 50, .1);
	--rsr-text: #2c2c2c;
	--rsr-muted: #5c6370;
	--rsr-radius: 12px;
	--rsr-ease: cubic-bezier(.16, 1, .3, 1);

	font-family: var(--rsr-font-body);
	color: var(--rsr-text);
	line-height: 1.6;
	background: #fff;
	overflow-x: clip;
}
.rsr-page *,
.rsr-page *::before,
.rsr-page *::after { box-sizing: border-box; }

.rsr-page h1,
.rsr-page h2,
.rsr-page h3 {
	font-family: var(--rsr-font-heading);
	font-weight: 400;
	line-height: 1.12;
	color: var(--rsr-navy);
	margin: 0;
}
.rsr-page h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); }
.rsr-page a { text-decoration: none; }
.rsr-page img { display: block; max-width: 100%; height: auto; }
.rsr-page [hidden] { display: none !important; }

.rsr-page .screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.rsr-wrap {
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 40px;
}

.rsr-label {
	margin: 0 0 18px;
	font-size: .78rem;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--rsr-teal-text);
}

/* ── Buttons (dark ink on the accent fill: light accents cannot carry white text) ── */
.rsr-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 28px;
	border: 0;
	border-radius: 999px;
	background: var(--rsr-teal);
	color: var(--rsr-btn-ink) !important;
	font: 700 .95rem/1 var(--rsr-font-body);
	cursor: pointer;
	white-space: nowrap;
	transition: transform .3s var(--rsr-ease), background-color .3s ease;
}
.rsr-btn:hover { background: color-mix(in srgb, var(--rsr-teal) 85%, #fff); transform: translateY(-2px); }
.rsr-btn:active { transform: translateY(0) scale(.98); }
.rsr-btn--ghost {
	background: transparent;
	color: var(--rsr-navy) !important;
	box-shadow: inset 0 0 0 1.5px var(--rsr-navy);
}
.rsr-btn--ghost:hover { background: var(--rsr-navy); color: #fff !important; }

.rsr-page :focus-visible {
	outline: 2px solid var(--rsr-teal-text);
	outline-offset: 3px;
}


/* ══════════════════════════════════════════════════════
   1. HERO
   ══════════════════════════════════════════════════════ */
.rsr-hero {
	background: var(--rsr-cream);
	padding: 72px 0 80px;
	border-bottom: 1px solid var(--rsr-line);
}
.rsr-hero__inner {
	max-width: 1240px;
	margin: 0 auto;
	padding: 0 40px;
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	gap: 56px;
	align-items: center;
}
.rsr-hero h1 {
	font-size: clamp(2.6rem, 5vw, 4rem);
	letter-spacing: -.01em;
}
.rsr-hero__lead {
	margin: 20px 0 0;
	max-width: 46ch;
	font-size: 1.15rem;
	color: var(--rsr-muted);
}
.rsr-hero__intro {
	margin: 12px 0 0;
	max-width: 60ch;
	color: var(--rsr-muted);
}
.rsr-hero__stats {
	display: flex;
	flex-wrap: wrap;
	gap: 16px 0;
	margin: 40px 0 0;
}
.rsr-hero__stats div {
	display: flex;
	flex-direction: column-reverse;
	padding: 0 28px;
	border-left: 1px solid var(--rsr-line);
}
.rsr-hero__stats div:first-child { padding-left: 0; border-left: 0; }
.rsr-hero__stats dd {
	margin: 0;
	font-family: var(--rsr-font-heading);
	font-size: 2rem;
	line-height: 1;
	color: var(--rsr-navy);
}
.rsr-hero__stats dt {
	margin-top: 6px;
	font-size: .85rem;
	color: var(--rsr-muted);
}

/* No covers to fan out (e.g. an empty catalogue): the copy takes the full width */
.rsr-hero__inner:not(:has(.rsr-hero__shelf)) { grid-template-columns: minmax(0, 1fr); }
.rsr-hero__inner:not(:has(.rsr-hero__shelf)) .rsr-hero__lead { max-width: 60ch; }

/* Fanned stack of real covers */
.rsr-hero__shelf {
	position: relative;
	height: 360px;
}
.rsr-hero__book {
	--w: 168px;
	position: absolute;
	bottom: 0;
	left: calc(50% - var(--w) / 2 + (var(--i) - 2) * 92px);
	width: var(--w);
	z-index: calc(10 - (var(--i) - 2) * (var(--i) - 2));
	transform: translateY(calc((var(--i) - 2) * (var(--i) - 2) * 10px)) rotate(calc((var(--i) - 2) * 5deg));
	transform-origin: 50% 100%;
}
.rsr-hero__book img {
	width: 100%;
	height: auto;
	border-radius: 3px 6px 6px 3px;
	box-shadow:
		0 1px 2px rgba(26, 35, 50, .15),
		0 24px 40px -16px rgba(26, 35, 50, .45);
}
@media (prefers-reduced-motion: no-preference) {
	.rsr-hero__book {
		animation: rsr-deal .9s var(--rsr-ease) both;
		animation-delay: calc(var(--i) * 70ms);
	}
	@keyframes rsr-deal {
		from { opacity: 0; transform: translateY(40px) rotate(0deg); }
	}
}


/* ══════════════════════════════════════════════════════
   COVERS (shared by grid, shelf, timeline)
   ══════════════════════════════════════════════════════ */
.rsr-cover img,
.rsr-cover__fallback {
	border-radius: 3px 6px 6px 3px;
	box-shadow:
		0 1px 2px rgba(26, 35, 50, .12),
		0 12px 24px -10px rgba(26, 35, 50, .4);
}

/* Typographic stand-in when an entry has no cover */
.rsr-cover__fallback {
	aspect-ratio: 2 / 3;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 18px 14px;
	background:
		linear-gradient(90deg, rgba(0, 0, 0, .14) 0 5px, transparent 5px),
		var(--tipo-color, var(--rsr-navy));
	color: #fff;
	overflow: hidden;
	text-align: left;
}
.rsr-cover__fallback-icon svg { width: 20px; height: 20px; opacity: .8; }
.rsr-cover__fallback-title {
	flex-shrink: 0;
	font-family: var(--rsr-font-heading);
	font-size: 1rem;
	line-height: 1.15;
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.rsr-cover__fallback-author {
	margin-top: auto;
	font-size: .66rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	opacity: .85;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}


/* ══════════════════════════════════════════════════════
   2. I NOSTRI CONSIGLI
   ══════════════════════════════════════════════════════ */
.rsr-featured { padding: 80px 0 24px; }
.rsr-shelf {
	list-style: none;
	margin: 32px 0 0;
	padding: 8px 0 24px;
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 168px;
	gap: 32px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
}
.rsr-shelf__item { scroll-snap-align: start; }
.rsr-shelf__item a {
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: var(--rsr-navy);
}
.rsr-shelf__cover {
	display: flex;
	align-items: flex-end;
	height: 240px;
	margin-bottom: 12px;
}
.rsr-shelf__cover img,
.rsr-shelf__cover .rsr-cover__fallback {
	width: 100%;
	max-height: 100%;
	object-fit: contain;
	object-position: bottom;
	transition: transform .4s var(--rsr-ease);
}
.rsr-shelf__item a:hover .rsr-cover img,
.rsr-shelf__item a:hover .rsr-cover__fallback { transform: translateY(-6px); }
.rsr-shelf__title {
	font-family: var(--rsr-font-heading);
	font-size: 1.05rem;
	line-height: 1.25;
}
.rsr-shelf__author { font-size: .85rem; color: var(--rsr-muted); }


/* ══════════════════════════════════════════════════════
   3. CATALOGUE
   ══════════════════════════════════════════════════════ */
.rsr-catalog { padding: 80px 0 96px; }
.rsr-catalog--empty { padding: 48px 0 64px; }

/* Toolbar */
/* minmax(0, 1fr): the nowrap chip row must scroll, not widen the track (and the page) on phones */
.rsr-toolbar {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 18px;
	margin: 28px 0 40px;
}
.rsr-search {
	position: relative;
	max-width: 560px;
}
.rsr-search svg {
	position: absolute;
	left: 20px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--rsr-muted);
	pointer-events: none;
}
.rsr-search input {
	width: 100%;
	height: 52px;
	padding: 0 22px 0 50px;
	border: 1px solid rgba(26, 35, 50, .22);
	border-radius: 999px;
	background: #fff;
	font: 1rem var(--rsr-font-body);
	color: var(--rsr-text);
	transition: border-color .2s ease, box-shadow .2s ease;
}
.rsr-search input::placeholder { color: #6b7280; }
.rsr-search input:focus {
	outline: none;
	border-color: var(--rsr-teal-text);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--rsr-teal) 25%, transparent);
}

.rsr-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	border: 0;
}
/* contain the hidden radio: unanchored, it escaped the scrolling chip row and widened the page */
.rsr-chip { position: relative; }
.rsr-chip input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.rsr-chip span {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	padding: 9px 18px;
	border-radius: 999px;
	box-shadow: inset 0 0 0 1px rgba(26, 35, 50, .18);
	font-size: .92rem;
	font-weight: 600;
	color: var(--rsr-navy);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.rsr-chip small { font-size: .78rem; font-weight: 500; opacity: .7; }
.rsr-chip span:hover { box-shadow: inset 0 0 0 1px var(--rsr-navy); }
.rsr-chip input:checked + span {
	background: var(--rsr-navy);
	color: #fff;
	box-shadow: none;
}
.rsr-chip input:focus-visible + span {
	outline: 2px solid var(--rsr-teal-text);
	outline-offset: 3px;
}

.rsr-toolbar__row {
	display: flex;
	align-items: center;
	gap: 16px;
	padding-top: 18px;
	border-top: 1px solid var(--rsr-line);
}
.rsr-filters-toggle {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 16px;
	border: 0;
	border-radius: 999px;
	background: var(--rsr-plate);
	font: 600 .9rem var(--rsr-font-body);
	color: var(--rsr-navy);
	cursor: pointer;
}
.rsr-filters-toggle[data-active]:not([data-active=""])::after {
	content: attr(data-active);
	display: inline-grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	border-radius: 999px;
	background: var(--rsr-navy);
	color: #fff;
	font-size: .72rem;
}
.rsr-count {
	margin: 0 auto 0 0;
	font-size: .92rem;
	color: var(--rsr-muted);
}
.rsr-view-toggle {
	display: inline-flex;
	padding: 4px;
	border-radius: 999px;
	background: var(--rsr-plate);
}
.rsr-view-btn {
	padding: 7px 16px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	font: 600 .88rem var(--rsr-font-body);
	color: var(--rsr-muted);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}
.rsr-view-btn--active {
	background: #fff;
	color: var(--rsr-navy);
	box-shadow: 0 1px 3px rgba(26, 35, 50, .12);
}

.rsr-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 16px 24px;
	padding: 20px 24px;
	border-radius: var(--rsr-radius);
	background: var(--rsr-plate);
}
.rsr-filter {
	display: grid;
	gap: 6px;
}
.rsr-filter label {
	font-size: .8rem;
	font-weight: 700;
	color: var(--rsr-navy);
}
.rsr-filter select {
	min-width: 190px;
	height: 42px;
	padding: 0 36px 0 16px;
	border: 1px solid rgba(26, 35, 50, .2);
	border-radius: 999px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231a2332' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 14px center;
	font: .92rem var(--rsr-font-body);
	color: var(--rsr-text);
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}
.rsr-check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	height: 42px;
	font-size: .92rem;
	color: var(--rsr-navy);
	cursor: pointer;
}
.rsr-check input { width: 18px; height: 18px; accent-color: var(--rsr-navy); }
.rsr-reset {
	height: 42px;
	padding: 0;
	border: 0;
	background: none;
	font: 600 .9rem var(--rsr-font-body);
	color: var(--rsr-teal-text);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* Grid of covers */
.rsr-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
	gap: 48px 32px;
}
.rsr-card {
	display: flex;
	flex-direction: column;
	color: var(--rsr-text);
	min-width: 0;
}
.rsr-card__cover {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 5;
	margin-bottom: 16px;
	padding: 12% 16%;
	border-radius: var(--rsr-radius);
	background: var(--rsr-plate);
	transition: background-color .3s ease;
}
.rsr-card__cover img,
.rsr-card__cover .rsr-cover__fallback {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: transform .45s var(--rsr-ease), box-shadow .45s var(--rsr-ease);
}
.rsr-card__cover .rsr-cover__fallback { height: 100%; }
.rsr-card:hover .rsr-card__cover { background: #eae7e0; }
.rsr-card:hover .rsr-cover img,
.rsr-card:hover .rsr-cover__fallback {
	transform: translateY(-6px) rotate(-1.5deg);
	box-shadow:
		0 1px 2px rgba(26, 35, 50, .12),
		0 22px 32px -12px rgba(26, 35, 50, .45);
}
.rsr-card:active .rsr-cover img { transform: translateY(-3px) scale(.99); }

.rsr-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 2px 8px;
	font-size: .8rem;
	font-weight: 600;
	color: var(--rsr-teal-text);
}
.rsr-card__pick {
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--rsr-navy);
	color: #fff;
	font-size: .72rem;
}
.rsr-card__title {
	margin: 6px 0 4px !important;
	font-size: 1.15rem;
	line-height: 1.22 !important;
	transition: color .2s ease;
}
.rsr-card:hover .rsr-card__title { color: var(--rsr-teal-text); }
.rsr-card__author {
	font-size: .88rem;
	font-weight: 600;
	color: var(--rsr-muted);
}
.rsr-card__summary {
	margin-top: 8px;
	font-size: .88rem;
	line-height: 1.55;
	color: var(--rsr-muted);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Timeline (by year) */
.rsr-tl-group {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr);
	gap: 24px;
	padding: 28px 0;
	border-top: 1px solid var(--rsr-line);
}
.rsr-tl-year {
	position: sticky;
	top: 88px;
	align-self: start;
	font-size: 2rem !important;
	color: var(--rsr-teal-text) !important;
}
.rsr-tl-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 18px 32px;
}
.rsr-tl-item a {
	display: flex;
	align-items: center;
	gap: 16px;
	color: var(--rsr-text);
}
.rsr-tl-thumb {
	flex: none;
	width: 48px;
	display: flex;
	justify-content: center;
}
.rsr-tl-thumb img,
.rsr-tl-thumb .rsr-cover__fallback {
	width: 48px;
	height: auto;
	box-shadow: 0 6px 12px -6px rgba(26, 35, 50, .45);
}
.rsr-tl-thumb .rsr-cover__fallback { padding: 0; }
.rsr-tl-thumb .rsr-cover__fallback > * { display: none; }
.rsr-tl-text { display: grid; gap: 2px; min-width: 0; }
.rsr-tl-title {
	font-family: var(--rsr-font-heading);
	font-size: 1.05rem;
	line-height: 1.25;
	color: var(--rsr-navy);
}
.rsr-tl-item a:hover .rsr-tl-title { color: var(--rsr-teal-text); }
.rsr-tl-author { font-size: .85rem; color: var(--rsr-muted); }

.rsr-empty {
	padding: 48px 0;
	text-align: center;
	font-size: 1.05rem;
	color: var(--rsr-muted);
}
.rsr-empty .rsr-reset { height: auto; margin-left: 6px; font-size: 1.05rem; }

.rsr-more {
	display: flex;
	justify-content: center;
	margin-top: 56px;
}


/* ══════════════════════════════════════════════════════
   4. CTA
   ══════════════════════════════════════════════════════ */
.rsr-cta {
	padding: 0 40px 96px;
}
.rsr-cta__inner {
	max-width: 1160px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas: "title btn" "text btn";
	align-items: center;
	gap: 12px 48px;
	padding: 48px 56px;
	border-radius: var(--rsr-radius);
	background: var(--rsr-cream);
	box-shadow: inset 0 0 0 1px var(--rsr-line);
}
.rsr-cta h2 { grid-area: title; }
.rsr-cta p {
	grid-area: text;
	margin: 0;
	max-width: 60ch;
	color: var(--rsr-muted);
}
.rsr-cta .rsr-btn { grid-area: btn; }


/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
	.rsr-hero__book { --w: 140px; left: calc(50% - var(--w) / 2 + (var(--i) - 2) * 72px); }
	.rsr-hero__shelf { height: 300px; }
}

@media (max-width: 900px) {
	.rsr-wrap,
	.rsr-hero__inner { padding: 0 20px; }
	.rsr-hero { padding: 40px 0 48px; }
	.rsr-hero__inner { grid-template-columns: 1fr; gap: 40px; }
	/* covers follow the title on phones: the page must open on its heading */
	.rsr-hero__shelf { height: 180px; }
	.rsr-hero__book { --w: 108px; left: calc(50% - var(--w) / 2 + (var(--i) - 2) * 56px); }
	.rsr-hero__stats { margin-top: 28px; }
	.rsr-hero__stats div { padding: 0 18px; }
	.rsr-hero__stats dd { font-size: 1.6rem; }
	.rsr-featured { padding: 56px 0 8px; }
	.rsr-shelf { grid-auto-columns: 136px; gap: 20px; }
	.rsr-shelf__cover { height: 196px; }
	.rsr-catalog { padding: 56px 0 72px; }
	.rsr-chips {
		flex-wrap: nowrap;
		overflow-x: auto;
		min-inline-size: 0; /* a fieldset defaults to min-content and would not scroll */
		margin: 0 -20px;
		padding: 0 20px 4px;
		scrollbar-width: none;
	}
	.rsr-chip span { white-space: nowrap; }
	.rsr-toolbar__row { flex-wrap: wrap; }
	.rsr-view-toggle { order: 3; }
	.rsr-filters { padding: 18px; }
	.rsr-filter, .rsr-filter select { width: 100%; }
	.rsr-tl-group { grid-template-columns: 1fr; gap: 12px; }
	.rsr-tl-year { position: static; font-size: 1.6rem !important; }
	.rsr-tl-list { grid-template-columns: 1fr; }
	.rsr-cta { padding: 0 20px 72px; }
	.rsr-cta__inner {
		grid-template-columns: 1fr;
		grid-template-areas: "title" "text" "btn";
		padding: 32px 24px;
	}
	.rsr-cta .rsr-btn { justify-self: start; }
	/* first section after the hero must not wait for the reveal observer */
	.rsr-catalog .reveal { opacity: 1; transform: none; }
}

@media (max-width: 520px) {
	.rsr-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 32px 16px;
	}
	.rsr-card__cover { padding: 12%; margin-bottom: 12px; }
	.rsr-card__title { font-size: 1rem; }
	.rsr-card__author { font-size: .82rem; }
	.rsr-card__summary { display: none; }
	.rsr-hero__stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; }
	.rsr-hero__stats div { padding: 0 12px; }
	.rsr-hero__stats dd { font-size: 1.4rem; }
	.rsr-hero__stats dt { font-size: .75rem; }
	.rsr-cover__fallback { padding: 10px 8px; gap: 6px; }
	.rsr-cover__fallback-icon { display: none; }
	.rsr-cover__fallback-title { font-size: .8rem; }
	.rsr-cover__fallback-author { font-size: .58rem; }
	.rsr-view-btn { padding: 7px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.rsr-page * { transition: none !important; }
}

/* Language note on cards not readable in Italian */
.rsr-card__lang {
	font-weight: 500;
	color: var(--rsr-muted);
}
