/* Mobile feed cards: post menu and reactions popover. */

/* Mobile feed cards: compact post options button. */
@media (max-width: 640px) {
  .post-menu-wrap {
    flex: 0 0 auto;
    align-self: flex-start;
  }

  .post-menu-button {
    display: inline-grid;
    place-items: center;
    padding: 0;
    font-size: 0;
    line-height: 1;
    background: color-mix(in srgb, var(--surface-muted) 44%, var(--surface-strong));
    color: color-mix(in srgb, var(--text-soft) 84%, var(--text));
  }

  .post-menu-button::before {
    content: "";
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
    opacity: 0.9;
  }
}


@media (max-width: 380px) {
  .post-menu-button,
  :where(.post-menu-button) {
    width: 36px;
    min-width: 36px;
    height: 38px;
    min-height: 38px;
    border-radius: 13px;
  }
}

/* Mobile feed cards: precise compact post options button. */
@media (max-width: 860px) {
  .post-card__header-main {
    padding-right: 42px;
  }

  .post-card__header-side {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    width: auto;
    margin-left: 0;
    pointer-events: none;
  }

  .post-menu-wrap {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    pointer-events: auto;
  }

  .post-menu-button,
  :where(.post-menu-button) {
    display: inline-grid;
    place-items: center;
    box-sizing: border-box;
    padding: 0;
    font-size: 0;
    line-height: 1;
    color: color-mix(in srgb, var(--text-soft) 66%, var(--text));
  }

  .post-menu-button::before {
    content: "";
    border-radius: 999px;
    opacity: 0.68;
  }
}


@media (max-width: 640px) {
  .post-card__header-side {
    top: 12px;
    right: 12px;
  }

  .post-card__header-main {
    padding-right: 38px;
  }




}


/* Mobile feed cards: keep the post options frame centered around the dots. */
@media (max-width: 860px) {
  .post-menu-button,
  :where(.post-menu-button) {
    position: relative;
    overflow: hidden;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface-muted) 22%, var(--surface-strong));
  }

  .post-menu-button::before {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    transform: translate(-50%, -50%);
    background: currentColor;
    box-shadow: 0 -4.5px 0 currentColor, 0 4.5px 0 currentColor;
  }
}

@media (pointer: coarse) and (max-width: 860px) {
  .post-menu-button,
  :where(.post-menu-button) {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
  }
}

@media (max-width: 640px) {
  .post-menu-wrap {
    width: 36px;
    height: 36px;
  }

  .post-menu-button,
  :where(.post-menu-button) {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    border-radius: 11px;
  }
}

@media (pointer: coarse) and (max-width: 640px) {
  .post-menu-button,
  :where(.post-menu-button) {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
  }
}

/* Mobile reaction overflow popover fix. */
.reactions-popover--floating {
  position: fixed;
  top: var(--reactions-popover-top, 12px);
  right: auto;
  bottom: auto;
  left: var(--reactions-popover-left, 12px);
  z-index: 140;
  max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-popover);
}

@media (max-width: 640px) {
  .reactions-popover--floating .reactions-popover__list {
    grid-template-columns: repeat(3, max-content);
  }
}

