/*
 * Nonprofit Directory Plugin — style.css
 * Brand: #474747 (charcoal) · #f4f3f3 (off-white)
 * Compatible with block themes including Twenty Twenty-Five.
 */

:root {
    --npd-brand:    #474747;
    --npd-surface:  #f4f3f3;
    --npd-white:    #ffffff;
    --npd-border:   #e0dfdf;
    --npd-muted:    #888888;
    --npd-hint:     #aaaaaa;
    --npd-success-bg:     #f0f7f1;
    --npd-success-border: #c3dfc8;
    --npd-success-text:   #2d6a35;
    --npd-error-bg:       #fdf2f2;
    --npd-error-border:   #f0c4c4;
    --npd-error-text:     #8b2020;
    --npd-radius:   10px;
    --npd-radius-sm: 6px;
}

/* =========================================================
   GENERAL
   ========================================================= */

.npd-directory,
.npd-form-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
    color: var(--npd-brand);
}

/* =========================================================
   SEARCH BAR
   ========================================================= */

.npd-search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.npd-search-form input[type="text"],
.npd-search-form select {
    flex: 1;
    min-width: 160px;
    padding: 10px 14px;
    border: 1px solid var(--npd-border);
    border-radius: var(--npd-radius-sm);
    font-size: 14px;
    background: var(--npd-white);
    color: var(--npd-brand);
    outline: none;
    transition: border-color 0.15s;
    height: 42px;
}

.npd-search-form input[type="text"]:focus,
.npd-search-form select:focus {
    border-color: var(--npd-brand);
}

.npd-clear-link {
    font-size: 13px;
    color: var(--npd-muted);
    text-decoration: none;
    white-space: nowrap;
}
.npd-clear-link:hover { color: var(--npd-brand); }

.npd-result-count {
    font-size: 13px;
    color: var(--npd-hint);
    margin: 0 0 20px;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.npd-btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--npd-brand);
    color: #ffffff;
    border: none;
    border-radius: var(--npd-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
    white-space: nowrap;
    height: 42px;
    line-height: 1;
}
.npd-btn:hover { background: #333333; color: #fff; }

.npd-btn-full { width: 100%; text-align: center; height: auto; padding: 13px 22px; }

.npd-btn-outline {
    background: transparent;
    border: 1px solid var(--npd-brand);
    color: var(--npd-brand);
}
.npd-btn-outline:hover { background: var(--npd-brand); color: #fff; }

/* =========================================================
   CARD GRID
   ========================================================= */

.npd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* =========================================================
   INDIVIDUAL CARD
   ========================================================= */

.npd-card {
    background: var(--npd-white);
    border: 1px solid var(--npd-border);
    border-radius: var(--npd-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}
.npd-card:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

/* Card image */
.npd-card-img-link { display: block; }

.npd-card-img img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.npd-card-img--placeholder {
    width: 100%;
    height: 180px;
    background: var(--npd-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--npd-border);
}

/* Card body */
.npd-card-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Category tag */
.npd-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--npd-surface);
    color: var(--npd-muted);
    border-radius: 4px;
    padding: 3px 8px;
    margin-bottom: 10px;
    text-decoration: none;
    transition: background 0.15s;
}
.npd-tag:hover { background: var(--npd-border); color: var(--npd-brand); }

/* Title */
.npd-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.3;
}
.npd-card-title a {
    text-decoration: none;
    color: var(--npd-brand);
}
.npd-card-title a:hover { text-decoration: underline; }

/* Description — truncated, with inline read more */
.npd-card-desc {
    font-size: 13px;
    color: var(--npd-muted);
    line-height: 1.65;
    margin: 0 0 10px;
    flex: 1;
}

.npd-read-more {
    font-size: 13px;
    color: var(--npd-brand);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.npd-read-more:hover { text-decoration: underline; }

/* Location */
.npd-card-location {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--npd-hint);
    margin: 0 0 12px;
}
.npd-card-location svg { flex-shrink: 0; }

/* Card footer */
.npd-card-footer {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--npd-border);
}

.npd-card-link {
    font-size: 13px;
    color: var(--npd-brand);
    text-decoration: none;
    font-weight: 500;
}
.npd-card-link:hover { text-decoration: underline; }

/* Empty state */
.npd-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--npd-muted);
    font-size: 15px;
}
.npd-empty a { margin-top: 16px; }

/* =========================================================
   SUBMISSION FORM
   ========================================================= */

.npd-form-wrap { max-width: 640px; }

.npd-submit-form {
    background: var(--npd-white);
    border: 1px solid var(--npd-border);
    border-radius: var(--npd-radius);
    overflow: hidden;
}

/* Form section blocks */
.npd-form-section {
    padding: 24px 28px;
    border-bottom: 1px solid var(--npd-border);
}
.npd-form-section:last-of-type { border-bottom: none; }

