/* ==========================================================================
   NPC Egyptian Paralympic Committee - Animated Sign Language Interpreter
   60fps Articulated Skeletal Interpreter Stage, Controls, Tabs & PiP Styles
   WCAG 2.2 AA / AAA High-Contrast Compliant | Full RTL & LTR | Zero Emojis
   ========================================================================== */

:root {
    --npc-sa-bg-deep: #060c1a;
    --npc-sa-bg-card: #0c162c;
    --npc-sa-bg-panel: #13213e;
    --npc-sa-bg-elevated: #1a2c4f;
    --npc-sa-gold: #c89d3c;
    --npc-sa-gold-bright: #facc15;
    --npc-sa-gold-soft: rgba(200, 157, 60, 0.18);
    --npc-sa-red: #c92332;
    --npc-sa-green: #22c55e;
    --npc-sa-ink: #f8fafc;
    --npc-sa-muted: #cbd5e1;
    --npc-sa-subtle: #94a3b8;
    --npc-sa-border: rgba(200, 157, 60, 0.38);
    --npc-sa-border-soft: rgba(255, 255, 255, 0.12);
    --npc-sa-radius: 14px;
    --npc-sa-font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   1. Core Animated Interpreter Root & Canvas Stage
   -------------------------------------------------------------------------- */
.npc-sa-root {
    font-family: var(--npc-sa-font);
    color: var(--npc-sa-ink);
    background: var(--npc-sa-bg-card);
    border: 1.5px solid var(--npc-sa-border);
    border-radius: var(--npc-sa-radius);
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(5, 10, 24, 0.36);
    position: relative;
    box-sizing: border-box;
    text-align: start;
}

.npc-sa-root *,
.npc-sa-root *::before,
.npc-sa-root *::after {
    box-sizing: border-box;
}

.npc-sa-stage-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 360 / 320;
    max-height: 360px;
    background: radial-gradient(circle at 50% 42%, #16284a 0%, #0a1428 66%, #050a16 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.npc-sa-canvas {
    width: 100%;
    height: 100%;
    display: block;
    user-select: none;
    -webkit-user-select: none;
}

/* Top Stage Overlays (Active Sign Badge + Language/Status Pill) */
.npc-sa-stage-hud {
    position: absolute;
    inset-block-start: 10px;
    inset-inline: 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
    z-index: 3;
}

.npc-sa-active-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(8, 15, 32, 0.84);
    border: 1px solid rgba(250, 204, 21, 0.45);
    color: var(--npc-sa-gold-bright);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1.3;
    max-width: 68%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.32);
}

.npc-sa-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--npc-sa-green);
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

.npc-sa-root.is-paused .npc-sa-live-dot {
    background: var(--npc-sa-gold);
    box-shadow: none;
}

.npc-sa-stage-badges {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.npc-sa-lang-tag,
.npc-sa-step-tag {
    background: rgba(8, 15, 32, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #e2e8f0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    font-variant-numeric: tabular-nums;
    backdrop-filter: blur(6px);
}

.npc-sa-lang-tag {
    color: var(--npc-sa-gold-bright);
    border-color: rgba(200, 157, 60, 0.45);
}

/* Bottom Progress Track inside Stage */
.npc-sa-progress-track {
    position: absolute;
    inset-block-end: 0;
    inset-inline: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.12);
    z-index: 4;
    overflow: hidden;
}

.npc-sa-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--npc-sa-gold) 0%, var(--npc-sa-gold-bright) 100%);
    transition: width 0.12s linear;
}

/* --------------------------------------------------------------------------
   2. Standalone / Hub Control Bar
   -------------------------------------------------------------------------- */
.npc-sa-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    background: var(--npc-sa-bg-panel);
    border-top: 1px solid var(--npc-sa-border-soft);
}

.npc-sa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 34px;
    min-height: 34px;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.07);
    color: var(--npc-sa-ink);
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

.npc-sa-btn:hover,
.npc-sa-btn:focus-visible {
    background: rgba(200, 157, 60, 0.24);
    border-color: var(--npc-sa-gold-bright);
    color: #ffffff;
    outline: 2px solid var(--npc-sa-gold-bright);
    outline-offset: 1px;
}

