/*
 * MoneyPantry Share — share.css
 * All front-end styles for every share placement.
 *
 * Design rules:
 *   - Zero hardcoded hex values — all colors via CSS variables from the theme
 *   - Sidebar fades in after 200px scroll (JS adds .is-visible)
 *   - Sidebar hidden on mobile
 *   - Hover uses cubic-bezier springy lift — matches theme card hovers
 *   - All interactive elements have focus-visible states for accessibility
 *   - "Send to a friend" shows on phones only, and not when JS adds
 *     .no-web-share to body
 */

/* ─── Shared Button Base ─────────────────────────────────────────────────── */

.mp-share-btn {
    display:          inline-flex;
    align-items:      center;
    justify-content:  center;
    gap:              7px;
    padding:          9px 14px;
    border-radius:    8px;
    font-family:      var(--body-font, 'Plus Jakarta Sans', sans-serif);
    font-size:        13px;
    font-weight:      600;
    line-height:      1;
    text-decoration:  none !important;
    cursor:           pointer;
    border:           none;
    background:       var(--btn-color, var(--navy));
    color:            var(--white) !important;  /* !important prevents theme a{color} override */
    transition:       transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                      box-shadow 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                      filter 0.15s ease;
    white-space:      nowrap;
    -webkit-user-select: none;
    user-select:      none;
    position:         relative;
}

.mp-share-btn:hover {
    transform:  translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    filter:     brightness(1.08);
    color:      var(--white) !important;
    text-decoration: none !important;
}