.npd-form-heading {
    font-size: 13px;
    font-weight: 600;
    color: var(--npd-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 18px;
}

/* Fields */
.npd-field {
    margin-bottom: 14px;
}
.npd-field:last-child { margin-bottom: 0; }

.npd-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--npd-brand);
    margin-bottom: 6px;
}

.npd-required { color: #c0392b; }

.npd-field-hint {
    font-size: 12px;
    color: var(--npd-hint);
    margin: 5px 0 0;
}
.npd-field-hint a { color: var(--npd-brand); }

.npd-field-hint-inline {
    font-size: 12px;
    color: var(--npd-hint);
    font-weight: 400;
}

/* Side-by-side field row */
.npd-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.npd-field input[type="text"],
.npd-field input[type="url"],
.npd-field input[type="email"],
.npd-field input[type="file"],
.npd-field textarea,
.npd-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--npd-border);
    border-radius: var(--npd-radius-sm);
    font-size: 14px;
    background: var(--npd-surface);
    color: var(--npd-brand);
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.npd-field input:focus,
.npd-field textarea:focus,
.npd-field select:focus {
    border-color: var(--npd-brand);
    background: var(--npd-white);
}

.npd-field input[type="file"] {
    padding: 8px 12px;
    cursor: pointer;
}

.npd-field textarea { resize: vertical; }

/* Form footer */
.npd-form-footer {
    padding: 20px 28px;
    background: var(--npd-surface);
    border-top: 1px solid var(--npd-border);
}
.npd-form-footer .npd-field-hint { margin: 0 0 12px; }

/* =========================================================
   MESSAGES
   ========================================================= */

.npd-message {
    padding: 14px 18px;
    border-radius: var(--npd-radius-sm);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.npd-success {
    background: var(--npd-success-bg);
    border: 1px solid var(--npd-success-border);
    color: var(--npd-success-text);
}

.npd-error {
    background: var(--npd-error-bg);
    border: 1px solid var(--npd-error-border);
    color: var(--npd-error-text);
}

/* =========================================================
   MAP
   ========================================================= */

.npd-map-wrap {
    height: 480px;
    border: 1px solid var(--npd-border);
    border-radius: var(--npd-radius);
    overflow: hidden;
    margin: 20px 0;
}

.npd-map-popup img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    display: block;
    margin-bottom: 8px;
    border-radius: 4px;
}

.npd-map-popup strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--npd-brand);
}

.npd-map-popup .npd-map-tag {
    display: inline-block;
    font-size: 11px;
    background: var(--npd-surface);
    color: var(--npd-muted);
    border-radius: 4px;
    padding: 2px 7px;
    margin-bottom: 4px;
}

.npd-map-popup small {
    display: block;
    font-size: 12px;
    color: var(--npd-hint);
    margin-bottom: 6px;
}

.npd-map-popup a {
    font-size: 13px;
    color: var(--npd-brand);
    font-weight: 500;
    text-decoration: none;
}
.npd-map-popup a:hover { text-decoration: underline; }

.npd-map-empty {
    padding: 40px;
    text-align: center;
    color: var(--npd-muted);
}

/* =========================================================
   GUTENBERG / BLOCK THEME COMPATIBILITY
   Prevents block theme global styles from breaking the plugin.
   ========================================================= */

.npd-directory *,
.npd-form-wrap * {
    box-sizing: border-box;
}

/* Stop block themes from over-stretching our inputs */
.npd-field input,
.npd-field textarea,
.npd-field select,
.npd-search-form input,
.npd-search-form select {
    width: 100%;
    max-width: 100%;
}

/* Prevent TT5 / Twenty Twenty-Five from removing button styles */
.npd-btn,
.npd-btn:visited,
.npd-btn:hover,
.npd-btn:focus {
    appearance: none;
    -webkit-appearance: none;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 700px) {
    .npd-search-form { flex-direction: column; }
    .npd-grid { grid-template-columns: 1fr; }
    .npd-field-row { grid-template-columns: 1fr; }
    .npd-form-section { padding: 20px; }
    .npd-form-footer { padding: 16px 20px; }
    .npd-map-wrap { height: 320px; }
}


/* =========================================================
   SINGLE NONPROFIT PROFILE
   ========================================================= */

.npd-profile-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    font-family: inherit;
    color: var(--npd-brand);
}

/* Back link */
.npd-profile-nav {
    margin-bottom: 24px;
}

.npd-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--npd-muted);
    text-decoration: none;
    transition: color 0.15s;
}
.npd-back-link:hover { color: var(--npd-brand); }
.npd-back-link svg { flex-shrink: 0; }

/* ── Header ── */
.npd-profile-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.npd-profile-header-left {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

/* Avatar */
.npd-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
}

