/*
 * tools-v4-post-preview.css: /tools/social-media-post-preview (social_media_post_preview.pug).
 * Editor on the left, the 7 drawn feed posts on a mist panel on the right (stacked on phones). The drawn posts copy
 * each feed's layout, not its brand: no network colours or logos inside a post, the logo sits in the label above it.
 * Builds on tools-v4.css and the pn-system tokens. No shadows, no gradients. Bump ?v= in the view on every edit.
 */
.tv4 .mp {
    --mp-text: #141414;
    --mp-muted: #555555;
    --mp-line: #e4e4e7;
    --mp-fill: #e4e4e7;
    position: relative;
}

/* ============ Layout ============ */
.tv4 .mp-layout {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.tv4 .mp-editor {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.tv4 .mp-block {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.tv4 .mp-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tv4 .mp-top .tv4-label {
    margin: 0;
}

.tv4 .mp-top__actions {
    display: flex;
    gap: 8px;
}

.tv4 .mp-top__count {
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 #mp-input {
    min-height: 190px;
    font-size: 16px;
    line-height: 1.5;
}

/* The two file inputs stay in the page (the buttons open them) but take no space. */
.tv4 .mp-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    opacity: 0;
}

/* ============ Pictures ============ */
.tv4 .mp-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
}

.tv4 .mp-thumb {
    position: relative;
    width: 64px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--mp-fill);
}

.tv4 .mp-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv4 .mp-thumb__x {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(20, 20, 20, 0.78);
    color: #ffffff;
    cursor: pointer;
}

.tv4 .mp-thumb__x svg {
    width: 14px;
    height: 14px;
}

.tv4 .mp-thumb__x:focus-visible,
.tv4 .mp-add:focus-visible,
.tv4 .mp-net:focus-visible {
    outline: 2px solid var(--pns-focus);
    outline-offset: 2px;
}

.tv4 .mp-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 112px;
    height: 80px;
    margin: 0;
    padding: 6px;
    border: 1px dashed var(--pns-field);
    border-radius: 10px;
    background: #ffffff;
    color: var(--pn-ink);
    font-family: var(--pn-font);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

.tv4 .mp-add:hover {
    border-color: var(--pn-ink);
}

.tv4 .mp-add svg {
    width: 20px;
    height: 20px;
}

.tv4 .mp-add[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.tv4 .mp.is-dragging .mp-add {
    border-color: var(--pn-ink);
    background: var(--pns-lime-tint);
}

/* ============ Networks ============ */
.tv4 .mp-nets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tv4 .mp-net {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--pns-field);
    border-radius: 12px;
    background: #ffffff;
    color: var(--pn-ink-2);
    font-family: var(--pn-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
}

.tv4 .mp-net img {
    width: 18px;
    height: 18px;
    opacity: 0.45;
    filter: grayscale(1);
}

.tv4 .mp-net[aria-pressed="true"] {
    border-color: var(--pn-ink);
    background: var(--pns-lime-tint);
    color: var(--pn-ink);
}

.tv4 .mp-net[aria-pressed="true"] img {
    opacity: 1;
    filter: none;
}

/* ============ Profile ============ */
.tv4 .mp-block--profile legend {
    float: left;
    width: 100%;
    padding: 0;
}

.tv4 .mp-profile {
    clear: both;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.tv4 .mp-photo {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tv4 .mp-photo__btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tv4 .mp-profile .tv4-label {
    font-size: 13px;
    margin-bottom: 6px;
}

.tv4 .mp-profile .tv4-field {
    font-size: 16px;
}

.tv4 .mp-at {
    position: relative;
}

.tv4 .mp-at span {
    position: absolute;
    top: 50%;
    left: 14px;
    color: var(--pn-ink-2);
    font-size: 16px;
    transform: translateY(-50%);
    pointer-events: none;
}

.tv4 .mp-at .tv4-field {
    padding-left: 32px;
}

/* ============ Avatar ============ */
.tv4 .mp-av {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--pns-lime);
    background-position: center;
    background-size: cover;
    color: var(--pns-on-lime);
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

.tv4 .mp-av--s { width: 32px; height: 32px; font-size: 14px; }
.tv4 .mp-av--l { width: 48px; height: 48px; font-size: 19px; }
.tv4 .mp-av--xl { width: 56px; height: 56px; font-size: 22px; }

.tv4 .mp-av.has-photo .mp-av__i {
    visibility: hidden;
}

/* ============ Preview stage ============ */
.tv4 .mp-stage {
    min-width: 0;
    padding: 20px;
    border-radius: 24px;
    background: var(--pns-mist);
}

.tv4 .mp-none {
    padding: 32px 16px;
    color: var(--pn-ink-2);
    font-size: 16px;
    text-align: center;
}

/* Phone view: phone-wide cards side by side, in the order of the network list. Computer view: one wider card
 * per row. */
.tv4 .mp-cards[data-view="mobile"] {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 28px 20px;
    align-items: start;
}

.tv4 .mp-cards[data-view="desktop"] {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tv4 .mp-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    margin: 0;
}

.tv4 .mp-cards[data-view="mobile"] .mp-card {
    width: 100%;
    max-width: 375px;
    margin: 0 auto;
}

.tv4 .mp-cards[data-view="desktop"] .mp-card {
    max-width: 600px;
}

.tv4 .mp-card[hidden] {
    display: none;
}

.tv4 .mp-card__label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--pn-ink);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
}

.tv4 .mp-shot {
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--mp-line);
    border-radius: 14px;
    background: #ffffff;
    color: var(--mp-text);
}