.npc-sa-btn.is-primary {
    background: linear-gradient(135deg, var(--npc-sa-gold) 0%, #b38628 100%);
    border-color: var(--npc-sa-gold-bright);
    color: #091122;
    font-weight: 800;
}

.npc-sa-btn.is-primary:hover,
.npc-sa-btn.is-primary:focus-visible {
    background: var(--npc-sa-gold-bright);
    color: #060c1a;
}

.npc-sa-btn.is-active {
    background: var(--npc-sa-gold);
    border-color: var(--npc-sa-gold-bright);
    color: #091122;
    font-weight: 800;
}

.npc-sa-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.npc-sa-group-end {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.npc-sa-speed-pill,
.npc-sa-lang-pill {
    min-width: 34px;
    min-height: 28px;
    padding: 2px 7px;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 6px;
}

/* --------------------------------------------------------------------------
   3. Synchronized Gloss Bar, Hand-Motion Badge & Plain-Language Subtitle
   -------------------------------------------------------------------------- */
.npc-sa-info {
    padding: 10px 12px 12px;
    background: var(--npc-sa-bg-card);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.npc-sa-motion-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-inline-start: 3px solid var(--npc-sa-gold-bright);
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 0.77rem;
    line-height: 1.5;
    color: var(--npc-sa-muted);
}

.npc-sa-motion-icon {
    color: var(--npc-sa-gold-bright);
    flex-shrink: 0;
    margin-top: 2px;
    display: inline-flex;
}

.npc-sa-motion-text {
    flex: 1;
    min-width: 0;
}

.npc-sa-subtitle-box {
    background: rgba(5, 10, 22, 0.78);
    border: 1px solid rgba(200, 157, 60, 0.34);
    border-radius: 8px;
    padding: 8px 11px;
    font-size: 0.87rem;
    font-weight: 700;
    line-height: 1.6;
    color: #ffffff;
    min-height: 40px;
}

.npc-sa-gloss-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(200, 157, 60, 0.45) transparent;
}

.npc-sa-gloss-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    background: #162442;
    color: #e2e8f0;
    border: 1px solid rgba(200, 157, 60, 0.35);
    border-radius: 7px;
    padding: 4px 9px;
    font-family: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    white-space: nowrap;
}

.npc-sa-gloss-chip:hover,
.npc-sa-gloss-chip:focus-visible {
    border-color: var(--npc-sa-gold-bright);
    color: #ffffff;
    background: #1f335c;
    outline: 2px solid var(--npc-sa-gold-bright);
    outline-offset: 1px;
}

.npc-sa-gloss-chip.is-active {
    background: var(--npc-sa-gold-bright);
    color: #081022;
    border-color: #ffffff;
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.55);
    transform: translateY(-1px);
}

.npc-sa-gloss-idx {
    font-size: 0.66rem;
    opacity: 0.75;
    font-variant-numeric: tabular-nums;
}

.npc-sa-sr-live {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   4. Variants: News Mount, Accessibility Hub Deaf Studio, Compact PiP
   -------------------------------------------------------------------------- */

/* News Article Embedded Mount (#npc-sign-animator-mount) */
.npc-sign-animator-mount {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.npc-sa-root.npc-sa-variant-news {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    width: 100%;
}

.npc-sa-root.npc-sa-variant-news .npc-sa-stage-wrap {
    aspect-ratio: 16 / 10;
    max-height: 340px;
}

.npc-sign-card.is-floating-pip .npc-sa-root.npc-sa-variant-news .npc-sa-stage-wrap {
    aspect-ratio: 360 / 260;
    max-height: 210px;
}

/* News Article Blade Enhancements (Tabs, Lang Switcher, Live Motion & Subtitle) */
.npc-sign-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #0b1326;
    border-bottom: 1px solid rgba(200, 157, 60, 0.25);
    flex-wrap: wrap;
}

.npc-sign-tab,
[data-sign-tab] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
    font-family: var(--npc-sa-font);
    font-size: 0.78rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    min-height: 34px;
}

