/* ── Popup modal — design/v5/specs/popup.md.
   One overlay + one card; a chip row switches which popup's pane is visible.
   Loaded only when CORE_POPUP is on (inc/onsil/enqueue.php). ── */

.onsil-popup {
	--popup-card-width: min(500px, calc(83.333vh - 133.333px), calc(100vw - 32px));
	--popup-card-width: min(500px, calc(83.333dvh - 133.333px), calc(100vw - 32px));
	position: fixed;
	inset: 0;
	z-index: 1000;
	background-color: rgba(0, 0, 0, .6);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 24px;
}

.js .onsil-popup {
	opacity: 0;
	visibility: hidden;
}

.js .onsil-popup.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity .3s ease, visibility 0s;
}

.js .onsil-popup.is-closing {
	opacity: 0;
	visibility: visible;
	pointer-events: none;
	transition: opacity .2s ease;
}

.onsil-popup:focus {
	outline: none;
}

/* -- tab chip strip: sits directly on the dark overlay, above the card -- */

.onsil-popup__tabs {
	position: relative;
	width: var(--popup-card-width);
	max-width: none;
	height: 40px;
	overflow: hidden;
}

.onsil-popup__tabs-scroll {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 5px;
	width: 100%;
	height: 100%;
	padding-right: 60px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 85px), transparent calc(100% - 35px));
	mask-image: linear-gradient(to right, #000 0%, #000 calc(100% - 85px), transparent calc(100% - 35px));
}

.onsil-popup__tabs-scroll::-webkit-scrollbar {
	display: none;
}

.onsil-popup__chip {
	flex: 0 0 auto;
	height: 40px;
	padding: 10px 20px;
	border: 1px solid transparent;
	border-radius: var(--r-pill);
	background-color: rgba(255, 255, 255, .15);
	color: #fff;
	font-family: var(--f-ui), sans-serif;
	font-weight: 600;
	font-size: 13px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
}

.onsil-popup__chip.is-active {
	background-color: rgba(255, 255, 255, .3);
	border-color: #fff;
}

.onsil-popup__chip:focus {
	outline: none;
}

.onsil-popup__chip:focus-visible {
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
}

.onsil-popup__next {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 2;
	width: 60px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: 0;
	background-color: transparent;
	cursor: pointer;
	padding: 0;
}

.onsil-popup__next::before {
	display: none;
}

.onsil-popup__next svg {
	position: relative;
	z-index: 1;
}

@media (hover: hover) {
	.onsil-popup__chip:hover {
		background-color: rgba(255, 255, 255, .3);
	}
}

/* -- modal card -- */

.onsil-popup__card {
	position: relative;
	container-type: inline-size;
	width: var(--popup-card-width);
	height: auto;
	aspect-ratio: 5 / 6;
	max-width: none;
	max-height: none;
	background-color: var(--c-bg);
	border-radius: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.onsil-popup__panes {
	position: relative;
	flex: 1;
	min-height: 0;
	height: 100%;
}

.onsil-popup__pane {
	position: absolute;
	inset: 0;
	height: 100%;
	overflow: auto;
	max-height: none;
	touch-action: pan-y;
	transform: translateX(100%);
	visibility: hidden;
	pointer-events: none;
	transition: transform .5s cubic-bezier(.2,.6,.2,1);
}

.onsil-popup__pane.is-active {
	transform: translateX(0);
	visibility: visible;
	pointer-events: auto;
	z-index: 2;
}

.onsil-popup__pane.is-entering-next,
.onsil-popup__pane.is-leaving-prev {
	transform: translateX(100%);
	visibility: visible;
}

.onsil-popup__pane.is-entering-prev,
.onsil-popup__pane.is-leaving-next {
	transform: translateX(-100%);
	visibility: visible;
}

.onsil-popup__pane.is-entering-next,
.onsil-popup__pane.is-entering-prev {
	transition: none;
}

.onsil-popup__pane:not(.onsil-popup__pane--overlay):not(.onsil-popup__pane--poster-center):not(.onsil-popup__pane--poster-wide):not(.onsil-popup__pane--video) {
	display: flex;
	flex-direction: column;
}

.onsil-popup__pane:not(.onsil-popup__pane--overlay):not(.onsil-popup__pane--poster-center):not(.onsil-popup__pane--poster-wide):not(.onsil-popup__pane--video) .onsil-popup__image {
	flex: 1 1 auto;
	min-height: 0;
	object-fit: cover;
}

.onsil-popup__pane[hidden] {
	display: none;
}

.no-js .onsil-popup__pane:not([hidden]) {
	transform: none;
	visibility: visible;
	pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
	.js .onsil-popup,
	.onsil-popup__pane,
	.onsil-popup__next::before {
		transition-duration: .01ms;
	}
}

.onsil-popup__image {
	display: block;
	width: 100%;
	height: auto;
}

.onsil-popup__link {
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	color: inherit;
}

.onsil-popup__text {
	padding: 24px;
	color: var(--c-body);
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-size: 14px;
	line-height: 1.6;
}

.onsil-popup__pane--video,
.onsil-popup__video-wrap {
	width: 100%;
	height: 100%;
	background-color: #000;
}

.onsil-popup__video-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
}

