/* ============================================================================
 * GG Directory — front-end styles
 *
 * Uses the Platform's brand custom properties emitted by gg-brand-css.php at
 * :root. New canonical names take priority; fall back to the older names so
 * this CSS works on any tenant whose brand-css is still on the legacy schema.
 *
 * House rule: SHARP CORNERS. New UI on the Platform is square.
 * (Old rounded UI elsewhere is on a future cleanup pass.)
 * ============================================================================ */

/* Local aliases so the rest of the file reads cleanly. */
.gg-directory-archive,
.gg-listing-page {
    --gg-d-primary:   var(--gg-colour-primary,   #091D2D);
    --gg-d-secondary: var(--gg-colour-secondary, #74C299);
    --gg-d-heading:   var(--gg-colour-heading,   #091D2D);
    --gg-d-body:      var(--gg-colour-body,      #222639);
    --gg-d-muted:     #5a6378;
    --gg-d-border:    #e1e4ea;
    --gg-d-surface:   #ffffff;
    --gg-d-bg:        #f7f8fb;
    /* Accent is PINNED to the platform green, not the tenant secondary: some
       tenants' "secondary" resolves to a dark colour (e.g. dark indigo
       #130D32), which turned every accent-background + primary-text pairing
       below (owner bar, niche tag, sidebar CTA card) dark-on-dark and
       unreadable. Same guard as .gg-ml in inc/my-listing.php. */
    --gg-d-accent:    #74C299;
    --gg-d-warning:   #f59e0b;
    --gg-d-success-bg:#DEF7EC;
    --gg-d-success-fg:#03543F;
    --gg-d-error-bg:  #FDE8E8;
    --gg-d-error-fg:  #9B1C1C;
}

/* ---------------------------------------------------------------------------
 * Buttons + badges (shared)
 * ------------------------------------------------------------------------- */

.gg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    border: 1px solid transparent;
    border-radius: 0;       /* sharp corners */
    background: transparent;
    color: var(--gg-d-body);
    text-decoration: none;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}
.gg-btn:hover { filter: brightness(1.05); }
.gg-btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.gg-btn-full { width: 100%; }
.gg-btn-primary {
    background: var(--gg-d-primary);
    color: #fff;
    border-color: var(--gg-d-primary);
}
.gg-btn-primary:hover { background: var(--gg-d-accent); border-color: var(--gg-d-accent); }
.gg-btn-outline {
    background: transparent;
    color: var(--gg-d-primary);
    border-color: var(--gg-d-primary);
}
.gg-btn-success { background: var(--gg-d-success-bg); color: var(--gg-d-success-fg); border-color: var(--gg-d-success-bg); }

.gg-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--gg-d-body);
    background: #eef0f4;
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    text-decoration: none;
}
.gg-badge-pill { padding: 2px 10px; }
.gg-badge-success { background: var(--gg-d-success-bg); color: var(--gg-d-success-fg); border-color: var(--gg-d-success-bg); }
.gg-badge-warning { background: #FEF3C7; color: #92400E; border-color: #FEF3C7; }

.gg-card {
    background: var(--gg-d-surface);
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    padding: 18px;
}

.gg-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
.gg-section { padding: 32px 0; }

.gg-breadcrumbs { font-size: 0.9rem; color: var(--gg-d-muted); }
.gg-breadcrumbs a { color: var(--gg-d-primary); text-decoration: none; }
.gg-breadcrumbs a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------------
 * Archive: header + layout
 * ------------------------------------------------------------------------- */

.gg-directory-archive .gg-breadcrumbs { margin-bottom: 14px; }

.gg-directory-header { margin-bottom: 28px; }
.gg-directory-kicker {
    color: var(--gg-d-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin: 0 0 4px;
}
.gg-directory-header h1 {
    margin: 0 0 8px;
    font-size: 2.2rem;
    line-height: 1.1;
    color: var(--gg-d-heading);
}
.gg-directory-subtitle { color: var(--gg-d-muted); margin: 0 0 8px; max-width: 720px; }
.gg-directory-count    { color: var(--gg-d-muted); font-size: 0.9rem; margin: 0; }

.gg-directory-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 28px;
}

/* ---------------------------------------------------------------------------
 * Archive: filter sidebar
 * ------------------------------------------------------------------------- */

.gg-directory-filters {
    background: var(--gg-d-surface);
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    padding: 18px;
    align-self: start;
}
.gg-directory-filters h3 {
    margin: 0 0 14px;
    font-size: 1rem;
    color: var(--gg-d-heading);
}
.gg-filter-form { display: flex; flex-direction: column; gap: 12px; }
.gg-filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--gg-d-body);
}
.gg-filter-group input,
.gg-filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    font: inherit;
    font-size: 0.9rem;
    background: #fff;
    color: var(--gg-d-body);
}
.gg-filter-actions { display: flex; gap: 8px; margin-top: 4px; }
.gg-filter-actions .gg-btn { flex: 1; }

/* ---------------------------------------------------------------------------
 * Archive: results grid + cards
 * ------------------------------------------------------------------------- */

