/*
 * Community Directory styles.
 * To match your website, change the variables in the first block.
 * Fonts inherit from your site when embedded directly; set --cd-font to override.
 */
:root {
  --cd-font: inherit;
  --cd-accent: #2f5d50;        /* buttons, links, map pins */
  --cd-accent-ink: #ffffff;    /* text on accent */
  --cd-ink: #1d2321;
  --cd-muted: #5f6a66;
  --cd-line: #d9dedb;
  --cd-bg: #ffffff;
  --cd-surface: #f3f5f4;
  --cd-danger: #a33a2c;
  --cd-radius: 10px;
  --cd-max: 1080px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --cd-accent: #8fc1b0;
    --cd-accent-ink: #10201b;
    --cd-ink: #e8ecea;
    --cd-muted: #a3aea9;
    --cd-line: #36403c;
    --cd-bg: #161a19;
    --cd-surface: #1f2523;
    --cd-danger: #e58b7d;
  }
}

.cd { margin: 0; background: var(--cd-bg); color: var(--cd-ink);
  font-family: var(--cd-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  font-size: 1rem; line-height: 1.55; -webkit-text-size-adjust: 100%; }
body.cd { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.cd *, .cd *::before, .cd *::after { box-sizing: border-box; }
.cd a { color: var(--cd-accent); text-underline-offset: 2px; }
.cd :focus-visible { outline: 2px solid var(--cd-accent); outline-offset: 2px; }
.cd img { max-width: 100%; }

.cd-wrap { max-width: var(--cd-max); margin: 0 auto; padding: 32px 20px 48px; }
.cd-embedded .cd-wrap { padding: 8px 4px 16px; }

.cd h1 { font-size: clamp(1.6rem, 3vw + 1rem, 2.25rem); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
.cd h2 { font-size: 1.2rem; margin: 0 0 .5em; }
.cd-lede { color: var(--cd-muted); max-width: 60ch; margin: 0 0 1.5em; }
.cd-hint { display: block; color: var(--cd-muted); font-size: .85rem; font-weight: 400; margin-top: 4px; }
.cd-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cd-hp { position: absolute; left: -9999px; }

/* Header */
.cd-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.cd-head h1 { margin: 0; }
.cd-back { margin: 0 0 20px; font-size: .95rem; }
.cd-back a::before { content: "\2190\00a0"; }

/* Buttons */
.cd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px;
  border: 1px solid var(--cd-accent); border-radius: 999px; background: var(--cd-accent); color: var(--cd-accent-ink) !important;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.cd-btn:hover { filter: brightness(1.08); }
.cd-btn-quiet { background: transparent; color: var(--cd-accent) !important; }
.cd-btn-quiet:hover { background: var(--cd-surface); filter: none; }
.cd-btn-danger { background: transparent; border-color: var(--cd-danger); color: var(--cd-danger) !important; }
.cd-btn-danger:hover { background: var(--cd-danger); color: var(--cd-bg) !important; filter: none; }
.cd-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Search */
.cd-search { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cd-search input[type="search"] { flex: 1 1 260px; }
.cd-search select { flex: 0 1 200px; }
.cd input, .cd select, .cd textarea { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--cd-line);
  border-radius: var(--cd-radius); background: var(--cd-bg); color: var(--cd-ink); font: inherit; }
.cd textarea { resize: vertical; min-height: 120px; }
.cd input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; padding: 0; accent-color: var(--cd-accent); flex: none; margin-top: 3px; }
.cd input[type="file"] { padding: 8px; }

.cd-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--cd-line); padding-bottom: 12px; margin-bottom: 24px; }
.cd-count { margin: 0; color: var(--cd-muted); font-size: .95rem; }

