/* ============================================================================
 * Photo Stories — YouTube Shorts style player.
 * Vertical 9:16 stage, blurred cinema fill, + FAB for upload, thinking overlay,
 * result preview with guest "אישור". Scoped under .ps-wrap.
 * ==========================================================================*/

.ps-wrap {
    --ps-ink: #ffffff;
    --ps-ink-dim: rgb(255 255 255 / 0.72);
    --ps-ink-mute: rgb(255 255 255 / 0.5);
    --ps-bg: #0a0a0a;
    --ps-panel: #141414;
    --ps-line: rgb(255 255 255 / 0.14);
    --ps-accent: #ffffff;
    --ps-danger: #ff6b6b;
    --ps-fab: #ffffff;
    --ps-fab-ink: #0a0a0a;
    --ps-radius: 18px;
    --ps-ease: 0.5s ease;

    direction: rtl;
    max-inline-size: 560px;
    margin-inline: auto;
    color: var(--ps-ink);
    font-family: 'Heebo', system-ui, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* The `hidden` attribute must always win. Class rules below set `display:block`
   / `flex`, which (author > UA at equal specificity) override the UA default of
   `[hidden] { display:none }` — that left the EMPTY upload preview <img> taking
   ~150px of dead space inside the drop box, and the empty-state text lingering
   after a photo was picked. This one line makes `hidden` authoritative. */
.ps-wrap [hidden] { display: none !important; }

.ps-shorts {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* Player row: stage + side arrows (LTR so arrows sit to the right like Shorts). */
.ps-player {
    direction: ltr;
    display: flex;
    align-items: center;
    gap: 12px;
    inline-size: 100%;
}

/* --------------------------------------------------------------- stage */
.ps-stage {
    position: relative;
    flex: 1 1 auto;
    inline-size: 100%;
    max-inline-size: 420px;
    aspect-ratio: 9 / 16;
    max-block-size: min(78vh, 720px);
    border-radius: var(--ps-radius);
    overflow: hidden;
    background: var(--ps-bg);
    box-shadow:
        rgb(0 0 0 / 0.45) 0 28px 48px -18px,
        rgb(0 0 0 / 0.2) 0 2px 10px 0;
    isolation: isolate;
}

.ps-blur {
    position: absolute;
    inset: -8%;
    background:
        radial-gradient(ellipse at 30% 20%, rgb(80 80 80 / 0.35), transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgb(40 40 40 / 0.5), transparent 50%),
        #111;
    background-size: cover;
    background-position: center;
    filter: blur(28px) saturate(1.15);
    transform: scale(1.12);
    opacity: 0.9;
    z-index: 0;
    pointer-events: none;
    transition: background-image var(--ps-ease), opacity var(--ps-ease);
}

.ps-blur.is-active {
    opacity: 1;
}

/* ---------------------------------------------------------------- feed */
.ps-feed {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ps-feed::-webkit-scrollbar { display: none; }

.ps-feed[hidden] { display: none !important; }

.ps-card {
    position: relative;
    flex: 0 0 100%;
    block-size: 100%;
    min-block-size: 100%;
    max-block-size: 100%;
    inline-size: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
    background: #000;
    /* Each story is one full slide — no nested scroll inside the card. */
    touch-action: pan-y;
}

.ps-card video {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
    background: #000;
    pointer-events: none;
}

/* Facebook / Instagram style story progress */
.ps-card__progress {
    position: absolute;
    inset-inline: 12px;
    inset-block-start: 12px;
    z-index: 4;
    block-size: 3px;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.28);
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
}

.ps-card__progress-fill {
    display: block;
    block-size: 100%;
    inline-size: 100%;
    transform: scaleX(0);
    /* Stories always fill left → right, even on RTL pages. */
    transform-origin: left center;
    background: #fff;
    border-radius: inherit;
    will-change: transform;
}

.ps-card__meta {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 2;
    padding: 56px 18px 22px;
    background: linear-gradient(to top, rgb(0 0 0 / 0.78), transparent 70%);
    color: #fff;
    pointer-events: none;
    direction: rtl;
    text-align: start;
}

.ps-card__name {
    display: block;
    font-weight: 800;
    font-size: 0.98rem;
    letter-spacing: 0.02em;
}

.ps-card__note {
    display: block;
    margin-block-start: 4px;
    font-size: 0.88rem;
    font-weight: 400;
    color: var(--ps-ink-dim);
}

/* Floating side rail: arrows + FAB */
.ps-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex: none;
    padding-block: 8px;
    align-self: stretch;
}

.ps-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: none;
    margin-block-end: auto;
}

.ps-nav[hidden] { display: none !important; }

