/* Thierry Content Studio v0.9.0 - Social profile/feed */
/* Thierry Content Studio - Social Feed + Home Carousel */

/* =========================================================
   SOCIAL PROFILE FEED
========================================================= */

.tcs-profile-page {
    width: 100%;
    background: #fff;
    color: #111;
    padding: 58px 0 100px;
}

.tcs-profile-container {
    width: 100%;
}

/*
 * KREAM처럼 프로필 영역은 컨테이너 왼쪽에 작고 조밀하게 배치.
 * 피드 그리드는 컨테이너 전체 폭을 사용합니다.
 */
.tcs-profile-head {
    width: 100%;
    max-width: 620px;
    margin: 0 0 34px;

    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    grid-template-areas:
        "avatar info"
        "avatar bio";
    column-gap: 24px;
    row-gap: 12px;
    align-items: start;
}

.tcs-profile-avatar {
    grid-area: avatar;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    border: 1px solid #e3e3e3;
    box-sizing: border-box;
    overflow: hidden;
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 38px;
}

.tcs-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.tcs-profile-name-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tcs-profile-username {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -.02em;
}

.tcs-profile-display-name {
    margin-top: 5px;
    font-size: 13px;
    font-weight: 600;
}

/* PC: 설명도 이름과 정확히 같은 왼쪽 시작선에 배치 */
.tcs-profile-bio {
    grid-area: bio;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
    word-break: keep-all;
}

/* KREAM처럼 게시물 수는 프로필 텍스트 안이 아니라
 * 피드 시작 직전의 별도 탭/통계 영역에 표시합니다. */
.tcs-profile-feed-nav {
    display: flex;
    align-items: flex-end;
    width: 100%;
    min-height: 46px;
    margin-top: 4px;
    border-bottom: 1px solid #e8e8e8;
}

.tcs-profile-feed-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 46px;
    padding: 0 0 11px;
    color: #111;
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
}

.tcs-profile-feed-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #111;
}

/* HTML은 모바일을 위해 count → label 순서지만, PC에서는 KREAM처럼 '게시물 2' */
.tcs-profile-feed-label {
    order: 1;
}

.tcs-profile-feed-count {
    order: 2;
    font-weight: 600;
}

/* KREAM 벤치마킹: PC 4열 */
.tcs-profile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-top: 14px;
}

.tcs-profile-card {
    min-width: 0;
    margin: 0;
}

.tcs-profile-card-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #f1f1f1;
}

.tcs-profile-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .28s ease, opacity .2s ease;
}

.tcs-profile-card:hover .tcs-profile-card-media img {
    transform: scale(1.015);
    opacity: .96;
}

.tcs-profile-card-placeholder,
.tcs-home-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: #777;
    font-size: 13px;
    background: #f1f1f1;
}

.tcs-profile-empty {
    padding: 90px 20px;
    text-align: center;
    color: #777;
    font-size: 14px;
}

/* =========================================================
   SOCIAL PROFILE + VIDEO TABS - v0.5.1
   Instagram-like profile alignment
========================================================= */

/* PC: Instagram desktop처럼 프로필 블록 전체를 중앙에 두고,
 * 큰 프로필 사진 + 계정명 + 통계를 한 묶음으로 구성합니다. */
.tcs-profile-head {
    width: 560px;
    max-width: 100%;
    margin: 0 auto 38px;
    display: grid;
    grid-template-columns: 150px 376px;
    grid-template-areas:
        "avatar info"
        "avatar stats"
        "avatar bio";
    column-gap: 34px;
    row-gap: 12px;
    align-items: start;
}

.tcs-profile-avatar {
    grid-area: avatar;
    width: 150px;
    height: 150px;
    flex: 0 0 150px;
    border: 1px solid #e3e3e3;
    border-radius: 50%;
    box-sizing: border-box;
    overflow: hidden;
    background: #fff;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 46px;
}

.tcs-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tcs-profile-info {
    grid-area: info;
    min-width: 0;
    padding-top: 6px;
}

.tcs-profile-username {
    margin: 0;
    font-size: 23px;
    line-height: 1.15;
    font-weight: 650;
    letter-spacing: -.025em;
    word-break: break-word;
}

/* PC에서는 통계를 계정명 바로 아래에 가로로 배치 */
.tcs-profile-stats {
    grid-area: stats;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 34px;
    min-width: 0;
}

