/* ==========================================================================
   FILE: tiktok-user.css
   ROLE: tiktok
   TikTok profile/tag/flair pages: hero card, media tabs (Videos/Photos),
   photo tiles and collection heroes.
   Loaded on: /u/<name>, /tag/<name>, /tags/, /flair/<name> (tag and flair
   pages include it for the collection hero + media tabs).
   ========================================================================== */

/* ==========================================================================
   TIKTOK USER PAGE — first slide only (user data)
   Video feed below keeps the existing fab.css / tiktok-videos.css design.
   ========================================================================== */

/* full-screen hero slide */
.tu-hero-slide {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* blurred, darkened cover behind everything */
.tu-hero-slide > .hp-media-thumb {
    position: absolute !important;
    inset: 0;
    z-index: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    filter: blur(26px) brightness(0.42) saturate(1.15) !important;
    -webkit-filter: blur(26px) brightness(0.42) saturate(1.15) !important;
    transform: scale(1.14);
    opacity: 1 !important;
}

.tu-hero-slide::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(65% 55% at 50% 50%, rgba(8, 8, 12, 0.35) 0%, rgba(8, 8, 12, 0) 100%),
        linear-gradient(180deg, rgba(8, 8, 12, 0.30) 0%, rgba(8, 8, 12, 0.10) 40%, rgba(8, 8, 12, 0.75) 100%),
        radial-gradient(80% 60% at 50% 105%, rgba(var(--hp-color-accent-rgb), 0.22) 0%, rgba(var(--hp-color-accent-rgb), 0) 60%);
    pointer-events: none;
}

/* share */
.tu-hero__share {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.14);
    border-radius: 999px;
    background: rgba(var(--hp-color-white-rgb), 0.07);
    color: var(--hp-color-white);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: background 0.18s ease, border-color 0.18s ease;
}

.tu-hero__share .hp-icon {
    width: 15px !important;
    height: 15px !important;
}

.tu-hero__share:hover {
    border-color: rgba(var(--hp-color-accent-rgb), 0.55);
    background: rgba(var(--hp-color-accent-rgb), 0.22);
}

/* centered content */
.tu-hero {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 90px 24px 116px;
}

/* glass card that keeps the text readable */
.tu-hero__card {
    display: flex;
    align-items: flex-start;
    gap: 26px;
    width: 100%;
    max-width: 1000px;
    padding: 26px 28px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.11);
    border-radius: 24px;
    background: rgba(12, 12, 16, 0.55);
    -webkit-backdrop-filter: blur(26px) saturate(130%);
    backdrop-filter: blur(26px) saturate(130%);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.5);
}

.tu-hero__avatar {
    flex: 0 0 auto;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(var(--hp-color-white-rgb), 0.14);
    box-shadow: 0 0 0 3px rgba(var(--hp-color-accent-rgb), 0.55), 0 18px 40px rgba(0, 0, 0, 0.5);
    background: #141418;
}

.tu-hero__info {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 4px;
}

.tu-hero__name {
    margin: 0;
    color: #fff;
    font-size: 40px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.tu-hero__handle {
    margin: 6px 0 0;
    color: var(--hp-color-text-muted);
    font-size: 13.5px;
    font-weight: 600;
}

/* stats */
.tu-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.tu-stat {
    padding: 8px 14px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.10);
    border-radius: 12px;
    background: rgba(var(--hp-color-white-rgb), 0.05);
}