.npc-sign-tab:hover,
.npc-sign-tab:focus-visible,
[data-sign-tab]:hover,
[data-sign-tab]:focus-visible {
    border-color: var(--npc-sa-gold-bright);
    color: #ffffff;
    outline: 2px solid var(--npc-sa-gold-bright);
    outline-offset: 1px;
}

.npc-sign-tab[aria-selected="true"],
.npc-sign-tab.active,
[data-sign-tab][aria-selected="true"] {
    background: linear-gradient(135deg, var(--npc-sa-gold) 0%, #b38628 100%);
    border-color: var(--npc-sa-gold-bright);
    color: #081022;
    box-shadow: 0 4px 12px rgba(200, 157, 60, 0.28);
}

.npc-sign-panel[hidden] {
    display: none !important;
}

.npc-sign-lang-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: 4px;
}

.npc-sign-lang-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #cbd5e1;
    font-family: var(--npc-sa-font);
    font-size: 0.74rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    min-height: 32px;
    transition: all 0.15s ease;
}

.npc-sign-lang-btn:hover,
.npc-sign-lang-btn:focus-visible,
.npc-sign-lang-btn.active {
    background: var(--npc-sa-gold);
    border-color: var(--npc-sa-gold-bright);
    color: #081022;
}

.npc-sign-live-readout {
    background: rgba(5, 10, 22, 0.72);
    border: 1px solid rgba(200, 157, 60, 0.36);
    border-inline-start: 3px solid var(--npc-sa-gold-bright);
    border-radius: 9px;
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.65rem;
}

#npc-sign-live-motion {
    font-size: 0.79rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--npc-sa-gold-bright);
    margin-bottom: 0.28rem;
}

#npc-sign-live-subtitle {
    font-size: 0.91rem;
    font-weight: 700;
    line-height: 1.6;
    color: #ffffff;
}

#npc-sign-article-gloss {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
    align-items: center;
}

#npc-sign-article-gloss .npc-sign-gloss-badge {
    cursor: pointer;
    font-family: var(--npc-sa-font);
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

#npc-sign-article-gloss .npc-sign-gloss-badge:hover,
#npc-sign-article-gloss .npc-sign-gloss-badge:focus-visible {
    background: rgba(250, 204, 21, 0.28);
    border-color: var(--npc-sa-gold-bright);
    color: #ffffff;
    outline: 2px solid var(--npc-sa-gold-bright);
}

#npc-sign-article-gloss .npc-sign-gloss-badge.is-active {
    background: var(--npc-sa-gold-bright);
    color: #081022;
    border-color: #ffffff;
    font-weight: 900;
    transform: translateY(-1px);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.52);
}

/* Accessibility Hub Tab 3 Deaf Studio (#npc-hub-sign-stage) */
#npc-hub-sign-stage.npc-sa-hub-enhanced {
    aspect-ratio: auto !important;
    overflow: visible !important;
    background: #081022 !important;
    border-radius: 12px;
    border: 1px solid rgba(250, 204, 21, 0.42);
    display: flex;
    flex-direction: column;
}

.npc-sa-hub-modebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
    background: #0e1a33;
    border-bottom: 1px solid rgba(200, 157, 60, 0.3);
    border-radius: 11px 11px 0 0;
}

.npc-sa-hub-mode-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.npc-sa-hub-mode-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #cbd5e1;
    font-family: var(--npc-sa-font);
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.npc-sa-hub-mode-btn.is-active {
    background: var(--npc-sa-gold-bright);
    border-color: var(--npc-sa-gold-bright);
    color: #081022;
}

.npc-sa-hub-ref-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #050811;
    border-radius: 0 0 11px 11px;
    overflow: hidden;
}

.npc-sa-hub-ref-wrap[hidden] {
    display: none !important;
}

.npc-sa-root.npc-sa-variant-hub {
    border: 0;
    border-radius: 0 0 11px 11px;
    box-shadow: none;
}

.npc-sa-root.npc-sa-variant-hub .npc-sa-stage-wrap {
    aspect-ratio: 360 / 265;
    max-height: 265px;
}