.cd-toggle { display: inline-flex; border: 1px solid var(--cd-line); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.cd-toggle a { padding: 6px 16px; border-radius: 999px; text-decoration: none; color: var(--cd-muted); font-weight: 500; font-size: .95rem; }
.cd-toggle a[aria-current] { background: var(--cd-ink); color: var(--cd-bg); }
.cd-tabs { margin-bottom: 24px; }

/* Grid of members — a quiet roster, not a pile of cards */
.cd-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 32px 20px; }
.cd-card a { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-decoration: none; color: inherit; }
.cd-card .cd-avatar { margin-bottom: 10px; transition: transform .2s ease; }
.cd-card a:hover .cd-avatar { transform: scale(1.03); }
.cd-card a:hover .cd-card-name { text-decoration: underline; text-decoration-color: var(--cd-accent); text-decoration-thickness: 2px; }
.cd-card-name { font-weight: 650; font-size: 1.05rem; line-height: 1.3; }
.cd-card-headline { color: var(--cd-ink); font-size: .95rem; line-height: 1.4; }
.cd-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--cd-muted); font-size: .88rem; margin: 6px 0 0; }
.cd-tag { display: inline-block; padding: 1px 10px; border-radius: 999px; background: var(--cd-surface); color: var(--cd-muted) !important; font-size: .82rem; text-decoration: none; }

/* Avatars */
.cd-avatar { display: block; border-radius: 50%; object-fit: cover; background: var(--cd-surface); flex: none; }
.cd-avatar-sm { width: 48px; height: 48px; font-size: 1rem; }
.cd-avatar-md { width: 112px; height: 112px; font-size: 1.9rem; }
.cd-avatar-lg { width: 148px; height: 148px; font-size: 2.6rem; }
.cd-avatar-initials { display: grid; place-items: center; color: var(--cd-accent); font-weight: 600; letter-spacing: .02em;
  border: 1px solid var(--cd-line); }

/* Profile */
.cd-profile-head { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-bottom: 28px; }
.cd-profile-head h1 { margin-bottom: .15em; }
.cd-profile-head p { margin: 0 0 .4em; }
.cd-profile-headline { font-size: 1.15rem; }
.cd-bio { max-width: 65ch; font-size: 1.05rem; line-height: 1.7; white-space: normal; }
.cd-contact { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--cd-line); max-width: 680px; }

/* Forms */
.cd-form { display: grid; gap: 18px; max-width: 680px; }
.cd-form-narrow { max-width: 420px; }
.cd-form label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.cd-form .cd-check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.cd-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.cd-req { font-weight: 400; color: var(--cd-muted); font-size: .82rem; margin-left: 4px; }
.cd-err { color: var(--cd-danger); font-weight: 500; font-size: .88rem; }
.cd-form .cd-btn { justify-self: start; }
.cd-photo-current { display: flex; align-items: center; gap: 12px; font-weight: 400; }
.cd-photo-current img { border-radius: 50%; object-fit: cover; }
.cd-photo-current span { display: flex; gap: 8px; align-items: center; }

.cd-danger { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--cd-line); max-width: 680px; }
.cd-danger p { color: var(--cd-muted); }

/* Messages */
.cd-flash { padding: 12px 16px; border-radius: var(--cd-radius); background: var(--cd-surface); border-left: 4px solid var(--cd-accent); margin: 0 0 20px; max-width: 680px; }
.cd-flash-warn { border-left-color: #c08a1e; }
.cd-empty { padding: 48px 0; color: var(--cd-muted); }
.cd-done { max-width: 560px; padding: 24px 0; }

/* Map */
.cd-map { height: min(70vh, 560px); border-radius: var(--cd-radius); border: 1px solid var(--cd-line); z-index: 0; }
.cd-map .leaflet-popup-content { font-family: inherit; margin: 12px 14px; }
.cd-map .leaflet-popup-content a { font-weight: 650; }
.cd-pin { width: 18px; height: 18px; border-radius: 50%; background: var(--cd-accent); border: 3px solid var(--cd-bg); box-shadow: 0 0 0 1px var(--cd-accent); }
.cd-cluster { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--cd-accent); color: var(--cd-accent-ink); font-weight: 700; font-size: .85rem; border: 3px solid var(--cd-bg); box-shadow: 0 0 0 1px var(--cd-accent); }

/* Pager / footer */
.cd-pager { display: flex; gap: 20px; align-items: center; justify-content: center; margin-top: 40px; color: var(--cd-muted); }
.cd-foot { margin-top: 48px; font-size: .9rem; color: var(--cd-muted); }

