/*
 * Media.com Posts on mobile web (Nov 2026 brief). Matches the app's Post presentation:
 * one stream, text inset 16px, media edge to edge, hairline separators, a full-screen image
 * viewer, and a compact Post page. Desktop keeps its layout; only the viewer and the gallery
 * tile structure apply at every width.
 */

/* The Post page's compact bar exists only on phones. */
.mpost-bar { display: none; }

/* ------------------------------------------------------------------ image viewer (all widths) */

.mxv { position: fixed; inset: 0; z-index: 2147483000; background: rgba(0, 0, 0, var(--mxv-bg, 1)); color: #fff; touch-action: none; opacity: 0; transition: opacity .18s ease; -webkit-tap-highlight-color: transparent; font-family: inherit; }
.mxv.is-open { opacity: 1; }
.mxv[hidden] { display: none !important; }
.mxv.is-dragging { transition: none; }
.mxv__viewport { position: absolute; inset: 0; overflow: hidden; }
.mxv__track { display: flex; height: 100%; will-change: transform; }
.mxv__slide { flex: 0 0 100%; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mxv__img { display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; will-change: transform; }

.mxv__top, .mxv__bottom { position: absolute; left: 0; right: 0; z-index: 2; transition: opacity .2s ease; }
.mxv__top { top: 0; display: flex; align-items: center; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 24px; background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, 0)); }
.mxv__count { margin: 0; flex: 1; text-align: center; font-size: 14px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.mxv__spacer { width: 44px; flex: none; }
.mxv__bottom { bottom: 0; padding: 32px 16px calc(env(safe-area-inset-bottom, 0px) + 10px); background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .7)); display: grid; gap: 10px; }
.mxv.is-bare .mxv__top, .mxv.is-bare .mxv__bottom, .mxv.is-bare .mxv__nav, .mxv.is-zoomed .mxv__bottom, .mxv.is-dragging .mxv__top, .mxv.is-dragging .mxv__bottom { opacity: 0; pointer-events: none; }

.mxv__btn { flex: none; width: 44px; height: 44px; border: 0; border-radius: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; }
.mxv__btn:focus-visible, .mxv__act:focus-visible, .mxv__by:focus-visible, .mxv__open:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.mxv__nav { position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); display: none; width: 48px; height: 48px; border-radius: 24px; }
.mxv__nav--prev { left: 16px; }
.mxv__nav--next { right: 16px; }
@media (hover: hover) and (min-width: 641px) { .mxv__nav:not([hidden]) { display: inline-flex; } }