/* A phone: dark frame, rounder corners. */
.tv4 .mp-cards[data-view="mobile"] .mp-shot {
    border: 6px solid var(--pns-ink);
    border-radius: 30px;
}

/* ============ Drawn posts ============ */
.tv4 .mp-post {
    padding: 14px 14px 12px;
    color: var(--mp-text);
    font-size: 15px;
    line-height: 20px;
}

.tv4 .mp-cards[data-view="mobile"] .mp-post {
    padding-top: 16px;
}

.tv4 .mp-post--x,
.tv4 .mp-post--threads,
.tv4 .mp-post--bluesky {
    display: flex;
    gap: 10px;
}

.tv4 .mp-side {
    flex: none;
}

.tv4 .mp-main {
    flex: 1;
    min-width: 0;
}

.tv4 .mp-who {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 4px;
    min-width: 0;
}

.tv4 .mp-name {
    overflow: hidden;
    color: var(--mp-text);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv4 .mp-handle,
.tv4 .mp-sub,
.tv4 .mp-time {
    color: var(--mp-muted);
}

.tv4 .mp-handle {
    overflow-wrap: anywhere;
}

.tv4 .mp-post--threads .mp-handle,
.tv4 .mp-post--instagram .mp-head .mp-handle {
    color: var(--mp-text);
    font-weight: 600;
}

.tv4 .mp-text {
    margin-top: 2px;
    color: var(--mp-text);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-break: break-word;
}

.tv4 .mp-text__who {
    font-weight: 600;
}

.tv4 .mp-more {
    color: var(--mp-muted);
    font-weight: 500;
}

.tv4 .mp-more--block {
    display: block;
    margin-top: 4px;
    color: var(--mp-text);
}

/* What does not fit the limit. */
.tv4 .mp-over {
    padding: 1px 0;
    border-radius: 3px;
    background: var(--pns-danger-tint);
    color: var(--tv4-bad);
    text-decoration: line-through;
    text-decoration-color: rgba(180, 35, 24, 0.5);
}

/* Empty text: grey lines where the text goes, then what to do. */
.tv4 .mp-ph {
    display: block;
    padding: 4px 0;
}

.tv4 .mp-ph__bar {
    display: block;
    width: 92%;
    height: 10px;
    margin: 4px 0 8px;
    border-radius: 5px;
    background: var(--mp-fill);
}

.tv4 .mp-ph__bar--short {
    width: 58%;
}

.tv4 .mp-empty {
    color: var(--mp-muted);
}

.tv4 .mp-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.tv4 .mp-head > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tv4 .mp-head__end {
    display: flex;
    margin-left: auto;
    color: var(--mp-text);
}

.tv4 .mp-head__end svg {
    width: 20px;
    height: 20px;
}

.tv4 .mp-sub {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.tv4 .mp-sub svg {
    width: 13px;
    height: 13px;
}

/* Pictures inside a post. */
.tv4 .mp-media {
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid var(--mp-line);
    border-radius: 14px;
}

.tv4 .mp-media[hidden] {
    display: none;
}

.tv4 .mp-frame {
    position: relative;
    width: 100%;
    background: var(--mp-fill);
}

.tv4 .mp-frame img,
.tv4 .mp-grid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tv4 .mp-frame.is-contain {
    background: #000000;
}

.tv4 .mp-frame.is-contain img {
    object-fit: contain;
}

.tv4 .mp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    gap: 2px;
    aspect-ratio: 16 / 9;
}

.tv4 .mp-grid img {
    min-height: 0;
}

.tv4 .mp-grid--3,
.tv4 .mp-grid--4 {
    grid-template-rows: 1fr 1fr;
}

.tv4 .mp-grid--3 img:first-child {
    grid-row: span 2;
}

/* Threads: pictures side by side in a row that scrolls sideways, the next one peeking in. */
.tv4 .mp-row {
    display: flex;
    gap: 6px;
    height: 220px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.tv4 .mp-row::-webkit-scrollbar {
    display: none;
}

.tv4 .mp-row .mp-frame {
    flex: none;
    width: auto;
    max-width: 82%;
    height: 100%;
    overflow: hidden;
    border-radius: 10px;
}

.tv4 .mp-media[data-layout="row"] {
    border: 0;
    border-radius: 0;
}

.tv4 .mp-chip {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(20, 20, 20, 0.75);
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
}

.tv4 .mp-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 56px;
    height: 40px;
    border-radius: 12px;
    background: rgba(20, 20, 20, 0.8);
    color: #ffffff;
    transform: translate(-50%, -50%);
}

.tv4 .mp-play svg {
    width: 22px;
    height: 22px;
}

/* A network that needs a picture or video, and none is added. */
.tv4 .mp-missing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    aspect-ratio: 1 / 1;
    padding: 24px;
    background: var(--pns-mist);
    color: var(--mp-muted);
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.tv4 .mp-missing svg {
    width: 28px;
    height: 28px;
}

/* Full-width pictures: Instagram, LinkedIn, YouTube. */
.tv4 .mp-post--instagram .mp-media,
.tv4 .mp-post--linkedin .mp-media {
    margin-right: -14px;
    margin-left: -14px;
    border: 0;
    border-radius: 0;
}

.tv4 .mp-acts {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 10px;
    color: var(--mp-muted);
    list-style: none;
}

.tv4 .mp-acts li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.tv4 .mp-acts svg {
    width: 20px;
    height: 20px;
}

.tv4 .mp-acts--x,
.tv4 .mp-acts--bluesky {
    justify-content: space-between;
    max-width: 380px;
}

.tv4 .mp-acts--instagram {
    color: var(--mp-text);
}

.tv4 .mp-acts--instagram svg {
    width: 24px;
    height: 24px;
}

.tv4 .mp-acts__end {
    margin-left: auto;
}

.tv4 .mp-acts--linkedin {
    justify-content: space-around;
    margin: 8px -14px 0;
    padding: 6px 8px 0;
    border-top: 1px solid var(--mp-line);
}

.tv4 .mp-post--instagram .mp-text {
    margin-top: 8px;
}

.tv4 .mp-time {
    margin-top: 4px;
    font-size: 13px;
    line-height: 18px;
}

.tv4 .mp-post--linkedin .mp-text {
    margin-top: 10px;
}

/* TikTok: a tall dark screen, the picture shown whole, the caption over its foot. */
.tv4 .mp-post--tiktok,
.tv4 .mp-cards[data-view="mobile"] .mp-post--tiktok {
    padding: 0;
}

.tv4 .mp-tt {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #000000;
    color: #ffffff;
}

.tv4 .mp-cards[data-view="desktop"] .mp-post--tiktok {
    padding: 16px;
    background: var(--pns-ink);
}

.tv4 .mp-cards[data-view="desktop"] .mp-tt {
    width: min(100%, 320px);
    margin: 0 auto;
    border-radius: 12px;
}

.tv4 .mp-tt .mp-media {
    position: absolute;
    inset: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
}

.tv4 .mp-tt .mp-frame {
    height: 100%;
}

.tv4 .mp-tt .mp-missing {
    height: 100%;
    aspect-ratio: auto;
    padding-bottom: 120px;
    background: #232323;
    color: #d4d4d8;
}

.tv4 .mp-tt__rail {
    position: absolute;
    right: 10px;
    bottom: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #ffffff;
}

.tv4 .mp-tt__rail svg {
    width: 26px;
    height: 26px;
}

.tv4 .mp-tt__cap {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 12px 56px 14px 12px;
    background: rgba(0, 0, 0, 0.5);
}

.tv4 .mp-tt__cap .mp-handle {
    color: #ffffff;
    font-weight: 600;
}

.tv4 .mp-tt .mp-text,
.tv4 .mp-tt .mp-empty {
    color: #ffffff;
}

.tv4 .mp-tt .mp-more {
    color: #ffffff;
    font-weight: 600;
}

.tv4 .mp-tt .mp-ph__bar {
    background: rgba(255, 255, 255, 0.35);
}

.tv4 .mp-tt .mp-chip {
    top: 12px;
    right: auto;
    left: 12px;
}

/* YouTube: thumbnail, title, channel, description box. */
.tv4 .mp-post--youtube,
.tv4 .mp-cards[data-view="mobile"] .mp-post--youtube {
    padding: 0 0 14px;
}

.tv4 .mp-post--youtube .mp-media {
    margin: 0;
    border: 0;
    border-radius: 0;
}

.tv4 .mp-post--youtube .mp-missing {
    aspect-ratio: 16 / 9;
}

.tv4 .mp-yt-title {
    padding: 12px 14px 0;
    color: var(--mp-text);
    font-size: 17px;
    font-weight: 600;
    line-height: 23px;
    overflow-wrap: break-word;
}

.tv4 .mp-post--youtube .mp-head {
    padding: 10px 14px 0;
}

.tv4 .mp-yt-desc {
    margin: 10px 14px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--pns-mist);
}

