/* ═════════════════════════════════════════════════════════════════════════════
   PWR Yearbooks — magazine grid + flipbook modal
   Loaded only on pages that use the [pwr_yearbooks] shortcode.
   ══════════════════════════════════════════════════════════════════════════ */

.pwr-yearbooks {
	margin: 34px 0 20px;
	padding: 0;
}
.pwr-yearbooks-title {
	color: var(--gold, #1d9bb8);
	font-size: 1.35rem;
	font-weight: 900;
	text-align: center;
	margin: 0 0 18px;
}

.pwr-yearbooks-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 18px;
	max-width: 900px;
	margin: 0 auto;
}
@media (max-width: 780px) { .pwr-yearbooks-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .pwr-yearbooks-grid { grid-template-columns: 1fr; max-width: 320px; } }

.pwr-yearbook-card {
	background: transparent;
	border: 0;
	padding: 0;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	font-family: inherit;
	transition: transform .2s;
}
.pwr-yearbook-card:hover { transform: translateY(-4px); }

.pwr-yearbook-cover {
	width: 100%;
	aspect-ratio: 3 / 4;
	background: #e5eef2 center/cover no-repeat;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .08);
	position: relative;
	overflow: hidden;
	transition: box-shadow .25s;
}
.pwr-yearbook-card:hover .pwr-yearbook-cover {
	box-shadow: 0 14px 30px rgba(29, 155, 184, .3), 0 4px 12px rgba(0, 0, 0, .12);
}
.pwr-yearbook-open {
	position: absolute;
	inset: auto 0 0 0;
	padding: 10px;
	background: linear-gradient(0deg, rgba(0, 0, 0, .55) 0%, transparent 100%);
	color: #fff;
	font-size: .85rem;
	font-weight: 700;
	text-align: center;
	opacity: 0;
	transition: opacity .2s;
}
.pwr-yearbook-card:hover .pwr-yearbook-open { opacity: 1; }