.mxv__caption { margin: 0; font-size: 14px; line-height: 20px; color: rgba(255, 255, 255, .92); max-height: 4.5em; overflow: auto; }
.mxv__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.mxv__by { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: #fff; text-decoration: none; }
.mxv__by img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; background: #2a3546; }
.mxv__name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mxv__tick { flex: none; }
.mxv__open { flex: none; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .45); }
.mxv__actions { display: flex; align-items: center; gap: 4px; margin: 0 -10px; }
.mxv__act { min-width: 44px; height: 44px; padding: 0 10px; border: 0; background: none; color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; }
.mxv__act svg { width: 22px; height: 22px; }
.mxv__act svg * { stroke: currentColor; }
.mxv__act.is-liked { color: #ff4f7b; }
.mxv__act.is-liked svg path, .mxv__act.is-saved svg path { fill: currentColor; }
.mxv__act--save { margin-left: auto; }
.mxv__act [class*="__label"], .mxv__act .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mxv__act [class*="count"] { color: inherit; font-size: 14px; }
.mxv__act .media-source-icon { display: none; }
html.media-viewer-open, html.media-viewer-open body { overflow: hidden !important; overscroll-behavior: none; }
/* The September viewer is retired; keep its leftovers from ever showing. */
.media-viewer { display: none !important; }

/* ------------------------------------------------------------------ Feed gallery tiles (all widths) */

.mfeed-gallery { display: grid; gap: 2px; overflow: hidden; }
.mfeed-gallery__tile { position: relative; margin: 0; min-width: 0; min-height: 0; overflow: hidden; background: #EEF1F5; cursor: zoom-in; }
.mfeed-gallery__tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mfeed-gallery__tile:focus-visible { outline: 3px solid var(--media-primary, #0b5fff); outline-offset: -3px; }
.mfeed-card__gallery.mfeed-gallery--1 { grid-template-columns: 1fr; }
.mfeed-card__gallery.mfeed-gallery--1 .mfeed-gallery__tile img { max-height: none; }
.mfeed-card__gallery.mfeed-gallery--2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.mfeed-card__gallery.mfeed-gallery--3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 3 / 2; }
.mfeed-card__gallery.mfeed-gallery--3 .mfeed-gallery__tile:first-child { grid-row: 1 / 3; }
.mfeed-card__gallery.mfeed-gallery--4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; }
.mfeed-gallery__more { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(14, 21, 32, .5); color: #fff; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.mfeed-gallery__count { position: absolute; right: 10px; top: 10px; z-index: 1; padding: 3px 8px; border-radius: 999px; background: rgba(14, 21, 32, .62); color: #fff; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }

/* ------------------------------------------------------------------ mobile Posts (≤640px) */

@media (max-width: 640px) {
    /* One stream: no boxes, hairline separators, text 16px from the edges, media edge to edge. */
    html body .mfeed-card { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: #fff; }
    html body .mfeed-card + .mfeed-card { border-top: 1px solid #E9ECEF !important; }
    html body .mfeed-card__text { font-size: 15px; line-height: 22px; color: #142033; }
    html body .mfeed-card__text a { color: inherit; }
    html body .mfeed-card__textmore { display: inline-block; margin: 2px 0 0; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 15px; line-height: 22px; font-weight: 600; color: #5d6b7c; cursor: pointer; text-align: left; }
    html body .mfeed-card__textmore[hidden] { display: none; }
    html body .mfeed-seemore { display: none !important; }
    html body .mfeed-card__gallery { margin-left: -16px !important; margin-right: -16px !important; border-radius: 0 !important; max-height: none; }
    html body .mfeed-card__gallery.mfeed-gallery--1 { max-height: 125vw; }

    /* ---------------------------------------------------------------- the Post page */

    .mpost-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; height: calc(48px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 4px 0; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; background: rgba(255, 255, 255, .96); -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid #E9ECEF; box-sizing: border-box; }
    .mpost-bar__btn { width: 44px; height: 44px; border: 0; border-radius: 22px; background: none; color: #142033; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; justify-self: center; }
    .mpost-bar__btn:active { background: #F1F3F6; }
    .mpost-bar__title { margin: 0; text-align: center; font-size: 16px; font-weight: 600; color: #142033; letter-spacing: -.01em; }
    html body:has(.mpost-bar) .media-header { display: none !important; }
    html body:has(.mpost-bar) .media-read-progress { display: none !important; }
    html body:has(.mpost-bar) .media-shell, html body:has(.mpost-bar) main { padding-top: 0 !important; }
    html body:has(.mpost-bar) .media-shell__content { padding-top: calc(48px + env(safe-area-inset-top, 0px)) !important; }
    html body .media-written--post { border: 0 !important; box-shadow: none !important; border-radius: 0 !important; }
    html body .media-written--post .media-written__inner { padding-top: 12px !important; padding-left: 16px !important; padding-right: 16px !important; }
    html body .media-written--post .media-written__byline { margin-bottom: 10px !important; }
    html body .media-written--post .media-post__title { font-size: 18px !important; line-height: 24px !important; font-weight: 600 !important; letter-spacing: -.2px; margin: 0 0 6px !important; }
    html body .media-written--post .media-written__body, html body .media-written--post .media-written__body p { font-size: 16px !important; line-height: 24px !important; color: #142033; }
    html body .media-written--post .media-written__body p { margin: 0 0 12px !important; }
    html body .media-written--post .media-written__body p:last-child { margin-bottom: 0 !important; }
    html body .media-written--post .media-gallery { width: calc(100% + 32px) !important; margin: 14px -16px 0 !important; gap: 2px !important; }
    html body .media-written--post .media-gallery--1 img { max-height: 125vw !important; background: #F3F5F8; }
    html body .media-written--post .mx-toolbar { margin-top: 6px !important; border: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }

    /* Responses under a Post: border-light, the same 16px inset. */
    html body:has(.media-written--post) .media-comments { padding-left: 16px !important; padding-right: 16px !important; margin-top: 4px !important; border-top: 8px solid #F3F5F8 !important; padding-top: 16px !important; }
    html body:has(.media-written--post) .media-comments__head { padding-left: 0 !important; padding-right: 0 !important; }
    html body:has(.media-written--post) .media-end { margin-left: 16px !important; margin-right: 16px !important; }
}

@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
    .mxv, .mxv__top, .mxv__bottom { transition: none; }
}

@media (max-width: 640px) {
    /* The app's order on the Post page too: Like, Comment, Share, Source, then Save on the right. */
    html body .media-written--post .mx-toolbar { display: flex !important; align-items: center; justify-content: flex-start; margin-left: -11px !important; margin-right: -11px !important; min-height: 44px; }
    html body .media-written--post .mx-toolbar__start, html body .media-written--post .mx-toolbar__end { display: contents !important; }
    html body .media-written--post .mx-act--source { order: 1; }
    html body .media-written--post .mx-act--save { order: 2; margin-left: auto !important; }
    html body .media-written--post .media-written__inner { padding-bottom: 4px !important; }
    html body .media-written--post .media-written__source-line:empty { display: none; }
    .mxv__close:focus:not(:focus-visible) { outline: none; }
    html body .media-written--post { padding-bottom: 0 !important; margin-bottom: 0 !important; }
    html body .media-written--post .mx-toolbar { margin-bottom: 0 !important; }
    html body .media-written--post .media-written__main, html body .media-written--post .media-written__inner { row-gap: 0 !important; margin-bottom: 0 !important; }
}

/* Public before verification (Nov 2026). */
.media-profile__idstatus { display: inline-flex; align-items: center; gap: 5px; margin: 4px 0 0; font-size: 13px; line-height: 18px; color: #68717f; }
.media-profile__idstatus svg { flex: none; }
.media-owner-verify { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin: 14px 0; padding: 12px 14px; border: 1px solid #E5E9F0; border-radius: 12px; background: #fff; position: relative; }
.media-owner-verify__text { flex: 1 1 240px; min-width: 0; }
.media-owner-verify__title { margin: 0; font-size: 14px; font-weight: 600; color: #142033; }
.media-owner-verify__body { margin: 2px 0 0; font-size: 13px; color: #5d6b7c; }
.media-owner-verify__close { border: 0; background: none; font-size: 20px; line-height: 1; color: #8A9099; cursor: pointer; padding: 4px 6px; }
.media-owner-status__actions { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.media-owner-status__fine { flex-basis: 100%; margin: 0; font-size: 12.5px; color: #5d6b7c; }
