/* home.css */
/* hide the app until loader is dismissed */
html {
  /* reserve space for the scrollbar so layout doesn’t jump */
  scrollbar-gutter: stable;
}

.page-content {
  display: none;
}

.page-loader > img {
    width: 120px;
    height: auto;
}

/* full-screen logo overlay */
.page-loader {
  position: fixed;
  inset: 0;                  /* top:0; right:0; bottom:0; left:0 */
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.page-loader.hidden {
  display: none !important;
}

/* RESET & BASE */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* LAYOUT */
.app-container {
    display: flex;
    min-height: 100vh;
    height: auto;
    overflow: visible;
    align-items: flex-start;
}

.main {
    width: 630px;
    flex: 1;
    padding: 0;
    overflow-y: visible;
    position: absolute; /* or fixed, relative to the nearest positioned ancestor */
    left: 50%;
    transform: translateX(-50%);
}

/* FOLLOWING-LIST CAROUSEL */
.following-list {
    display: flex;
    align-items: center;
    border-radius: 29px;
    padding: 7px 0;
    overflow: hidden;
}

.following-list__arrow {
    background: var(--bg-surface);
    border: none;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 99px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 4px 0 var(--shadow-default);
    transition: box-shadow 0.2s ease;
}

.following-list__arrow.prev {
    position: absolute;
    left: 7px;
    margin-top: 3px;
}

.following-list__arrow.next {
    position: absolute;
    right: 7px;
    margin-top: 3px;
}

button.following-list__arrow:hover {
    box-shadow: 0 0 7px 0 var(--shadow-default);
}

.following-list__items {
    flex: 1;
    display: flex;
    overflow-x: auto;
    gap: 17px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}

.following-list__item {
    scroll-snap-align: start;
    text-align: center;
    width: max-content;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.following-list__item img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid var(--logo-color);
    object-fit: cover;
    padding: 2px;
}

.following-list__item .username {
    display: inline-block;
    width: 58px;
    margin-top: 0;
    font-size: 10px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* front-of-7 & last-child padding */
.following-list__item:nth-child(8n+1) {
    padding-left: 22px;
}
.following-list__item:last-child {
    padding-right: 22px;
}

.following-list.ended .following-list__item:nth-child(8n+1) {
    padding-left: 0;
}
.following-list.ended .following-list__item:nth-last-child(8n) {
    padding-left: 22px;
}

/* FEED WRAPPER */
.feed-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--bg-surface);
    overflow: hidden;
    border: 1px solid var(--border-default);
    border-top: none;
    min-height: calc(100vh - 60px);
}

/* FEED HEADER */
.feed-header {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    padding: 19px 25px 14px;
}

#profileAvatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-search);
    border: none;
    object-fit: cover;
    margin-right: 12px;
    cursor: pointer;
}

.feed-header__new {
    flex: 1;
    background: none;
    border: none;
    padding: 7px 12px;
    color: var(--text-placeholder);
    font-size: 16px;
    text-align: left;
    cursor: pointer;
}

.feed-header__post {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 9px 16px 8px 16px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
}

/* FEED CONTAINER */
.feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

button.following-list__arrow > i {
    margin-top: 2px;
}

.following-wrapper {
    width: 100%;
    height: max-content;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-default);
}

.feed-border {
    display: block;
    height: 45px;
    width: 100%;
    background: none;
    position: sticky;
    top: 60px;
    margin-top: -45px;
    border: 1px solid var(--border-default);
    border-radius: 18px;
    box-shadow: 0 0 0 15px var(--bg-page);
    z-index: 58;
    clip-path: polygon(-1% 0, 101% 0, 100% 50%, 0 50%);
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 60px;
    background: var(--bg-page);
    position: sticky;
    top: 0;
    z-index: 56;
    box-shadow: 0px -3px 0px 3px var(--bg-page);
}

.main-header-button {
    padding: 5px;
    font-size: 15px;
    background: none;
    border: none;
    font-weight: 600;
    cursor: pointer;
}

.main-header-item {
    display: flex;
    width: max-content;
    height: 100%;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 0 var(--text-primary);
    padding: 0 25px;
    margin: 0 5px;
}

.main-header-item.active {
    box-shadow: 0 2px 0px -0.5px var(--text-primary);
}

.main-header-item > button {
    color: var(--text-muted);
}

.main-header-item.active > button {
    color: var(--text-primary);
}

button.following-list__arrow.hide {
    display: none;
}

.feed-wrapper {
  position: relative;
}

/* fullâ€cover overlay, centered spinner */
.initial-loading {
  position: absolute;
  inset: 0;
  /* top:0; right:0; bottom:0; left:0 */
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-surface);
  z-index: 10;
  width: 100%;
  height: calc(100vh - 60px);
  font-size: 25px;
}

/* when hidden, remove from layout */
.initial-loading.hidden {
  display: none;
}

section.following-list.start > .following-list__arrow.prev {
    display: none;
}

section.following-list.finish > .following-list__arrow.next {
    display: none;
}

/* ----------------------------------------------------------------------------
   Remove any old transitions so they don’t conflict
   ---------------------------------------------------------------------------- */
.page-loader,
.page-loader img {
    transition: none !important;
}

/* ----------------------------------------------------------------------------
   1) Fade out the full-screen white overlay
   ---------------------------------------------------------------------------- */
@keyframes loaderBgFade {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ----------------------------------------------------------------------------
   2) Scale up the logo from 1→1.15 while fading it out
   ---------------------------------------------------------------------------- */
@keyframes loaderImgPulseFade {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(4);
        opacity: 0;
    }
}

/* ----------------------------------------------------------------------------
   3) Trigger both animations when your JS adds the class
   ---------------------------------------------------------------------------- */
.page-loader.animate-logo-bigger {
    animation: loaderBgFade 0.3s ease-in-out forwards;
}

.page-loader.animate-logo-bigger img {
    animation: loaderImgPulseFade 0.3s ease-in-out forwards;
}