.pwr-yearbook-caption {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	text-align: center;
}
.pwr-yearbook-year {
	color: var(--gold, #1d9bb8);
	font-weight: 900;
	font-size: 1.15rem;
}
.pwr-yearbook-label {
	color: var(--text, #14323d);
	font-weight: 600;
	font-size: .95rem;
	max-width: 220px;
	line-height: 1.35;
}


/* ═════════════════════════════════════════════════════════════════════════════
   Modal — full-screen dark overlay, flipbook centered, chrome top & bottom.
   ══════════════════════════════════════════════════════════════════════════ */

.pwr-yearbook-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(15, 20, 24, .96);
	display: flex;
	flex-direction: column;
	color: #fff;
	animation: pwrYbFadeIn .2s ease-out;
}
body.pwr-yb-open { overflow: hidden; }
@keyframes pwrYbFadeIn { from { opacity: 0; } to { opacity: 1; } }

.pwr-yb-topbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 16px;
	background: rgba(0, 0, 0, .35);
	border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.pwr-yb-topbar-title {
	flex: 1;
	font-weight: 700;
	font-size: 1rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.pwr-yb-topbar-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}
.pwr-yb-btn {
	background: rgba(255, 255, 255, .1);
	color: #fff;
	border: 1px solid rgba(255, 255, 255, .18);
	border-radius: 8px;
	padding: 8px 14px;
	font-size: .9rem;
	font-weight: 700;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s;
	font-family: inherit;
}
.pwr-yb-btn:hover { background: rgba(255, 255, 255, .2); }
.pwr-yb-close { padding: 6px 12px; font-size: 1.1rem; line-height: 1; }

.pwr-yb-stage {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	padding: 20px;
	overflow: hidden;
	min-height: 0;
}
.pwr-yb-flip {
	max-width: 100%;
	max-height: 100%;
}

.pwr-yb-nav {
	background: rgba(255, 255, 255, .08);
	border: 1px solid rgba(255, 255, 255, .18);
	color: #fff;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	display: grid;
	place-items: center;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	font-family: inherit;
	transition: background .15s;
}
.pwr-yb-nav:hover { background: rgba(255, 255, 255, .2); }
.pwr-yb-prev { left: 12px; }
.pwr-yb-next { right: 12px; }

.pwr-yb-status {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 10px;
	background: rgba(0, 0, 0, .35);
	border-top: 1px solid rgba(255, 255, 255, .08);
	font-size: .85rem;
	color: rgba(255, 255, 255, .85);
	min-height: 40px;
}

/* Book pages — used by StPageFlip via loadFromHTML */
.pwr-yb-book { margin: 0 auto; }
.pwr-yb-page {
	background: #fff;
	overflow: hidden;
}
.pwr-yb-page img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Toast — the copy-link confirmation */
.pwr-yb-toast {
	position: absolute;
	top: 60px;
	left: 50%;
	transform: translate(-50%, -10px);
	background: rgba(29, 155, 184, .95);
	color: #fff;
	padding: 8px 16px;
	border-radius: 20px;
	font-size: .85rem;
	font-weight: 700;
	opacity: 0;
	transition: opacity .2s, transform .2s;
	pointer-events: none;
	white-space: nowrap;
}
.pwr-yb-toast.show { opacity: 1; transform: translate(-50%, 0); }


/* Phone tweaks — smaller chrome, tighter nav buttons */
@media (max-width: 640px) {
	.pwr-yb-topbar { padding: 8px 10px; gap: 6px; }
	.pwr-yb-topbar-title { font-size: .85rem; }
	.pwr-yb-btn { padding: 6px 10px; font-size: .8rem; }
	.pwr-yb-nav { width: 36px; height: 36px; font-size: 1.3rem; }
	.pwr-yb-prev { left: 4px; }
	.pwr-yb-next { right: 4px; }
	.pwr-yb-stage { padding: 8px; }
}

/* ═════════════════════════════════════════════════════════════════════════════
 * v2.9.7 — three critical bug fixes:
 *   1. Modal was auto-opening on page load because `display: flex` was
 *      overriding the [hidden] attribute's default `display: none`.
 *   2. RTL arrows pointed the wrong way — swap positions AND swap the arrow
 *      characters so left/right feel correct in a right-to-left flow.
 *   3. Cover images that fail to load now show a nice gold-on-navy placeholder
 *      with the year, so the cards never look broken.
 * ══════════════════════════════════════════════════════════════════════════ */

/* CRITICAL: honour [hidden] so the modal is invisible until openViewer() runs.
 * Without !important the earlier `display: flex` wins and the modal shows on
 * page load — exactly what the client just reported. */
.pwr-yearbook-modal[hidden] { display: none !important; }

/* RTL arrow positions + glyphs are handled by the v2.9.8 SVG rules
 * further down (.pwr-yearbook-modal[dir="rtl"] .pwr-yb-*::before). The
 * v2.9.7 text-arrow rules that used to live here have been REMOVED because
 * they were painting a second `›`/`‹` on top of the new SVG chevron. */


/* Cover fallback: if the JPG doesn't load, show a nicely styled placeholder
 * instead of an empty grey box. The year is already in the caption so the
 * card doesn't look broken even without a cover image at all. */
.pwr-yearbook-cover {
	background-color: #14323d;
	background-image: linear-gradient(135deg, #14323d 0%, #1d9bb8 100%);
}
.pwr-yearbook-card[data-cover]:not([data-cover=""]) .pwr-yearbook-cover::after {
	/* Only show the book emoji when there's NO cover URL. When one is set,
	 * the inline style on .pwr-yearbook-cover overrides our gradient with
	 * the real image and we hide this decorative fallback. */
	content: none;
}
.pwr-yearbook-cover::after {
	content: '📖';
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 3rem;
	color: rgba(245, 204, 98, .35);
	pointer-events: none;
}

/* ═════════════════════════════════════════════════════════════════════════════
 * v2.9.8 — bigger viewer, zoom controls, proper RTL arrows, no more inward glyphs
 * ══════════════════════════════════════════════════════════════════════════ */

/* Give the stage almost the full modal area — old 20px padding wasted a lot
 * of screen. The play controls stay outside so no chrome overlaps the book. */
.pwr-yb-stage { padding: 8px 60px !important; }
@media (max-width: 720px) { .pwr-yb-stage { padding: 4px 48px !important; } }

/* A scrollable wrapper for the flipbook — needed once zoom > 1x so the user
 * can pan around the enlarged page. */
.pwr-yb-flip-wrap {
	flex: 1;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-height: 0;
}
.pwr-yb-flip {
	transform-origin: center center;
	transition: transform .18s ease-out;
	max-width: none;
	max-height: none;
	margin: 0 auto;      /* fallback horizontal centering */
	display: block;
}
.pwr-yb-flip .stf__parent,
.pwr-yb-flip .stf__block,
.pwr-yb-book { margin: 0 auto !important; }

/* Circular icon-only buttons for zoom controls, matches the visual weight of
 * the existing top-bar buttons but tighter. */
.pwr-yb-icon-btn {
	width: 38px; height: 38px;
	padding: 0 !important;
	display: grid; place-items: center;
	font-size: 1.25rem; font-weight: 700; line-height: 1;
}

/* ---- Page-flip arrows — rebuild from scratch with SVG so they always
 * point OUTWARD regardless of language direction. HTML no longer contains
 * arrow glyphs; CSS pseudo-elements draw them from an inline SVG. -------- */
.pwr-yb-nav {
	font-size: 0 !important; /* hide any stray text content */
	background: rgba(255, 255, 255, .12);
	backdrop-filter: blur(4px);
}
.pwr-yb-nav::before {
	content: '';
	display: block;
	width: 22px; height: 22px;
	background-repeat: no-repeat;
	background-position: center;
	background-size: contain;
}
/* LTR: prev button sits on LEFT, arrow points LEFT (outward). */
.pwr-yb-prev::before {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='15 18 9 12 15 6'/></svg>");
}
/* LTR: next button sits on RIGHT, arrow points RIGHT (outward). */
.pwr-yb-next::before {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
}
/* RTL: swap BOTH the position AND the arrow so each button points outward
 * from its edge in the RTL reading flow. */
.pwr-yearbook-modal[dir="rtl"] .pwr-yb-prev { left: auto; right: 12px; }
.pwr-yearbook-modal[dir="rtl"] .pwr-yb-next { right: auto; left: 12px; }
.pwr-yearbook-modal[dir="rtl"] .pwr-yb-prev::before {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
}
.pwr-yearbook-modal[dir="rtl"] .pwr-yb-next::before {
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='15 18 9 12 15 6'/></svg>");
}