.ps-nav__btn {
    appearance: none;
    display: flex;
    justify-content: center;
    place-items: center;
    inline-size: 42px;
    block-size: 42px;
    border: 1px solid #e4e4e7;
    border-radius: 50%;
    background: #fff;
    color: #111;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 10px rgb(0 0 0 / 0.08);
    transition: background var(--ps-ease), opacity var(--ps-ease), transform var(--ps-ease);
}

.ps-nav__btn:hover:not(:disabled) {
    background: #f4f4f5;
    transform: scale(1.04);
}

.ps-nav__btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.ps-feed-empty,
.ps-idle {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    pointer-events: none;
    direction: rtl;
}

.ps-feed-empty[hidden],
.ps-idle[hidden] {
    display: none !important;
}

.ps-feed-empty__title,
.ps-idle__title {
    font-size: clamp(1.6rem, 6vw, 2.1rem);
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
}

.ps-feed-empty__sub,
.ps-idle__sub {
    max-inline-size: 16em;
    color: var(--ps-ink-dim);
    font-weight: 300;
    font-size: 1rem;
}

.ps-feed-sentinel { flex: none; block-size: 1px; }

/* ------------------------------------------------------------ thinking */
.ps-thinking {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    background: rgb(0 0 0 / 0.55);
    backdrop-filter: blur(8px);
    text-align: center;
}

.ps-thinking[hidden] { display: none !important; }

.ps-thinking__orb {
    position: relative;
    inline-size: 88px;
    block-size: 88px;
}

.ps-thinking__ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    border-block-start-color: #fff;
    border-inline-end-color: rgb(255 255 255 / 0.25);
    animation: ps-spin 1.1s linear infinite;
}

.ps-thinking__ring:nth-child(2) {
    inset: 10px;
    animation-duration: 1.6s;
    animation-direction: reverse;
    border-block-start-color: rgb(255 255 255 / 0.7);
}

.ps-thinking__ring:nth-child(3) {
    inset: 22px;
    animation-duration: 2.2s;
    border-block-start-color: rgb(255 255 255 / 0.4);
}

@keyframes ps-spin { to { transform: rotate(360deg); } }

.ps-thinking__label {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.ps-thinking__msg {
    margin: 0;
    max-inline-size: 18em;
    color: var(--ps-ink-dim);
    font-weight: 400;
    font-size: 0.95rem;
    min-block-size: 1.4em;
}

/* -------------------------------------------------------- thank-you done */
.ps-done {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 28px 24px;
    background: rgb(0 0 0 / 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: center;
}

.ps-done[hidden] { display: none !important; }

.ps-done__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 58px;
    block-size: 58px;
    border-radius: 50%;
    color: #fff;
    box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.55) inset;
    animation: ps-pop 0.5s ease;
}

.ps-done__icon svg {
    inline-size: 27px;
    block-size: 27px;
}

