/* PW Share Posts */

/* ---------------------------------------------------------------------------
 * The arrow. Sized in em and drawn in currentColor, like the Favorite Posts
 * bookmark it sits beside, so it takes the byline's size and color wherever
 * it lands. A <button>, reset hard: the theme's button rules (padding, fill,
 * uppercase) must not reach it.
 * ------------------------------------------------------------------------ */

.pwsp-span {
    position: relative;
    display: inline-block;
}

.pwsp-btn {
    display: inline-flex;
    align-items: center;
    vertical-align: text-bottom;
    margin: 0 0.1em;
    padding: 0.1em 0.15em;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.pwsp-btn:hover,
.pwsp-btn:focus {
    background: none;
    color: inherit;
}

.pwsp-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 3px;
}

.pwsp-icon {
    width: 1.1em;
    height: 1.1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.pwsp-btn:hover .pwsp-icon,
.pwsp-btn:focus .pwsp-icon,
.pwsp-btn[aria-expanded="true"] .pwsp-icon {
    opacity: 0.7;
}

.pwsp-after-content {
    margin: 1em 0 0;
}

/* ---------------------------------------------------------------------------
 * The menu. Built once by the script and appended to <body>, so it is never
 * clipped by the byline and needs no z-index war with the theme. A light
 * card in light mode; in dark mode it takes the site's panel palette from
 * PW Dark Mode (html[data-pw-theme="dark"] — the OS setting is ignored here,
 * exactly as it is everywhere else on the site).
 * ------------------------------------------------------------------------ */

.pwsp-pop {
    position: absolute;
    z-index: 9999;
    box-sizing: border-box;
    width: 236px;
    margin: 0;
    padding: 6px 0;
    border: 1px solid #dcdfe3;
    border-radius: 8px;
    background: #fff;
    color: #1b1e22;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: normal;
    text-align: left;
    text-transform: none;
}

/* The pointer is its own element so the card can be clamped sideways while
 * the point stays on the arrow that opened it. */
.pwsp-pop-arrow {
    position: absolute;
    bottom: 100%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: 0 0 -6px -6px;
    border: 1px solid #dcdfe3;
    border-width: 1px 0 0 1px;
    background: #fff;
    transform: rotate(45deg);
}

.pwsp-pop-title {
    margin: 0;
    padding: 6px 14px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #6b7178;
}

.pwsp-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.pwsp-list li {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Extra specificity on purpose: the theme's link rules, and PW Dark Mode's
 * blanket <a> recolor, would otherwise restyle these rows. */
.pwsp-pop a.pwsp-item,
.pwsp-pop button.pwsp-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 7px 14px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.pwsp-pop a.pwsp-item:hover,
.pwsp-pop button.pwsp-item:hover,
.pwsp-pop a.pwsp-item:focus-visible,
.pwsp-pop button.pwsp-item:focus-visible {
    background: #f1f3f5;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.pwsp-item-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #c9cdd2;
    border-radius: 50%;
    color: #1b1e22;
}

.pwsp-item-icon svg {
    width: 13px;
    height: 13px;
    fill: currentColor;
}

.pwsp-item-icon svg.pwsp-stroke {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.pwsp-item-label {
    flex: 1 1 auto;
    min-width: 0;
}

/* The device share sheet sits apart from the networks. */
.pwsp-list li.pwsp-sep {
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #e6e8eb;
}
html[data-pw-theme="dark"] .pwsp-list li.pwsp-sep {
    border-top-color: var(--pw-border-2, #3a3f46);
}

/* "Link copied" swaps the label for a moment. */
.pwsp-item.is-done .pwsp-item-label {
    color: #0d527a;
    font-weight: 600;
}

/* ---- Dark mode (PW Dark Mode palette) ----------------------------------- */

html[data-pw-theme="dark"] .pwsp-pop {
    background: var(--pw-panel, #24282d);
    border-color: var(--pw-border-2, #3a3f46);
    color: var(--pw-text-bright, #e8eaec);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

html[data-pw-theme="dark"] .pwsp-pop-arrow {
    background: var(--pw-panel, #24282d);
    border-color: var(--pw-border-2, #3a3f46);
}

html[data-pw-theme="dark"] .pwsp-pop-title {
    color: var(--pw-text-dim, #9aa0a6);
}

html[data-pw-theme="dark"] .pwsp-pop a.pwsp-item,
html[data-pw-theme="dark"] .pwsp-pop button.pwsp-item {
    color: var(--pw-text-bright, #e8eaec);
}

html[data-pw-theme="dark"] .pwsp-pop a.pwsp-item:hover,
html[data-pw-theme="dark"] .pwsp-pop button.pwsp-item:hover,
html[data-pw-theme="dark"] .pwsp-pop a.pwsp-item:focus-visible,
html[data-pw-theme="dark"] .pwsp-pop button.pwsp-item:focus-visible {
    background: var(--pw-panel-2, #2a2f35);
}

html[data-pw-theme="dark"] .pwsp-item-icon {
    border-color: var(--pw-border-2, #3a3f46);
    color: var(--pw-text-bright, #e8eaec);
}

html[data-pw-theme="dark"] .pwsp-item.is-done .pwsp-item-label {
    color: var(--pw-accent, #0ebfe9);
}

@media (prefers-reduced-motion: no-preference) {
    .pwsp-pop {
        animation: pwsp-in 120ms ease-out;
    }
    @keyframes pwsp-in {
        from { opacity: 0; transform: translateY(-4px); }
        to   { opacity: 1; transform: none; }
    }
}
