/* ===== Our Departments — selectors prefixed .dept ===== */
.dept {
  --d-green: #1E5C4C;
  --d-deep: #164438;
  --d-gold: #ecb454;
  --d-pill: #DCEEE1;
  --d-pale: #EFF6F1;
  --d-ink: #1B2B25;
  --d-soft: #5C6E66;
  --d-line: #D8E7DE;
  --d-ease: cubic-bezier(.22, .61, .36, 1);

  padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2rem);
  background: #fff;
  color: var(--d-ink);
  scroll-margin-top: 90px;
}
.dept *, .dept *::before, .dept *::after { box-sizing: border-box; }
.dept-wrap { max-width: 1240px; margin: 0 auto; }
.dept-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header + search ---------- */
.dept-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem 2rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
.dept-title {
  margin: 0;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700; line-height: 1.1; letter-spacing: -.01em;
  color: var(--d-deep);
  text-align: left;
}
.dept-title::after { content: ""; display: block; width: 3.5rem; height: 3px; margin-top: .9rem; border-radius: 2px; background: var(--d-gold); }
.dept-sub { margin: 1rem 0 0; max-width: 46ch; font-size: clamp(1rem, 2.2vw, 1.1rem); line-height: 1.65; color: var(--d-soft); }

.dept-tools { display: flex; flex-direction: column; gap: .5rem; width: min(100%, 380px); }
.dept-search {
  position: relative; display: block;
}
.dept-search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; fill: none; stroke: var(--d-soft); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none; transition: stroke .2s ease;
}
.dept-search:focus-within svg { stroke: var(--d-green); }
.dept-search input {
  width: 100%; height: 48px; margin: 0;
  padding: 0 14px 0 44px;
  font: inherit; font-size: .95rem; color: var(--d-ink);
  background: #F2F8F4;
  border: 1.5px solid var(--d-line);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.dept-search input::placeholder { color: #8da097; }
.dept-search input:hover { border-color: #bfd3c7; }
.dept-search input:focus { background: #fff; border-color: var(--d-green); box-shadow: 0 0 0 4px rgba(30, 92, 76, .14); }
.dept-count { margin: 0; font-size: .85rem; color: var(--d-soft); text-align: right; min-height: 1.2em; }

/* ---------- Grid ---------- */
.dept-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(.85rem, 2vw, 1.25rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
}
.dept-grid > li { min-width: 0; }

.dept-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 1rem; height: 100%;
  padding: 1.25rem 1.25rem 1.1rem;
  background: #fff;
  border: 1px solid var(--d-line);
  border-radius: 16px;
  color: inherit; text-decoration: none;
  box-shadow: 0 4px 14px rgba(22, 68, 56, .06);
  transition: transform .3s var(--d-ease), box-shadow .3s var(--d-ease), border-color .3s ease;
}
.dept-card::after { /* gold bar that draws in on hover / focus */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--d-gold);
  transform: scaleX(0); transform-origin: left center;
  transition: transform .45s var(--d-ease);
}
.dept-card:hover, .dept-card:focus-visible { transform: translateY(-4px); border-color: #bfd3c7; box-shadow: 0 16px 32px rgba(22, 68, 56, .14); }
.dept-card:hover::after, .dept-card:focus-visible::after { transform: scaleX(1); }
.dept-card:focus-visible { outline: 3px solid rgba(30, 92, 76, .4); outline-offset: 2px; }

.dept-mono {
  flex: none; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 14px;
  font-family: "Source Serif 4", Georgia, serif; font-size: 1.35rem; font-weight: 700;
  color: var(--d-green); background: var(--d-pill);
  transition: background .3s ease, color .3s ease, transform .4s var(--d-ease);
}
.dept-card:hover .dept-mono, .dept-card:focus-visible .dept-mono { background: var(--d-green); color: #fff; transform: rotate(-6deg) scale(1.06); }

.dept-name {
  margin: 0; font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.1rem; line-height: 1.3; font-weight: 600; color: var(--d-deep);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dept-desc {
  margin: -.4rem 0 0; font-size: .9rem; line-height: 1.55; color: var(--d-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dept-go { margin-top: auto; display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 700; color: var(--d-green); }
.dept-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s ease; }
.dept-card:hover .dept-go svg, .dept-card:focus-visible .dept-go svg { transform: translateX(4px); }

/* ---------- Empty state ---------- */
.dept-empty { text-align: center; padding: 2.5rem 1rem; color: var(--d-soft); }
.dept-empty p { margin: 0 0 1rem; font-size: 1.05rem; }
.dept-empty button, .dept-more-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .75rem 1.4rem; font: inherit; font-size: .95rem; font-weight: 700;
  color: var(--d-green); background: #fff;
  border: 1.5px solid var(--d-green); border-radius: 999px; cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
.dept-empty button:hover, .dept-more-btn:hover { background: var(--d-green); color: #fff; }
.dept-empty button:focus-visible, .dept-more-btn:focus-visible { outline: 3px solid rgba(30, 92, 76, .4); outline-offset: 3px; }
.dept-more { display: flex; justify-content: center; margin-top: clamp(1.5rem, 4vw, 2.25rem); }
.dept-more-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s ease; }
.dept-more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.dept [hidden] { display: none !important; }

/* ---------- Entrance (cards rise in as they scroll into view) ---------- */
.dept-js .dept-card { opacity: 0; transform: translateY(18px); }
.dept-js .dept-card.is-in {
  opacity: 1; transform: none;
  transition: opacity .6s ease var(--d, 0ms), transform .6s var(--d-ease) var(--d, 0ms), box-shadow .3s var(--d-ease), border-color .3s ease;
}
.dept-js .dept-card.is-in:hover, .dept-js .dept-card.is-in:focus-visible { transform: translateY(-4px); transition-delay: 0ms; }

@media (max-width: 640px) {
  .dept-head { align-items: stretch; }
  .dept-tools { width: 100%; }
  .dept-count { text-align: left; }
  .dept-search input { font-size: 16px; } /* stops iOS zooming on focus */
  .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .dept-card { padding: 1rem; gap: .75rem; border-radius: 14px; }
  .dept-mono { width: 42px; height: 42px; font-size: 1.15rem; border-radius: 12px; }
  .dept-name { font-size: 1rem; }
}
@media (max-width: 360px) { .dept-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  .dept *, .dept *::before, .dept *::after { transition: none !important; animation: none !important; }
  .dept-js .dept-card { opacity: 1; transform: none; }
}