/*
 * The math sim's banner and full-screen layer (contract D12, MS-PR4c), shared by both course pages.
 * The banner wears the sim's own palette (CEP's qimah-cep-math-sim.css: forest #10301d, gold #f4bf54, cream #f6eeda),
 * so the door looks like the room it opens. Class names avoid the theme's dark-mode substring blankets.
 */

/* ---------- the banner ---------- */
.qms-door { content-visibility: visible; contain: none; contain-intrinsic-size: none; scroll-margin-top: 100px; }
.qms-door--course { margin: 18px 0 22px; }
.qms-door__card {
	direction: rtl; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px 28px;
	padding: 22px 26px; border-radius: 14px; background: #10301d; color: #f6eeda;
	border: 2px solid #0a2214; box-shadow: 6px 6px 0 rgba(10, 34, 20, 0.35);
}
.qms-door__text { flex: 1 1 320px; min-width: 0; }
.qms-door__kicker { margin: 0 0 6px; font-size: 13px; letter-spacing: 0.04em; color: #f4bf54; }
.qms-door__card h2 { margin: 0; font-size: clamp(20px, 2.4vw, 26px); line-height: 1.35; font-weight: 700; color: #f6eeda; }
.qms-door__line { margin: 8px 0 0; font-size: 16px; line-height: 1.7; color: #d6dfd0; }
.qms-door__chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 14px 0 0; padding: 0; }
.qms-door__chips li {
	padding: 4px 12px; border-radius: 999px; font-size: 13px; line-height: 1.6; color: #f6eeda;
	background: rgba(246, 238, 218, 0.08); border: 1px solid rgba(246, 238, 218, 0.24);
}
/* (0,2,1) and up: over style.css button:hover, reset.css a:hover (0,1,1) and both sheets' [type="button"]:focus (0,2,0),
   which paint a focused button pink (#c36) or inherit the page's ink. Focus keeps the resting look, plus the ring. */
body .qms-door .qms-door__go,
body .qms-door .qms-door__go:focus {
	flex: 0 0 auto; display: inline-flex; align-items: center; gap: 10px; padding: 12px 24px; border-radius: 6px;
	font: inherit; font-size: 16px; font-weight: 700; line-height: 1.3; text-decoration: none; cursor: pointer;
	background: #f4bf54; color: #0a2214; border: 2px solid #0a2214; box-shadow: 4px 4px 0 #0a2214;
	transition: background 0.12s ease, box-shadow 0.12s ease;
}
/* style.css paints every button:hover green with white text: pin both, and never move it on hover. */
body .qms-door .qms-door__go:hover { background: #f7cb6e; color: #0a2214; box-shadow: 5px 5px 0 #0a2214; }
/* (0,3,1): style.css's html[data-theme="dark"] :focus-visible is (0,2,1) and would paint the ring green. */
body .qms-door .qms-door__go:focus-visible { outline: 3px solid #f4bf54; outline-offset: 3px; }
@media (max-width: 600px) {
	.qms-door__card { padding: 18px; }
	/* box-sizing here, not from Hello's reset.css, which the theme dequeues on some pages. */
	body .qms-door .qms-door__go { width: 100%; box-sizing: border-box; justify-content: center; }
}

/* ---------- the layer ---------- */
.qms-layer {
	position: fixed; inset: 0; z-index: 100000; /* above the header (10001), the app shell, the buy bar and WhatsApp */
	overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
	background-color: #f6eeda; background-image: radial-gradient(rgba(16, 48, 29, 0.08) 1px, transparent 1.2px); background-size: 9px 9px;
}
html[data-theme="dark"] .qms-layer { background-color: #10301d; background-image: radial-gradient(rgba(246, 238, 218, 0.05) 1px, transparent 1.2px); }
.qms-layer[hidden] { display: none; }
.qms-layer__body { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; }
/* The layer covers the site topbar, so the sim's sticky bands start at the top (D12). !important beats the runner's
   inline --qm-top, which it measures off .qimah-app-topbar. */
.qms-layer #qimah-major-sim-mount { --qm-top: 0px !important; }
/* One dot grid: the layer paints it and does not scroll, the mount's own would scroll over it as a seam. */
.qms-layer #qimah-major-sim-mount.is-math { background: transparent; }
/* Room for «رجوع» on the bar's right end, so the brand ellipsizes before it slides under the button (360 and 320). */
#qms-layer #qimah-major-sim-mount .qm-bar { padding-right: 160px; }
/* The page under the layer does not scroll; the layer does. */
html.qms-open, html.qms-open body { overflow: hidden !important; }
/* MathLive's LaTeX suggestion popover (z 100 by default) sits above the layer. */
html.qms-open { --suggestion-zindex: 100020; }
/* MathLive's keyboard is a child of <body>, outside the layer: lift it (and its variants panel, +1) above it. */
html.qms-open .ML__keyboard { --_keyboard-zindex: 100010 !important; }

/* «رجوع»: placed on the sim bar's empty right end by qimah-major-layer.js (top/right), so it scrolls with the bar. */
/* Under the layer's id: the button has focus when the layer opens, and [type="button"]:focus would win otherwise. */
#qms-layer .qms-layer__back,
#qms-layer .qms-layer__back:focus {
	position: absolute; top: 24px; right: 34px; z-index: 25; direction: rtl;
	display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 6px;
	font: inherit; font-size: 15px; font-weight: 700; line-height: 1.3; cursor: pointer;
	background: #10301d; color: #f6eeda; border: 1.5px solid rgba(246, 238, 218, 0.45);
	transition: background 0.12s ease;
}
/* A forest fill, so it reads on the sim bar and on the bare cream layer alike (no bar: a note, or an older runner). */
#qms-layer .qms-layer__back:hover { background: #1b4a2e; color: #f6eeda; }
#qms-layer .qms-layer__back:focus-visible { outline: 3px solid #f4bf54; outline-offset: 2px; }

/* The light/dark toggle, left of «رجوع» on the bar (placed by qimah-major-layer.js); the same forest button, square. */
#qms-layer .qms-layer__theme,
#qms-layer .qms-layer__theme:focus {
	position: absolute; top: 24px; right: 140px; z-index: 25;
	display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
	border-radius: 6px; cursor: pointer; line-height: 1;
	background: #10301d; color: #f6eeda; border: 1.5px solid rgba(246, 238, 218, 0.45);
	transition: background 0.12s ease;
}
#qms-layer .qms-layer__theme:hover { background: #1b4a2e; color: #f6eeda; }
#qms-layer .qms-layer__theme:focus-visible { outline: 3px solid #f4bf54; outline-offset: 2px; }
#qms-layer .qms-layer__theme span { display: inline-flex; }
html[data-theme="dark"] #qms-layer .qms-layer__sun { display: none; }
html:not([data-theme="dark"]) #qms-layer .qms-layer__moon { display: none; }
