/* Pro Gallery Lightbox — Share sheet
 * Same layered sheet as the statistics panel: same width, same distance from
 * the top, rises smoothly from the bottom. Same palette (yellow #ffc809 /
 * greys, light + dark). Real platform links, copy link and native share. */

/* ---------- Trigger button (inside the lightbox) ---------- */
button#pgl-share:focus-visible {
    outline: 2px solid #ffc809;
    outline-offset: 3px;
}

/* ---------- Panel shell ---------- */
.pgl-share-panel {
    --sh-accent: #ffc809;
    --sh-accent-line: #f0b400;
    --sh-accent-ink: #1a1a1a;
    --sh-head: #f5f5f5;
    --sh-head-line: #ddd;
    --sh-bg: #fff;
    --sh-tile: #f5f5f5;
    --sh-tile-line: #ededed;
    --sh-icon-bg: #fff;
    --sh-fg: #2a2a2a;
    --sh-mut: #666;
    --sh-ease: cubic-bezier(.22, 1, .36, 1);
    --sh-top: 108px;
    position: fixed;
    inset: 0;
    z-index: 100010;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear .55s;
}
[data-theme='dark'] .pgl-share-panel {
    --sh-head: #2a2a2a;
    --sh-head-line: #484848;
    --sh-bg: #333;
    --sh-tile: #2a2a2a;
    --sh-tile-line: #484848;
    --sh-icon-bg: #333;
    --sh-fg: #ebebeb;
    --sh-mut: #cdcdcd;
}
.pgl-share-panel.is-open {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}
.pgl-share-panel.is-instant,
.pgl-share-panel.is-instant * {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
}
.pgl-share-panel *,
.pgl-share-panel *::before,
.pgl-share-panel *::after {
    box-sizing: border-box;
}
.pgl-share-panel h3,
.pgl-share-panel h4,
.pgl-share-panel p {
    margin: 0;
    padding: 0;
    letter-spacing: normal;
    text-transform: none;
}
.pgl-share-panel i {
    font-style: normal;
}
.pgl-share-panel button,
.pgl-share-panel a {
    font: inherit;
    margin: 0;
    box-shadow: none;
    text-transform: none;
    text-shadow: none;
}

.pgl-sh-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    opacity: 0;
    transition: opacity .45s ease;
}
.pgl-share-panel.is-open .pgl-sh-backdrop {
    opacity: 1;
}

.pgl-sh-sheet {
    position: absolute;
    top: var(--sh-top);
    bottom: 0;
    left: 65px;
    width: calc(100% - 130px);
    display: flex;
    flex-direction: column;
    background: var(--sh-bg);
    color: var(--sh-fg);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -10px 36px rgba(0, 0, 0, .35);
    transform: translateY(105%);
    transition: transform .55s var(--sh-ease);
    will-change: transform;
    overflow: hidden;
}
.pgl-share-panel.is-open .pgl-sh-sheet {
    transform: translateY(0);
}

.pgl-lightbox.pgl-share-open .pgl-lightbox-modal {
    filter: brightness(.7);
    overflow: hidden;
    transition: filter .5s ease;
}

/* ---------- Header ---------- */
.pgl-sh-header {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 15px;
    background: var(--sh-head);
    border-bottom: 1px solid var(--sh-head-line);
    border-radius: 12px 12px 0 0;
    touch-action: none;
}
.pgl-sh-headline {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 1em;
    color: var(--sh-fg);
}
.pgl-sh-headline h3 {
    flex: none;
    font-size: 1em;
    font-weight: 600;
    line-height: 1.4;
    color: var(--sh-fg);
}
.pgl-sh-headline p {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1em;
    font-weight: 400;
    color: var(--sh-mut);
}
.pgl-sh-headline p:not(:empty)::before {
    content: "·";
    margin-right: 8px;
}
.pgl-sh-close {
    flex: none;
    border: 0;
    border-radius: 0;
}
.pgl-sh-close:focus-visible {
    outline: 2px solid var(--sh-fg);
    outline-offset: 2px;
}

/* ---------- Scroll area: content sits centred in the sheet ---------- */
.pgl-sh-scroll {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 20px 28px;
}
.pgl-sh-content {
    width: 100%;
    max-width: 880px;
    margin: auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.pgl-share-panel.is-open .pgl-sh-content {
    animation: pglShRise .6s .12s var(--sh-ease) both;
}

.pgl-sh-lead h4 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--sh-fg);
}
.pgl-sh-lead p {
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--sh-mut);
}

/* ---------- Wallpaper card ---------- */
.pgl-sh-ref {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 10px;
    background: var(--sh-tile);
    border: 1px solid var(--sh-tile-line);
    border-radius: 12px;
}
.pgl-sh-thumb {
    flex: none;
    width: 52px;
    height: 66px;
    border-radius: 8px;
    background: var(--sh-icon-bg) center / cover no-repeat;
    border: 1px solid var(--sh-tile-line);
}
.pgl-sh-thumb:not([style*="url"]) { display: none; }
.pgl-sh-ref-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pgl-sh-ref-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--sh-fg);
}
.pgl-sh-ref-url {
    direction: ltr;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--sh-mut);
}

/* ---------- Buttons ---------- */
.pgl-sh-copy {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 18px;
    background: var(--sh-bg) !important;
    color: var(--sh-fg);
    border: 1px solid var(--sh-tile-line);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}