.mp-share-btn:active {
    transform:  translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.mp-share-btn:focus-visible {
    outline:        3px solid var(--gold);
    outline-offset: 2px;
}

.mp-share-icon {
    width:       18px;
    height:      18px;
    flex-shrink: 0;
    display:     block;
}

/* ─── Button Row ─────────────────────────────────────────────────────────── */

.mp-share-btn-row {
    display:   flex;
    flex-wrap: wrap;
    gap:       8px;
    align-items: center;
}

.mp-share-btn-row--large .mp-share-btn {
    padding:   11px 18px;
    font-size: 14px;
}

.mp-share-btn-row--large .mp-share-icon {
    width:  20px;
    height: 20px;
}

/* ─── Copy Button — Confirmed State ─────────────────────────────────────── */
/* JS adds .is-copied for 2 seconds after clipboard write */

.mp-share-copy-btn .mp-share-btn-label::after {
    content: '';
}

.mp-share-copy-btn.is-copied {
    background: var(--forest, #166534);
}

.mp-share-copy-btn.is-copied .mp-share-btn-label::before {
    content: '✓ ';
}

/* ─── Floating Sidebar ───────────────────────────────────────────────────── */

.mp-share-sidebar {
    position:   fixed;
    left:       20px;
    top:        50%;
    transform:  translateY(-50%);
    z-index:    900;

    /* Hidden by default — JS adds .is-visible after 200px scroll */
    opacity:    0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.mp-share-sidebar.is-visible {
    opacity:        1;
    pointer-events: auto;
}

.mp-share-sidebar-inner {
    display:          flex;
    flex-direction:   column;
    align-items:      center;
    gap:              6px;
    background:       var(--navy);
    border-radius:    12px;
    padding:          14px 10px;
    box-shadow:       0 8px 30px rgba(0, 0, 0, 0.18);
}

/* Sidebar total count pill */
.mp-share-sidebar-total {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    color:          var(--white);
    margin-bottom:  4px;
    padding-bottom: 10px;
    border-bottom:  1px solid rgba(255, 255, 255, 0.12);
    width:          100%;
    text-align:     center;
}

.mp-share-count-num {
    font-size:   18px;
    font-weight: 700;
    color:       var(--gold-lt, #FFB92A);
    line-height: 1;
}

.mp-share-count-label {
    font-size:  10px;
    font-weight: 500;
    color:      rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

/* Sidebar buttons — icon-only, labels hidden, tooltip on hover */
.mp-share-sidebar .mp-share-btn {
    width:            44px;
    height:           44px;
    padding:          0;
    border-radius:    10px;
    background:       rgba(255, 255, 255, 0.08);
    position:         relative;
}

.mp-share-sidebar .mp-share-btn:hover {
    background: var(--btn-color, var(--gold));
    transform:  translateX(3px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.mp-share-sidebar .mp-share-btn-label {
    position:      absolute;
    left:          calc(100% + 10px);
    top:           50%;
    transform:     translateY(-50%);
    background:    var(--navy-mid, #1E293B);
    color:         var(--white);
    font-size:     12px;
    font-weight:   600;
    padding:       5px 10px;
    border-radius: 6px;
    white-space:   nowrap;
    pointer-events:none;
    opacity:       0;
    transition:    opacity 0.15s ease;
    box-shadow:    0 2px 8px rgba(0,0,0,0.2);
}

/* Tooltip arrow */
.mp-share-sidebar .mp-share-btn-label::before {
    content:      '';
    position:     absolute;
    right:        100%;
    top:          50%;
    transform:    translateY(-50%);
    border:       5px solid transparent;
    border-right-color: var(--navy-mid, #1E293B);
}

.mp-share-sidebar .mp-share-btn:hover .mp-share-btn-label {
    opacity: 1;
}

.mp-share-sidebar .mp-share-icon {
    width:  20px;
    height: 20px;
}

/* ─── Share Box ──────────────────────────────────────────────────────────── */
/* After the post content, and anywhere in a post via [mp_share].             */
/* Label on top, then Pinterest, Facebook and (phones) "Send to a friend".    */

.mp-share-box {
    margin:        32px 0;
    padding:       20px;
    background:    var(--paper);
    border-radius: 10px;
    text-align:    center;
}

.mp-share-box .mp-share-box-label {
    font-size:      13px;
    font-weight:    700;
    color:          var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height:    1.3;
    margin:         0 0 14px;
}

.mp-share-box-row {
    justify-content: center;
}

.mp-share-box .mp-share-btn {
    min-height:  44px;
    padding:     12px 18px;
    font-family: inherit;
    font-size:   14px;
}

/* "Send to a friend" — phones with a native share menu only */
.mp-share-btn--share {
    display: none;
}

/* ─── Pinterest "Save" Button on Post Images ─────────────────────────────── */
/* share.js wraps each large post image in .mp-pin-wrap and adds the button.  */
/* The wrapper takes over the image's own spacing.                            */

.entry-content .mp-pin-wrap {
    display:   block;
    position:  relative;
    width:     fit-content;
    max-width: 100%;
    margin:    1.5rem 0;
}

.entry-content .mp-pin-wrap--center {
    margin-left:  auto;
    margin-right: auto;
}

.entry-content .mp-pin-wrap--left {
    float: left;
}

.entry-content .mp-pin-wrap--right {
    float: right;
}

.entry-content .mp-pin-wrap > a {
    display: block;
}

.entry-content .mp-pin-wrap img {
    display: block;
    float:   none;
    margin:  0;
}

.mp-pin-save {
    position:      absolute;
    top:           10px;
    left:          10px;
    min-height:    36px;
    padding:       8px 14px;
    background:    var(--coral);
    color:         var(--white);
    border:        none;
    border-radius: 999px;
    font-family:   inherit;
    font-size:     13px;
    font-weight:   700;
    line-height:   1;
    cursor:        pointer;
    box-shadow:    0 2px 8px rgba(0, 0, 0, 0.25);
    transition:    opacity 0.15s ease;
}

.mp-pin-save:focus-visible {
    outline:        3px solid var(--gold);
    outline-offset: 2px;
}

/* Devices with a mouse: the button shows when the pointer is over the image */
@media ( hover: hover ) {
    .mp-pin-save {
        opacity: 0;
    }

    .mp-pin-wrap:hover .mp-pin-save,
    .mp-pin-save:focus-visible {
        opacity: 1;
    }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media ( max-width: 1024px ) {
    .mp-share-sidebar {
        display: none;
    }
}

@media ( max-width: 768px ) {

    .mp-share-btn--share {
        display: inline-flex;
    }

    body.no-web-share .mp-share-btn--share {
        display: none;
    }

    /* Share box buttons share the row evenly on small screens */
    .mp-share-box .mp-share-btn {
        flex: 1 1 auto;
    }
}

/* ─── Reduced Motion ─────────────────────────────────────────────────────── */

@media ( prefers-reduced-motion: reduce ) {
    .mp-share-btn,
    .mp-share-sidebar,
    .mp-pin-save {
        transition: none;
    }

    .mp-share-btn:hover {
        transform: none;
    }
}
