/* Dogwood Facebook Gallery v2.0 — Mobile-first social gallery */

/* ── GRID ── */
.dwfg-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 680px;
    margin: 0 auto;
    padding: 0;
    align-items: start;
}

@media (min-width: 600px) {
    .dwfg-gallery {
        grid-template-columns: repeat(2, 1fr);
        max-width: 100%;
    }
}

@media (min-width: 980px) {
    .dwfg-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ── CARD ── */
.dwfg-item {
    background: #ffffff;
    border: 1px solid #e2e8dd;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.dwfg-item:hover {
    box-shadow: 0 6px 24px rgba(74,124,47,0.12);
    transform: translateY(-2px);
}
.dwfg-img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f0f0f0;
    cursor: pointer;
    flex-shrink: 0;
}

.dwfg-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.dwfg-item:hover .dwfg-img-wrap img {
    transform: scale(1.04);
}

.dwfg-expand-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0,0,0,0.45);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    backdrop-filter: blur(4px);
}

.dwfg-item:hover .dwfg-expand-btn,
.dwfg-img-wrap:focus-within .dwfg-expand-btn {
    opacity: 1;
}

.dwfg-expand-btn:hover { background: rgba(74,124,47,0.85); }

@media (hover: none) {
    .dwfg-expand-btn { opacity: 1; background: rgba(0,0,0,0.35); }
}

/* ── CAPTION & DATE ── */
.dwfg-caption {
    font-family: Inter, sans-serif;
    font-size: 0.88rem;
    color: #2d3748;
    line-height: 1.55;
    padding: 12px 14px 4px;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dwfg-date {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.68rem;
    color: #9ca3af;
    padding: 0 14px 8px;
    margin: 0;
    letter-spacing: 0.04em;
}

/* ── ACTIONS BAR ── */
.dwfg-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px 10px;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.dwfg-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 7px 10px;
    border-radius: 8px;
    font-family: Inter, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: #6b7280;
    transition: background 0.15s, color 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 40px; /* touch target */
}

