/**
 * MoiréPress Demo — the demo's own panels (look picker, options, preview holder).
 * Every rule starts at #moirepress-demo, so nothing here reaches the rest of the page.
 * The looks themselves are never loaded into this page: they live inside the preview frame.
 *
 * @package MoirePress_Demo
 */
#moirepress-demo {
	--mpd-bg: #0e1016; --mpd-panel: #171a23; --mpd-line: #2a2e3b; --mpd-text: #f3f4f8; --mpd-soft: #9aa0b2;
	--mpd-accent: #c9b8ff; --mpd-accent-ink: #0e1016; --mpd-field: #0e1016; --mpd-frame: #090a0e;
	box-sizing: border-box; width: 100%; max-width: 1320px; margin: 0 auto; padding: 16px; border-radius: 14px;
	background: var(--mpd-bg); color: var(--mpd-text); text-align: start;
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
}
#moirepress-demo.mpdemo--light {
	--mpd-bg: #f3f5fa; --mpd-panel: #ffffff; --mpd-line: #cfd5e3; --mpd-text: #1b2030; --mpd-soft: #4c556b;
	--mpd-accent: #0b6f8c; --mpd-accent-ink: #ffffff; --mpd-field: #ffffff; --mpd-frame: #dfe3ee;
}
#moirepress-demo *, #moirepress-demo *::before, #moirepress-demo *::after { box-sizing: border-box; }
#moirepress-demo [hidden] { display: none !important; }

#moirepress-demo .mpdemo-grid {
	display: grid; gap: 14px; align-items: start;
	grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
	grid-template-areas: "picker picker" "stage options";
}
#moirepress-demo .mpdemo-picker { grid-area: picker; min-width: 0; }
#moirepress-demo .mpdemo-stage { grid-area: stage; min-width: 0; }
#moirepress-demo .mpdemo-options { grid-area: options; min-width: 0; }

#moirepress-demo .mpdemo-panel { margin: 0; padding: 14px; border: 1px solid var(--mpd-line); border-radius: 12px; background: var(--mpd-panel); color: var(--mpd-text); }
#moirepress-demo .mpdemo-title { margin: 0 0 10px; padding: 0; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--mpd-text); }

/* Look picker */
#moirepress-demo .mpdemo-picker-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 10px; }
#moirepress-demo .mpdemo-picker-head .mpdemo-title { margin: 0; }
#moirepress-demo .mpdemo-tabs, #moirepress-demo .mpdemo-device { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; background: transparent; }
#moirepress-demo .mpdemo-group { display: flex; align-items: stretch; gap: 6px; }
#moirepress-demo.mpdemo-ready .mpdemo-group:not(.mpdemo-group-on) { display: none; }
#moirepress-demo .mpdemo-looks { display: flex; flex: 1 1 auto; min-width: 0; gap: 8px; padding: 3px 3px 8px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
#moirepress-demo .mpdemo-look {
	display: flex; flex: 0 0 118px; flex-direction: column; align-items: stretch; gap: 0; width: 118px; min-width: 0; height: auto; margin: 0; padding: 0; overflow: hidden;
	border: 2px solid var(--mpd-line); border-radius: 10px; background: var(--mpd-field); color: var(--mpd-text); scroll-snap-align: start;
	font: inherit; font-size: 13px; line-height: 1.3; text-align: center; text-transform: none; letter-spacing: 0; cursor: pointer; box-shadow: none;
}
#moirepress-demo .mpdemo-look:hover { border-color: var(--mpd-soft); }
#moirepress-demo .mpdemo-look[aria-pressed="true"] { border-color: var(--mpd-accent); box-shadow: 0 0 0 1px var(--mpd-accent); }
#moirepress-demo .mpdemo-look-img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; margin: 0; border: 0; border-radius: 0; background: var(--mpd-frame); }
#moirepress-demo .mpdemo-look-name { display: flex; flex: 1 1 auto; align-items: center; justify-content: center; padding: 5px 5px 6px; font-weight: 600; overflow-wrap: anywhere; }
#moirepress-demo .mpdemo-look[aria-pressed="true"] .mpdemo-look-name { background: var(--mpd-accent); color: var(--mpd-accent-ink); }
#moirepress-demo .mpdemo-scroll {
	flex: 0 0 34px; width: 34px; min-width: 0; height: auto; margin: 3px 0 8px; padding: 0; border: 1px solid var(--mpd-line); border-radius: 8px; background: var(--mpd-field); color: var(--mpd-text);
	font: inherit; font-size: 24px; line-height: 1; cursor: pointer; box-shadow: none;
}
#moirepress-demo .mpdemo-scroll:hover { border-color: var(--mpd-soft); }
/* The arrows always point outward. Their two characters are drawn left-to-right whatever the page
   direction (a right-to-left page would otherwise mirror them by itself), then turned for Arabic. */