.tu-stat b {
    display: block;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.tu-stat span {
    display: block;
    margin-top: 3px;
    color: var(--hp-color-text-muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.tu-hero__bio {
    margin: 14px 0 0;
    max-width: 560px;
    color: var(--hp-color-text-soft);
    font-size: 13px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* links column */
.tu-hero__side {
    flex: 0 0 238px;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-left: 24px;
    border-left: 1px solid rgba(var(--hp-color-white-rgb), 0.10);
}

.tu-hero__side-label {
    color: var(--hp-color-text-muted);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.tu-hero__links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.tu-hero__links a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.10);
    border-radius: 9px;
    background: rgba(var(--hp-color-white-rgb), 0.04);
    color: var(--hp-color-text-soft);
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none;
    text-transform: capitalize;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tu-hero__links a .hp-icon {
    width: 13px !important;
    height: 13px !important;
    flex-shrink: 0;
    opacity: 0.85;
}

.tu-hero__links a span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tu-hero__links a:hover {
    border-color: rgba(var(--hp-color-accent-rgb), 0.5);
    background: rgba(var(--hp-color-accent-rgb), 0.16);
    color: #fff;
}

/* ---------------- mobile ---------------- */
@media screen and (max-width: 991px) {
    .tu-hero__card {
        flex-wrap: wrap;
    }

    .tu-hero__side {
        flex: 1 1 100%;
        padding-left: 0;
        padding-top: 16px;
        border-left: 0;
        border-top: 1px solid rgba(var(--hp-color-white-rgb), 0.10);
    }

    .tu-hero__links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media screen and (max-width: 767px) {
    .tu-hero__share {
        top: 12px;
        right: 12px;
        padding: 7px 11px;
        font-size: 11px;
    }

    .tu-hero {
        padding: 78px 12px 104px;
    }

    .tu-hero__card {
        gap: 14px;
        padding: 16px;
        border-radius: 18px;
    }

    .tu-hero__avatar {
        width: 84px;
        height: 84px;
    }

    .tu-hero__info {
        flex: 1 1 150px;
        padding-top: 2px;
    }

    .tu-hero__name {
        font-size: 22px;
    }

    .tu-hero__bio {
        -webkit-line-clamp: 3;
        font-size: 12px;
        margin-top: 12px;
    }

    .tu-hero__links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* /user/: TikTok-profile layout — compact hero + video grid with infinite scroll */
.hp-videos-list {
    scroll-snap-type: none !important;
}

.tu-hero-slide {
    height: auto !important;
    min-height: 0 !important;
}

.tu-hero-slide .tu-hero {
    /* card starts at the top; the Filter pill floats on the right */
    padding: 20px 16px 20px !important;
}

/* grid layout/background lives in tiktok-videos.css (shared with /tag/, /flairs/) —
   nothing here so spacing comes from the hero + end note */

.hp-media-tile {
    position: relative;
    display: block;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 5px;
    background: var(--hp-color-surface);
    text-decoration: none;
}

.hp-media-tile__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hp-media-tile::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 42%;
    background: linear-gradient(180deg, rgba(var(--hp-color-black-rgb), 0) 0%, rgba(var(--hp-color-black-rgb), 0.6) 100%);
    pointer-events: none;
}

.hp-media-tile__play {
    position: absolute;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    color: var(--hp-color-white);
    pointer-events: none;
    filter: drop-shadow(0 1px 4px rgba(var(--hp-color-black-rgb), 0.75));
}

.hp-media-tile__play svg {
    width: 30px;
    height: 30px;
    margin-left: 2px;
}

.hp-media-tile__views {
    position: absolute;
    left: 6px;
    bottom: 7px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--hp-color-white);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(var(--hp-color-black-rgb), 0.85);
}

.hp-media-tile__views svg {
    width: 12px;
    height: 12px;
}

.hp-media-sentinel {
    height: 1px;
}

/* TikTok profile head — avatar left, name/handle/stats right, bio + links below */
.tu-hero__card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "avatar info"
        "bio    bio"
        "links  links";
    align-items: start;
    gap: 14px 16px;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
}

.tu-hero__avatar {
    grid-area: avatar;
    flex: 0 0 auto;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(var(--hp-color-white-rgb), 0.16);
    box-shadow: none;
    background: var(--hp-color-surface);
}

.tu-hero__info {
    grid-area: info;
    min-width: 0;
    padding-top: 2px;
}

.tu-hero__name {
    margin: 0;
    color: var(--hp-color-white);
    font-size: 21px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.tu-hero__handle {
    margin: 3px 0 0;
    color: var(--hp-color-text-muted);
    font-size: 13px;
    font-weight: 600;
}

/* stats as an inline row: bold number + small label (TikTok style) */
.tu-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 18px;
    margin-top: 10px;
}

.tu-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
}

.tu-stat b {
    display: inline;
    color: var(--hp-color-white);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.tu-stat span {
    display: inline;
    margin: 0;
    color: var(--hp-color-text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.tu-hero__bio {
    grid-area: bio;
    margin: 4px 0 0;
    max-width: none;
    color: var(--hp-color-text-soft);
    font-size: 13px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tu-hero__bio a {
    color: var(--hp-color-accent-soft);
}

/* links: inline pills under the bio */
.tu-hero__side {
    grid-area: links;
    flex: none;
    align-self: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    border-left: 0;
    border-top: 0;
}

.tu-hero__side-label {
    display: none;
}

.tu-hero__links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tu-hero__links a {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.14);
    background: rgba(var(--hp-color-white-rgb), 0.07);
    font-size: 12px;
    font-weight: 600;
}

.tu-hero__links a:hover {
    background: rgba(var(--hp-color-accent-rgb), 0.22);
    border-color: rgba(var(--hp-color-accent-rgb), 0.45);
}

@media screen and (max-width: 767px) {
    .tu-hero__avatar {
        width: 82px;
        height: 82px;
    }

    .tu-hero__name {
        font-size: 19px;
    }
}
/* the fixed top-bar scrim is for the full-screen feed; on the profile
   head it only darkens the name/bio (the Filter pill has its own glass). */
.hp-videos-topbar::before {
    display: none !important;
}

.hp-media-tile__sep {
    opacity: 0.6;
    margin: 0 2px;
}

.hp-media-end {
    grid-column: 1 / -1;
    margin: 18px 0 calc(96px + env(safe-area-inset-bottom, 0px));
    color: var(--hp-color-text-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.hp-media-end[hidden] {
    display: none;
}
/* /user/: Filter right, Share left on the top row */
.hp-user-page .header .header__topbar {
    justify-content: flex-end !important;
    max-width: 860px !important;
    /* match the hero's 20px/16px padding */
    margin: 20px auto 0 !important;
    padding: 0 16px !important;
}

.hp-user-page .header .header__topbar .filter-btn {
    margin: 0 !important;
}

.hp-user-page .tu-hero__share {
    left: 16px;
    right: auto;
}

/* no top scrim on the profile page (hero starts at the top) */
.hp-user-page .hp-videos-topbar::before {
    display: none !important;
}

/* profile media tabs (Videos / Photos) + photo grid tiles */
.hp-media-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    width: max-content;
    max-width: 100%;
    margin: 18px auto;
    padding: 4px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.08);
    border-radius: 999px;
    background: rgba(var(--hp-color-white-rgb), 0.045);
}

.hp-media-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 32px;
    padding: 0 16px;
    border: 0;
    border-radius: 999px;
    color: var(--hp-color-text-soft);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.hp-media-tab:hover {
    color: var(--hp-color-white);
    background: rgba(var(--hp-color-white-rgb), 0.06);
}

.hp-media-tab.is-active {
    color: var(--hp-color-white);
    background: linear-gradient(180deg,
            rgba(var(--hp-color-accent-rgb), 0.98) 0%,
            rgba(var(--hp-color-accent-mid-rgb, var(--hp-color-accent-rgb)), 0.82) 100%);
    box-shadow: 0 4px 14px rgba(var(--hp-color-accent-rgb), 0.35);
}

.hp-media-tab__count {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 999px;
    background: rgba(var(--hp-color-black-rgb), 0.22);
    color: inherit;
    font-size: 10.5px;
    font-weight: 700;
    opacity: 0.75;
}

.hp-media-tab.is-active .hp-media-tab__count {
    background: rgba(var(--hp-color-black-rgb), 0.16);
    opacity: 0.95;
}

@media screen and (max-width: 767px) {
    .hp-media-tabs {
        margin: 14px auto;
        padding: 3px;
    }

    .hp-media-tab {
        height: 30px;
        padding: 0 14px;
        font-size: 12px;
    }
}

.hp-media-panel[hidden] {
    display: none !important;
}

/* photo tiles reuse the video tile shell, minus the play glyph */
.hp-media-tile--photo .hp-media-tile__play {
    display: none;
}

.hp-media-grid--photos {
    padding-top: 0 !important;
}

/* Photos tab: clean edge-to-edge photos (no card shell behind them) and the
   same bottom breathing room the videos grid gets from the page list padding. */
.hp-media-tile--photo {
    background: transparent !important;
}

.hp-media-tile--photo::after {
    display: none !important;
}


/* photos read as one clean image wall: no card shell, no gutters, no rounding */
.hp-media-grid--photos {
    gap: 0 !important;
    background: none !important;
}

.hp-media-tile--photo {
    background: none !important;
    border-radius: 0;
}

/* profile media grid (same layout as the tiktok video grids, owned by the
   hp-media component instead of the shared tu-video-grid alias) */
.hp-media-grid {
    display: grid;
    max-width: 860px;
    margin: 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3px;
    background: none;
}

@media screen and (min-width: 768px) {
    .hp-media-grid {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
        gap: 6px;
    }
}

/* photo tile: image link fills the shell, subreddit chip sits bottom-right */
.hp-media-tile__link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.hp-media-tile__tag {
    position: absolute;
    right: 6px;
    top: 6px;
    bottom: auto;
    z-index: 2;
    max-width: 58%;
    overflow: hidden;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(var(--hp-color-black-rgb), 0.55);
    color: var(--hp-color-white);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hp-media-tile__tag:hover {
    background: rgba(var(--hp-color-accent-rgb), 0.85);
    color: var(--hp-color-white);
}

.hp-media-tile--photo .hp-media-tile__views {
    max-width: 44%;
    overflow: hidden;
}

/* collection hero (tag / flair pages): blurred media backdrop + title + counts */
.hp-collection-hero {
    position: relative;
    max-width: 860px;
    margin: 16px auto 0;
    overflow: hidden;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.07);
    border-radius: 20px;
    background: var(--hp-color-surface);
    isolation: isolate;
}

.hp-collection-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.15);
    filter: blur(24px) brightness(0.42) saturate(1.2);
}

.hp-collection-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(80% 60% at 50% 110%, rgba(var(--hp-color-accent-rgb), 0.24) 0%, rgba(var(--hp-color-accent-rgb), 0) 60%),
        linear-gradient(180deg, rgba(var(--hp-color-black-rgb), 0.18) 0%, rgba(var(--hp-color-black-rgb), 0.74) 100%);
    pointer-events: none;
}

.hp-collection-hero__inner {
    position: relative;
    z-index: 2;
    padding: 26px 22px 22px;
}

.hp-collection-hero__title {
    margin: 6px 0 14px;
    color: var(--hp-color-white);
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 800;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.hp-collection-hero__stats {
    display: flex;
    gap: 22px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.hp-collection-hero__stats li {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hp-collection-hero__stats b {
    color: var(--hp-color-white);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.hp-collection-hero__stats span {
    color: var(--hp-color-text-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media screen and (max-width: 767px) {
    .hp-collection-hero {
        margin: 12px 16px 0;
        border-radius: 16px;
    }

    .hp-collection-hero__inner {
        padding: 20px 16px 18px;
    }
}

/* tag/flair collection hero reuses the /u/ hero card; only the page wrapper,
   the letter avatar and the label differ */
.hp-tag-page .hp-collection-hero {
    max-width: 860px;
    margin: 16px auto 0;
    border-radius: 20px;
    border: 1px solid rgba(var(--hp-color-white-rgb), 0.07);
    overflow: hidden;
}

.hp-collection-hero__avatar {
    display: grid;
    place-items: center;
    color: var(--hp-color-white);
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    background:
        radial-gradient(120% 120% at 30% 10%, rgba(var(--hp-color-accent-rgb), 0.55) 0%, rgba(var(--hp-color-accent-rgb), 0.12) 55%, transparent 100%),
        var(--hp-color-surface-2);
}

@media screen and (max-width: 767px) {
    .hp-tag-page .hp-collection-hero {
        margin: 12px 16px 0;
        border-radius: 16px;
    }
}

/* /u/ profile: same breathing room above the hero as the tag/flair heroes */
.hp-user-page .hp-videos-list > .tu-hero-slide {
    margin: 16px auto 0;
}

@media screen and (max-width: 767px) {
    .hp-user-page .hp-videos-list > .tu-hero-slide {
        margin: 12px 16px 0;
    }
}

/* heroes are full-bleed: no rounded corners, no outline */
.hp-collection-hero,
.hp-tag-page .hp-collection-hero {
    border: 0 !important;
    border-radius: 0 !important;
}

@media screen and (max-width: 767px) {
    .hp-collection-hero,
    .hp-tag-page .hp-collection-hero {
        border: 0 !important;
        border-radius: 0 !important;
    }
}

/* /tags/ index: gap between the hero and the browse controls */
.hp-tags-page .hp-tags-browse {
    padding-top: 18px;
}

@media screen and (max-width: 767px) {
    .hp-tags-page .hp-tags-browse {
        padding-top: 14px;
    }
}

/* mobile: hero cards are width:100% by default, so the 16px side margins
   pushed them out of the right edge. Let the margins define the width. */
@media screen and (max-width: 767px) {
    .hp-user-page .hp-videos-list > .tu-hero-slide,
    .hp-collection-hero,
    .hp-tag-page .hp-collection-hero {
        width: auto !important;
        max-width: none !important;
        margin-left: 5px !important;
        margin-right: 5px !important;
    }
}

/* numbered pager under the Videos/Photos grids (replaced infinite scroll) */
.hp-media .hp-pagination-row {
    margin: 22px auto 8px;
}

.hp-media .hp-pagination-row .pagination {
    flex-wrap: wrap;
    justify-content: center;
}