.tcs-profile-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    text-align: left;
}

.tcs-profile-stat strong {
    display: inline;
    color: #111;
    font-size: 15px;
    line-height: 1.2;
    font-weight: 700;
}

.tcs-profile-stat span {
    display: inline;
    margin-top: 0;
    color: #333;
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
}

.tcs-profile-bio {
    grid-area: bio;
    margin: 2px 0 0;
    color: #333;
    font-size: 13px;
    line-height: 1.65;
    word-break: keep-all;
}

/* 기존 게시물 수 전용 nav는 사용하지 않음 */
.tcs-profile-feed-nav {
    display: none !important;
}

.tcs-social-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    height: 52px;
    border-top: 0;
    border-bottom: 1px solid #ececec;
}

.tcs-social-tab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #999;
    cursor: pointer;
}

.tcs-social-tab svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tcs-social-tab[data-tcs-social-tab="videos"] svg path {
    fill: currentColor;
    stroke: none;
}

.tcs-social-tab.is-active {
    color: #111;
}

.tcs-social-tab::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -1px;
    width: 0;
    height: 2px;
    background: #111;
    transform: translateX(-50%);
    transition: width .18s ease;
}

.tcs-social-tab.is-active::after {
    width: 72px;
}

.tcs-social-panel {
    display: none;
}

.tcs-social-panel.is-active {
    display: block;
}

.tcs-profile-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding-top: 6px;
}

/* =========================================================
   VIDEO TAB
========================================================= */

.tcs-video-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    min-height: 54px;
    padding: 8px 16px 7px;
    border-bottom: 1px solid #ededed;
}

.tcs-video-filter {
    position: relative;
    margin: 0;
    padding: 8px 2px 9px;
    border: 0;
    background: transparent;
    color: #999;
    font-size: 13px;
    line-height: 1;
    font-weight: 500;
    cursor: pointer;
}

.tcs-video-filter::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: transparent;
}

.tcs-video-filter.is-active {
    color: #111;
    font-weight: 650;
}

.tcs-video-filter.is-active::after {
    background: #111;
}

.tcs-video-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    padding-top: 6px;
}

.tcs-video-grid.is-hidden {
    display: none;
}

.tcs-video-card {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #eee;
    cursor: pointer;
}

.tcs-video-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .25s ease, opacity .2s ease;
}

.tcs-video-card:hover img {
    transform: scale(1.012);
    opacity: .97;
}

.tcs-video-card-badge {
    position: absolute;
    top: 9px;
    right: 9px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #fff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.28));
    pointer-events: none;
}

.tcs-video-card-badge svg {
    width: 22px;
    height: 22px;
}

.tcs-video-empty {
    grid-column: 1 / -1;
    padding: 70px 20px;
    color: #777;
    font-size: 13px;
    text-align: center;
}

@media (min-width: 768px) and (max-width: 1024px) {
    .tcs-profile-grid,
    .tcs-video-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding-top: 8px;
    }
}