.onsil-popup__video {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	border: 0;
}

@media (pointer: coarse) {
	/* The autoplaying popup video is view-only on touch screens so the carousel can own swipes. */
	.onsil-popup__video {
		pointer-events: none;
	}
}

/* Popup 1 — Figma 557:714. */
.onsil-popup__pane--overlay {
	aspect-ratio: 500 / 600;
	max-height: none;
}

.onsil-popup__pane--overlay .onsil-popup__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.onsil-popup__badge {
	position: absolute;
	top: 47.5%;
	left: 32%;
	z-index: 1;
	width: 36%;
	height: 5%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: var(--c-bg);
	color: var(--c-ink);
	font-family: var(--f-display), serif;
	font-size: 14px;
}

.onsil-popup__logo {
	position: absolute;
	left: 43%;
	top: 87.333%;
	z-index: 1;
	width: 14%;
	height: auto;
}

.onsil-popup__vertical {
	position: absolute;
	left: 4.4%;
	top: 18.333%;
	z-index: 1;
	width: 2.8%;
	height: 13.833%;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-family: var(--f-ui), sans-serif;
	font-size: 12px;
	line-height: 1;
	letter-spacing: .04em;
	color: var(--c-on-dark);
	white-space: nowrap;
}

/* Popups 2/3 — Figma 557:544 / 557:638. Percentages preserve the 500×600 poster geometry when
   the modal scales down for a shorter viewport. */
.onsil-popup__poster {
	position: relative;
	width: 100%;
	height: 100%;
	background-color: var(--c-bg);
	color: var(--c-ink);
}

.onsil-popup__headline,
.onsil-popup__poster-copy,
.onsil-popup__body-light,
.onsil-popup__body-bold {
	margin: 0;
}

.onsil-popup__headline {
	position: absolute;
	font-family: var(--f-display), serif;
	font-weight: 400;
	text-align: center;
}

.onsil-popup__poster-media,
.onsil-popup__poster-logo,
.onsil-popup__poster-copy {
	position: absolute;
}

.onsil-popup__poster-media {
	overflow: hidden;
}

.onsil-popup__poster-media .onsil-popup__image {
	position: absolute;
	max-width: none;
}

.onsil-popup__poster-copy {
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-size: 2.6cqw;
	line-height: 1.385;
	letter-spacing: -.02em;
}

.onsil-popup__body-light {
	font-weight: 300;
}

.onsil-popup__body-bold {
	font-weight: 600;
}

.onsil-popup__pane--poster-center .onsil-popup__headline {
	left: 23.6%;
	top: 9.333%;
	width: 52.8%;
	font-size: 8.8cqw;
	line-height: 1.045;
	letter-spacing: -.02em;
}

.onsil-popup__pane--poster-center .onsil-popup__poster-media {
	left: 30%;
	top: 31.667%;
	width: 40%;
	height: 36.667%;
}

