/**
 * Pocket Giving — Fundraisers: Minimal structural styles.
 *
 * This stylesheet provides ONLY layout structure (grid, card, progress bar).
 * Fonts, colors, button styles, spacing, and typography are inherited from
 * the active WordPress theme.
 *
 * DO NOT add colors, font families, font sizes, border-radius, or box-shadows
 * here — let the theme dictate those.
 */

/* -------------------------------------------------------------------------
   Layouts (grid / list)
   ------------------------------------------------------------------------- */
.pg-fundraisers.pg-layout--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.pg-fundraisers.pg-layout--list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* -------------------------------------------------------------------------
   Card
   ------------------------------------------------------------------------- */
.pg-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--pg-border, #e5e7eb);
    border-radius: inherit; /* theme dictates radius */
    background: inherit;    /* theme dictates bg */
}

.pg-layout--list .pg-card {
    flex-direction: row;
    align-items: stretch;
}

/* -------------------------------------------------------------------------
   Image
   ------------------------------------------------------------------------- */
.pg-card__image-link {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 10;
}

.pg-layout--list .pg-card__image-link {
    flex: 0 0 240px;
    aspect-ratio: auto;
    min-height: 180px;
}

.pg-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* -------------------------------------------------------------------------
   Body
   ------------------------------------------------------------------------- */
.pg-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px;
    gap: 10px;
}

.pg-layout--list .pg-card__body {
    padding: 20px 24px;
}

/* -------------------------------------------------------------------------
   Meta (project / location)
   ------------------------------------------------------------------------- */
.pg-card__meta {
    display: flex;
    gap: 8px;
    font-size: 0.85em;
    opacity: 0.7;
}

.pg-card__project::after {
    content: "·";
    margin-left: 8px;
}

.pg-card__project:last-child::after,
.pg-card__project:only-child::after {
    display: none;
}

/* -------------------------------------------------------------------------
   Title
   ------------------------------------------------------------------------- */
.pg-card__title {
    margin: 0;
    font-size: inherit;
    font-weight: 600;
    line-height: 1.3;
}

.pg-card__title a {
    text-decoration: none;
    color: inherit;
}

.pg-card__title a:hover {
    text-decoration: underline;
}

/* -------------------------------------------------------------------------
   Tagline / Story
   ------------------------------------------------------------------------- */