@keyframes ps-pop {
    from { transform: scale(0.6); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.ps-done__title {
    margin: 0;
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
}

.ps-done__msg {
    margin: 0;
    max-inline-size: 22em;
    color: var(--ps-ink-dim);
    font-weight: 300;
    font-size: 1.02rem;
    line-height: 1.55;
}

.ps-done__btn {
    appearance: none;
    margin-block-start: 8px;
    border: 1.5px solid #fff;
    border-radius: 0;
    padding: 12px 22px;
    background: #fff;
    color: #0a0a0a;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background var(--ps-ease), color var(--ps-ease), opacity var(--ps-ease);
}

.ps-done__btn:hover {
    background: transparent;
    color: #fff;
}

/* ----------------------------------------------------- result preview */
.ps-preview {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background: #000;
}

.ps-preview[hidden] { display: none !important; }

.ps-preview__video {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: contain;
    background: #000;
}

.ps-preview__scrim {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    block-size: 42%;
    background: linear-gradient(to top, rgb(0 0 0 / 0.88), transparent);
    pointer-events: none;
}

.ps-preview__footer {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 22px 18px 24px;
}

.ps-preview__msg {
    margin: 0;
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--ps-ink-dim);
}

.ps-approve {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 14px 20px;
    background: #fff;
    color: #0a0a0a;
    font: inherit;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: opacity var(--ps-ease), transform var(--ps-ease);
}

.ps-approve:hover:not(:disabled) { opacity: 0.92; }
.ps-approve:disabled { opacity: 0.45; cursor: wait; }

/* --------------------------------------------------------------- toast */
.ps-toast {
    position: absolute;
    inset-inline: 14px;
    inset-block-start: 14px;
    z-index: 8;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgb(40 8 8 / 0.92);
    color: #ffd0d0;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}

.ps-toast.is-ok {
    background: rgb(12 40 22 / 0.92);
    color: #d4ffe0;
}

.ps-toast[hidden] { display: none !important; }

/* ----------------------------------------------------------------- FAB */
.ps-fab {
    appearance: none;
    position: relative;
    flex: none;
    inline-size: 52px;
    block-size: 52px;
    border: 0;
    border-radius: 50%;
    background: var(--ps-fab);
    color: var(--ps-fab-ink);
    cursor: pointer;
    box-shadow:
        rgb(0 0 0 / 0.28) 0 10px 24px -6px,
        rgb(255 255 255 / 0.14) 0 0 0 1px inset;
    transition: transform var(--ps-ease), box-shadow var(--ps-ease);
}

.ps-fab:hover {
    transform: scale(1.06);
    box-shadow:
        rgb(0 0 0 / 0.34) 0 14px 28px -6px,
        rgb(255 255 255 / 0.2) 0 0 0 1px inset;
}

.ps-fab:active { transform: scale(0.96); }

.ps-fab__plus,
.ps-fab__plus::before {
    position: absolute;
    inset-inline-start: 50%;
    inset-block-start: 50%;
    background: currentColor;
    border-radius: 2px;
    content: '';
}

.ps-fab__plus {
    inline-size: 20px;
    block-size: 2.5px;
    margin: -1.25px -10px;
}

.ps-fab__plus::before {
    inline-size: 2.5px;
    block-size: 20px;
    margin: -10px -1.25px;
}

/* --------------------------------------------------------------- sheet */
.ps-sheet {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.ps-sheet[hidden] { display: none !important; }

.ps-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(12 12 14 / 0.38);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ps-sheet__panel {
    --ps-form-ink: #161616;
    --ps-form-mute: #6e6e76;
    --ps-form-line: #e4e4e8;
    --ps-form-soft: #fafafa;
    --ps-form-paper: #ffffff;

    position: relative;
    z-index: 1;
    inline-size: min(100%, 440px);
    max-block-size: min(94vh, 780px);
    overflow: auto;
    padding: 28px 28px 36px;
    border-radius: 28px 28px 0 0;
    background:
        linear-gradient(180deg, #ffffff 0%, #f6f6f7 100%);
    color: var(--ps-form-ink);
    box-shadow:
        0 -1px 0 rgb(255 255 255 / 0.8) inset,
        0 -24px 80px rgb(0 0 0 / 0.18);
    animation: ps-sheet-up 0.5s ease;
}

@keyframes ps-sheet-up {
    from { transform: translateY(28px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.ps-sheet__close {
    appearance: none;
    position: absolute;
    inset-block-start: 16px;
    inset-inline-start: 16px;
    inline-size: 40px;
    block-size: 40px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ps-form-mute);
    font-size: 1.55rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    transition: color var(--ps-ease), background var(--ps-ease);
}

.ps-sheet__close:hover {
    color: var(--ps-form-ink);
    background: rgb(0 0 0 / 0.04);
}

.ps-sheet__head {
    margin-block-end: 28px;
    padding-inline-end: 44px;
    text-align: start;
}

.ps-sheet__eyebrow {
    margin: 0 0 10px;
    color: var(--ps-form-mute);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
}

.ps-sheet__title {
    margin: 0 0 10px;
    font-size: clamp(1.95rem, 5.4vw, 2.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--ps-form-ink);
}

/* Signature mixed-weight display: light word + black word. */
.ps-sheet__title-a { font-weight: 300; }
.ps-sheet__title-b { font-weight: 900; }

.ps-sheet__sub {
    margin: 0;
    max-inline-size: 28ch;
    color: var(--ps-form-mute);
    font-weight: 300;
    font-size: 1.02rem;
    line-height: 1.55;
}

.ps-form {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.ps-drop {
    position: relative;
    display: block;
    border: 1.5px dashed #d4d4dc;
    border-radius: 7px;
    background: radial-gradient(130% 130% at 50% 0%, #fff 0%, var(--ps-form-soft) 100%);
    cursor: pointer;
    overflow: hidden;
    transition:
        border-color var(--ps-ease),
        background var(--ps-ease),
        box-shadow var(--ps-ease),
        transform var(--ps-ease);
}

.ps-drop:hover,
.ps-drop.is-dragover {
    border-color: var(--ps-form-ink);
    background: radial-gradient(130% 130% at 50% 0%, #fff 0%, #f2f2f4 100%);
    box-shadow: 0 20px 44px -26px rgb(0 0 0 / 0.3);
}

.ps-drop.is-dragover { transform: scale(1.01); }

/* Once a photo is chosen, the box holds the (uncropped) preview. */
.ps-drop.is-filled {
    border-style: solid;
    border-color: var(--ps-form-line);
    background: #efeff2;
}

.ps-drop__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 30px 22px 28px;
    text-align: center;
}

.ps-drop__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 54px;
    block-size: 54px;
    margin-block-end: 8px;
    border-radius: 50%;
    background: #fff;
    color: var(--ps-form-ink);
    box-shadow:
        0 8px 18px -8px rgb(0 0 0 / 0.22),
        0 0 0 1px var(--ps-form-line) inset;
    transition: transform var(--ps-ease), box-shadow var(--ps-ease);
}

.ps-drop:hover .ps-drop__icon {
    transform: translateY(-3px);
    box-shadow:
        0 14px 24px -10px rgb(0 0 0 / 0.3),
        0 0 0 1px #c8c8ce inset;
}

.ps-drop__icon svg {
    inline-size: 26px;
    block-size: 26px;
}

.ps-drop__text {
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--ps-form-ink);
}

.ps-drop__or {
    color: var(--ps-form-mute);
    font-weight: 300;
    font-size: 0.92rem;
}

.ps-drop__hint {
    margin-block-start: 6px;
    color: #9a9aa3;
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.ps-drop__preview {
    display: block;
    inline-size: 100%;
    max-block-size: 320px;
    object-fit: contain;
    background: #efeff2;
    border-radius: 7px;
}

.ps-drop.is-filled:hover .ps-drop__preview { filter: brightness(0.92); }

/* "Change photo" pill that surfaces over the chosen preview. */
.ps-drop__change {
    position: absolute;
    inset-block-end: 12px;
    inset-inline: 0;
    z-index: 2;
    inline-size: fit-content;
    margin-inline: auto;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgb(10 10 12 / 0.82);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity var(--ps-ease), transform var(--ps-ease);
}

.ps-drop:not(.is-filled) .ps-drop__change { display: none; }

.ps-drop.is-filled:hover .ps-drop__change {
    opacity: 1;
    transform: translateY(0);
}

.ps-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ps-field__label {
    color: var(--ps-form-mute);
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.ps-input {
    inline-size: 100%;
    box-sizing: border-box;
    padding: 10px 0 12px;
    border: 0;
    border-block-end: 1px solid var(--ps-form-line);
    border-radius: 0;
    background: transparent;
    color: var(--ps-form-ink);
    font: inherit;
    font-weight: 400;
    transition: border-color var(--ps-ease);
}

.ps-input::placeholder { color: #b0b0b8; font-weight: 300; }

.ps-input:focus {
    outline: none;
    border-block-end-color: var(--ps-form-ink);
    border-block-end-width: 1.5px;
}

.ps-input--area {
    resize: none;
    min-block-size: 56px;
    line-height: 1.5;
}

.ps-hp {
    position: absolute;
    inset-inline-start: -9999px;
    block-size: 1px;
    inline-size: 1px;
    opacity: 0;
}

.ps-consent {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-block-start: 4px;
    color: var(--ps-form-mute);
    font-size: 0.88rem;
    font-weight: 300;
    line-height: 1.5;
    cursor: pointer;
}

.ps-consent input {
    flex: none;
    margin-block-start: 3px;
    inline-size: 16px;
    block-size: 16px;
    accent-color: var(--ps-form-ink);
}

.ps-btn {
    appearance: none;
    margin-block-start: 6px;
    border: 1.5px solid var(--ps-form-ink);
    border-radius: 0;
    padding: 15px 22px;
    background: var(--ps-form-ink);
    color: #fff;
    font: inherit;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition:
        opacity var(--ps-ease),
        background var(--ps-ease),
        color var(--ps-ease);
}

.ps-btn:hover:not(:disabled) {
    background: transparent;
    color: var(--ps-form-ink);
}

.ps-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

/* ----------------------------------------------------------- responsive */
@media (max-width: 480px) {
    .ps-wrap { max-inline-size: 100%; }
    .ps-player {
        position: relative;
        gap: 0;
    }
    .ps-stage {
        border-radius: 0;
        max-block-size: calc(100vh - 24px);
        aspect-ratio: auto;
        block-size: calc(100vh - 24px);
        max-inline-size: none;
    }
    .ps-rail {
        position: absolute;
        inset-inline-end: 10px;
        inset-block-end: 72px;
        z-index: 5;
        justify-content: flex-end;
        gap: 12px;
        padding: 0;
        pointer-events: none;
    }
    .ps-rail > * { pointer-events: auto; }
    .ps-nav { margin-block-end: 0; }
    .ps-nav__btn {
        inline-size: 38px;
        block-size: 38px;
        font-size: 0.95rem;
        background: rgb(255 255 255 / 0.92);
        backdrop-filter: blur(8px);
    }
    .ps-fab {
        inline-size: 48px;
        block-size: 48px;
    }
    .ps-shorts { gap: 0; }
    .ps-sheet__panel {
        padding: 24px 22px 32px;
        border-radius: 24px 24px 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ps-thinking__ring,
    .ps-sheet__panel,
    .ps-done__icon,
    .ps-fab { animation: none; transition: none; }
}