.gg-directory-results { min-width: 0; }
.gg-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.gg-listing-card {
    background: var(--gg-d-surface);
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}
.gg-listing-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.gg-listing-featured { border-color: var(--gg-d-accent); box-shadow: 0 0 0 1px var(--gg-d-accent); }

.gg-listing-card-thumb {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: var(--gg-d-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.gg-listing-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}
.gg-listing-card-placeholder {
    width: 80px;
    height: 80px;
    background: var(--gg-d-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
}
.gg-listing-card-niche {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(255,255,255,0.95);
    color: var(--gg-d-primary);
}
.gg-listing-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.gg-listing-card-title { margin: 0; font-size: 1.05rem; line-height: 1.2; }
.gg-listing-card-title a { color: var(--gg-d-heading); text-decoration: none; }
.gg-listing-card-title a:hover { color: var(--gg-d-primary); }
.gg-listing-card-pro      { margin: 0; font-size: 0.85rem; color: var(--gg-d-primary); font-weight: 600; }
.gg-listing-card-headline { margin: 0; font-size: 0.9rem; color: var(--gg-d-body); line-height: 1.5; }
.gg-listing-card-excerpt  { margin: 0; font-size: 0.9rem; color: var(--gg-d-muted); line-height: 1.5; }
.gg-listing-card-flags    { display: flex; flex-wrap: wrap; gap: 6px; }
.gg-listing-card-meta     { margin: 0; font-size: 0.85rem; color: var(--gg-d-muted); }
.gg-listing-card-specialties { display: flex; flex-wrap: wrap; gap: 4px; }

/* Empty state */
.gg-directory-empty {
    text-align: center;
    padding: 48px 24px;
    background: var(--gg-d-bg);
    border: 1px dashed var(--gg-d-border);
    border-radius: 0;
}
.gg-directory-empty h3 { margin: 0 0 8px; color: var(--gg-d-heading); }
.gg-directory-empty p  { margin: 0; color: var(--gg-d-muted); }

/* Pagination */
.gg-pagination {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}
.gg-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    color: var(--gg-d-body);
    background: #fff;
    text-decoration: none;
    font-size: 0.9rem;
}
.gg-pagination .page-numbers.current {
    background: var(--gg-d-primary);
    color: #fff;
    border-color: var(--gg-d-primary);
}
.gg-pagination .page-numbers:hover:not(.current) { background: var(--gg-d-bg); }

/* ---------------------------------------------------------------------------
 * Single listing
 * ------------------------------------------------------------------------- */

.gg-listing-page .gg-breadcrumbs { margin-bottom: 18px; }
.gg-listing-single {
    background: #fff;
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    overflow: hidden;
}

.gg-listing-header {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 28px;
    padding: 32px;
    border-bottom: 1px solid var(--gg-d-border);
    align-items: start;
}
.gg-listing-photo img,
.gg-listing-photo-placeholder {
    width: 200px;
    height: 200px;
    object-fit: cover;
    display: block;
    border-radius: 0;
}
.gg-listing-photo-placeholder {
    background: var(--gg-d-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    font-weight: 700;
}

.gg-listing-niche-tag { margin-bottom: 8px; }
.gg-listing-niche-tag a {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 0;
    background: var(--gg-d-accent);
    color: var(--gg-d-primary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
}
.gg-listing-name { margin: 0 0 6px; font-size: 2rem; line-height: 1.15; color: var(--gg-d-heading); }
.gg-listing-pronouns { font-size: 0.95rem; font-weight: 400; color: var(--gg-d-muted); margin-left: 10px; }
.gg-listing-pro-title { margin: 0 0 6px; font-weight: 600; color: var(--gg-d-primary); }
.gg-listing-headline { margin: 0 0 14px; color: var(--gg-d-body); font-size: 1.05rem; }
.gg-listing-flags { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gg-listing-flag-meta { font-size: 0.9rem; color: var(--gg-d-muted); display: inline-flex; align-items: center; gap: 4px; }

.gg-listing-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    padding: 32px;
}
.gg-listing-content > section { margin-bottom: 36px; }
.gg-listing-content > section:last-child { margin-bottom: 0; }
.gg-listing-content h2 { font-size: 1.4rem; color: var(--gg-d-heading); margin: 0 0 14px; }

.gg-listing-video-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.gg-listing-video-frame iframe,
.gg-listing-video-frame embed,
.gg-listing-video-frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.gg-listing-tagrow {
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px;
    align-items: start;
}
.gg-listing-tagrow-label {
    font-size: 0.85rem;
    color: var(--gg-d-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 4px;
}
.gg-listing-tagrow-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.gg-listing-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}
.gg-pricing-tier {
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    padding: 16px;
    background: var(--gg-d-bg);
}
.gg-pricing-tier-name   { margin: 0 0 6px; font-size: 1.05rem; color: var(--gg-d-heading); }
.gg-pricing-tier-price  { margin: 0 0 8px; font-weight: 700; color: var(--gg-d-primary); font-size: 1.1rem; }
.gg-pricing-tier-detail { margin: 0; color: var(--gg-d-body); font-size: 0.95rem; }

.gg-listing-testimonial-list { display: grid; gap: 16px; }
.gg-testimonial {
    margin: 0;
    padding: 18px;
    border-left: 4px solid var(--gg-d-accent);
    background: var(--gg-d-bg);
    border-radius: 0;
}
.gg-testimonial blockquote { margin: 0 0 8px; font-style: italic; color: var(--gg-d-body); }
.gg-testimonial figcaption { font-size: 0.9rem; color: var(--gg-d-muted); }
.gg-testimonial-role       { margin-left: 6px; }
.gg-testimonial-rating     { margin-bottom: 8px; }
.gg-star    { color: #cbd5e1; font-size: 1.1rem; }
.gg-star-on { color: var(--gg-d-warning); }

.gg-faq-item {
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    margin-bottom: 8px;
    background: var(--gg-d-bg);
}
.gg-faq-item > summary {
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    color: var(--gg-d-heading);
    list-style: none;
}
.gg-faq-item > summary::-webkit-details-marker { display: none; }
.gg-faq-item[open] > summary { border-bottom: 1px solid var(--gg-d-border); }
.gg-faq-answer { padding: 14px 18px; color: var(--gg-d-body); }

/* Sidebar */
.gg-listing-sidebar .gg-card {
    background: var(--gg-d-bg);
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    padding: 18px;
    margin-bottom: 16px;
}
.gg-listing-sidebar .gg-card:last-child { margin-bottom: 0; }
.gg-listing-sidebar .gg-card h3 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: var(--gg-d-heading);
}
.gg-listing-sidebar .gg-card-cta {
    background: var(--gg-d-accent);
    border-color: var(--gg-d-accent);
}
.gg-listing-sidebar .gg-card-cta h3 { color: var(--gg-d-primary); }
.gg-listing-discovery { margin: 0 0 12px; color: var(--gg-d-primary); font-size: 0.95rem; }

.gg-listing-contact-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
}
.gg-listing-contact-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--gg-d-border);
}
.gg-listing-contact-list li:last-child { border-bottom: 0; }