.dwfg-action:hover { background: #f3f4f6; color: #2d3748; }
.dwfg-action:active { background: #e5e7eb; }

/* Like button active state */
.dwfg-like-btn.liked { color: #e53e3e; }
.dwfg-like-btn.liked .dwfg-heart { fill: currentColor; }
.dwfg-like-btn.liked:hover { background: #fff5f5; }

.dwfg-heart { transition: transform 0.2s, fill 0.2s; }
.dwfg-like-btn:active .dwfg-heart { transform: scale(1.3); }

.dwfg-share-btn { margin-left: auto; }

/* ── LOAD MORE ── */
.dwfg-more-wrap {
    text-align: center;
    margin-top: 2rem;
}

.dwfg-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1.5px solid #4a7c2f;
    color: #4a7c2f;
    font-family: Inter, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.75rem 1.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    min-height: 44px;
}

.dwfg-more-btn:hover { background: #4a7c2f; color: #ffffff; }
.dwfg-more-btn:disabled { opacity: 0.5; cursor: default; }

/* ── LIGHTBOX ── */
.dwfg-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15,20,30,0.96);
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.dwfg-lightbox.active { display: flex; }

/* Side-by-side layout */
.dwfg-lb-layout {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    max-width: 1100px;
    max-height: 92vh;
    margin: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}

/* Photo side */
.dwfg-lb-photo {
    flex: 1 1 60%;
    background: #0a0d14;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
}

.dwfg-lb-photo img {
    max-width: 100%;
    max-height: 92vh;
    object-fit: contain;
    display: block;
}

/* Panel side */
.dwfg-lb-panel {
    flex: 0 0 320px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 1px solid #e2e8dd;
}

.dwfg-lb-panel-top {
    padding: 20px 20px 0;
    flex-shrink: 0;
}

.dwfg-lb-date {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: #9ca3af;
    margin: 0 0 8px;
}

.dwfg-lb-caption {
    font-family: Inter, sans-serif;
    font-size: 0.92rem;
    color: #2d3748;
    line-height: 1.65;
    margin: 0 0 16px;
    max-height: 140px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c8dbb8 transparent;
}

.dwfg-lb-caption::-webkit-scrollbar { width: 4px; }
.dwfg-lb-caption::-webkit-scrollbar-track { background: transparent; }
.dwfg-lb-caption::-webkit-scrollbar-thumb { background: #c8dbb8; border-radius: 2px; }

/* Actions in panel */
.dwfg-lb-panel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.dwfg-lb-panel-actions .dwfg-action { color: #6b7280; }
.dwfg-lb-panel-actions .dwfg-like-btn.liked { color: #e53e3e; }
.dwfg-lb-panel-actions .dwfg-share-btn { margin-left: auto; }

/* Comments area in panel */
.dwfg-lb-comments-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.dwfg-lb-comments {
    flex: 1;
    overflow-y: auto;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
}

.dwfg-lb-comment-form {
    padding: 12px 16px 16px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

/* Nav buttons */
.dwfg-lb-close,
.dwfg-lb-prev,
.dwfg-lb-next {
    position: fixed;
    background: rgba(74,124,47,0.85);
    color: #ffffff;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 100000;
    -webkit-tap-highlight-color: transparent;
    min-width: 48px;
}

.dwfg-lb-close { top: 16px; right: 16px; font-size: 1.8rem; }
.dwfg-lb-prev  { left: 12px; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.dwfg-lb-next  { right: calc(320px + 12px); top: 50%; transform: translateY(-50%); font-size: 2rem; }

.dwfg-lb-close:hover,
.dwfg-lb-prev:hover,
.dwfg-lb-next:hover { background: #4a7c2f; }

/* Mobile — photo full screen, fixed panel pulls up from bottom */
@media (max-width: 700px) {

    .dwfg-lb-layout {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        position: relative;
        background: #000;
        flex-direction: column;
    }

    .dwfg-lb-photo {
        position: absolute;
        inset: 0;
        flex: none;
        max-height: none;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .dwfg-lb-photo img {
        width: 100%;
        height: 100%;
        max-height: none;
        object-fit: contain;
    }

    /* Panel fixed to viewport bottom */
    .dwfg-lb-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        z-index: 100001 !important;
        flex: none;
        width: 100%;
        border-left: none;
        border-top: none;
        border-radius: 18px 18px 0 0;
        background: #ffffff;
        box-shadow: 0 -4px 32px rgba(0,0,0,0.3);
        /* Start collapsed — JS sets explicit height on open */
        height: 72px;
        overflow: hidden;
        will-change: height;
    }

    .dwfg-lb-panel.expanded {
        height: 72vh;
    }

    /* Handle — green pill + hint */
    .dwfg-lb-panel-handle {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 0 4px;
        cursor: pointer;
        flex-shrink: 0;
        gap: 4px;
        min-height: 32px;
        user-select: none;
        -webkit-user-select: none;
    }
    .dwfg-lb-panel-handle::before {
        content: '';
        display: block;
        width: 44px;
        height: 5px;
        background: #4a7c2f;
        border-radius: 3px;
        opacity: 0.75;
        flex-shrink: 0;
    }
    .dwfg-lb-panel-handle::after {
        content: 'pull up for comments';
        font-family: 'Overpass Mono', monospace;
        font-size: 0.55rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        color: #4a7c2f;
        opacity: 0.65;
    }
    .dwfg-lb-panel.expanded .dwfg-lb-panel-handle::after {
        content: 'pull down';
    }

    /* Caption hidden until expanded */
    .dwfg-lb-panel-top {
        padding: 0 16px;
        flex-shrink: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }
    .dwfg-lb-panel.expanded .dwfg-lb-panel-top {
        max-height: 130px;
        padding: 6px 16px 0;
        overflow-y: auto;
    }

    .dwfg-lb-panel-actions { flex-shrink: 0; }

    .dwfg-lb-comments-wrap { display: none; }
    .dwfg-lb-panel.expanded .dwfg-lb-comments-wrap {
        display: flex;
        flex: 1;
        min-height: 0;
    }

    /* Nav arrows — JS positions these dynamically via inline style */
    .dwfg-lb-prev,
    .dwfg-lb-next {
        position: fixed !important;
        z-index: 100000 !important;
        top: auto !important;
        transform: none !important;
        width: 42px;
        height: 42px;
        transition: opacity 0.25s, bottom 0.35s cubic-bezier(0.34,1.1,0.64,1);
    }
    .dwfg-lb-prev { left: 10px !important; right: auto !important; }
    .dwfg-lb-next { right: 10px !important; left: auto !important; }

    .dwfg-lb-close {
        position: fixed !important;
        top: 12px !important;
        right: 12px !important;
        z-index: 100003 !important;
    }
}

/* ── COMMENT PANEL ── */
.dwfg-comment-panel {
    position: fixed;
    inset: 0;
    z-index: 99998;
    pointer-events: none;
}

.dwfg-comment-panel.open {
    pointer-events: all;
}

.dwfg-cp-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s;
}

.dwfg-comment-panel.open .dwfg-cp-backdrop {
    background: rgba(0,0,0,0.5);
}

/* Bottom sheet on mobile, side panel on desktop */
.dwfg-cp-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
    overflow: hidden;
}

.dwfg-comment-panel.open .dwfg-cp-sheet {
    transform: translateY(0);
}

@media (min-width: 680px) {
    .dwfg-cp-sheet {
        left: auto;
        bottom: 0;
        top: 0;
        right: 0;
        width: 400px;
        max-height: 100vh;
        border-radius: 0;
        transform: translateX(100%);
    }
    .dwfg-comment-panel.open .dwfg-cp-sheet {
        transform: translateX(0);
    }
}

.dwfg-cp-handle {
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

@media (min-width: 680px) { .dwfg-cp-handle { display: none; } }

.dwfg-cp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.dwfg-cp-title {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1.15rem;
    color: #2d3748;
    margin: 0;
}

.dwfg-cp-close {
    width: 36px; height: 36px;
    border-radius: 8px;
    border: 1.5px solid #e2e8dd;
    background: none;
    cursor: pointer;
    font-size: 1.3rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.dwfg-cp-close:hover { background: #f3f4f6; color: #2d3748; }

/* Comments list */
.dwfg-cp-comments {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    -webkit-overflow-scrolling: touch;
}

.dwfg-cp-loading {
    color: #9ca3af;
    font-size: 0.88rem;
    text-align: center;
    padding: 20px 0;
}

.dwfg-no-comments {
    color: #9ca3af;
    font-size: 0.88rem;
    text-align: center;
    padding: 24px 0;
}

.dwfg-comment {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.dwfg-comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #4a7c2f;
    color: #ffffff;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.dwfg-comment-body {
    flex: 1;
    background: #f9f7f4;
    border-radius: 12px;
    padding: 10px 14px;
}

.dwfg-comment-author {
    font-weight: 600;
    font-size: 0.85rem;
    color: #2d3748;
    display: block;
}

.dwfg-comment-time {
    font-size: 0.72rem;
    color: #9ca3af;
    display: block;
    margin-bottom: 4px;
}

.dwfg-comment-text {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.55;
    margin: 0 0 6px;
    word-break: break-word;
}

.dwfg-report-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: Inter, sans-serif;
    font-size: 0.7rem;
    color: #d1d5db;
    padding: 0;
    margin-top: 2px;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.dwfg-report-btn:hover { color: #c0392b; }
.dwfg-report-btn:disabled { cursor: default; }

/* Comment form */
.dwfg-cp-form {
    padding: 14px 20px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    background: #ffffff;
}

.dwfg-cp-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e2e8dd;
    border-radius: 10px;
    font-family: Inter, sans-serif;
    font-size: 0.95rem;
    color: #2d3748;
    background: #f9f7f4;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
}

.dwfg-cp-input:focus {
    outline: none;
    border-color: #4a7c2f;
    background: #ffffff;
}

.dwfg-cp-textarea { resize: none; }

.dwfg-cp-submit {
    width: 100%;
    padding: 12px;
    background: #4a7c2f;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: Inter, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 46px;
}

.dwfg-cp-submit:hover { background: #3d6826; }
.dwfg-cp-submit:disabled { opacity: 0.6; cursor: default; }

.dwfg-cp-notice {
    font-size: 0.72rem;
    color: #9ca3af;
    text-align: center;
    margin: 0;
}

/* ── PASSPORT BADGE ── */
.dwfg-passport-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f0f7eb;
    border: 1px solid #c8dbb8;
    border-radius: 10px;
    margin-bottom: 4px;
}

.dwfg-passport-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #4a7c2f;
    color: #ffffff;
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.dwfg-passport-name {
    font-family: Inter, sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2d3748;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dwfg-passport-tag {
    font-family: 'Overpass Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #4a7c2f;
    background: #c8dbb8;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

/* ── LOGIN PROMPT ── */
.dwfg-login-prompt {
    text-align: center;
    padding: 16px 12px;
}

.dwfg-login-prompt-text {
    font-family: Inter, sans-serif;
    font-size: 0.88rem;
    color: #6b7280;
    margin: 0 0 14px;
    line-height: 1.55;
}

.dwfg-passport-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #4a7c2f;
    color: #ffffff;
    font-family: Inter, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.dwfg-passport-login-btn:hover {
    background: #3d6826;
    transform: translateY(-1px);
    color: #ffffff;
    text-decoration: none;
}

/* ── TOAST ── */
.dwfg-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #2d3748;
    color: #ffffff;
    font-family: Inter, sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 12px 24px;
    border-radius: 999px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    z-index: 999999;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
    text-align: center;
}

.dwfg-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