.onsil-popup__pane--poster-center .onsil-popup__poster-media .onsil-popup__image {
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.onsil-popup__pane--poster-center .onsil-popup__poster-copy {
	left: 28.4%;
	top: 71.167%;
	width: 43.2%;
	text-align: center;
}

.onsil-popup__pane--poster-center .onsil-popup__poster-logo {
	left: 43%;
	top: 93.167%;
	width: 14%;
	height: 1.333%;
}

.onsil-popup__pane--poster-wide .onsil-popup__headline {
	left: 5.2%;
	top: 4.833%;
	width: 91.4%;
	font-size: 6cqw;
	line-height: 1.133;
	white-space: pre;
}

.onsil-popup__pane--poster-wide .onsil-popup__poster-media {
	left: 4.8%;
	top: 11.5%;
	width: 92%;
	height: 41.667%;
}

.onsil-popup__pane--poster-wide .onsil-popup__poster-media .onsil-popup__image {
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.onsil-popup__pane--poster-wide .onsil-popup__poster-copy {
	left: 4.8%;
	top: 84%;
	width: 72.4%;
	text-align: left;
}

.onsil-popup__pane--poster-wide .onsil-popup__poster-logo {
	left: 96.8%;
	top: 84%;
	width: 1.6%;
	height: 11.333%;
}

/* -- bottom control row: sits on the dark overlay, below the card -- */

.onsil-popup__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	width: var(--popup-card-width);
	max-width: none;
	transform: translateY(-2px);
}

.onsil-popup__today-label {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	color: #fff;
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-weight: 400;
	font-size: 14px;
	line-height: 1.4;
	cursor: pointer;
}

.onsil-popup__today {
	appearance: none;
	-webkit-appearance: none;
	position: relative;
	flex: 0 0 16px;
	width: 16px;
	height: 16px;
	margin: 0;
	background-color: transparent;
	border: 1px solid rgba(255, 255, 255, .7);
	border-radius: 3px;
	cursor: pointer;
}

.onsil-popup__today:checked {
	background-color: var(--c-ink);
	border-color: #fff;
}

.onsil-popup__today:checked::after {
	content: "";
	position: absolute;
	left: 5px;
	top: 2px;
	width: 4px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}

.onsil-popup__dismiss {
	flex-shrink: 0;
	min-height: 44px;
	padding: 0 20px;
	border: 1px solid rgba(255, 255, 255, .5);
	border-radius: var(--r-pill);
	background-color: transparent;
	color: #fff;
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-weight: 400;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
	cursor: pointer;
	transition: background-color 200ms ease, border-color 200ms ease;
}

.onsil-popup__today:focus-visible,
.onsil-popup__dismiss:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

@media (hover: hover) {
	.onsil-popup__dismiss:hover {
		background-color: rgba(255, 255, 255, .15);
		border-color: #fff;
	}
}

@media (max-width: 768px) {
	.onsil-popup__tabs-scroll {
		padding-right: 0;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.onsil-popup__next {
		display: none;
	}

	.onsil-popup__poster-copy {
		font-size: 2.6cqw;
		line-height: 1.4;
	}
}

/* Native top-layer viewer keeps the original notice artwork readable without shrinking it. */
.onsil-popup__enlarge {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	padding: 0;
	border: 1px solid;
	border-color: var(--c-line);
	border-radius: var(--r-pill);
	background-color: var(--c-bg);
	color: var(--c-ink);
	cursor: pointer;
}

.onsil-popup__enlarge[hidden] {
	display: none;
}

.onsil-popup-viewer {
	width: 1032px;
	max-width: calc(100vw - 32px);
	max-height: calc(100dvh - 32px);
	margin: auto;
	padding: 16px;
	border: 0;
	background-color: var(--c-bg);
	color: var(--c-ink);
}

.onsil-popup-viewer::backdrop {
	background-color: rgba(0, 0, 0, .6);
}

.onsil-popup-viewer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}

.onsil-popup-viewer__header h2 {
	min-width: 0;
	font-family: var(--f-ui), var(--f-body), sans-serif;
	font-size: 16px;
}

.onsil-popup-viewer__header button {
	flex-shrink: 0;
	min-height: 44px;
	padding: 8px 16px;
	border: 1px solid;
	border-color: var(--c-line);
	border-radius: var(--r-pill);
	background-color: var(--c-bg);
	color: var(--c-ink);
	cursor: pointer;
}

.onsil-popup-viewer__viewport {
	max-height: calc(100dvh - 140px);
	overflow: auto;
	overscroll-behavior: contain;
}

.onsil-popup-viewer__image {
	max-width: none;
}

@media (max-width: 768px) {
	.onsil-popup-viewer {
		width: calc(100vw - 32px);
	}
}