@media (max-width: 767px) {
    .tcs-profile-page {
        padding: 34px 0 70px;
    }

    .tcs-profile-container {
        width: 100vw !important;
        max-width: 100vw !important;
        margin-left: calc(50% - 50vw) !important;
        margin-right: calc(50% - 50vw) !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box;
    }

    .tcs-profile-head {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0 16px 26px;
        box-sizing: border-box;
        display: grid;
        grid-template-columns: 88px minmax(0, 1fr);
        grid-template-areas:
            "avatar info"
            "avatar stats"
            "bio bio";
        column-gap: 18px;
        row-gap: 4px;
        align-items: start;
    }

    /* Instagram mobile profile photo size에 가깝게 확대 */
    .tcs-profile-avatar {
        grid-area: avatar;
        width: 88px;
        height: 88px;
        flex-basis: 88px;
        font-size: 30px;
    }

    .tcs-profile-info {
        grid-area: info;
        min-width: 0;
        padding-top: 2px;
        align-self: start;
    }

    /* 모바일 계정명은 Instagram처럼 살짝 더 작고 위쪽에 배치 */
    .tcs-profile-username {
        font-size: 15px;
        line-height: 1.12;
        font-weight: 650;
    }

    /* 모바일: 계정명과 통계 사이에 Instagram 수준의 숨 쉴 공간 확보 */
    .tcs-profile-stats {
        grid-area: stats;
        display: grid;
        grid-template-columns: repeat(2, 64px);
        gap: 20px;
        width: auto;
        margin-top: 7px;
        justify-self: start;
        align-self: start;
        align-items: start;
    }

    .tcs-profile-stat {
        display: block;
        text-align: center;
    }

    .tcs-profile-stat strong {
        display: block;
        font-size: 15px;
        line-height: 1.05;
    }

    .tcs-profile-stat span {
        display: block;
        margin-top: 4px;
        font-size: 11px;
        line-height: 1.05;
        color: #666;
    }

    .tcs-profile-bio {
        grid-area: bio;
        margin: 6px 0 0;
        font-size: 12px;
        line-height: 1.55;
    }

    .tcs-social-tabs {
        height: 50px;
        border-top: 0;
    }

    .tcs-social-tab svg {
        width: 22px;
        height: 22px;
    }

    .tcs-social-tab.is-active::after {
        width: 42px;
    }

    .tcs-profile-grid,
    .tcs-video-grid {
        width: 100%;
        max-width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px;
        padding-top: 2px;
    }

    .tcs-video-filters {
        min-height: 48px;
        gap: 28px;
        padding: 6px 12px 5px;
    }

    .tcs-video-filter {
        font-size: 12px;
    }

    .tcs-video-card-badge {
        top: 6px;
        right: 6px;
        width: 20px;
        height: 20px;
    }

    .tcs-video-card-badge svg {
        width: 19px;
        height: 19px;
    }

    .tcs-social-video-dialog {
        width: min(390px, calc(100vw - 20px));
        max-height: calc(100vh - 20px);
    }

    .tcs-social-video-close {
        position: fixed;
        top: max(12px, env(safe-area-inset-top));
        right: 14px;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: rgba(0,0,0,.48);
        font-size: 34px;
    }
}

/* =========================================================
   v0.5.5 feed/viewer refinements
========================================================= */
@media (min-width: 1025px) {
    .tcs-profile-grid,
    .tcs-video-grid {
        gap: 6px;
        padding-top: 6px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .tcs-profile-grid,
    .tcs-video-grid {
        gap: 4px;
        padding-top: 4px;
    }
}

@media (max-width: 767px) {
    .tcs-profile-grid,
    .tcs-video-grid {
        gap: 1px;
        padding-top: 1px;
    }

}
/* =========================================================
   v0.6.2 - MOBILE PROFILE MICRO ALIGNMENT
========================================================= */
@media (max-width: 767px) {
    /* v0.6.1에서 너무 위로 붙은 계정명을 4px 정도 다시 내립니다. */
    .tcs-profile-info {
        padding-top: 6px;
    }

    .tcs-profile-username {
        font-size: 14px;
        line-height: 1.15;
    }

    /* 오른쪽 info column 기준으로 통계 전체를 실제 중앙에 맞춘 뒤 3px 우측 보정 */
    .tcs-profile-stats {
        width: 166px;
        grid-template-columns: repeat(2, 74px);
        gap: 18px;
        justify-self: center;
        transform: translateX(3px);
        margin-top: 9px;
    }
}
/* =========================================================
   v0.6.3 - MOBILE PROFILE STATS TRUE CENTER + FLASH-FREE SHARED TRANSITION
========================================================= */
@media (max-width: 767px) {
    /* 계정명은 v0.6.2보다 아주 살짝 아래로 */
    .tcs-profile-info {
        padding-top: 10px;
    }

    /* 통계는 우측 컬럼이 아니라 프로필 컨테이너 전체 기준 정중앙 */
    .tcs-profile-stats {
        grid-area: auto;
        grid-row: 2;
        grid-column: 1 / -1;
        width: 184px;
        grid-template-columns: repeat(2, 74px);
        gap: 36px;
        justify-self: center;
        align-self: start;
        margin-top: 9px;
        transform: none;
    }
}
/* =========================================================
   v0.7.3 - ASYNC YOUTUBE FEED
========================================================= */
.tcs-video-grid-host {
    min-height: 120px;
}

.tcs-video-loading,
.tcs-video-load-retry {
    width: 100%;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: #8a8a8a;
    font-size: 13px;
    text-align: center;
}

.tcs-video-load-retry {
    cursor: pointer;
}

