/* ============================================================
   CAREMAP MORRIS — Directory Page Styles
   Matches homepage warm editorial aesthetic
============================================================ */

/* ============================================================
   PAGE HERO
============================================================ */
.dir-hero {
  padding: 3.5rem 0 2.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
}

.dir-hero h1 {
  font-family: var(--ff-display);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
  color: var(--bark);
}

.dir-hero .subtitle {
  font-size: 1.05rem;
  color: var(--warm-gray);
  max-width: 700px;
  line-height: 1.6;
}


/* ============================================================
   DIRECTORY SECTION
============================================================ */
.dir-section {
  padding: 2.5rem 0 5rem;
  background: var(--cream);
}


/* ============================================================
   FILTER BAR (ASSUMES YOU ALREADY HAVE IT IN HTML)
============================================================ */
.dir-controls {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.25rem;
  box-shadow: 0 10px 30px rgba(26, 20, 16, 0.06);
  margin-bottom: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dir-search input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cream);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dir-search input::placeholder {
  color: rgba(26, 20, 16, 0.45);
}

.dir-search input:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 4px rgba(192, 75, 32, 0.18);
}

.dir-filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dir-filters select {
  flex: 1;
  min-width: 180px;
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--cream);
  font-size: 0.9rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease;
}

.dir-filters select:focus {
  border-color: var(--rust);
}

.dir-clear-btn {
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  transition: transform 0.2s ease, background 0.2s ease;
}

.dir-clear-btn:hover {
  background: var(--bark);
  transform: translateY(-1px);
}


/* ============================================================
   RESOURCE GRID
============================================================ */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}


/* ============================================================
   RESOURCE CARD
============================================================ */
.res-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  box-shadow: 0 12px 30px rgba(26, 20, 16, 0.05);
}

.res-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 45px rgba(26, 20, 16, 0.10);
}

.res-card:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 3px;
}

.res-card-body {
  padding: 1.25rem 1.3rem 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}


/* ============================================================
   CATEGORY BADGE
============================================================ */
.res-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(26, 20, 16, 0.04);
  color: var(--rust);
  width: fit-content;
}