/* Compact Floating Hover PiP (#npc-sign-pip-avatar) */
#npc-sign-pip-avatar.npc-sa-pip-enhanced {
    aspect-ratio: 360 / 250 !important;
    height: auto !important;
    min-height: 168px;
    overflow: hidden !important;
    background: #060c1a !important;
    padding: 0 !important;
    display: block !important;
}

.npc-sa-root.npc-sa-variant-pip {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    height: 100%;
}

.npc-sa-root.npc-sa-variant-pip .npc-sa-stage-wrap {
    aspect-ratio: 360 / 250;
    max-height: 200px;
}

.npc-sa-root.npc-sa-variant-pip .npc-sa-active-pill {
    font-size: 0.68rem;
    padding: 2px 8px;
    max-width: 78%;
}

.npc-sa-root.npc-sa-variant-pip .npc-sa-lang-tag,
.npc-sa-root.npc-sa-variant-pip .npc-sa-step-tag {
    font-size: 0.62rem;
    padding: 2px 6px;
}

/* Standalone Floating Picture-in-Picture Dock */
.npc-sa-root.npc-sa-floating-pip {
    position: fixed;
    bottom: 22px;
    inset-inline-end: 22px;
    width: min(330px, calc(100vw - 28px));
    z-index: 99994;
    border: 2px solid var(--npc-sa-gold-bright);
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.58);
    animation: npcSaPipEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.npc-sa-root.npc-sa-floating-pip .npc-sa-stage-wrap {
    max-height: 215px;
}

@keyframes npcSaPipEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --------------------------------------------------------------------------
   5. AAA High-Contrast Mode (html.npc-hc-mode)
   -------------------------------------------------------------------------- */
html.npc-hc-mode .npc-sa-root,
html.npc-hc-mode .npc-sa-controls,
html.npc-hc-mode .npc-sa-info,
html.npc-hc-mode .npc-sa-subtitle-box,
html.npc-hc-mode .npc-sa-motion-row,
html.npc-hc-mode .npc-sign-tabs,
html.npc-hc-mode #npc-sign-live-motion,
html.npc-hc-mode #npc-sign-live-subtitle {
    background: #000000 !important;
    color: #ffffff !important;
    border-color: #facc15 !important;
}

html.npc-hc-mode .npc-sa-stage-wrap {
    background: #000000 !important;
    border-bottom: 2px solid #facc15 !important;
}

html.npc-hc-mode .npc-sa-btn,
html.npc-hc-mode .npc-sa-gloss-chip,
html.npc-hc-mode .npc-sign-tab,
html.npc-hc-mode .npc-sign-lang-btn,
html.npc-hc-mode .npc-sa-hub-mode-btn {
    background: #000000 !important;
    color: #facc15 !important;
    border: 2px solid #facc15 !important;
}

html.npc-hc-mode .npc-sa-btn.is-primary,
html.npc-hc-mode .npc-sa-btn.is-active,
html.npc-hc-mode .npc-sa-gloss-chip.is-active,
html.npc-hc-mode .npc-sign-tab[aria-selected="true"],
html.npc-hc-mode .npc-sign-lang-btn.active,
html.npc-hc-mode .npc-sa-hub-mode-btn.is-active,
html.npc-hc-mode #npc-sign-article-gloss .npc-sign-gloss-badge.is-active {
    background: #facc15 !important;
    color: #000000 !important;
    border-color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   6. Reduced Motion & Responsive Adjustments
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .npc-sa-root,
    .npc-sa-root *,
    .npc-sa-progress-fill,
    .npc-sa-gloss-chip,
    .npc-sa-btn {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 600px) {
    .npc-sa-controls {
        padding: 7px 9px;
        gap: 5px;
    }
    .npc-sa-active-pill {
        font-size: 0.7rem;
        padding: 3px 8px;
    }
    .npc-sa-subtitle-box,
    #npc-sign-live-subtitle {
        font-size: 0.83rem;
    }
    .npc-sa-root.npc-sa-floating-pip {
        bottom: 14px;
        inset-inline-end: 14px;
    }
}
