/* QERP guided tour player */
html.qt-open, html.qt-open body { overflow: hidden !important; }
.qt {
    position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column;
    background: radial-gradient(120% 80% at 50% 0%, #12345F, #0B2545 55%, #071A33);
    color: #fff; font-family: var(--f-body, Cairo, sans-serif);
    opacity: 0; transition: opacity .35s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.qt.in { opacity: 1; }

/* top bar */
.qt-top { display: flex; align-items: center; gap: 14px; height: 58px; padding: 0 20px; flex: none; }
.qt-brand { display: flex; align-items: center; gap: 8px; }
.qt-brand svg { width: 28px; height: 28px; color: #E9D3A0; }
.qt-brand b { font-family: var(--f-display, Cairo); font-size: 1.25rem; letter-spacing: .05em; }
.qt-brand span { color: #9FB3CF; font-size: .9rem; margin-inline-start: 6px; padding-inline-start: 10px; border-inline-start: 1px solid rgba(255, 255, 255, .15); }
.qt-chapter { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.qt-role { background: rgba(194, 154, 69, .16); color: #E9D3A0; border: 1px solid rgba(194, 154, 69, .4); padding: 3px 12px; border-radius: 99px; font-weight: 700; }
.qt-count { color: #9FB3CF; font-variant-numeric: tabular-nums; direction: ltr; }
.qt-close { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #fff; border-radius: 99px; padding: 7px 14px; font-weight: 700; font-size: .9rem; }
.qt-close:hover { background: rgba(255, 255, 255, .14); }
.qt-close .ic { width: 16px; height: 16px; }

/* stage */
.qt-stage { position: relative; flex: 1; min-height: 0; margin: 0 20px; border-radius: 18px; overflow: hidden; background: #F6F8FB; box-shadow: 0 30px 80px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .08); }
.qt-frames { position: absolute; inset: 0; }
.qt-frame { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #fff; opacity: 0; transition: opacity .45s ease; pointer-events: none; }
.qt-frame.is-front { opacity: 1; z-index: 1; }
.qt-shield { position: absolute; inset: 0; z-index: 5; cursor: default; }
.qt-shield.off { pointer-events: none; }

.qt-spot {
    position: absolute; top: 0; left: 0; z-index: 3; width: 0; height: 0; border-radius: 14px; pointer-events: none;
    box-shadow: 0 0 0 2px #C29A45, 0 0 0 7px rgba(194, 154, 69, .22), 0 0 0 9999px rgba(11, 37, 69, 0);
    opacity: 0; transition: transform .6s cubic-bezier(.2, .7, .2, 1), width .6s cubic-bezier(.2, .7, .2, 1), height .6s cubic-bezier(.2, .7, .2, 1), opacity .35s, box-shadow .5s;
}
.qt-spot.on { opacity: 1; box-shadow: 0 0 0 2px #C29A45, 0 0 0 7px rgba(194, 154, 69, .22), 0 0 0 9999px rgba(11, 37, 69, .42); }

.qt-cursor { position: absolute; top: 0; left: 0; z-index: 4; width: 30px; height: 30px; margin: -4px 0 0 -4px; pointer-events: none; opacity: 0; transition: transform .85s cubic-bezier(.45, .05, .25, 1), opacity .3s; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .3)); }
.qt-cursor.on { opacity: 1; }
.qt-cursor svg { width: 100%; height: 100%; }
.qt-cursor::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; border: 2px solid #C29A45; opacity: 0; }
.qt-cursor.click::after { animation: qt-ripple .55s ease-out; }
@keyframes qt-ripple { 0% { opacity: 1; transform: scale(.4); } 100% { opacity: 0; transform: scale(3.2); } }

.qt-loading { position: absolute; top: 0; inset-inline: 0; height: 3px; z-index: 6; overflow: hidden; opacity: 0; transition: opacity .2s; }
.qt-loading.on { opacity: 1; }
.qt-loading span { position: absolute; top: 0; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, #C29A45, transparent); animation: qt-load 1s linear infinite; }
@keyframes qt-load { from { left: -40%; } to { left: 100%; } }

/* slides */
.qt-slide {
    position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; padding: 24px;
    background: linear-gradient(180deg, rgba(11, 37, 69, .55), rgba(7, 26, 51, .92)), url("../media/hero-poster.webp") center / cover, #0B2545;
    opacity: 0; visibility: hidden; transition: opacity .5s, visibility .5s;
}
.qt-slide.on { opacity: 1; visibility: visible; }
.qt-card { text-align: center; max-width: 620px; color: #fff; }
.qt-mark { width: 64px; height: 64px; color: #E9D3A0; margin: 0 auto 18px; }
.qt-card h2 { font-family: var(--f-display, Cairo); font-weight: 800; font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.25; }
.qt-card p { color: #C9D6E8; font-size: clamp(1rem, 2vw, 1.2rem); margin-top: 12px; line-height: 1.9; }
.qt-roles { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.qt-roles li { border: 1px solid rgba(233, 211, 160, .45); color: #E9D3A0; padding: 6px 16px; border-radius: 99px; font-weight: 700; animation: qt-pop .6s cubic-bezier(.2, .8, .2, 1.2) both; }
.qt-roles li:nth-child(2) { animation-delay: .12s; } .qt-roles li:nth-child(3) { animation-delay: .24s; } .qt-roles li:nth-child(4) { animation-delay: .36s; }
@keyframes qt-pop { from { opacity: 0; transform: translateY(10px) scale(.9); } }
.qt-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.qt-replay { margin-top: 18px; background: none; border: 0; color: #9FB3CF; font-weight: 700; }
.qt-replay:hover { color: #fff; }

/* bottom bar */
.qt-bar { flex: none; padding: 14px 20px 16px; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "prog prog" "cap ctl"; gap: 12px 20px; align-items: center; }
.qt-progress { grid-area: prog; display: flex; gap: 6px; }
.qt-seg { flex: 1 1 0; min-width: 0; border: 0; background: none; padding: 0; color: #7F93AE; text-align: start; font-size: .75rem; font-weight: 700; cursor: pointer; }
.qt-seg i { display: block; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .14); position: relative; overflow: hidden; margin-bottom: 6px; }
.qt-seg i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #E9D3A0, #C29A45); transform-origin: right; transform: scaleX(var(--f, 0)); }
.qt-seg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.qt-seg.is-now { color: #E9D3A0; }
.qt-caption { grid-area: cap; font-size: clamp(1.02rem, 1.7vw, 1.28rem); line-height: 1.8; font-weight: 600; min-height: 3.6em; max-width: 60em; }
.qt-caption .w { color: rgba(255, 255, 255, .45); transition: color .25s; }
.qt-caption .w.on { color: #fff; }
.qt-controls { grid-area: ctl; display: flex; gap: 8px; }
.qt-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: #fff; display: grid; place-items: center; }
.qt-btn:hover { background: rgba(255, 255, 255, .14); }
.qt-btn .ic { width: 20px; height: 20px; }
.qt-play { width: 54px; height: 54px; background: #C29A45; border-color: #C29A45; color: #0B2545; }
.qt-play:hover { background: #D3AE5C; }
.qt.is-muted .qt-wave { opacity: .2; }
.qt :focus-visible { outline: 3px solid #E9D3A0; outline-offset: 2px; }

/* landing button hint when opened with ?tour=1 */
.tour-pulse { animation: tour-pulse 1.6s ease-out infinite; }
@keyframes tour-pulse { 0% { box-shadow: 0 0 0 0 rgba(194, 154, 69, .6); } 100% { box-shadow: 0 0 0 16px rgba(194, 154, 69, 0); } }

@media (max-width: 760px) {
    .qt-top { height: 52px; padding: 0 12px; gap: 8px; }
    .qt-brand span, .qt-count { display: none; }
    .qt-close span { display: none; }
    .qt-close { padding: 8px; }
    .qt-stage { margin: 0; border-radius: 0; }
    .qt-bar { grid-template-columns: 1fr; grid-template-areas: "prog" "cap" "ctl"; padding: 10px 14px 14px; gap: 8px; }
    .qt-seg span { display: none; }
    .qt-caption { font-size: 1rem; min-height: 3.6em; }
    .qt-controls { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
    .qt-spot, .qt-cursor, .qt-frame { transition: none; }
}

/* ---------- role avatars ---------- */
.qt-avatar { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: visible;
    background: radial-gradient(circle at 35% 30%, #2E6FB5, #0B2545 75%); color: #E9D3A0; box-shadow: 0 0 0 2px #C29A45; }
.qt-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.qt-avatar svg { width: 56%; height: 56%; }
.qt-avatar::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid rgba(194, 154, 69, .7); animation: qt-breathe 2.6s ease-out infinite; pointer-events: none; }
@keyframes qt-breathe { 0% { transform: scale(1); opacity: .85; } 70%, 100% { transform: scale(1.45); opacity: 0; } }
.qt-avatar-xs { width: 26px; height: 26px; }
.qt-avatar-sm { width: 30px; height: 30px; }
.qt-avatar-lg { width: 68px; height: 68px; box-shadow: 0 0 0 3px #C29A45, 0 12px 30px rgba(0, 0, 0, .35); }
.qt-avatar-lg::after { border-width: 3px; }
.qt-avatar.has-img { background: #0B2545; }

.qt-role { display: inline-flex; align-items: center; gap: 8px; }
.qt-role.has-ava { padding-inline-start: 3px; }
.qt-role .qt-ava:empty { display: none; }
.qt-role .qt-ava { display: inline-flex; }
.qt-role.swap .qt-ava { animation: qt-ava-in .6s cubic-bezier(.2, .9, .3, 1.3) both; }
.qt-role.swap b { animation: qt-fade-in .5s ease both; }
@keyframes qt-ava-in { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
@keyframes qt-fade-in { from { opacity: 0; transform: translateY(4px); } }

/* who-is-speaking card, bottom corner of the stage */
.qt-rolecard {
    position: absolute; z-index: 6; inset-inline-start: 18px; bottom: 18px; display: flex; align-items: center; gap: 14px;
    padding: 12px 20px 12px 14px; border-radius: 18px; max-width: min(420px, calc(100% - 36px));
    background: rgba(11, 37, 69, .92); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(233, 211, 160, .35); box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
    opacity: 0; transform: translateY(16px) scale(.96); pointer-events: none; transition: opacity .45s ease, transform .55s cubic-bezier(.2, .9, .3, 1.2);
}
.qt-rolecard.on { opacity: 1; transform: none; }
.qt-rolecard small { display: block; color: #9FB3CF; font-size: .78rem; font-weight: 600; }
.qt-rolecard b { display: block; font-family: var(--f-display, Cairo); font-size: 1.25rem; line-height: 1.3; color: #E9D3A0; }
.qt-rolecard span:not(.qt-avatar) { display: block; font-size: .85rem; color: #DCE6F3; line-height: 1.5; margin-top: 2px; }

/* intro role chips with avatars */
.qt-roles li { display: inline-flex; align-items: center; gap: 8px; padding-inline-start: 5px; }

/* ---------- intro film (4 stills) ---------- */
.qt-slide.has-film { background: #071A33; place-items: end start; padding: clamp(16px, 3vw, 36px); }
.qt-film { position: absolute; inset: 0; overflow: hidden; }
.qt-film::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 26, 51, .1) 30%, rgba(7, 26, 51, .88)), linear-gradient(90deg, rgba(7, 26, 51, .55), transparent 55%); }
[dir="rtl"] .qt-film::after { background: linear-gradient(180deg, rgba(7, 26, 51, .1) 30%, rgba(7, 26, 51, .88)), linear-gradient(270deg, rgba(7, 26, 51, .55), transparent 55%); }
.qt-shot { position: absolute; inset: -2%; background-size: cover; background-position: center; opacity: 0; transform: scale(1.02); transition: opacity 1.3s ease; will-change: opacity, transform; }
.qt-shot.on { opacity: 1; animation: qt-kenburns 9s ease-out both; }
.qt-shot:nth-child(2).on { animation-name: qt-kenburns-2; }
.qt-shot:nth-child(4).on { animation-name: qt-kenburns-2; }
@keyframes qt-kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.12) translate(-1.5%, -1%); } }
@keyframes qt-kenburns-2 { from { transform: scale(1.12) translate(1.5%, 0); } to { transform: scale(1.03) translate(0, -1%); } }
.qt-moments { position: absolute; top: clamp(14px, 3vw, 28px); inset-inline-start: clamp(14px, 3vw, 28px); z-index: 3; }
.qt-moment:empty { display: none; }
.qt-moment { position: absolute; top: 0; inset-inline-start: 0; white-space: nowrap; display: inline-flex; align-items: center; gap: 10px;
    background: rgba(11, 37, 69, .72); border: 1px solid rgba(233, 211, 160, .4); color: #fff; padding: 7px 16px; border-radius: 99px; font-weight: 700; font-size: .95rem;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); opacity: 0; transform: translateY(-8px); transition: opacity .6s .5s, transform .6s .5s; }
.qt-moment b { color: #E9D3A0; direction: ltr; unicode-bidi: isolate; }
.qt-moment.on { opacity: 1; transform: none; transition-delay: .5s; }
.qt-moment:not(.on) { transition-delay: 0s; }
.qt-card-film { position: relative; z-index: 2; text-align: start; max-width: 560px; }
.qt-card-film .qt-mark { margin: 0 0 12px; width: 52px; height: 52px; }
.qt-card-film .qt-roles { justify-content: flex-start; }
.qt-card-film h2 { text-shadow: 0 4px 24px rgba(0, 0, 0, .35); }

@media (max-width: 760px) {
    .qt-rolecard { bottom: 10px; inset-inline-start: 10px; padding: 8px 14px 8px 10px; gap: 10px; }
    .qt-avatar-lg { width: 48px; height: 48px; }
    .qt-rolecard b { font-size: 1.05rem; }
    .qt-rolecard span:not(.qt-avatar) { font-size: .78rem; }
    .qt-role b { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
    .qt-avatar::after, .qt-shot.on { animation: none; }
}
