/* === PDG Manager Frontend Styles === */

.pdg-list-wrap {
    width: 100%;
}

/* ============================================
   Grid Layout
   ============================================ */
.pdg-grid {
    display: grid;
    grid-template-columns: repeat(var(--pdg-columns, 3), 1fr);
    gap: 24px;
}

/* ============================================
   Row Layout
   ============================================ */
.pdg-rows .pdg-card {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid #eee;
}
.pdg-rows .pdg-card:last-child {
    border-bottom: none;
}
.pdg-rows .pdg-photo-container {
    flex: 0 0 180px;
    width: 180px;
}
.pdg-rows .pdg-content {
    flex: 1;
    min-width: 0;
}

/* ============================================
   Card Base
   ============================================ */
.pdg-card {
    background: var(--pdg-card-bg, #fff);
    border-radius: var(--pdg-border-radius, 8px);
    overflow: hidden;
    padding: var(--pdg-card-padding, 16px);
    /* text-align is set by Elementor text_align control and inherited by all children */
}

/* ============================================
   Photo
   ============================================
   HOW ALIGNMENT WORKS:
   - .pdg-card has text-align set by Elementor (e.g. center)
   - .pdg-photo-container inherits that text-align (no override here)
   - .pdg-photo-wrap is display:inline-block so it RESPONDS to text-align
   - When photo width < 100%, the inline-block is narrower than container
     and text-align visually moves it left/center/right
   - Individual photo_align control sets text-align on .pdg-photo-container
     to override the inherited card alignment if needed
   ============================================ */
.pdg-photo-container {
    /* No text-align here — inherits from .pdg-card or prefix_class rules below */
    font-size: 0; /* removes inline-block gap */
}
/* Photo alignment via prefix_class on widget wrapper.
   Only center/right need explicit rules. Left = no rule = inherits from card. */
.pdg-photo-align-center .pdg-photo-container { text-align: center; }
.pdg-photo-align-right  .pdg-photo-container { text-align: right; }
.pdg-photo-wrap {
    display: inline-block;
    vertical-align: top;
    position: relative;
    width: 100%; /* default: fills card; overridden by Elementor photo_width */
    max-width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 4px;
    background: #f0f0f0;
}
.pdg-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.pdg-photo-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    transition: background 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

/* ============================================
   Logo
   ============================================
   HOW ALIGNMENT WORKS:
   - .pdg-logo-container inherits text-align from .pdg-card
   - .pdg-logo-wrap is display:inline-block with width:120px
   - 120px is always narrower than the card, so text-align IMMEDIATELY
     moves it left/center/right — no width change needed
   ============================================ */
.pdg-logo-container {
    /* No text-align here — inherits from .pdg-card or prefix_class rules below */
    margin: 12px 0;
    font-size: 0; /* removes inline-block gap */
}
/* Logo alignment via prefix_class on widget wrapper.
   Only center/right need explicit rules. Left = no rule = inherits from card. */
.pdg-logo-align-center .pdg-logo-container { text-align: center; }
.pdg-logo-align-right  .pdg-logo-container { text-align: right; }
.pdg-logo-wrap {
    display: inline-block;
    vertical-align: top;
    width: 120px; /* explicit width — narrower than card, immediately alignable */
    max-width: 100%;
}
.pdg-logo-wrap img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ============================================
   Text Elements
   ============================================ */
.pdg-name {
    font-size: var(--pdg-name-size, 1.1em);
    font-weight: bold;
    margin: 10px 0 4px;
}
.pdg-year,
.pdg-theme,
.pdg-club {
    font-size: var(--pdg-meta-size, 0.9em);
    color: #555;
    margin: 2px 0;
}
.pdg-prefix {
    font-size: 0.85em;
    opacity: 0.75;
}
.pdg-ry-prefix,
.pdg-rc-prefix {
    font-size: 0.85em;
    opacity: 0.75;
}
.pdg-deceased {
    margin-left: 6px;
    color: #888;
    font-size: 0.9em;
}

/* ============================================
   Spouse Section
   ============================================ */
.pdg-spouse {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.pdg-spouse-photo-wrap {
    display: inline-block;
    vertical-align: top;
    width: 80px;
    max-width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 4px;
    background: #f0f0f0;
    position: relative;
}
.pdg-spouse-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pdg-spouse-name {
    font-size: 0.85em;
    color: #666;
    margin: 6px 0 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .pdg-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .pdg-grid {
        grid-template-columns: 1fr;
    }
    .pdg-rows .pdg-card {
        flex-direction: column;
    }
    .pdg-rows .pdg-photo-container {
        flex: none;
        width: 100%;
    }
    .pdg-horizontal {
        grid-template-columns: 1fr;
    }
    .pdg-card--horizontal {
        flex-direction: column;
    }
    .pdg-photo-col {
        flex: none;
        max-width: 100%;
        width: 100%;
    }
}

/* ============================================
   Horizontal Card Layout
   ============================================ */
.pdg-horizontal {
    display: grid;
    grid-template-columns: repeat(var(--pdg-columns, 1), 1fr);
    gap: 24px;
}

.pdg-card--horizontal {
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: flex-start;
}

/* Left column — PDG photo */
.pdg-photo-col {
    flex: 0 0 25%;
    max-width: 25%;
}

/* Scoped to avoid inheriting grid card's aspect-ratio and inline-block rules.
   display:block is intentionally added here (not in spec CSS listing) to
   override the grid card's display:inline-block on .pdg-photo-wrap. */
.pdg-photo-col .pdg-photo-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    position: relative;
}

.pdg-photo-col .pdg-photo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Right column — all content */
.pdg-content-col {
    flex: 1;
    min-width: 0;
}

.pdg-card--horizontal .pdg-name {
    margin-top: 0;
}

.pdg-theme-year {
    font-style: italic;
    margin-bottom: 8px;
}

/* Media thumbnails + details row */
.pdg-meta-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: flex-start;
    margin-top: 8px;
}

.pdg-media-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.pdg-details-col {
    flex: 1;
}

.pdg-ri-president {
    margin-top: 4px;
}
