/*
 * roll-call-skin.css — Brushy Mountain Squares
 * Transforms the TablePress Roll Call table into a mug shot card grid.
 * Loaded only on the Roll Call page via functions.php.
 *
 * HOW TO ADD PHOTOS:
 * Add a 5th column called "PHOTO" to your TablePress table (table 313).
 * Put a full image URL in each row. The CSS will display it automatically.
 * Members without a photo get the silhouette placeholder.
 */

/* ── HIDE THE ORIGINAL TABLE ───────────────────────────────────── */
.page-id-roll-call #tablepress-313,
body.page #tablepress-313,
.tablepress-id-313,
.tablepress-id-313-no-footer,
.dataTables_wrapper {
  display: none !important;
}

/* ── PAGE HEADER ───────────────────────────────────────────────── */
.entry-content .wp-block-heading,
body .roll-call-heading {
  font-family: 'Rye', Georgia, serif !important;
  color: #e8d5b0 !important;
  text-align: center !important;
}

/* ── RESET ENTRY-CONTENT PADDING ON ROLL CALL PAGE ─────────────── */
/*
 * FIX: WordPress's .is-layout-constrained rule constrains direct
 * children of .entry-content to 645px with margin: auto. We zero out
 * the padding on the constrained containers and let the search bar
 * and grid fill 100% of that now-padding-free container. We do NOT
 * touch overflow-x on .wp-site-blocks — doing so breaks the homepage
 * hero prison photo which relies on overflow:hidden for its image clip.
 */
body.page-id-313 .entry-content.wp-block-post-content {
  padding-left:  0 !important;
  padding-right: 0 !important;
  margin-left:   0 !important;
  margin-right:  0 !important;
  max-width:     100% !important;
  width:         100% !important;
}
body.page-id-313 main.wp-block-group,
body.page-id-313 .wp-block-group.has-global-padding {
  padding-left:  0 !important;
  padding-right: 0 !important;
  max-width:     100% !important;
}
/* Override the is-layout-constrained 645px child constraint on this page */
body.page-id-313 .entry-content.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
  max-width: 100% !important;
  margin-left:  0 !important;
  margin-right: 0 !important;
}
/* FIX: WordPress alignfull blocks get a negative margin-left equal to
 * --wp--style--root--padding-left (14px on mobile) to bleed full-width.
 * On this page we've already zeroed all padding so that negative margin
 * just shifts everything 14px off-screen to the left. Cancel it out. */
body.page-id-313 .wp-block-group.alignfull {
  margin-left:  0 !important;
  margin-right: 0 !important;
  padding-left:  0 !important;
  padding-right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  left: 0 !important;
  position: relative !important;
}

/* ── FULL-BLEED SEARCH BAR AND GRID ────────────────────────────── */
/*
 * With the constrained layout zeroed out above, these elements just
 * need width:100% and no margins to fill edge-to-edge. We avoid
 * 100vw because it includes scrollbar width and causes horizontal
 * overflow on mobile.
 */
#bms-roll-call-search-bar,
#bms-roll-call-grid {
  width:      100% !important;
  max-width:  100% !important;
  margin-left:  0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
  position: relative;
}

/* ── SEARCH BAR ─────────────────────────────────────────────────── */
#bms-roll-call-search-bar {
  background: #201d1a;
  border-bottom: 1px solid #33302b;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ── CARD GRID ────────────────────────────────────────────────────── */
#bms-roll-call-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.25rem;
  /* Generous horizontal padding so cards never touch the viewport edge */
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
  box-sizing: border-box;
}

#bms-roll-call-search {
  background: #2e2b27;
  border: 1px solid #3d3a35;
  color: #e8e0d4;
  font-family: 'Special Elite', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  width: 260px;
  max-width: 100%;
}
#bms-roll-call-search:focus {
  border-color: #c2490d;
  outline: none;
  box-shadow: 0 0 0 2px rgba(194,73,13,0.2);
}
#bms-roll-call-search::placeholder { color: #5e5a55; }