.tv4 .mp-yt-desc .mp-time {
    margin: 0 0 2px;
    color: var(--mp-text);
    font-weight: 600;
}

/* ============ Under each card ============ */
.tv4 .mp-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    border: 1px solid var(--pns-line);
    border-radius: 14px;
    background: #ffffff;
}

.tv4 .mp-meta__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 2px 8px;
    color: var(--pn-ink-2);
    font-size: 14px;
    line-height: 1.45;
}

.tv4 .mp-meta__k {
    min-width: 92px;
}

.tv4 .mp-meta__row b {
    color: var(--pn-ink);
    font-weight: 500;
}

.tv4 .mp-meta__row b span {
    color: inherit;
}

.tv4 .mp-meta__row small {
    color: var(--pn-ink-2);
    font-size: 14px;
    font-weight: 400;
}

.tv4 .mp-meta__row em {
    margin-left: auto;
    color: var(--pn-ink-2);
    font-style: normal;
}

.tv4 .mp-meta__row.is-over b,
.tv4 .mp-meta__row.is-over b span,
.tv4 .mp-meta__row.is-over em,
.tv4 .mp-meta__row.is-warn em {
    color: var(--tv4-bad);
    font-weight: 500;
}

.tv4 .mp-approx {
    margin-left: auto;
    color: var(--tv4-warn);
    font-size: 13px;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
}

