/**
 * Global Member Directory — Organization styles.
 *
 * Covers:
 *   - Organization directory (committees & cultural forums) — spec §4
 *   - Single organization page (banner, flags, members, sidebar) — spec §5
 *
 * Loaded on:
 *   - [gmd_committees] / [gmd_cultural_forums] / [gmd_organizations]
 *   - [gmd_organization] / singular gmd_organization view
 *   - [gmd_relations] (relation pages that link to committees/forums)
 *
 * Uses --gmd-* custom properties emitted by GMD_Organization::print_branding_css(),
 * with hardcoded fallbacks so the design is never broken if that fails.
 *
 * @package GlobalMemberDirectory
 */


/* =========================================================================
 * 1. ORGANIZATION DIRECTORY — spec §4
 * ====================================================================== */

.gmd-org-directory {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 40px;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--gmd-text, #1d2327);
}


/* -----------------------------------------------------------------
 * 1.1 Header — beige/cream, gold ornament, serif title (spec §4.1)
 * ----------------------------------------------------------------- */

.gmd-org-directory__header {
    position: relative;
    background: #f4ecd8;
    border: 1px solid #e4d9bf;
    border-radius: 12px;
    padding: 48px 24px 40px;
    text-align: center;
    margin-bottom: 32px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .05);
}

.gmd-org-directory__emblem {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: rgba(201, 169, 97, .15);
    border: 2px solid #c9a961;
    font-size: 2.2rem;
    line-height: 1;
}

.gmd-org-directory__globe {
    display: block;
    filter: grayscale(.2);
}

.gmd-org-directory__title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
    letter-spacing: .04em;
    line-height: 1.2;
}

.gmd-org-directory__subtitle {
    color: #6b5d3f;
    margin: 10px 0 0;
    font-size: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.gmd-org-directory__ornament {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.gmd-org-directory__ornament span {
    display: block;
    height: 2px;
    width: 40px;
    background: linear-gradient(90deg, transparent, #c9a961, transparent);
}

.gmd-org-directory__ornament span:nth-child(2) {
    width: 60px;
}


/* -----------------------------------------------------------------
 * 1.2 Two-column listing layout (spec §4.3)
 * ----------------------------------------------------------------- */

.gmd-org-directory__columns {
    display: grid;
    gap: 24px;
    align-items: start;
}

.gmd-org-directory__columns--2 {
    grid-template-columns: 1fr 1fr;
}

.gmd-org-directory__columns--1 {
    grid-template-columns: 1fr;
}

@media (max-width: 720px) {
    .gmd-org-directory__columns--2 {
        grid-template-columns: 1fr;
    }
}

.gmd-org-directory__column {
    min-width: 0;
}


/* -----------------------------------------------------------------
 * 1.3 Table-like listing (spec §4.3)
 * ----------------------------------------------------------------- */

.gmd-org-directory__table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .03);
}

.gmd-org-directory__row {
    border-bottom: 1px solid #eef0f3;
    transition: background .12s ease;
}

.gmd-org-directory__row:last-child {
    border-bottom: 0;
}

.gmd-org-directory__row:hover {
    background: #f9fafb;
}

.gmd-org-directory__flags {
    padding: 12px 16px;
    white-space: nowrap;
    vertical-align: middle;
    width: 100px;
    text-align: left;
}

.gmd-org-directory__flags img {
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
    height: 20px;
    width: auto;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .06);
}

.gmd-org-directory__flags img:last-child {
    margin-right: 0;
}

.gmd-org-directory__name {
    padding: 12px 16px;
    vertical-align: middle;
}

.gmd-org-directory__name a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
}

.gmd-org-directory__name a:hover,
.gmd-org-directory__name a:focus {
    text-decoration: underline;
    color: #1e40af;
}

.gmd-org-directory__name span {
    color: #374151;
    font-weight: 600;
    font-size: 1.05rem;
}

.gmd-org-directory__excerpt {
    display: block;
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 3px;
    line-height: 1.4;
}


/* Empty state */

.gmd-org-directory .gmd-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    background: #fff;
}

.gmd-org-directory .gmd-empty strong {
    display: block;
    font-size: 1rem;
    color: #1e3a5f;
    margin-bottom: 6px;
}


/* =========================================================================
 * 2. SINGLE ORGANIZATION — spec §5
 * ====================================================================== */

.gmd-org-single {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0 40px;
    color: var(--gmd-text, #1d2327);
}


/* -----------------------------------------------------------------
 * 2.1 Hero banner
 * ----------------------------------------------------------------- */

.gmd-org-single__hero {
    position: relative;
    background-color: #f4ecd8;
    background-size: cover;
    background-position: center;
    padding: 64px 24px 56px;
    text-align: center;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 32px;
}

.gmd-org-single__hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .35));
    pointer-events: none;
}