#bms-roll-call-count {
  font-family: 'Special Elite', monospace;
  font-size: 0.65rem;
  color: #5e5a55;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#bms-roll-call-count span { color: #c2490d; }

/* ── INDIVIDUAL CARD ───────────────────────────────────────────── */
.bms-mug-card {
  background: #201d1a;
  border: 1px solid #3d3a35;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transition: transform 200ms ease, box-shadow 200ms ease;
  position: relative;
}
.bms-mug-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.65);
}
.bms-mug-card.bms-hidden { display: none !important; }

/* Inmate ID — shown as subtitle under nickname in card body */
.bms-mug-inmate-id {
  font-family: 'Special Elite', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: #5e5a55;
  margin-top: -0.35rem;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

/* Mug shot photo */
.bms-mug-photo {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #262320;
  border-bottom: 2px solid #33302b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
/* Vertical line rule overlay */
.bms-mug-photo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent, transparent 18px,
    rgba(255,255,255,0.025) 18px,
    rgba(255,255,255,0.025) 19px
  );
  pointer-events: none;
  z-index: 1;
}
.bms-mug-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: sepia(20%) contrast(1.05) brightness(0.92);
}
/* Silhouette for no-photo members */
.bms-mug-silhouette {
  width: 52%;
  height: auto;
  fill: #3d3a35;
  position: relative;
  z-index: 2;
  opacity: 0.75;
}

/* Card body */
.bms-mug-body {
  padding: 0.875rem 1rem 1.25rem;
  background: #201d1a;
  position: relative;
}
.bms-mug-name {
  font-family: 'Rye', Georgia, serif;
  font-size: 1rem;
  color: #e8d5b0;
  margin-bottom: 0.6rem;
  line-height: 1.2;
}
.bms-mug-field-label {
  font-family: 'Special Elite', monospace;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #c2490d;
  display: block;
  margin-bottom: 0.15rem;
  margin-top: 0.5rem;
}
.bms-mug-field-label:first-of-type { margin-top: 0; }
.bms-mug-value {
  font-family: 'Special Elite', monospace;
  font-size: 0.7rem;
  color: #9a9388;
  line-height: 1.4;
}
.bms-mug-value.bms-unknown {
  color: #5e5a55;
  font-style: italic;
}

/* Rotating stamp */
.bms-mug-stamp {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  font-family: 'Rye', Georgia, serif;
  font-size: 0.65rem;
  color: rgba(194,73,13,0.3);
  border: 2px solid rgba(194,73,13,0.22);
  padding: 2px 5px;
  border-radius: 2px;
  transform: rotate(-12deg);
  letter-spacing: 0.05em;
  pointer-events: none;
  user-select: none;
}

/* ── MOBILE ────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #bms-roll-call-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0.75rem 0.875rem;
  }
  .bms-mug-name { font-size: 0.875rem; }
  .bms-mug-body { padding: 0.6rem 0.75rem 0.75rem; }
}

/* ── REAL NAME (logged-in only) ──────────────────────────────────── */
.bms-real-name {
  color: #c2490d !important;
  font-style: italic;
  font-size: 0.72rem !important;
}

/* ── MEMBERS-ONLY BADGE ──────────────────────────────────────────── */
.bms-member-badge {
  font-family: 'Special Elite', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c2490d;
  border: 1px solid #c2490d;
  padding: 3px 10px;
  border-radius: 2px;
  background: #3d2418;
  margin-left: auto;
}

/* ── PRIVATE FIELDS (email / phone links) ────────────────────────── */
.bms-private a {
  color: #9a9388 !important;
  text-decoration: none !important;
  font-family: 'Special Elite', monospace !important;
  font-size: 0.68rem !important;
  word-break: break-all;
}
.bms-private a:hover {
  color: #c2490d !important;
}
