/* =========================================================
   DEPARTMENT CATEGORY PAGES
   Shared by law-enforcement.html, civilian.html,
   fire-ems.html and communications.html.
   Loaded after style.css.
   ========================================================= */

.dept-header {
  padding: 8rem 5rem 3.5rem;
  background: linear-gradient(to bottom, rgba(123,47,190,0.12), rgba(13,0,16,0));
}

.dept-header-inner {
  max-width: 75rem;
  margin: 0 auto;
  width: 100%;          /* the header is display:flex now — without this
                           the inner block collapses to its content width */
  position: relative;
  z-index: 1;           /* sits above the overlay and grid texture */
}

.dept-title {
  font-size: clamp(2rem, 4.5vw, 3.3rem);
  font-weight: 900;
  line-height: 1.1;
  color: #FFFFFF;
  margin-bottom: 1rem;
}

.dept-lead {
  font-size: 0.98rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.75);
  max-width: 40rem;
}

/* ---------- AGENCY GRID ---------- */
.dept-main {
  max-width: 75rem;
  margin: 0 auto;
  padding: 3.5rem 5rem 6rem;
}

.agency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1.5rem;
}

/* ---------- GROUP HEADINGS ----------
   Municipal / County / State. Each group gets its own grid below it. */
.agency-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin: 3.5rem 0 1.5rem;
}

.agency-group:first-child { margin-top: 0; }

/* the rule that runs off to the right of the label */
.agency-group::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(123,47,190,0.28);
}

/* ---------- EMPTY STATE ----------
   For divisions that exist but have no agencies announced yet.
   Better than an empty page — it says "not yet", not "broken". */
.dept-empty {
  padding: 4rem 2.5rem;
  text-align: center;
  background: rgba(255,255,255,0.02);
  border: 1px dashed rgba(123,47,190,0.35);
  border-radius: 6px;
}

.dept-empty h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.8);
  margin-bottom: 0.75rem;
}

.dept-empty p {
  font-size: 0.9rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.5);
  max-width: 26.25rem;
  margin: 0 auto;
}

.agency-card {
  position: relative;
  padding: 2rem 2rem 2rem 2.25rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(123,47,190,0.28);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}

.agency-card:hover {
  border-color: rgba(123,47,190,0.6);
  background: rgba(255,255,255,0.04);
}

/* accent bar down the left edge, matching the form panels */
.agency-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: #7B2FBE;
}

.agency-abbr {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #E8874A;
  margin-bottom: 0.5rem;
}

.agency-name {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.3;
  color: #FFFFFF;
  margin-bottom: 0.6rem;
}

.agency-desc {
  font-size: 0.88rem;
  line-height: 1.75;
  color: rgba(255,255,255,0.65);
  margin-bottom: 1.25rem;
}

/* ---------- STATUS PILL ---------- */
.agency-status {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.status-open {
  background: rgba(92,140,90,0.18);
  border: 1px solid rgba(92,140,90,0.5);
  color: #8FBF8C;
}

.status-soon {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.5);
}

.status-closed {
  background: rgba(176,48,48,0.12);
  border: 1px solid rgba(176,48,48,0.45);
  color: #D98080;
}

/* ---------- FOOT CTA ---------- */
.dept-cta {
  margin-top: 3.5rem;
  padding: 2.5rem;
  text-align: center;
  background: rgba(123,47,190,0.08);
  border: 1px solid rgba(123,47,190,0.28);
  border-radius: 6px;
}

.dept-cta h2 {
  font-size: 1.4rem;
  font-weight: 900;
  color: #FFFFFF;
  margin-bottom: 0.75rem;
}

.dept-cta p {
  font-size: 0.92rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.7);
  max-width: 30rem;
  margin: 0 auto 1.75rem;
}

/* ---------- MOBILE ---------- */
@media (max-width: 700px) {
  .dept-header { padding: 7rem 1.25rem 2.5rem; }
  .dept-main   { padding: 2.5rem 1.25rem 4rem; }
  .agency-grid { grid-template-columns: 1fr; }
  .dept-cta    { padding: 2rem 1.25rem; }
}

/* ---------- REPORTING LINE ----------
   Used on the Server Operations cards to show the chain of command. */
.agency-meta {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(123,47,190,0.2);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.42);
}

.agency-meta strong {
  color: rgba(255,255,255,0.7);
  font-weight: 600;
}


/* =============================================================
   PAGE HEADER BACKGROUND IMAGES
   Each page sets its own image with a custom property:
     <header class="dept-header" style="--page-bg: url('bg-civilian.jpg')">
   ::before is the dark overlay that keeps text readable,
   ::after is the grid texture on top of it.
   ============================================================= */
.dept-header {
  position: relative;
  /* 28.75rem is 460px at the base scale - exactly what the EMT/Fire/Rescue and
     Civilian banners already measured, which is the size you said looked right.
     Short pages like FAQ and Partners were collapsing to ~348px and showing
     almost none of their image. In rem so it grows with the page on a big
     monitor instead of staying a thin strip. */
  min-height: 28.75rem;
  display: flex;
  align-items: center;
  background-color: #0D0010;
  background-image: var(--page-bg);
  background-size: cover;
  background-position: center;
}

.dept-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to right,
    rgba(5,0,15,0.86) 0%,
    rgba(11,0,20,0.70) 45%,
    rgba(13,0,22,0.30) 100%
  );
}

/* pages with no image still need the old flat treatment */
.dept-header:not([style])::before,
.dept-header.no-image::before {
  background: linear-gradient(to bottom, rgba(123,47,190,0.12), rgba(13,0,16,0));
}

/* =============================================================
   GALLERY GRID
   ============================================================= */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(123,47,190,0.28);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
}

/* Every tile is the same 16:9 box. A wider tile would keep its ratio
   and tower over its neighbours, leaving a hole in the grid. */

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, opacity 0.3s;
}

.gallery-item:hover img { transform: scale(1.04); }

.gallery-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.5rem 1.1rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #FFFFFF;
  background: linear-gradient(to top, rgba(5,0,15,0.9), transparent);
}

.gallery-note {
  margin-top: 2.5rem;
  font-size: 0.78rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.35);
}

@media (max-width: 700px) {
  /* shorter band on a phone so the banner does not eat the whole screen */
  .dept-header { min-height: 20rem; }
}