.gg-listing-social { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.gg-social-link {
    font-size: 0.85rem;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    text-decoration: none;
    color: var(--gg-d-body);
}

.gg-listing-cred-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Owner bar */
.gg-listing-owner-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gg-d-accent);
    color: var(--gg-d-primary);
    padding: 10px 16px;
    border-radius: 0;
    margin-bottom: 14px;
    font-size: 0.95rem;
}

/* Edit form */
.gg-listing-single.is-editing .gg-listing-body { grid-template-columns: 1fr; }

.gg-edit-form { display: block; }
.gg-edit-form h2 { margin: 0 0 4px; color: var(--gg-d-heading); }
.gg-edit-form-help { color: var(--gg-d-muted); margin: 0 0 18px; font-size: 0.9rem; }
.gg-edit-form fieldset {
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    padding: 16px 18px 6px;
    margin: 0 0 18px;
}
.gg-edit-form legend {
    padding: 0 8px;
    font-weight: 700;
    color: var(--gg-d-heading);
    font-size: 0.95rem;
}
.gg-edit-form label {
    display: block;
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--gg-d-body);
}
.gg-edit-form label.gg-edit-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}
.gg-edit-form input[type=text],
.gg-edit-form input[type=url],
.gg-edit-form input[type=email],
.gg-edit-form input[type=number],
.gg-edit-form input[type=file],
.gg-edit-form textarea {
    display: block;
    width: 100%;
    padding: 8px 10px;
    margin-top: 4px;
    border: 1px solid var(--gg-d-border);
    border-radius: 0;
    font: inherit;
    background: #fff;
    color: var(--gg-d-body);
}
.gg-edit-form textarea { resize: vertical; min-height: 140px; }
.gg-edit-photo-current img { max-width: 160px; height: auto; display: block; margin-bottom: 6px; }
.gg-edit-form-note {
    font-size: 0.85rem;
    color: var(--gg-d-muted);
    padding: 10px 14px;
    background: var(--gg-d-bg);
    border-radius: 0;
}
.gg-edit-actions { display: flex; gap: 10px; margin-top: 16px; }
.gg-edit-status { padding: 10px 14px; border-radius: 0; margin: 0 0 14px; font-size: 0.95rem; }
.gg-edit-status-ok    { background: var(--gg-d-success-bg); color: var(--gg-d-success-fg); }
.gg-edit-status-error { background: var(--gg-d-error-bg);   color: var(--gg-d-error-fg); }

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .gg-directory-layout { grid-template-columns: 1fr; }
    .gg-listing-header   { grid-template-columns: 1fr; text-align: center; padding: 24px; }
    .gg-listing-photo    { justify-self: center; }
    .gg-listing-flags    { justify-content: center; }
    .gg-listing-body     { grid-template-columns: 1fr; padding: 24px; }
    .gg-listing-tagrow   { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 600px) {
    .gg-directory-grid { grid-template-columns: 1fr; }
    .gg-directory-header h1 { font-size: 1.7rem; }
}