.pg-card__tagline {
    margin: 0;
    font-size: 0.95em;
    opacity: 0.8;
    line-height: 1.5;

    /* clamp to 2 lines in grid */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pg-card__story {
    margin: 0;
    font-size: 0.95em;
    opacity: 0.8;
    line-height: 1.5;
}

/* -------------------------------------------------------------------------
   Progress bar
   ------------------------------------------------------------------------- */
.pg-card__progress {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pg-progress-bar {
    height: 8px;
    background: var(--pg-progress-bg, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
}

.pg-progress-bar__fill {
    height: 100%;
    background: var(--pg-progress-fill, #059669);
    border-radius: inherit;
    transition: width 0.3s ease;
}

.pg-progress-bar__labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    font-weight: 600;
}

.pg-progress-bar__target {
    opacity: 0.6;
    font-weight: 400;
}

/* -------------------------------------------------------------------------
   Footer (donors + donate button)
   ------------------------------------------------------------------------- */
.pg-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 8px;
    border-top: 1px solid var(--pg-border, #e5e7eb);
}

.pg-card__donors {
    font-size: 0.85em;
    opacity: 0.7;
}

.pg-card__button {
    display: inline-block;
    padding: 8px 20px;
    background: var(--pg-button-bg, #1a1a2e);
    color: var(--pg-button-color, #fff);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    border-radius: inherit;
    transition: opacity 0.2s;
    white-space: nowrap;
}

.pg-card__button:hover {
    opacity: 0.85;
    color: var(--pg-button-color, #fff);
}

/* -------------------------------------------------------------------------
   States
   ------------------------------------------------------------------------- */
.pg-error,
.pg-empty {
    padding: 24px;
    text-align: center;
    opacity: 0.7;
    font-style: italic;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .pg-fundraisers.pg-layout--grid {
        grid-template-columns: 1fr;
    }

    .pg-layout--list .pg-card {
        flex-direction: column;
    }

    .pg-layout--list .pg-card__image-link {
        flex: none;
        aspect-ratio: 16 / 10;
        min-height: auto;
    }
}

/* -------------------------------------------------------------------------
   Theme variables — partners can override these in their theme CSS:
   -------------------------------------------------------------------------
   --pg-border          Card / progress bar border colour
   --pg-progress-bg     Progress bar background
   --pg-progress-fill   Progress bar fill colour
   --pg-button-bg       Donate button background
   --pg-button-color    Donate button text colour
   ------------------------------------------------------------------------- */

/* =========================================================================
   DETAIL PAGE — Full fundraiser view
   ========================================================================= */
.pg-detail {
    max-width: 800px;
    margin: 0 auto;
}

.pg-detail__back {
    display: inline-block;
    margin-bottom: 16px;
    text-decoration: none;
    font-size: 0.9em;
    opacity: 0.7;
}
.pg-detail__back:hover { opacity: 1; }

.pg-detail__hero {
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
}
.pg-detail__hero-img {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.pg-detail__header { margin-bottom: 24px; }
.pg-detail__meta {
    display: flex;
    gap: 12px;
    font-size: 0.85em;
    opacity: 0.7;
    margin-bottom: 8px;
}
.pg-detail__title {
    margin: 0 0 8px 0;
    font-size: 2em;
    line-height: 1.2;
}
.pg-detail__tagline {
    margin: 0 0 12px 0;
    font-size: 1.1em;
    opacity: 0.8;
}
.pg-detail__charity {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    opacity: 0.7;
}
.pg-detail__charity-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

/* Progress */
.pg-detail__progress { margin-bottom: 28px; }
.pg-detail__progress-bar {
    height: 12px;
    background: var(--pg-progress-bg, #e5e7eb);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}
.pg-detail__progress-fill {
    height: 100%;
    background: var(--pg-progress-fill, #059669);
    border-radius: inherit;
    transition: width 0.3s ease;
}
.pg-detail__progress-stats {
    display: flex;
    gap: 16px;
    font-size: 0.95em;
    flex-wrap: wrap;
}
.pg-detail__raised { font-weight: 700; font-size: 1.2em; }
.pg-detail__target { opacity: 0.7; }
.pg-detail__donors { opacity: 0.6; margin-left: auto; }

/* Giving levels */
.pg-detail__giving {
    margin-bottom: 28px;
    padding: 24px;
    border: 1px solid var(--pg-border, #e5e7eb);
    border-radius: 8px;
    background: var(--pg-giving-bg, #f9fafb);
}
.pg-detail__giving h2 {
    margin: 0 0 16px 0;
    font-size: 1.2em;
}
.pg-giving__options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}
.pg-giving__btn {
    flex: 1;
    min-width: 80px;
    padding: 12px 16px;
    border: 2px solid var(--pg-border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 700;
    text-align: center;
    transition: all 0.15s;
    color: inherit;
}
.pg-giving__btn:hover {
    border-color: var(--pg-progress-fill, #059669);
}
.pg-giving__btn--active {
    border-color: var(--pg-progress-fill, #059669);
    background: var(--pg-progress-fill, #059669);
    color: #fff;
}
.pg-giving__btn small {
    display: block;
    font-weight: 400;
    font-size: 0.75em;
    opacity: 0.7;
    margin-top: 2px;
}
.pg-giving__custom {
    position: relative;
    margin-bottom: 16px;
}
.pg-giving__input {
    width: 100%;
    padding: 14px 16px 14px 36px;
    border: 2px solid var(--pg-border, #e5e7eb);
    border-radius: 8px;
    font-size: 1.05em;
    box-sizing: border-box;
}
.pg-giving__currency {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    opacity: 0.5;
}
.pg-donate-btn {
    display: block;
    width: 100%;
    padding: 16px;
    background: var(--pg-button-bg, #1a1a2e);
    color: var(--pg-button-color, #fff);
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}
.pg-donate-btn:hover { opacity: 0.9; }
.pg-donate-note {
    text-align: center;
    font-size: 0.8em;
    opacity: 0.5;
    margin: 10px 0 0 0;
}

/* Story */
.pg-detail__story { margin-bottom: 28px; }
.pg-detail__story h2 { margin-bottom: 12px; }

/* Gallery */
.pg-detail__gallery { margin-bottom: 28px; }
.pg-detail__gallery h2 { margin-bottom: 12px; }
.pg-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.pg-gallery__item {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 6px;
}
.pg-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}
.pg-gallery__item:hover img { transform: scale(1.05); }

/* Updates */
.pg-detail__updates { margin-bottom: 28px; }
.pg-detail__updates h2 { margin-bottom: 12px; }
.pg-updates { display: flex; flex-direction: column; gap: 20px; }
.pg-update {
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--pg-border, #e5e7eb);
    border-radius: 8px;
}
.pg-update__img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.pg-update__body { flex: 1; }
.pg-update__body h3 { margin: 0 0 4px 0; font-size: 1.05em; }
.pg-update__date { font-size: 0.8em; opacity: 0.5; display: block; margin-bottom: 8px; }
.pg-update__text { font-size: 0.95em; line-height: 1.6; }

@media (max-width: 640px) {
    .pg-update { flex-direction: column; }
    .pg-update__img { width: 100%; height: 180px; }
    .pg-detail__title { font-size: 1.5em; }
}