#moirepress-demo .mpdemo-scroll span { display: inline-block; direction: ltr; unicode-bidi: bidi-override; }
#moirepress-demo[dir="rtl"] .mpdemo-scroll span { transform: scaleX(-1); }

/* Preview */
#moirepress-demo .mpdemo-stage-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 10px; }
#moirepress-demo .mpdemo-stage-head .mpdemo-title { margin: 0; }
#moirepress-demo .mpdemo-status { flex: 1 1 140px; min-height: 1.5em; font-size: 14px; color: var(--mpd-soft); }
#moirepress-demo .mpdemo-chip { display: inline-flex; align-items: center; margin: 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--mpd-text); }
#moirepress-demo .mpdemo-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
#moirepress-demo .mpdemo-chip span { display: inline-block; padding: 5px 12px; border: 1px solid var(--mpd-line); border-radius: 999px; background: var(--mpd-field); }
#moirepress-demo .mpdemo-chip input:checked + span { background: var(--mpd-accent); border-color: var(--mpd-accent); color: var(--mpd-accent-ink); }
#moirepress-demo .mpdemo-chip input:focus-visible + span { outline: 3px solid var(--mpd-accent); outline-offset: 2px; }
#moirepress-demo .mpdemo-frame { position: relative; direction: ltr; height: var(--mpdemo-height, 640px); padding: 0; border-radius: 10px; background: var(--mpd-frame); overflow: hidden; border: 1px solid var(--mpd-line); }
#moirepress-demo .mpdemo-iframe { position: absolute; top: 0; left: 0; display: block; width: 100%; max-width: none; height: 100%; margin: 0; border: 0; background: #fff; transform-origin: 0 0; }
#moirepress-demo.mpdemo-is-loading .mpdemo-iframe { opacity: .55; }
#moirepress-demo .mpdemo-frame-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; padding: 24px; direction: inherit; text-align: center; font-size: 15px; line-height: 1.5; color: var(--mpd-text); }
#moirepress-demo .mpdemo-note, #moirepress-demo .mpdemo-foot { margin: 10px 0 0; padding: 0; font-size: 13px; line-height: 1.5; color: var(--mpd-soft); }
#moirepress-demo .mpdemo-foot { text-align: center; }
#moirepress-demo .mpdemo-notice { margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--mpd-accent); border-radius: 8px; font-size: 14px; color: var(--mpd-text); background: transparent; }

