/* Shorts: vertical swipe feed (user/shorts/*) and the 9:16 Shorts rows / channel grid (user/partials/shorts-*).
   Colours follow the Modern theme tokens when it is on, else light defaults; .sh-dark = the Dark theme. */

.sh-page, .sh-shelf, .sh-grid, .sh-sort {
    --sh-bg: var(--mt-bg, #fff);
    --sh-text: var(--mt-text-1, #0f0f0f);
    --sh-text-2: var(--mt-text-2, #606060);
    --sh-btn: var(--mt-surface-2, #f2f2f2);
    --sh-btn-hover: var(--mt-hover, #e5e5e5);
    --sh-border: var(--mt-border, #e5e5e5);
    --sh-elevated: var(--mt-elevated, #fff);
}
.sh-dark {
    --sh-bg: #0f0f0f; --sh-text: #f1f1f1; --sh-text-2: #aaa;
    --sh-btn: #272727; --sh-btn-hover: #3f3f3f; --sh-border: #3f3f3f; --sh-elevated: #212121;
}

/* ---------- player page ---------- */

.page-inner.sh-page { position: relative; padding: 0 !important; color: var(--sh-text); }

.sh-feed {
    height: calc(100vh - 56px);                                  /* shorts.js sets the exact height under the header */
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-padding-top: 16px;
    overscroll-behavior: contain;
    scrollbar-width: none;
    outline: none;
}
.sh-feed::-webkit-scrollbar { display: none; }

.sh-slide {
    display: flex; justify-content: center; align-items: flex-end;
    height: calc(100% - 64px);                                   /* leaves the top of the next Short peeking in */
    margin-top: 16px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}
.sh-slide:last-child { margin-bottom: 16px; }

.sh-player {
    position: relative;
    height: 100%;
    aspect-ratio: 9 / 16;
    max-width: calc(100vw - 32px);
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}
.sh-video { display: block; width: 100%; height: 100%; object-fit: contain; cursor: pointer; }

.sh-mute {
    position: absolute; top: 12px; left: 12px;
    width: 40px; height: 40px; border: 0; border-radius: 50%;
    background: rgba(0, 0, 0, .45); color: #fff; font-size: 18px;
}
.sh-paused {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 64px; height: 64px; border-radius: 50%;
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, .5); color: #fff; font-size: 26px; padding-left: 4px;
    pointer-events: none;
}
.sh-slide.is-paused .sh-paused { display: flex; }

.sh-info {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 48px 16px 16px;
    background: linear-gradient(transparent, rgba(0, 0, 0, .6));
    color: #fff;
    pointer-events: none;
}
.sh-info a, .sh-info button { pointer-events: auto; }
.sh-channel { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sh-channel a { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 500; text-decoration: none; min-width: 0; }
.sh-channel a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-channel img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.sh-subscribe {
    flex: none; border: 0; border-radius: 18px; padding: 0 14px; height: 32px;
    background: #fff; color: #0f0f0f; font-weight: 500; font-size: 13px;
}
.sh-subscribe.is-on { background: rgba(255, 255, 255, .2); color: #fff; }
.sh-title {
    margin: 0; font-size: 15px; line-height: 1.35; color: #fff;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.sh-actions { display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; margin-left: 12px; padding-bottom: 4px; }
.sh-act {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 0; padding: 0; background: none; color: var(--sh-text); font-size: 12px; text-decoration: none;
}
.sh-act:hover, .sh-act:focus { color: var(--sh-text); text-decoration: none; }
.sh-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--sh-btn); font-size: 20px;
}
.sh-act:hover .sh-icon { background: var(--sh-btn-hover); }
.sh-act.is-on .sh-icon { background: var(--sh-text); color: var(--sh-bg); }
.sh-avatar img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }

.sh-nav {
    position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 16px;
}
.sh-nav button {
    width: 56px; height: 56px; border: 0; border-radius: 50%;
    background: var(--sh-btn); color: var(--sh-text); font-size: 20px;
}
.sh-nav button:hover { background: var(--sh-btn-hover); }
.sh-nav button:disabled { opacity: .35; }

:is(.sh-page, .sh-shelf, .sh-grid) :is(a, button, input):focus-visible { outline: 2px solid var(--mt-focus, #065fd4); outline-offset: 2px; }

/* comments: side panel, bottom sheet on phones */
.sh-comments {
    position: fixed; z-index: 1030; right: 16px; top: 72px; bottom: 16px; width: 400px;
    display: flex; flex-direction: column;
    background: var(--sh-elevated); color: var(--sh-text);
    border: 1px solid var(--sh-border); border-radius: 12px;
    box-shadow: 0 4px 32px rgba(0, 0, 0, .2);
}
.sh-comments[hidden] { display: none; }
.sh-comments header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--sh-border); }
.sh-comments h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--sh-text); }
.sh-comments-close { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--sh-text); font-size: 18px; }
.sh-comments-close:hover { background: var(--sh-btn); }
.sh-comments-list { flex: 1; overflow-y: auto; padding: 12px 16px; }
.sh-c { display: flex; gap: 12px; margin-bottom: 16px; }
.sh-c img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.sh-c b { font-size: 13px; }
.sh-c small { color: var(--sh-text-2); }
.sh-c p { margin: 2px 0 0; font-size: 14px; word-break: break-word; }
.sh-c-empty { color: var(--sh-text-2); text-align: center; margin-top: 24px; }
.sh-comment-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--sh-border); }
.sh-comment-form input {
    flex: 1; min-width: 0; height: 36px; padding: 0 12px;
    border: 1px solid var(--sh-border) !important; border-radius: 18px !important;
    background: transparent; color: var(--sh-text);
}
.sh-comment-form button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--sh-btn); color: var(--sh-text); }
.sh-comment-login { display: block; padding: 12px 16px; border-top: 1px solid var(--sh-border); text-align: center; }

