/* =====================================================
   FILE PATH: public/css/Welcome.css
   PURPOSE  : Full-screen welcome GIF page with playback control
              State 1: Idle    — first frame frozen, hint says "press to play"
              State 2: Playing — GIF plays one full loop
              State 3: Done    — last frame frozen, hint says "press to enter"
              State 4: Fading  — redirecting to /home
===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000000;
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
}

/* ── Full-screen wrapper ─────────────────────────── */
.welcome-wrap {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}

/* ── GIF / Canvas: cover the whole screen ────────── */
.welcome-gif,
.welcome-wrap canvas,
.jsgif {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    display: block;
    pointer-events: none;
    background: #000;
}

/* libgif wraps the canvas in <div class="jsgif"> — make it full screen */
.jsgif {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.jsgif canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

/* libgif loading text — hide it (we have our own hint) */
.jsgif > div:not(canvas) {
    display: none !important;
}

/* ── Hint overlay at bottom ──────────────────────── */
.welcome-hint {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    padding: 12px 26px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.4px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
    z-index: 10;
    white-space: nowrap;
    text-align: center;
    transition: opacity 0.3s ease, background 0.3s ease;
}

.welcome-hint .hint-text-mar {
    display: block;
    font-size: 14px;
    margin-bottom: 2px;
}

.welcome-hint .hint-text-eng {
    display: block;
    font-size: 11px;
    opacity: 0.75;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* ── State 1: idle — GIF frozen on first frame ──── */
.welcome-hint.state-idle {
    animation: hint-pulse 1.6s ease-in-out infinite;
    background: rgba(232, 150, 26, 0.85);   /* gold — invitation */
    border-color: rgba(255, 255, 255, 0.3);
}

/* ── State 2: playing — hide hint while GIF plays ─ */
.welcome-hint.state-playing {
    opacity: 0;
}

/* ── State 3: done — last frame, "press to enter" ─ */
.welcome-hint.state-done {
    animation: hint-pulse 1.4s ease-in-out infinite;
    background: rgba(122, 31, 31, 0.88);    /* maroon — call to action */
    border-color: rgba(232, 150, 26, 0.5);
    box-shadow: 0 0 0 4px rgba(232, 150, 26, 0.15),
                0 8px 28px rgba(0, 0, 0, 0.4);
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.92; transform: translateX(-50%) translateY(0)    scale(1);    }
    50%      { opacity: 1;    transform: translateX(-50%) translateY(-3px) scale(1.03); }
}

/* ── Fade-out animation when redirecting ─────────── */
.welcome-wrap.fading-out {
    animation: welcome-fade 0.4s ease-in forwards;
}

@keyframes welcome-fade {
    to { opacity: 0; }
}

/* ── Mobile / smaller screens ────────────────────── */
@media (max-width: 600px) {
    .welcome-hint {
        bottom: 24px;
        padding: 10px 20px;
    }
    .welcome-hint .hint-text-mar {
        font-size: 13px;
    }
    .welcome-hint .hint-text-eng {
        font-size: 10px;
    }
}

/* ── Tall portrait screens — switch to contain ───── */
@media (orientation: portrait) and (max-aspect-ratio: 3/4) {
    .welcome-gif,
    .welcome-wrap canvas,
    .jsgif canvas {
        object-fit: contain;
    }
}