/* Softer category color hints (matches warm theme) */
.badge-food             { color: #A14A1F; background: rgba(192,75,32,.12); }
.badge-housing          { color: #2F5A2D; background: rgba(74,103,65,.12); }
.badge-domestic-violence{ color: #8C1D1D; background: rgba(192,40,40,.12); }
.badge-mental-health    { color: #1A3B8B; background: rgba(30,70,160,.10); }
.badge-substance-use    { color: #5A2080; background: rgba(120,60,170,.10); }
.badge-health           { color: #0D5C45; background: rgba(30,150,120,.10); }
.badge-legal            { color: #7A5800; background: rgba(200,150,50,.12); }
.badge-disability       { color: #0D3E6B; background: rgba(70,140,210,.10); }
.badge-youth            { color: #7A3010; background: rgba(232,151,78,.14); }
.badge-senior           { color: #3A5C1A; background: rgba(110,170,80,.12); }
.badge-employment       { color: #1A4A6B; background: rgba(90,150,210,.10); }
.badge-education        { color: #5A1A6B; background: rgba(160,90,190,.10); }
.badge-social-services  { color: #6B2A1A; background: rgba(184,154,106,.16); }


/* ============================================================
   CARD CONTENT
============================================================ */
.res-card-title {
  font-family: var(--ff-display);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  color: var(--bark);
}

.res-card-location {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--warm-gray);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.res-card-location svg {
  opacity: 0.65;
}

.res-card-desc {
  font-size: 0.9rem;
  color: #5A4F45;
  line-height: 1.55;
  margin-top: 0.2rem;

  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.res-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.res-tag {
  font-size: 0.72rem;
  font-weight: 500;
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  background: rgba(58, 40, 28, 0.06);
  border: 1px solid var(--border);
  color: var(--bark);
}


/* ============================================================
   CARD FOOTER
============================================================ */
.res-card-footer {
  padding: 1rem 1.3rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.res-card-phone {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  color: var(--warm-gray);
  overflow-wrap: anywhere;
}

.res-expand-btn {
  background: var(--rust);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 0.95rem;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.res-expand-btn:hover {
  background: var(--rust-lt);
  transform: translateY(-1px);
}


/* ============================================================
   DETAIL MODAL (POPUP)
============================================================ */
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 20, 16, 0.70);
  backdrop-filter: blur(4px);
  z-index: 200;
}

.detail-backdrop[hidden] {
  display: none;
}

.detail-modal-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 201;
}

.detail-modal-wrap[hidden] {
  display: none;
}

.detail-card {
  width: min(760px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 28px 70px rgba(26, 20, 16, 0.25);
  animation: popIn 0.3s cubic-bezier(.22,.68,0,1.2);
}


/* Header inside modal */
.detail-head {
  padding: 1.6rem 1.7rem 1.2rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  background: var(--cream);
  position: sticky;
  top: 0;
  z-index: 2;
}

.detail-title {
  font-family: var(--ff-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--bark);
  margin-top: 0.5rem;
  line-height: 1.2;
}

.detail-head-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-close {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  color: var(--warm-gray);
  transition: background 0.2s ease, color 0.2s ease;
}

.detail-close:hover {
  background: rgba(192,75,32,.12);
  color: var(--rust);
}


/* Modal body */
.detail-body {
  padding: 1.4rem 1.7rem 1rem;
}

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section-label {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 0.5rem;
}

.detail-long-desc {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #453C34;
}


/* Contact info grid */
.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.detail-info-item {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 0.95rem;
}

.detail-info-label {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(26,20,16,.55);
  margin-bottom: 0.35rem;
}

.detail-info-value {
  font-size: 0.9rem;
  color: var(--bark);
  line-height: 1.45;
}

.detail-info-value a {
  color: var(--rust);
  text-decoration: underline;
  word-break: break-word;
}


/* Tags inside modal */
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}


/* Modal actions footer */
.detail-actions {
  padding: 1.1rem 1.7rem 1.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--cream);
}

.detail-actions .btn {
  border-radius: 6px;
  padding: 0.65rem 1.1rem;
  font-size: 0.85rem;
}


/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes popIn {
  from { opacity: 0; transform: translateY(22px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}


/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 900px) {
  .detail-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .res-card-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .res-expand-btn {
    width: 100%;
    justify-content: center;
  }
}
/* ============================================================
   DIRECTORY — Make it match homepage aesthetic
============================================================ */

.dir-hero-title {
  font-family: var(--ff-display);
  font-size: clamp(2.1rem, 4vw, 3.4rem);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--bark);
  margin-bottom: .75rem;
}

.dir-hero-title em {
  font-style: italic;
  color: var(--rust);
}

.dir-hero-sub {
  max-width: 620px;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--warm-gray);
  margin-bottom: 1.75rem;
}

/* ============================================================
   FILTER BAR / CONTROLS — make it pretty
============================================================ */

.dir-controls {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.25rem;
  box-shadow: 0 14px 38px rgba(26,20,16,.06);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dir-controls label {
  font-family: var(--ff-mono);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: .35rem;
  display: block;
}

/* Search bar */
.dir-controls input[type="search"],
.dir-controls input[type="text"] {
  width: 100%;
  padding: .85rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(58,40,28,.18);
  background: rgba(247,242,234,.55);
  font-family: var(--ff-body);
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border .2s, box-shadow .2s, background .2s;
}

.dir-controls input::placeholder {
  color: rgba(26,20,16,.45);
}

.dir-controls input:focus {
  border-color: var(--rust);
  background: rgba(247,242,234,.85);
  box-shadow: 0 0 0 4px rgba(192,75,32,.15);
}

/* Dropdowns */
.dir-controls select {
  width: 100%;
  padding: .85rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(58,40,28,.18);
  background: rgba(247,242,234,.55);
  font-family: var(--ff-body); /* THIS makes it match search bar */
  font-size: .95rem;
  color: var(--ink);
  outline: none;
  transition: border .2s, box-shadow .2s, background .2s;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(26,20,16,.6) 50%),
    linear-gradient(135deg, rgba(26,20,16,.6) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.dir-controls select:focus {
  border-color: var(--rust);
  background: rgba(247,242,234,.85);
  box-shadow: 0 0 0 4px rgba(192,75,32,.15);
}

/* Filter grid layout */
.dir-filter-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: .75rem;
  align-items: end;
}

@media (max-width: 820px) {
  .dir-filter-row {
    grid-template-columns: 1fr;
  }
}

/* Clear button */
.dir-clear-btn {
  padding: .8rem 1.1rem;
  border-radius: 8px;
  border: 2px solid var(--rust);
  background: transparent;
  font-family: var(--ff-body);
  font-size: .9rem;
  font-weight: 500;
  color: var(--rust);
  transition: all .22s;
  white-space: nowrap;
}

.dir-clear-btn:hover {
  background: var(--rust);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(192,75,32,.25);
}

/* ============================================================
   RESULTS COUNT ("Showing 50/50 resources")
============================================================ */

.dir-results-count {
  margin-top: .25rem;
  font-family: var(--ff-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(26,20,16,.55);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.dir-results-count strong {
  color: var(--rust);
  font-weight: 600;
}

.dir-results-count::before {
  content: "";
  width: 28px;
  height: 2px;
  background: var(--rust);
  display: inline-block;
  opacity: .7;
}

/* ============================================================
   RESOURCE CARDS — make them match homepage style
============================================================ */

.resource-card {
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--border);
  transition: transform .25s, box-shadow .25s;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 46px rgba(26,20,16,.12);
}

.resource-card h3 {
  font-family: var(--ff-display);
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--bark);
}

.resource-card p {
  color: #5A4F45;
}

/* ============================================================
   POPUP MODAL — make it feel less ugly and more premium
============================================================ */

.modal-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--cream);
  box-shadow: 0 30px 80px rgba(26,20,16,.25);
}

.modal-head h2 {
  font-family: var(--ff-display);
  font-weight: 900;
  color: var(--bark);
}

.modal-body h3 {
  font-family: var(--ff-mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: .4rem;
}

.modal-body p,
.modal-body li {
  color: #5A4F45;
  line-height: 1.6;
}