.pgl-sh-copy svg { width: 18px; height: 18px; flex: none; }
.pgl-sh-copy:hover { border-color: var(--sh-accent); }
.pgl-sh-copy:focus-visible { outline: 2px solid var(--sh-fg); outline-offset: 2px; }
.pgl-sh-copy.is-done {
    background: var(--sh-accent) !important;
    border-color: var(--sh-accent);
    color: var(--sh-accent-ink);
}
.pgl-sh-native {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: 50px;
    padding: 0 22px;
    background: var(--sh-accent);
    color: var(--sh-accent-ink) !important;
    border: 0;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 6px 20px #00000026 !important;
    transition: transform .2s ease, background-color .2s ease;
}
/* Dark mode / theme-proof: site themes often restyle every <button> (grey bg, muted text).
   Pin the accent look with higher specificity + !important so it stays yellow in both modes. */
.pgl-share-panel .pgl-sh-sheet button.pgl-sh-native,
[data-theme='dark'] .pgl-share-panel .pgl-sh-sheet button.pgl-sh-native,
[data-theme='dark'] .pgl-share-panel .pgl-sh-sheet button.pgl-sh-native:not(:hover) {
    background: var(--sh-accent) !important;
    background-image: none !important;
    color: var(--sh-accent-ink) !important;
    -webkit-text-fill-color: var(--sh-accent-ink) !important;
    opacity: 1 !important;
    filter: none !important;
    border: 0 !important;
}
.pgl-share-panel .pgl-sh-sheet button.pgl-sh-native:hover,
[data-theme='dark'] .pgl-share-panel .pgl-sh-sheet button.pgl-sh-native:hover {
    background: var(--sh-accent-line) !important;
    color: var(--sh-accent-ink) !important;
}
.pgl-share-panel .pgl-sh-sheet button.pgl-sh-native svg { color: var(--sh-accent-ink) !important; stroke: currentColor !important; }
.pgl-share-panel .pgl-sh-sheet button.pgl-sh-native[hidden] { display: none !important; }
.pgl-sh-native[hidden] { display: none; }
.pgl-sh-native svg { width: 20px; height: 20px; flex: none; }
.pgl-sh-native:hover { background: var(--sh-accent-line); transform: translateY(-2px); }
.pgl-sh-native:focus-visible { outline: 2px solid var(--sh-fg); outline-offset: 3px; }

/* ---------- Platform tiles ---------- */
.pgl-sh-group { display: flex; flex-direction: column; gap: 12px; }
.pgl-sh-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em !important;
    text-transform: uppercase !important;
    color: var(--sh-mut);
}
.pgl-sh-label::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--sh-tile-line); }
.pgl-sh-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
.pgl-sh-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 10px 16px;
    min-width: 0;
    background: var(--sh-tile);
    border: 1px solid var(--sh-tile-line);
    border-radius: 12px;
    color: var(--sh-fg) !important;
    text-decoration: none !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .25s ease, transform .25s var(--sh-ease);
}
.pgl-share-panel.is-open .pgl-sh-tile {
    animation: pglShRise .5s calc(.16s + var(--i, 0) * 45ms) var(--sh-ease) both;
}
.pgl-sh-tile:hover, .pgl-sh-tile:focus-visible { border-color: var(--sh-accent); transform: translateY(-2px); }
.pgl-sh-tile:active { transform: scale(.97); }
.pgl-sh-tile:focus-visible { outline: 2px solid var(--sh-fg); outline-offset: 2px; }
.pgl-sh-ico {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    background: var(--sh-icon-bg);
    border: 1px solid var(--sh-tile-line);
    border-radius: 14px;
    color: var(--sh-fg);
    transition: border-color .25s ease, box-shadow .25s ease;
}
.pgl-sh-ico svg { width: 28px; height: 28px; }
.pgl-sh-tile:hover .pgl-sh-ico, .pgl-sh-tile:focus-visible .pgl-sh-ico {
    border-color: var(--sh-accent);
    box-shadow: 0 6px 18px #00000022;
}
.pgl-sh-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--sh-fg);
}

/* ---------- Confirmation toast ---------- */
.pgl-sh-toast {
    position: absolute;
    left: 50%;
    bottom: 22px;
    max-width: calc(100% - 32px);
    padding: 11px 18px;
    background: #2a2a2a;
    color: #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity .25s ease, transform .35s var(--sh-ease);
}
[data-theme='dark'] .pgl-sh-toast {
    background: #f5f5f5;
    color: #2a2a2a;
}
.pgl-sh-toast.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
}

@keyframes pglShRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive (lightbox goes full width at 768px) ---------- */
@media (max-width: 768px) {
    .pgl-share-panel { --sh-top: 78px; }
    .pgl-sh-sheet { left: 0; width: 100%; }
    .pgl-sh-headline { font-size: .9em; }
    .pgl-sh-scroll { padding: 18px 14px 24px; }
    .pgl-sh-content { gap: 18px; }
    .pgl-sh-lead h4 { font-size: 19px; }
    .pgl-sh-lead p { font-size: 14px; }
    .pgl-sh-ref { gap: 12px; }
    .pgl-sh-copy { width: 40px; padding: 0; }
    .pgl-sh-copy span { display: none; }
    .pgl-sh-grid { gap: 10px; }
    .pgl-sh-tile { padding: 16px 4px 12px; gap: 10px; }
    .pgl-sh-ico { width: 46px; height: 46px; border-radius: 13px; }
    .pgl-sh-ico svg { width: 25px; height: 25px; }
    .pgl-sh-name { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
    .pgl-share-panel *,
    .pgl-share-panel *::before,
    .pgl-share-panel *::after {
        animation: none !important;
        transition-duration: .01s !important;
    }
}