.tv4 .mp-note {
    margin-top: 20px;
}

/* Facts table: network names with their logo; the links sentence (tv4Links). */
.tv4 table.mp-facts tbody th {
    color: var(--pn-ink);
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
}

.tv4 table.mp-facts tbody th img {
    display: inline-block;
    margin-right: 8px;
    vertical-align: -3px;
}

.tv4 table.mp-facts td a {
    display: inline-block;
    padding: 2px 0;
}

.tv4 .tv4-links {
    max-width: 760px;
    margin-top: 20px;
    color: var(--pn-ink-2);
    font-size: 16px;
    line-height: 1.6;
}

.tv4 .tv4-links a {
    color: var(--pn-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ============ Narrow screens ============ */
@media (max-width: 1080px) {
    .tv4 .mp-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The editor's parts join the page grid, so the cards come right after the network and view pickers and the
     * profile fields go last. */
    .tv4 .mp-editor {
        display: contents;
    }

    .tv4 .mp-block--post { order: 1; }
    .tv4 .mp-block--media { order: 2; }
    .tv4 .mp-block--nets { order: 3; }
    .tv4 .mp-block--view { order: 4; }
    .tv4 .mp-stage { order: 5; }
    .tv4 .mp-block--profile { order: 6; }

    .tv4 .mp-layout {
        gap: 22px;
    }
}

@media (max-width: 640px) {
    .tv4 .mp-stage {
        margin-right: -8px;
        margin-left: -8px;
        padding: 14px 10px;
        border-radius: 20px;
    }

    .tv4 .mp-cards[data-view="mobile"] .mp-shot {
        border-width: 4px;
        border-radius: 24px;
    }

    .tv4 .mp-net {
        height: 42px;
    }

    .tv4 .mp-acts--linkedin span {
        display: none;
    }

    .tv4 .mp-meta__k {
        min-width: 0;
    }
}

/* The site's phone rules raise paragraph text to 15px on 24px lines; the drawn feeds keep their own sizes at every
 * width, so the cut and the card height do not change with the visitor's screen. */
html body main#hero.tv4 .mp-post .mp-text,
html body main#hero.tv4 .mp-post .mp-who {
    font-size: 15px !important;
    line-height: 20px !important;
}

html body main#hero.tv4 .mp-post .mp-time {
    font-size: 13px !important;
    line-height: 18px !important;
}

html body main#hero.tv4 .mp-post .mp-yt-title {
    font-size: 17px !important;
    line-height: 23px !important;
}

html body main#hero.tv4 .mp-meta .mp-meta__row {
    font-size: 14px !important;
    line-height: 1.45 !important;
}
