/* E-Paper Management — cards, latest, archive, calendar. Themes may override via the CSS variables. */
:root {
	--epm-primary: #c4161c;
	--epm-primary-ink: #fff;
	--epm-ink: #1b1b1b;
	--epm-muted: #6b665e;
	--epm-line: #e4dfd5;
	--epm-surface: #fff;
	--epm-bg: #f7f5f0;
	--epm-radius: 10px;
	--epm-shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
}

.epm-container { width: min(1200px, 100% - 32px); margin-inline: auto; }
.epm-main { padding-block: 24px 48px; }
.epm-page-header { margin: 8px 0 24px; }
.epm-page-title { margin: 0; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.3; color: var(--epm-ink); }
.epm-page-sub, .epm-lead { color: var(--epm-muted); margin: 6px 0 0; }
.epm-lead { margin-bottom: 20px; }
.epm-empty, .epm-notice { padding: 24px; background: var(--epm-surface); border: 1px dashed var(--epm-line); border-radius: var(--epm-radius); text-align: center; color: var(--epm-muted); }

/* Buttons */
.epm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, transform .15s; }
.epm-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--epm-primary) 40%, transparent); outline-offset: 2px; }
.epm-btn-primary { background: var(--epm-primary); color: var(--epm-primary-ink); }
.epm-btn-primary:hover { background: color-mix(in srgb, var(--epm-primary) 85%, #000); color: var(--epm-primary-ink); }
.epm-btn-ghost { background: transparent; color: var(--epm-ink); border-color: var(--epm-line); }
.epm-btn-ghost:hover { border-color: var(--epm-ink); color: var(--epm-ink); }
.epm-btn-lg { min-height: 48px; padding: 10px 22px; font-size: 1.05rem; }

/* Breadcrumbs */
.epm-breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 8px; padding: 0; font-size: .9rem; color: var(--epm-muted); }
.epm-breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.epm-breadcrumbs a { color: inherit; text-decoration: none; }
.epm-breadcrumbs a:hover { color: var(--epm-primary); }

/* Cover */
.epm-cover-img { display: block; width: 100%; height: auto; }
.epm-cover-placeholder { aspect-ratio: 3 / 4.6; display: grid; place-content: center; gap: 6px; text-align: center; background: repeating-linear-gradient(0deg, #fff 0 22px, #f1eee8 22px 23px); color: var(--epm-ink); padding: 16px; }
.epm-cover-placeholder span { font-weight: 700; font-size: 1.25rem; }
.epm-cover-placeholder small { color: var(--epm-muted); }

/* Grid + card */
.epm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px; }
.epm-card { display: flex; flex-direction: column; background: var(--epm-surface); border: 1px solid var(--epm-line); border-radius: var(--epm-radius); overflow: hidden; transition: box-shadow .2s, transform .2s; }
.epm-card:hover { box-shadow: var(--epm-shadow); transform: translateY(-2px); }
.epm-card-cover { position: relative; display: block; background: #eee; aspect-ratio: 3 / 4.4; overflow: hidden; border-bottom: 1px solid var(--epm-line); }
.epm-card-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.epm-card-cover .epm-cover-placeholder { height: 100%; aspect-ratio: auto; }
.epm-badge { position: absolute; top: 10px; left: 10px; background: var(--epm-primary); color: var(--epm-primary-ink); font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.epm-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.epm-card-date { margin: 0; font-size: 1.08rem; line-height: 1.35; }
.epm-card-date a { color: var(--epm-ink); text-decoration: none; }
.epm-card-date a:hover { color: var(--epm-primary); }
.epm-card-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--epm-muted); font-size: .86rem; }
.epm-card-meta span + span::before { content: "•"; margin-right: 10px; }
.epm-card-meta span:nth-child(3) { flex-basis: 100%; }
.epm-card-meta span:nth-child(3)::before { content: none; }
.epm-card-actions { margin-top: auto; padding-top: 6px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.epm-card-actions .epm-btn { min-height: 36px; padding: 6px 10px; font-size: .92rem; }
.epm-card-actions .epm-btn:only-child { grid-column: 1 / -1; }

/* Latest */
.epm-latest { display: grid; grid-template-columns: minmax(260px, 420px) 1fr; gap: clamp(20px, 4vw, 48px); align-items: center; }
.epm-latest-cover { display: block; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 20px 50px -12px rgba(0,0,0,.35); transform: rotate(-1deg); transition: transform .25s; }
.epm-latest-cover:hover { transform: rotate(0) scale(1.01); }
.epm-kicker { display: inline-block; background: color-mix(in srgb, var(--epm-primary) 12%, transparent); color: var(--epm-primary); font-weight: 700; font-size: .9rem; padding: 4px 12px; border-radius: 99px; }
.epm-latest-date { font-size: clamp(1.8rem, 1.2rem + 2.6vw, 3rem); line-height: 1.2; margin: 12px 0 4px; color: var(--epm-ink); }
.epm-latest-sub { margin: 0 0 18px; color: var(--epm-muted); }
.epm-facts { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0 0 20px; }
.epm-facts li { display: flex; flex-direction: column; min-width: 96px; padding: 10px 14px; background: var(--epm-surface); border: 1px solid var(--epm-line); border-radius: 8px; }
.epm-facts span { font-size: .8rem; color: var(--epm-muted); }
.epm-facts strong { font-size: 1.05rem; }
.epm-latest-desc { color: var(--epm-muted); margin: 0 0 18px; }
.epm-latest-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.epm-other-editions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--epm-muted); font-size: .92rem; }
.epm-other-editions a { color: var(--epm-primary); font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; }

/* Archive */
.epm-archive { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.epm-archive-side { display: grid; gap: 18px; position: sticky; top: 90px; }
.epm-panel { background: var(--epm-surface); border: 1px solid var(--epm-line); border-radius: var(--epm-radius); padding: 16px; }
.epm-panel-title { margin: 0 0 12px; font-size: 1rem; }
.epm-date-search { display: flex; gap: 8px; }
.epm-date-search input { flex: 1; min-width: 0; min-height: 40px; padding: 6px 10px; border: 1px solid var(--epm-line); border-radius: 8px; font: inherit; background: #fff; color: var(--epm-ink); }
.epm-date-search button { min-height: 40px; padding: 6px 14px; border: 0; border-radius: 8px; background: var(--epm-primary); color: var(--epm-primary-ink); font: inherit; font-weight: 600; cursor: pointer; }
.epm-filter { display: grid; gap: 10px; }
.epm-filter label { display: grid; gap: 4px; font-size: .9rem; color: var(--epm-muted); }
.epm-filter select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--epm-line); border-radius: 8px; background: #fff; font: inherit; color: var(--epm-ink); }
.epm-filter-actions { display: flex; gap: 8px; }
.epm-filter-actions .epm-btn { flex: 1; }
.epm-filter-summary { margin: 0 0 14px; font-weight: 600; color: var(--epm-ink); }

/* Calendar */
.epm-calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.epm-cal-nav { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--epm-ink); text-decoration: none; font-size: 1.4rem; line-height: 1; border: 1px solid var(--epm-line); }
.epm-cal-nav:hover { border-color: var(--epm-primary); color: var(--epm-primary); }
.epm-calendar table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.epm-calendar th { font-size: .72rem; font-weight: 600; color: var(--epm-muted); padding: 4px 0; }
.epm-calendar td { padding: 2px; }
.epm-calendar td > * { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; font-size: .88rem; color: #b9b3a8; }
.epm-calendar a.has-paper { color: var(--epm-ink); background: color-mix(in srgb, var(--epm-primary) 10%, #fff); font-weight: 700; text-decoration: none; }
.epm-calendar a.has-paper:hover { background: var(--epm-primary); color: var(--epm-primary-ink); }
.epm-calendar td.is-today > * { outline: 2px solid var(--epm-primary); outline-offset: -2px; }

/* Pagination */
.epm-pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 32px; }
.epm-pagination .page-numbers { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--epm-line); border-radius: 8px; background: var(--epm-surface); color: var(--epm-ink); text-decoration: none; }
.epm-pagination .page-numbers.current { background: var(--epm-primary); border-color: var(--epm-primary); color: var(--epm-primary-ink); font-weight: 700; }
.epm-pagination a.page-numbers:hover { border-color: var(--epm-primary); color: var(--epm-primary); }

.epm-notfound { display: grid; gap: 18px; max-width: 420px; }
.epm-date-title { margin: 0 0 14px; }

@media (max-width: 900px) {
	.epm-archive { grid-template-columns: 1fr; }
	.epm-archive-side { position: static; }
	.epm-latest { grid-template-columns: 1fr; }
	.epm-latest-cover { max-width: 360px; margin-inline: auto; width: 100%; transform: none; }
	.epm-latest-info { text-align: center; }
	.epm-facts, .epm-latest-actions, .epm-other-editions { justify-content: center; }
}
@media (max-width: 520px) {
	.epm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.epm-card-body { padding: 10px; }
	.epm-card-actions { grid-template-columns: 1fr; }
	.epm-latest-actions .epm-btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
	.epm-card, .epm-latest-cover { transition: none; }
}