.npd-profile-avatar--img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.npd-profile-avatar--initials {
    background: var(--npd-brand);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

/* Header text */
.npd-profile-header-text { min-width: 0; }

.npd-profile-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
    line-height: 1.2;
    color: var(--npd-brand);
}

.npd-profile-tagline {
    font-size: 14px;
    color: var(--npd-muted);
    margin: 0 0 10px;
}

/* Tag pills */
.npd-profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.npd-profile-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    background: var(--npd-surface);
    color: var(--npd-brand);
    border: 1px solid var(--npd-border);
    border-radius: 20px;
    padding: 3px 10px;
}

.npd-profile-tag--verified {
    background: var(--npd-brand);
    color: #ffffff;
    border-color: var(--npd-brand);
}
.npd-profile-tag--verified svg { stroke: #ffffff; }

/* Visit website button */
.npd-profile-btn {
    display: inline-block;
    padding: 9px 18px;
    background: var(--npd-brand);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
}
.npd-profile-btn:hover { background: #333333; color: #fff; }

/* Divider */
.npd-divider {
    border: none;
    border-top: 1px solid var(--npd-border);
    margin: 0 0 28px;
}

/* ── Sections ── */
.npd-profile-section {
    margin-bottom: 28px;
}

.npd-profile-section-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--npd-muted);
    margin: 0 0 16px;
}

/* About text */
.npd-profile-about {
    font-size: 15px;
    line-height: 1.75;
    color: var(--npd-brand);
}
.npd-profile-about p { margin: 0 0 1em; }
.npd-profile-about p:last-child { margin-bottom: 0; }

/* Details grid — 3 columns */
.npd-profile-details-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px 16px;
}

.npd-profile-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.npd-profile-detail-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--npd-muted);
}

.npd-profile-detail-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--npd-brand);
    line-height: 1.3;
}

/* Contact rows */
.npd-profile-contact {
    display: flex;
    flex-direction: column;
}

.npd-profile-contact-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid var(--npd-border);
    font-size: 14px;
}
.npd-profile-contact-row:first-child { border-top: 1px solid var(--npd-border); }

.npd-profile-contact-label {
    color: var(--npd-muted);
    flex-shrink: 0;
    font-size: 13px;
}

.npd-profile-contact-value {
    text-align: right;
    color: var(--npd-brand);
    word-break: break-all;
}
.npd-profile-contact-value a {
    color: var(--npd-brand);
    text-decoration: none;
}
.npd-profile-contact-value a:hover { text-decoration: underline; }

/* Profile footer */
.npd-profile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 16px;
    border-top: 1px solid var(--npd-border);
    font-size: 12px;
}

.npd-profile-updated { color: var(--npd-hint); }

.npd-profile-suggest {
    color: var(--npd-muted);
    text-decoration: none;
    font-size: 12px;
}
.npd-profile-suggest:hover {
    color: var(--npd-brand);
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 560px) {
    .npd-profile-header { flex-direction: column; }
    .npd-profile-btn { width: 100%; text-align: center; }
    .npd-profile-details-grid { grid-template-columns: repeat(2, 1fr); }
    .npd-profile-name { font-size: 20px; }
}


/* =========================================================
   FEATURED NONPROFITS  [npd_featured]
   ========================================================= */

.npd-featured-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-family: inherit;
}

.npd-featured-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.npd-featured-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--npd-muted);
    background: var(--npd-surface);
    border: 1px solid var(--npd-border);
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
}

.npd-featured-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--npd-brand);
    margin: 0;
}

/* Featured cards grid */
.npd-featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

/* Individual featured card */
.npd-featured-card {
    border: 1px solid var(--npd-border);
    border-radius: var(--npd-radius);
    overflow: hidden;
    background: var(--npd-white);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.npd-featured-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: var(--npd-brand);
}

.npd-featured-card-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    text-decoration: none;
    color: inherit;
}

/* Avatar inside featured card */
.npd-featured-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
}

.npd-featured-avatar--img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.npd-featured-avatar--initials {
    background: var(--npd-brand);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* Card body */
.npd-featured-card-body {
    flex: 1;
    min-width: 0;
}

.npd-featured-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--npd-brand);
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.npd-featured-tagline {
    font-size: 12px;
    color: var(--npd-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow */
.npd-featured-arrow {
    font-size: 16px;
    color: var(--npd-border);
    flex-shrink: 0;
    transition: color 0.15s, transform 0.15s;
}
.npd-featured-card:hover .npd-featured-arrow {
    color: var(--npd-brand);
    transform: translateX(3px);
}

/* Footer link */
.npd-featured-footer {
    text-align: center;
    margin-top: 8px;
}

@media (max-width: 600px) {
    .npd-featured-grid { grid-template-columns: 1fr; }
}