/* ABA Training Center: photo galleries, event timeline and photo viewer (v1.0.4). */

/* ---------- Justified gallery: equal-height rows, no cropping ---------- */
.wp-block-gallery.abatc-gallery {
	--abatc-row: 210px;
	display: flex !important;
	flex-wrap: wrap;
	gap: 10px !important;
	margin: 0;
}
.wp-block-gallery.abatc-gallery::after { content: ""; flex: 9999 1 0; }
.wp-block-gallery.abatc-gallery figure.wp-block-image:not(#individual-image) {
	--ar: 1.3333;
	flex: var(--ar) 1 calc(var(--ar) * var(--abatc-row)) !important;
	width: auto !important;
	max-width: 100%;
	margin: 0 !important;
	position: relative;
	overflow: hidden;
	border-radius: var(--abatc-radius-sm, 12px);
	background: var(--abatc-sage, #E4F1EE);
}
.wp-block-gallery.abatc-gallery figure.wp-block-image img {
	display: block;
	width: 100% !important;
	height: auto !important;
	aspect-ratio: var(--ar);
	object-fit: cover; /* only fills sub-pixel rounding; ratio matches the photo */
	transition: transform .35s ease, filter .35s ease;
}
.wp-block-gallery.abatc-gallery--large { --abatc-row: 200px; }
.abatc-album.abatc-album--plain { background: none; border: 0; box-shadow: none; padding: 0 !important; }
/* Event albums with up to 5 photos: always one even row on wider screens. */
@media (min-width: 782px) {
	.abatc-album .wp-block-gallery.abatc-gallery:not(:has(> figure:nth-of-type(6))) { flex-wrap: nowrap; }
	.abatc-album .wp-block-gallery.abatc-gallery:not(:has(> figure:nth-of-type(6)))::after { display: none; }
}
@media (max-width: 781px) {
	.wp-block-gallery.abatc-gallery { --abatc-row: 100px; gap: 8px !important; }
	.wp-block-gallery.abatc-gallery--large { --abatc-row: 110px; }
}

/* Zoom affordance on any viewer link. */
a.abatc-lb-link { display: block; position: relative; cursor: zoom-in; }
a.abatc-lb-link::after {
	content: ""; position: absolute; right: .6rem; bottom: .6rem; width: 2.1rem; height: 2.1rem; border-radius: 50%;
	background: rgba(22, 91, 84, .82) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6'/%3E%3Cpath d='M20 20l-4.2-4.2M11 8.5v5M8.5 11h5'/%3E%3C/g%3E%3C/svg%3E") center / 60% no-repeat;
	opacity: 0; transform: scale(.85); transition: opacity .2s ease, transform .2s ease;
}
a.abatc-lb-link:hover img { transform: scale(1.03); }
a.abatc-lb-link:hover::after, a.abatc-lb-link:focus-visible::after { opacity: 1; transform: none; }
@media (hover: none) { a.abatc-lb-link::after { opacity: .9; transform: none; width: 1.8rem; height: 1.8rem; } }

/* ---------- Event albums ---------- */
.abatc-album {
	background: #fff; border: 1px solid var(--abatc-line); border-radius: var(--abatc-radius-md);
	padding: clamp(1rem, 2.5vw, 1.5rem) !important; box-shadow: var(--abatc-shadow);
}
.abatc-album + .abatc-album { margin-top: 1.25rem !important; }
.abatc-album__head { gap: .35rem 1rem !important; margin-bottom: 1rem !important; align-items: baseline; }
.abatc-album__head h3 { margin: 0 !important; font-size: clamp(1.2rem, 2.2vw, 1.45rem); letter-spacing: -.015em; }
.abatc-album__meta {
	margin: 0 !important; display: inline-flex; align-items: center; gap: .4rem;
	font-size: .9rem; font-weight: 600; color: var(--abatc-deep);
	background: var(--abatc-sage); border-radius: 999px; padding: .3rem .8rem .3rem .65rem;
}
.abatc-album__meta::before {
	content: ""; width: .95rem; height: .95rem; flex: none;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z' fill='none' stroke='%23259D91' stroke-width='2.2' stroke-linejoin='round'/%3E%3Ccircle cx='12' cy='9.5' r='2.4' fill='%23259D91'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- Year-by-year timeline ---------- */
.abatc-years { position: relative; }
.abatc-year {
	display: grid !important; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0 2rem;
	position: relative; padding-bottom: clamp(2rem, 5vw, 3.5rem);
}
.abatc-year > * { margin-block: 0 !important; }
.abatc-year::before {
	content: ""; position: absolute; left: 8.5rem; margin-left: 1rem; top: .6rem; bottom: 0; width: 2px;
	background: linear-gradient(var(--abatc-sea), var(--abatc-line));
}
.abatc-year:last-child::before { bottom: 2rem; }
.abatc-year__label {
	position: sticky; top: 110px; align-self: start;
	font-size: clamp(2.2rem, 4.5vw, 3.25rem); font-weight: 800; letter-spacing: -.04em; line-height: 1;
	color: var(--abatc-deep); text-align: right; padding-right: .9rem;
}
.abatc-year__label::after {
	content: ""; position: absolute; right: -1rem; top: .55rem; transform: translateX(50%);
	width: 1.05rem; height: 1.05rem; border-radius: 50%;
	background: var(--abatc-mist); border: 4px solid var(--abatc-sea); box-shadow: 0 0 0 5px var(--abatc-sage);
}
.abatc-year__events { grid-column: 2; padding-left: 1.25rem; }
@media (max-width: 781px) {
	.abatc-year { grid-template-columns: 1fr; padding-left: 1.5rem; }
	.abatc-year::before { left: .35rem; margin-left: 0; top: .9rem; }
	.abatc-year__label { position: relative; top: 0; text-align: left; padding-right: 0; margin-bottom: 1rem !important; font-size: 2.25rem; }
	.abatc-year__label::after { right: auto; left: -1.15rem; top: .7rem; transform: translateX(-50%); }
	.abatc-year__events { grid-column: 1; padding-left: 0; }
}

/* ---------- Numbered focus cards (parent trainings) ---------- */
.abatc-focus { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem !important; counter-reset: abatc-focus; }
.abatc-focus > * { margin: 0 !important; }
.abatc-focus .abatc-tile { counter-increment: abatc-focus; position: relative; }
.abatc-focus .abatc-tile::before {
	content: counter(abatc-focus, decimal-leading-zero); display: block; margin-bottom: .9rem;
	font-size: .95rem; font-weight: 800; color: var(--abatc-sea);
	width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--abatc-sage); line-height: 2.6rem; text-align: center;
}
.abatc-focus .abatc-tile p { font-weight: 600; color: var(--abatc-ink); font-size: 1.05rem; line-height: 1.45; }
@media (max-width: 960px) { .abatc-focus { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .abatc-focus { grid-template-columns: 1fr; } }

.abatc-infocard { background: var(--abatc-sage); border-radius: var(--abatc-radius-md); padding: 1.75rem !important; }
.abatc-infocard > * { margin-block: 0 !important; }
.abatc-infocard > * + * { margin-top: .9rem !important; }
.abatc-infocard dl, .abatc-infolist { margin: 0; padding: 0; list-style: none; display: grid; gap: .9rem; }
.abatc-infolist li { display: grid; gap: .1rem; }
.abatc-infolist strong { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--abatc-muted); font-weight: 700; }
.abatc-infolist span { font-weight: 700; color: var(--abatc-deep); font-size: 1.1rem; }

.abatc-statement p { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.55; color: var(--abatc-ink); }
.abatc-statement p:first-child { font-weight: 700; color: var(--abatc-deep); }

/* ---------- Photo viewer ---------- */
html.abatc-lb-open { overflow: hidden; }
.abatc-lb {
	position: fixed; inset: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none;
	margin: 0; padding: 0; border: 0; background: rgba(8, 26, 24, .94); color: #fff;
	overscroll-behavior: contain;
}
.abatc-lb::backdrop { background: rgba(8, 26, 24, .94); }
.abatc-lb[open] { display: block; animation: abatc-lb-in .2s ease; }
@keyframes abatc-lb-in { from { opacity: 0; } to { opacity: 1; } }
.abatc-lb__stage {
	position: absolute; inset: 0 0 4.5rem; display: flex; align-items: center; justify-content: center;
	padding: 1.25rem clamp(1rem, 7vw, 5.5rem);
}
.abatc-lb__img {
	max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain;
	border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); user-select: none; -webkit-user-drag: none;
}
.abatc-lb__btn {
	position: absolute; display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 50%;
	border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; transition: background .15s ease;
	-webkit-tap-highlight-color: transparent;
}
.abatc-lb__btn:hover { background: rgba(255, 255, 255, .24); }
.abatc-lb__btn:focus-visible { outline: 3px solid #8FD9CD; outline-offset: 2px; }
.abatc-lb__btn[hidden] { display: none; }
.abatc-lb__close { top: 1rem; right: 1rem; }
.abatc-lb__prev, .abatc-lb__next { top: calc(50% - 2.25rem - 1.5rem); }
.abatc-lb__prev { left: 1rem; }
.abatc-lb__next { right: 1rem; }
.abatc-lb__bar {
	position: absolute; left: 0; right: 0; bottom: 0; min-height: 4.5rem; display: flex; align-items: center;
	justify-content: space-between; gap: 1rem; padding: .75rem clamp(1rem, 4vw, 2rem); font-size: .95rem;
}
.abatc-lb__title { font-weight: 700; }
.abatc-lb__meta { opacity: .75; }
.abatc-lb__meta:not(:empty)::before { content: "· "; }
.abatc-lb__count { font-variant-numeric: tabular-nums; opacity: .8; white-space: nowrap; }
.abatc-lb__spinner {
	position: absolute; top: 1.5rem; left: 50%; width: 1.5rem; height: 1.5rem; margin-left: -.75rem;
	border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%;
	opacity: 0; transition: opacity .2s; animation: abatc-spin .8s linear infinite;
}
.abatc-lb.is-loading .abatc-lb__spinner { opacity: 1; transition-delay: .25s; }
@keyframes abatc-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) {
	.abatc-lb__prev, .abatc-lb__next { top: auto; bottom: .75rem; width: 2.75rem; height: 2.75rem; }
	.abatc-lb__prev { left: auto; right: 4rem; }
	.abatc-lb__next { right: 1rem; }
	.abatc-lb__bar { padding-right: 8.5rem; flex-direction: column; align-items: flex-start; justify-content: center; gap: .15rem; }
	.abatc-lb__stage { padding: 4rem .5rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
	.abatc-lb[open], .abatc-lb__spinner { animation: none; }
	a.abatc-lb-link img, a.abatc-lb-link::after { transition: none; }
	a.abatc-lb-link:hover img { transform: none; }
}