/* Mobile trending cards extracted from the remaining legacy layer. */
@media (max-width: 999.98px) {
  .mobile-trend-card {
    overflow: hidden;
    padding: 10px 12px 11px;
    border-color: color-mix(in srgb, var(--line) 66%, transparent);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
    box-shadow: none;
  }

  .mobile-trend-card__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
    margin-bottom: 8px;
  }

  .mobile-trend-card__title {
    color: color-mix(in srgb, var(--text) 90%, var(--text-soft));
    font-size: 0.92rem;
    font-weight: 780;
    line-height: 1.12;
  }

  .mobile-trend-card__periods {
    gap: 1px;
    min-height: 24px;
    padding: 1px;
    border-color: color-mix(in srgb, var(--line) 58%, transparent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--surface-muted) 52%, transparent);
    box-shadow: none;
  }

  .mobile-trend-card__period {
    min-width: 24px;
    min-height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-sm);
    color: color-mix(in srgb, var(--text-soft) 86%, var(--text));
    font-size: 0.62rem;
    font-weight: 720;
    line-height: 1;
    transition:
      background-color var(--transition-fast),
      color var(--transition-fast),
      box-shadow var(--transition-fast);
  }

  .mobile-trend-card__period:hover,
  .mobile-trend-card__period:focus-visible {
    background: color-mix(in srgb, var(--accent) 4%, var(--surface-strong));
    color: color-mix(in srgb, var(--accent) 72%, var(--text));
  }

  .mobile-trend-card__period.is-active {
    background: var(--surface-strong);
    color: color-mix(in srgb, var(--text) 88%, var(--accent));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 52%, transparent);
  }

  .mobile-trend-card__empty {
    margin-top: 4px;
    padding: 10px;
    border: 1px dashed color-mix(in srgb, var(--line) 62%, transparent);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--surface-muted) 42%, transparent);
    color: color-mix(in srgb, var(--text-soft) 84%, var(--text));
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
  }

  .mobile-trend-card__rail {
    gap: 8px;
    max-width: calc(100% + 20px);
    margin-inline: -10px;
    padding: 0 10px 2px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-trend-item {
    flex: 0 0 164px;
    width: 164px;
    min-height: 156px;
    border: 1px solid color-mix(in srgb, var(--line) 58%, transparent);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: none;
  }

  .mobile-trend-item__thumb {
    position: relative;
    inset: auto;
    display: block;
    height: 82px;
    background: color-mix(in srgb, var(--surface-muted) 70%, var(--surface-strong));
  }

  .mobile-trend-item__thumb::after {
    background: linear-gradient(180deg, transparent 48%, rgba(6, 9, 14, 0.2));
  }

  .mobile-trend-item__thumb img {
    filter: saturate(0.94) contrast(0.96);
  }

  .mobile-trend-item__body {
    min-height: 72px;
    padding: 7px;
    justify-content: flex-start;
  }

  .mobile-trend-item__rank {
    margin-bottom: 5px;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--surface-muted) 70%, transparent);
    color: color-mix(in srgb, var(--text-soft) 86%, var(--text));
    font-size: 0.58rem;
    font-weight: 700;
  }

  .mobile-trend-item__title {
    margin-top: 0;
    color: color-mix(in srgb, var(--text) 92%, var(--text-soft));
    font-size: 0.72rem;
    font-weight: 720;
    line-height: 1.22;
    overflow-wrap: anywhere;
  }

  .mobile-trend-item__meta {
    gap: 8px;
    margin-top: auto;
    color: color-mix(in srgb, var(--text-soft) 84%, var(--text));
    font-size: 0.62rem;
    font-weight: 620;
    text-shadow: none;
  }

  .mobile-trend-item__meta-icon,
.mobile-trend-item__meta-icon svg {
    width: 11px;
    height: 11px;
  }}

@media (max-width: 640px) {

  .mobile-trend-card {
    padding: 9px 10px 10px;
  }

  .mobile-trend-card__period {
    min-width: 23px;
    padding: 0 5px;
    font-size: 0.6rem;
  }

  .mobile-trend-card__rail {
    max-width: calc(100% + 16px);
    margin-inline: -8px;
    padding-inline: 8px;
  }

  .mobile-trend-item {
    flex-basis: 152px;
    width: 152px;
  }}

.mobile-trend-card__header {
  align-items: center;
}

.mobile-trend-card__title {
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

@media (max-width: 700px) {


  .mobile-trend-card__rail {
    gap: 10px;
    padding-bottom: 0;
  }}

@media (max-width: 700px) {
  .mobile-trend-card {
    padding: 8px 8px 7px;
  }

  .mobile-trend-card__header {
    margin-bottom: 5px;
  }

  .mobile-trend-item {
    min-height: 122px;
  }

  .mobile-trend-item__thumb {
    height: 76px;
  }

  .mobile-trend-item__body {
    position: relative;
    min-height: 46px;
    padding: 6px 7px 7px;
  }

  .mobile-trend-item__rank {
    position: absolute;
    top: -15px;
    left: 7px;
    margin: 0;
    padding: 1px 6px;
    background: color-mix(in srgb, var(--surface-strong) 90%, transparent);
    box-shadow: 0 3px 8px rgba(16, 24, 40, 0.1);
  }

  .mobile-trend-item__title {
    margin-top: 0;
  }

  .mobile-trend-item__meta {
    margin-top: 5px;
  }}
