/*
 * Popup block (0.83.0) — front end. Colours are the Alexi theme tokens.
 * The popup is a native <dialog> opened with showModal(), so it sits in the
 * browser's top layer above the header, sidebars and anything else.
 */

html.asc-popup-lock { overflow: hidden; }

.asc-popup-trigger { margin: 0 0 1.25em; }
.asc-popup-trigger.is-align-center { text-align: center; }
.asc-popup-trigger.is-align-right { text-align: right; }
/* 0.83.1: the button matches the "Details" buttons on My Courses (ASC Reports
   .asc-rep-detail-btn) — thin outline, 5px corners, small text (Alex). */
.asc-popup-open {
	display: inline-block;
	cursor: pointer;
	margin: 0;
	padding: 0.3rem 0.75rem !important;
	border: 1px solid var( --alexi-outline, #c9ced4 ) !important;
	border-radius: 5px !important;
	background: transparent !important;
	color: var( --alexi-btn-text, #0f2a47 ) !important;
	font: inherit;
	font-size: 0.82rem !important;
	line-height: 1.2 !important;
	font-weight: inherit;
	text-transform: none;
	letter-spacing: normal;
	white-space: nowrap;
	box-shadow: none !important;
}
.asc-popup-open:hover,
.asc-popup-open:focus {
	border-color: var( --alexi-muted, #5f6b78 ) !important;
	background: transparent !important;
	color: var( --alexi-btn-text, #0f2a47 ) !important;
	outline: none;
}
.asc-popup-open:focus-visible { outline: 2px solid var( --alexi-outline, #c9ced4 ); outline-offset: 2px; }

/* ---- The popup box ---------------------------------------------------- */
/* 0.83.2: position, inset, margin and max-width are !important — WordPress
   sets margin:0 on everything inside Grid / Row / Stack groups (and max-width /
   auto margins inside constrained groups), which pushed popups placed there to
   the top-left corner. */
dialog.asc-popup {
	--asc-popup-w: 640px;
	--asc-popup-gap: 24px;
	position: fixed !important;
	inset: 0 !important;
	box-sizing: border-box;
	width: min( var( --asc-popup-w ), calc( 100vw - 2 * var( --asc-popup-gap ) ) );
	max-width: none !important;
	height: fit-content;
	max-height: calc( 100dvh - 2 * var( --asc-popup-gap ) );
	margin: auto !important;
	padding: 0;
	border: 1px solid var( --alexi-line, #d9dde3 );
	border-radius: 16px;
	background: #fff;
	color: var( --alexi-ink, #0f2a47 );
	font: inherit;
	line-height: 1.6;
	box-shadow: 0 18px 48px rgba( 15, 42, 71, 0.22 );
	overflow: hidden;
}
dialog.asc-popup[open] { display: flex; flex-direction: column; }
dialog.asc-popup::backdrop { background: rgba( 15, 42, 71, 0.45 ); }

dialog.asc-popup.is-size-small { --asc-popup-w: 420px; }
dialog.asc-popup.is-size-medium { --asc-popup-w: 640px; }
dialog.asc-popup.is-size-large { --asc-popup-w: 920px; }
/* custom: --asc-popup-w is set inline on the element */

/* ---- Position ---------------------------------------------------------- */
dialog.asc-popup.is-pos-top { margin: var( --asc-popup-gap ) auto auto !important; }
dialog.asc-popup.is-pos-bottom { margin: auto auto var( --asc-popup-gap ) !important; }
dialog.asc-popup.is-pos-top-left { margin: var( --asc-popup-gap ) auto auto var( --asc-popup-gap ) !important; }
dialog.asc-popup.is-pos-top-right { margin: var( --asc-popup-gap ) var( --asc-popup-gap ) auto auto !important; }
dialog.asc-popup.is-pos-bottom-left { margin: auto auto var( --asc-popup-gap ) var( --asc-popup-gap ) !important; }
dialog.asc-popup.is-pos-bottom-right { margin: auto var( --asc-popup-gap ) var( --asc-popup-gap ) auto !important; }

/* Side panels: full height, flush to the edge. */
dialog.asc-popup.is-pos-left,
dialog.asc-popup.is-pos-right {
	width: min( var( --asc-popup-w ), 100vw );
	height: 100dvh;
	max-height: 100dvh;
	border-top: 0;
	border-bottom: 0;
}
dialog.asc-popup.is-pos-left { margin: 0 auto 0 0 !important; border-left: 0; border-radius: 0 16px 16px 0; }
dialog.asc-popup.is-pos-right { margin: 0 0 0 auto !important; border-right: 0; border-radius: 16px 0 0 16px; }

/* Full screen wins over any position. */
dialog.asc-popup.is-size-full {
	width: 100vw;
	height: 100dvh;
	max-height: 100dvh;
	margin: 0 !important;
	border: 0;
	border-radius: 0;
}

/* ---- Inside ----------------------------------------------------------- */
.asc-popup-bar {
	flex: 0 0 auto;
	display: flex;
	justify-content: flex-end;
	padding: 10px 10px 0;
}
.asc-popup-close {
	-webkit-tap-highlight-color: transparent;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 999px !important;
	background: var( --alexi-btn-bg, #e8eaed ) !important;
	color: var( --alexi-btn-text, #0f2a47 ) !important;
	box-shadow: none !important;
	cursor: pointer;
}
.asc-popup-close:hover { background: var( --alexi-btn-bg-hover, #d5d9de ) !important; }
.asc-popup-close:focus { outline: none; }
/* 0.93.9: the dialog takes focus when opened from the URL hash (popup.js). */
dialog.asc-popup:focus { outline: none; }
.asc-popup-close:focus-visible { box-shadow: 0 0 0 3px var( --alexi-focus-ring, rgba( 91, 122, 153, 0.45 ) ) !important; }

.asc-popup-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
	padding: 0 28px 28px;
}
.asc-popup-body > :first-child { margin-top: 0; }
.asc-popup-body > :last-child { margin-bottom: 0; }
dialog.asc-popup.is-size-full .asc-popup-body { width: 100%; max-width: 920px; margin: 0 auto; box-sizing: border-box; }

/* ---- Tablets ---------------------------------------------------------- */
/* 0.100.11 (Alex, 11 Nov 2026 — "apply this to all popups"): same rule as the
   Product links popup in frontend.css. Between 601px and 1366px wide, portrait
   and landscape, the popup sits 48px from the top and 32px from the bottom,
   whatever position was picked. The 24px gap was too thin, and on a tablet
   whose status bar overlays the page it left the top edge and the x cut off.
   Side panels and Full screen are deliberate full-height layouts: unchanged. */
@media ( min-width: 601px ) and ( max-width: 1366px ) {
	dialog.asc-popup:not( .is-pos-left ):not( .is-pos-right ):not( .is-size-full ) {
		inset: 48px 0 32px !important;
		max-height: calc( 100vh - 80px );
		max-height: calc( 100dvh - 80px );
	}
	/* The inset already makes the gap: no second one on top of it. */
	dialog.asc-popup.is-pos-top,
	dialog.asc-popup.is-pos-top-left,
	dialog.asc-popup.is-pos-top-right { margin-top: 0 !important; }
	dialog.asc-popup.is-pos-bottom,
	dialog.asc-popup.is-pos-bottom-left,
	dialog.asc-popup.is-pos-bottom-right { margin-bottom: 0 !important; }
}

/* ---- Phones ----------------------------------------------------------- */
@media ( max-width: 600px ) {
	dialog.asc-popup { --asc-popup-gap: 12px; }
	/* 0.87.2 (Alex): a bottom sheet that starts a quarter of the way down the
	   visible screen, whatever size or position was picked (side panels and
	   Full screen excepted). The dimmed top quarter closes it on a tap. */
	dialog.asc-popup:not( .is-pos-left ):not( .is-pos-right ):not( .is-size-full ) {
		width: 100%;
		height: 75vh;
		height: 75dvh;
		max-height: 75dvh;
		margin: auto 0 0 !important;
		border-bottom: 0;
		border-radius: 16px 16px 0 0;
	}
	dialog.asc-popup.is-pos-left,
	dialog.asc-popup.is-pos-right { width: min( var( --asc-popup-w ), 92vw ); }
	.asc-popup-body { padding: 0 18px 22px; }
}

/* ---- A gentle entrance, unless motion is reduced ----------------------- */
@media ( prefers-reduced-motion: no-preference ) {
	dialog.asc-popup[open] { animation: asc-popup-in 0.16s ease-out; }
	dialog.asc-popup[open]::backdrop { animation: asc-popup-fade 0.16s ease-out; }
}
@keyframes asc-popup-in {
	from { opacity: 0; transform: translateY( 8px ); }
	to { opacity: 1; transform: none; }
}
@keyframes asc-popup-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* 0.93.2/0.93.3: Pikaday calendars (Ninja Tables' From / To filters) re-created
 * inside the dialog by popup.js — a drop-down under the From / To pair, over the
 * table, not in <body>. !important because Pikaday's hide() writes an inline
 * "position:static; left:auto; top:auto" that would otherwise win from the
 * second opening on (0.93.3). */
.asc-popup .ninja_custom_date_filter { position: relative; }
/* 0.93.7 (Alex, 20 Oct 2026, My progress popup: "the date fields wrap ... looks
 * terrible"): Ninja Tables gives each filter a quarter of the row and sizes
 * From / To as two inline-blocks of 50% − 7.75px plus a right margin, which in
 * the popup's slot comes to a hair more than the slot, so To dropped under
 * From. A flex pair sharing the slot with a 6px gap never wraps; the Pikaday
 * drop-down above is absolute, so the flex box does not move it. */
.asc-popup .ninja_custom_date_filter { display: flex !important; align-items: center; gap: 6px; }
.asc-popup .ninja_custom_date_filter .ninja_filter_date_range { flex: 1 1 0; min-width: 0; width: auto !important; margin: 0 !important; }
.asc-popup .ninja_custom_date_filter .pika-single.asc-pika {
	position: absolute !important;
	top: 100% !important;
	/* 0.93.8 (Alex, 21 Oct 2026, My lessons popup: Sat/Sun columns outside the
	 * calendar box): the box was capped at the From/To pair's width (max-width
	 * 100%), which is narrower than the calendar in a popup with fewer filters,
	 * so the day grid spilled past the edge. The calendar keeps its own width. */
	width: max-content;
	max-width: none;
	margin-top: 4px;
	z-index: 50;
}
/* 0.95.13 (Alex, 28 Oct 2026, CTP lessons popup: "move the From calendar to
 * the left so it is fully visible"): the From/To pair sits at the right end
 * of the filter row and is narrower than the calendar, so a From calendar
 * anchored to the pair's LEFT edge ran off the popup's right side. Both
 * calendars now hang from the pair's right edge and grow leftwards. */
.asc-popup .ninja_custom_date_filter .pika-single.asc-pika-from { right: 0 !important; left: auto !important; }
.asc-popup .ninja_custom_date_filter .pika-single.asc-pika-to { right: 0 !important; left: auto !important; }

/* 0.93.6: Fluent Forms buttons inside a popup look like the site's buttons —
 * Next / Submit filled (accent), Previous / Upload outline. !important beats the
 * per-form styles Fluent Forms prints. */
.asc-popup .frm-fluent-form .ff-btn {
	font: inherit !important;
	font-size: 0.95em !important;
	font-weight: 500 !important;
	line-height: 1 !important;
	padding: 0.55em 1.1em !important;
	border-radius: var(--radius, 6px) !important;
	border: 2px solid var(--accent, #3C4F62) !important;
	background: var(--accent, #3C4F62) !important;
	color: #fff !important;
	box-shadow: none !important;
	text-decoration: none !important;
	cursor: pointer;
}
.asc-popup .frm-fluent-form .ff-btn:hover,
.asc-popup .frm-fluent-form .ff-btn:focus {
	background: var(--heading, #1F2A36) !important;
	border-color: var(--heading, #1F2A36) !important;
	color: #fff !important;
}
.asc-popup .frm-fluent-form .ff-btn-prev,
.asc-popup .frm-fluent-form .ff_upload_btn {
	background: transparent !important;
	color: var(--accent, #3C4F62) !important;
}
.asc-popup .frm-fluent-form .ff-btn-prev:hover,
.asc-popup .frm-fluent-form .ff_upload_btn:hover {
	background: var(--accent, #3C4F62) !important;
	color: #fff !important;
}

/* ---- 0.93.9: "My details" card (home page, popup #my-details) --------------
 * Fluent Forms "My Details Display" (form 5) is a read-only profile built from
 * Custom HTML blocks: <h1>name</h1>, <h3>section</h3>, <p><strong>Label:</strong>
 * value</p>, <blockquote><strong>Notes:</strong> …</blockquote>. Shown as a card:
 * light name, hairline section rules, small-caps labels above values, the
 * outline "Edit" button (Alex, 21 Oct 2026: "really good"). Moved here from
 * Customizer Additional CSS. */
#my-details .fluentform_wrapper_5 { padding: 1rem 2rem 1.5rem; }
#my-details .fluentform_wrapper_5 .ff-el-group { margin-bottom: 0.4rem; }
#my-details .fluentform_wrapper_5 .ff-t-container { gap: 0 2rem; }
#my-details .fluentform_wrapper_5 h1 {
	margin: 0 0 0.5rem;
	font-size: 1.7rem;
	font-weight: 300;
	line-height: 1.2;
	color: var(--alexi-heading, var(--alexi-ink));
}
#my-details .fluentform_wrapper_5 h1 strong { font-weight: 300; }
/* The form's h3s carry inline margin-bottom:-10px, hence !important. */
#my-details .fluentform_wrapper_5 h3 {
	margin: 0.9rem 0 0.5rem !important;
	padding-bottom: 0.3rem;
	border-bottom: 1px solid var(--alexi-line, #e4e4e0);
	font-size: 1.05rem;
	font-weight: 400;
	letter-spacing: 0.02em;
	color: var(--alexi-heading, var(--alexi-ink));
}
#my-details .fluentform_wrapper_5 h3 strong { font-weight: 400; }
#my-details .fluentform_wrapper_5 p {
	margin: 0 0 0.9rem;
	font-size: 1.05rem;
	line-height: 1.4;
	color: var(--alexi-text, var(--alexi-ink));
}
#my-details .fluentform_wrapper_5 p > strong,
#my-details .fluentform_wrapper_5 blockquote strong {
	display: block;
	margin-bottom: 0.15rem;
	font-size: 11px;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--alexi-text-muted, var(--alexi-muted));
}
#my-details .fluentform_wrapper_5 blockquote {
	margin: 0.25rem 0 0.9rem;
	padding: 0.2rem 0 0.2rem 1rem;
	border-left: 2px solid var(--alexi-line, #e4e4e0);
	font-size: 1rem;
	line-height: 1.5;
	color: var(--alexi-body, var(--alexi-ink));
}
#my-details .fluentform_wrapper_5 .ff_submit_btn_wrapper { margin-top: 1rem; text-align: right; }
/* Outline, not the filled 0.93.6 look: this button only opens the edit form. */
#my-details .fluentform_wrapper_5 .ff-btn-submit {
	background: transparent !important;
	color: var(--alexi-ink) !important;
	border: 1px solid var(--alexi-outline, var(--alexi-ink)) !important;
	border-radius: 5px !important;
	font-size: 0.9rem !important;
	font-weight: 500 !important;
	padding: 0.45rem 1.1rem !important;
}
#my-details .fluentform_wrapper_5 .ff-btn-submit:hover,
#my-details .fluentform_wrapper_5 .ff-btn-submit:focus {
	background: var(--alexi-ink) !important;
	border-color: var(--alexi-ink) !important;
	color: #fff !important;
}
@media (max-width: 600px) {
	#my-details .fluentform_wrapper_5 { padding: 0.5rem 1rem 1rem; }
}