.gmd-org-single__hero-content {
    position: relative;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}


/* Flag pair */

.gmd-org-single__flags {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.gmd-org-single__flags img {
    height: 40px;
    width: auto;
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
    background: #fff;
}

.gmd-org-single__flags-arrow {
    font-size: 1.5rem;
    opacity: .8;
    font-weight: 400;
}


/* Type badge */

.gmd-org-single__type {
    display: inline-block;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, .92) !important;
    color: #1e3a5f !important;
    border-color: rgba(255, 255, 255, .5) !important;
    font-weight: 600;
    letter-spacing: .02em;
}


/* Logo + title */

.gmd-org-single__identity {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.gmd-org-single__logo {
    height: 64px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.gmd-org-single__title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: #fff;
    letter-spacing: .02em;
}

.gmd-org-single__excerpt {
    max-width: 720px;
    margin: 12px auto 0;
    font-size: 1rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, .95);
}


/* -----------------------------------------------------------------
 * 2.2 Body — main + sidebar
 * ----------------------------------------------------------------- */

.gmd-org-single__body {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .gmd-org-single__body {
        grid-template-columns: 1fr;
    }
}

.gmd-org-single__main,
.gmd-org-single__sidebar {
    min-width: 0;
}

.gmd-org-single__section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    padding: 24px;
    margin-bottom: 20px;
}

.gmd-org-single__section:last-child {
    margin-bottom: 0;
}

.gmd-org-single__section-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #c9a961;
    color: #1e3a5f;
    display: inline-block;
    letter-spacing: .01em;
}

.gmd-org-single__description {
    font-size: 0.95rem;
    line-height: 1.65;
    color: #374151;
}

.gmd-org-single__description p {
    margin: 0 0 12px;
}

.gmd-org-single__description p:last-child {
    margin-bottom: 0;
}


/* Sidebar card fallback */

.gmd-org-single__sidebar .gmd-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.gmd-org-single__sidebar .gmd-card__title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: #1e3a5f;
    letter-spacing: .02em;
}


/* Sidebar lists */

.gmd-org-single__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gmd-org-single__list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
    line-height: 1.5;
}

.gmd-org-single__list li:last-child {
    border-bottom: 0;
}

.gmd-org-single__list img.gmd-flag {
    height: 16px;
    width: auto;
    border-radius: 2px;
}

.gmd-org-single__list .dashicons {
    color: #1e3a5f;
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.gmd-org-single__list a {
    color: #1d4ed8;
    text-decoration: none;
    word-break: break-word;
}

.gmd-org-single__list a:hover,
.gmd-org-single__list a:focus {
    text-decoration: underline;
}

.gmd-org-single__contact-info {
    display: block;
    padding: 8px 0;
    font-size: 0.9rem;
    color: #6b7280;
    line-height: 1.55;
    white-space: pre-line;
}


/* Footer back links */

.gmd-org-single__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}


/* =========================================================================
 * 3. MEMBERS GRID (inside organization single)
 *
 * Uses the shared .gmd-members + .gmd-member-card classes but the
 * organization single page uses .gmd-members--grid which defaults to
 * 4 columns. Override to 3 columns inside the org single for balance.
 * ====================================================================== */

.gmd-org-single .gmd-members--grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .gmd-org-single .gmd-members--grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .gmd-org-single .gmd-members--grid {
        grid-template-columns: 1fr;
    }
}


/* =========================================================================
 * 4. RESPONSIVE TRIM
 * ====================================================================== */

@media (max-width: 782px) {
    .gmd-org-directory__header {
        padding: 36px 16px 32px;
    }
    .gmd-org-directory__emblem {
        width: 56px;
        height: 56px;
        font-size: 1.8rem;
    }
    .gmd-org-directory__title {
        font-size: 1.5rem;
    }
    .gmd-org-single__hero {
        padding: 40px 16px 36px;
    }
    .gmd-org-single__flags img {
        height: 32px;
    }
    .gmd-org-single__title {
        font-size: 1.5rem;
    }
    .gmd-org-single__logo {
        height: 48px;
        max-width: 90px;
    }
    .gmd-org-single__section {
        padding: 18px;
    }
    .gmd-org-directory__flags {
        width: auto;
        padding: 10px 12px;
    }
    .gmd-org-directory__name {
        padding: 10px 12px;
    }
    .gmd-org-directory__name a,
    .gmd-org-directory__name span {
        font-size: 0.95rem;
    }
}