.sh-toast {
    position: fixed; z-index: 1040; left: 50%; bottom: 32px; transform: translateX(-50%);
    padding: 10px 16px; border-radius: 8px; background: #323232; color: #fff; font-size: 14px;
    opacity: 0; transition: opacity .2s; pointer-events: none;
}
.sh-toast.is-on { opacity: 1; }

/* phones: full-bleed video, buttons over it */
@media (max-width: 767px) {
    .sh-slide { position: relative; height: 100%; margin: 0; }
    .sh-slide:last-child { margin-bottom: 0; }
    .sh-feed { scroll-padding-top: 0; }
    .sh-player { width: 100%; max-width: none; aspect-ratio: auto; border-radius: 0; }
    .sh-info { padding-right: 72px; }
    .sh-actions { position: absolute; right: 8px; bottom: 16px; margin: 0; z-index: 2; }
    .sh-act, .sh-act:hover, .sh-act:focus { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
    .sh-icon { background: rgba(0, 0, 0, .35); }
    .sh-act.is-on .sh-icon { background: #fff; color: #0f0f0f; text-shadow: none; }
    .sh-nav { display: none; }
    .sh-comments { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 70vh; border-radius: 12px 12px 0 0; }
}

/* ---------- 9:16 cards: Shorts rows and the channel Shorts tab ---------- */

.sh-shelf { margin: 8px 0 24px; color: var(--sh-text); }
.sh-shelf-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 20px; font-weight: 700; color: var(--sh-text); }
.sh-shelf-head i { color: #e0322b; }
.sh-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 210px); gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.sh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px 12px; color: var(--sh-text); }

.sh-card { display: block; color: var(--sh-text); text-decoration: none; min-width: 0; }
.sh-card:hover, .sh-card:focus { color: var(--sh-text); text-decoration: none; }
.sh-card-img { display: block; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--sh-btn); }
.sh-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.sh-card:hover .sh-card-img img { transform: scale(1.03); }
.sh-card-title {
    margin: 8px 0 2px; font-size: 15px; font-weight: 500; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sh-card-views { font-size: 13px; color: var(--sh-text-2); }

.sh-sort { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.sh-sort button {
    border: 0; border-radius: 8px; padding: 6px 12px;
    background: var(--sh-btn); color: var(--sh-text); font-size: 14px; font-weight: 500;
}
.sh-sort button.is-on { background: var(--sh-text); color: var(--sh-bg); }

@media (max-width: 767px) {
    .sh-row { grid-auto-columns: 42vw; }
    .sh-grid { grid-template-columns: repeat(2, 1fr); gap: 12px 4px; }
    .sh-card-img { border-radius: 8px; }
}