/* Account bar */
.cd-memberbar { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px 18px; font-size: .92rem; margin: -12px 0 20px; }
.cd-memberbar a { text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.cd-memberbar a:hover { text-decoration: underline; }
.cd-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--cd-accent); color: var(--cd-accent-ink); font-size: .75rem; font-weight: 700; line-height: 1; }
.cd-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Inbox */
.cd-inbox { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--cd-line); }
.cd-inbox li { border-bottom: 1px solid var(--cd-line); }
.cd-inbox a { display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center; padding: 14px 4px; color: inherit; text-decoration: none; }
.cd-inbox a:hover { background: var(--cd-surface); }
.cd-inbox-main { display: grid; gap: 2px; min-width: 0; }
.cd-inbox-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.cd-inbox-top time { color: var(--cd-muted); font-size: .82rem; white-space: nowrap; }
.cd-inbox-snippet { color: var(--cd-muted); font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-inbox .is-unread .cd-inbox-snippet { color: var(--cd-ink); font-weight: 600; }

/* Conversation */
.cd-thread-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--cd-line); }
.cd-thread-head h1 { font-size: 1.3rem; margin: 0; }
.cd-thread-head h1 a { color: inherit; text-decoration: none; }
.cd-thread-head h1 a:hover { text-decoration: underline; }
.cd-thread-head p { margin: 0; color: var(--cd-muted); font-size: .92rem; }
.cd-thread { list-style: none; margin: 0; padding: 20px 0; display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.cd-thread-empty { color: var(--cd-muted); padding: 24px 0; max-width: 46ch; }
.cd-msg { align-self: flex-start; max-width: min(78%, 520px); display: grid; gap: 3px; }
.cd-msg-body { background: var(--cd-surface); padding: 10px 14px; border-radius: 16px 16px 16px 4px; overflow-wrap: anywhere; }
.cd-msg time { font-size: .75rem; color: var(--cd-muted); padding: 0 6px; }
.cd-msg-mine { align-self: flex-end; justify-items: end; }
.cd-msg-mine .cd-msg-body { background: var(--cd-accent); color: var(--cd-accent-ink); border-radius: 16px 16px 4px 16px; }
.cd-compose { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: flex-end; max-width: 720px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--cd-bg); border-top: 1px solid var(--cd-line); }
.cd-compose textarea { min-height: 46px; resize: none; border-radius: 22px; padding: 11px 16px; }
.cd-compose .cd-btn { min-height: 46px; }
.cd-safety { margin-top: 28px; max-width: 720px; color: var(--cd-muted); font-size: .92rem; }
.cd-safety summary { cursor: pointer; padding: 6px 0; }
.cd-safety form { margin-top: 14px; }
.cd-inline-form { display: inline; margin-left: 6px; }
.cd-linkbtn { background: none; border: 0; padding: 0; color: var(--cd-accent); font: inherit; text-decoration: underline; cursor: pointer; }

/* Admin */
.cd-admin-list { list-style: none; margin: 0; padding: 0; }
.cd-admin-list li { display: grid; grid-template-columns: 48px 1fr auto; gap: 16px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--cd-line); }
.cd-admin-who { display: grid; gap: 2px; min-width: 0; }
.cd-admin-who span { color: var(--cd-muted); font-size: .9rem; overflow-wrap: anywhere; }
.cd-admin-bio { margin: 6px 0 0; font-size: .9rem; max-width: 60ch; }
.cd-admin-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cd-admin-actions form { margin: 0; }
.cd-admin-actions .cd-btn { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.cd-panel { padding: 0 0 28px; margin-bottom: 28px; border-bottom: 1px solid var(--cd-line); max-width: 720px; }
.cd-panel p { color: var(--cd-muted); }
.cd-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cd-inline input[type="file"] { flex: 1 1 240px; width: auto; }

@media (max-width: 600px) {
  .cd-grid { grid-template-columns: 1fr 1fr; gap: 28px 14px; }
  .cd-avatar-md { width: 88px; height: 88px; font-size: 1.5rem; }
  .cd-avatar-lg { width: 112px; height: 112px; }
  .cd-admin-list li { grid-template-columns: 48px 1fr; }
  .cd-admin-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .cd * { transition: none !important; } }