/* Options */
#moirepress-demo .mpdemo-options-body { max-height: calc(var(--mpdemo-height, 640px) + 70px); overflow: auto; padding: 2px; margin: -2px; scrollbar-width: thin; }
#moirepress-demo .mpdemo-lookname { font-size: 18px; font-weight: 700; line-height: 1.3; color: var(--mpd-accent); }
#moirepress-demo .mpdemo-lookdesc { margin: 4px 0 0; padding: 0; font-size: 14px; color: var(--mpd-soft); }
#moirepress-demo .mpdemo-set { margin: 14px 0 0; padding: 10px 12px 12px; border: 1px solid var(--mpd-line); border-radius: 10px; min-width: 0; background: transparent; }
#moirepress-demo .mpdemo-legend { float: none; width: auto; margin: 0; padding: 0 6px; border: 0; font-size: 14px; font-weight: 700; line-height: 1.3; color: var(--mpd-text); background: transparent; }
#moirepress-demo .mpdemo-check { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 0; padding: 2px 0; font-size: 14px; font-weight: 400; line-height: 1.4; color: var(--mpd-text); cursor: pointer; }
#moirepress-demo .mpdemo-check input { flex: 0 0 auto; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--mpd-accent); cursor: pointer; }
#moirepress-demo .mpdemo-check input:disabled, #moirepress-demo .mpdemo-check input:disabled + span { cursor: default; opacity: .6; }
#moirepress-demo .mpdemo-hint { display: inline; margin: 0; padding: 0; font-size: 13px; font-weight: 400; line-height: 1.45; color: var(--mpd-soft); }
#moirepress-demo p.mpdemo-hint { display: block; margin: 6px 0 0; }
#moirepress-demo .mpdemo-field { margin: 8px 0 0; }
#moirepress-demo .mpdemo-label { display: block; margin: 0 0 3px; padding: 0; font-size: 13px; font-weight: 600; color: var(--mpd-text); }
#moirepress-demo .mpdemo-select {
	display: block; width: 100%; max-width: 100%; height: auto; min-height: 38px; margin: 0; padding: 7px 10px; border: 1px solid var(--mpd-line); border-radius: 8px;
	background-color: var(--mpd-field); color: var(--mpd-text); font: inherit; font-size: 14px; line-height: 1.3;
}
#moirepress-demo .mpdemo-select:disabled { opacity: .55; }
#moirepress-demo .mpdemo-areas { display: grid; grid-template-columns: 1fr; }
#moirepress-demo .mpdemo-reset {
	display: block; width: 100%; margin: 14px 0 0; padding: 9px 12px; border: 1px solid var(--mpd-line); border-radius: 8px; background: var(--mpd-field); color: var(--mpd-text);
	font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3; text-transform: none; letter-spacing: 0; cursor: pointer; box-shadow: none;
}
#moirepress-demo .mpdemo-reset:hover { border-color: var(--mpd-soft); }

#moirepress-demo .mpdemo-look:focus-visible, #moirepress-demo .mpdemo-select:focus-visible, #moirepress-demo .mpdemo-reset:focus-visible,
#moirepress-demo .mpdemo-check input:focus-visible, #moirepress-demo .mpdemo-iframe:focus-visible { outline: 3px solid var(--mpd-accent); outline-offset: 2px; }

#moirepress-demo .mpdemo-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

#moirepress-demo .mpdemo-look:focus-visible, #moirepress-demo .mpdemo-scroll:focus-visible { outline: 3px solid var(--mpd-accent); outline-offset: 1px; }

/* When the demo's script cannot start (no JavaScript, or the page's security settings block it), a
   plain message replaces the panels. The message is ordinary text in the page; it is held back for
   three seconds so it does not flash while the script is still on its way, and the script hides it
   for good when it starts. If the script starts but finds the demo unusable, it shows at once. */
#moirepress-demo .mpdemo-nostart { margin: 0; }
#moirepress-demo.mpdemo-ready .mpdemo-nostart { display: none; }
#moirepress-demo:not(.mpdemo-ready):not(.mpdemo-failed) .mpdemo-nostart {
	max-height: 0; padding-block: 0; border-width: 0; overflow: hidden; visibility: hidden;
	animation: mpdemo-late-show .01s linear 3s forwards;
}
#moirepress-demo:not(.mpdemo-ready):not(.mpdemo-failed) .mpdemo-grid,
#moirepress-demo:not(.mpdemo-ready):not(.mpdemo-failed) .mpdemo-foot { overflow: hidden; animation: mpdemo-late-hide .01s linear 3s forwards; }
#moirepress-demo.mpdemo-failed .mpdemo-grid, #moirepress-demo.mpdemo-failed .mpdemo-foot { display: none; }
@keyframes mpdemo-late-show { to { max-height: 30em; padding-block: 8px; border-width: 1px; visibility: visible; } }
@keyframes mpdemo-late-hide { to { max-height: 0; margin: 0; padding: 0; border-width: 0; visibility: hidden; } }

/* Narrow screens: one column, the preview right under the picker. */
@media (max-width: 900px) {
	#moirepress-demo { padding: 10px; border-radius: 10px; }
	#moirepress-demo .mpdemo-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "picker" "stage" "options"; gap: 10px; }
	#moirepress-demo .mpdemo-panel { padding: 10px; }
	#moirepress-demo .mpdemo-options-body { max-height: none; overflow: visible; }
}
@media (max-width: 600px) {
	#moirepress-demo .mpdemo-look { flex-basis: 104px; width: 104px; }
	#moirepress-demo .mpdemo-scroll, #moirepress-demo .mpdemo-device { display: none; }
	#moirepress-demo .mpdemo-frame { height: min(var(--mpdemo-height, 640px), 72vh); }
}
