/* =============================================================================
   Nevada Integrity — Grid Homepage
   Loaded only on pages using the `page-homepage` template (see inc/homepage.php).

   Layout is CSS Grid throughout, driven by core's native Grid layout on the
   Group block. Core emits `grid-template-columns` inline via a
   `.wp-container-core-group-is-layout-*` class (specificity 0,1,0), so every
   override here is scoped under `.ni-page` to win on specificity rather than
   relying on `!important` or source order.

   The header, footer and the --ni-* tokens they share live in
   global-header-footer.css, which loads site-wide and is declared as this
   file's dependency — the chrome is global now, only the page body is not.
   ============================================================================= */

/* ── Section scaffolding ──────────────────────────────────────────────────── */
.ni-page .ni-section { padding: 90px var(--ni-gutter); }
.ni-page .ni-section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.ni-page .ni-section-head {
  text-align: center;
  margin-bottom: 50px;
}
/* Section titles are uppercase Oswald with no break opportunities, so the
   lower clamp bound has to be small enough to fit a 320px viewport. */
.ni-page .ni-section-head .wp-block-heading {
  font-size: clamp(1.45rem, 5.6vw, 3rem);
  margin: 0;
}
/* The section rule is drawn here rather than as a Separator block, so the
   heading area stays two blocks deep and has nothing that can drift out of
   sync with its saved markup. */
.ni-page .ni-section-head::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  margin: 18px auto 0;
  background: var(--ni-red);
}
.ni-page .ni-section-navy .ni-section-head::after,
.ni-page .ni-section-navy-deep .ni-section-head::after,
.ni-page .ni-section-red .ni-section-head::after {
  background: rgba(247, 243, 234, .6);
}
.ni-page .ni-section-cream     { background: var(--ni-cream); }
.ni-page .ni-section-sand      { background: var(--ni-sand); }
.ni-page .ni-section-navy      { background: var(--ni-navy); color: var(--ni-cream); }
.ni-page .ni-section-navy-deep { background: var(--ni-navy-deep); color: var(--ni-cream); }
.ni-page .ni-section-red       { background: var(--ni-red); color: var(--ni-cream); }

.ni-page .ni-section-navy,
.ni-page .ni-section-navy-deep { position: relative; }
.ni-page .ni-section-navy::before,
.ni-page .ni-section-navy-deep::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--ni-red);
}

.ni-page .ni-kicker {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: .35em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ni-red);
  margin: 0 0 14px;
  line-height: 1.4;
}
.ni-page .ni-section-navy .ni-kicker,
.ni-page .ni-section-navy-deep .ni-kicker,
.ni-page .ni-section-red .ni-kicker { color: var(--ni-gold-soft); }

.ni-page .ni-section-navy .wp-block-heading,
.ni-page .ni-section-navy-deep .wp-block-heading,
.ni-page .ni-section-red .wp-block-heading { color: var(--ni-cream); }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.ni-page .ni-hero {
  border-bottom: 6px solid var(--ni-red);
  position: relative;
  padding: 130px var(--ni-gutter) 120px;
  min-height: 0;
}
.ni-page .ni-hero-inner { position: relative; }
.ni-page .ni-hero-title {
  font-size: clamp(2rem, 8.5vw, 5.2rem);
  color: var(--ni-cream);
  line-height: 1.05;
}
.ni-page .ni-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  z-index: 3;
  background: repeating-linear-gradient(
    90deg,
    var(--ni-red) 0 40px,
    var(--ni-cream) 40px 80px,
    var(--ni-navy) 80px 120px
  );
}
.ni-page .ni-hero-eyebrow {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--ni-gold-soft);
  margin: 0 0 22px;
}
.ni-page .ni-hero .wp-block-heading {
  text-shadow: 0 2px 10px rgba(0, 0, 0, .4);
  margin-bottom: 18px;
}
.ni-page .ni-hero-accent {
  display: block;
  font-size: .55em;
  letter-spacing: .25em;
  margin-top: 10px;
  color: var(--ni-gold-soft);
}
.ni-page .ni-hero-sub {
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--ni-cream);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.45;
}

/* ── Grid primitives ──────────────────────────────────────────────────────── */
/* Core supplies the track definition; these rules only handle alignment and
   the gap fallback, since theme.json sets a global blockGap of 0. */
.ni-page .ni-grid { align-items: stretch; }
/* A grid item's default `min-width: auto` lets wide content (an 800px image,
   a long unbreakable heading) push its track past the viewport. Pinning the
   floor to 0 is what keeps every grid from causing horizontal overflow. */
.ni-page .ni-grid > * {
  margin: 0;
  min-width: 0;
}

/* About: text column wider than the portrait column. */
.ni-page .ni-about-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
  gap: 60px;
}

/* ── About ────────────────────────────────────────────────────────────────── */
.ni-page .ni-about-lead {
  font-size: 1.3rem;
  color: var(--ni-navy);
  font-weight: 600;
  font-style: italic;
  border-left: 4px solid var(--ni-red);
  padding-left: 20px;
  margin: 0 0 28px;
}
.ni-page .ni-about-body { font-size: 1.1rem; margin: 0 0 20px; }
.ni-page .ni-about-body:last-child { margin-bottom: 0; }
.ni-page .ni-about-photo img {
  border: 6px solid var(--ni-cream);
  box-shadow: 0 8px 30px rgba(11, 37, 69, .25);
  width: 100%;
  height: auto;
}

/* ── Profile pages (page-ni-inner) ────────────────────────────────────────── */
/* The page title needs to outrank a section title, so it gets its own scale
   on top of the shared .ni-section-head rule (which supplies the red bar). */
.ni-page .ni-profile-head .wp-block-heading {
  font-size: clamp(2rem, 6vw, 3.6rem);
}
.ni-page .ni-profile-role {
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ni-muted);
  margin: 10px 0 0;
}
.ni-page .ni-section-navy .ni-profile-role,
.ni-page .ni-section-navy-deep .ni-profile-role { color: var(--ni-gold-soft); }

/* Portrait beside copy, alternating sides down the page. */
.ni-page .ni-profile-grid {
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  align-items: center;
  gap: 60px;
}
.ni-page .ni-profile-grid-alt {
  grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
}
.ni-page .ni-profile-photo {
  margin: 0;
  line-height: 0;
}
.ni-page .ni-profile-photo img {
  width: 100%;
  height: auto;
  border: 6px solid #fff;
  box-shadow: 0 10px 34px rgba(11, 37, 69, .28);
}
.ni-page .ni-section-navy .ni-profile-photo img,
.ni-page .ni-section-navy-deep .ni-profile-photo img {
  border-color: rgba(255, 255, 255, .12);
}
/* Cut-out portrait — a PNG with a transparent background. The frame and drop
   shadow above are drawn on the image's box rather than the subject's
   silhouette, so on a cut-out they read as a rectangle hovering behind the
   person. Drop both and let the figure stand directly on the section colour. */
.ni-page .ni-profile-cutout img,
.ni-page .ni-section-navy .ni-profile-cutout img,
.ni-page .ni-section-navy-deep .ni-profile-cutout img {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.ni-page .ni-profile-body {
  font-size: 1.08rem;
  line-height: 1.75;
  margin: 0 0 20px;
}
.ni-page .ni-profile-body:last-child { margin-bottom: 0; }

/* ── Priorities ───────────────────────────────────────────────────────────── */
.ni-page .ni-priority-card {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  padding: 36px 28px;
  text-align: center;
  transition: transform .25s, border-color .25s;
}
.ni-page .ni-priority-card:hover {
  transform: translateY(-4px);
  border-color: var(--ni-red);
}
.ni-page .ni-priority-num {
  font-family: 'Oswald', sans-serif;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: var(--ni-red);
  margin: 0 0 14px;
}
.ni-page .ni-priority-card .wp-block-heading {
  font-size: 1.3rem;
  margin: 0 0 15px;
}
.ni-page .ni-priority-card p:last-child {
  color: #d5dce6;
  font-size: 1rem;
  margin: 0;
}

/* ── Endorsements ─────────────────────────────────────────────────────────── */
.ni-page .ni-endorse-heading {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ni-navy);
  border-bottom: 2px solid var(--ni-navy);
  padding-bottom: .4rem;
  margin: 0 0 1.25rem;
}
.ni-page .ni-endorse-group + .ni-endorse-group { margin-top: 2.5rem; }
.ni-page .ni-endorse-card {
  padding: .85rem 0 .85rem 1.6rem;
  border-bottom: 1px dashed #c8c0b0;
  position: relative;
}
.ni-page .ni-endorse-card::before {
  content: "\2605";
  position: absolute;
  left: 0;
  top: .9rem;
  color: var(--ni-red);
  font-size: .95rem;
  line-height: 1;
}
.ni-page .ni-endorse-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ni-navy);
  margin: 0;
}
.ni-page .ni-endorse-role {
  font-size: .82rem;
  font-style: italic;
  color: #555;
  margin: .1rem 0 0;
}

/* ── Photos ───────────────────────────────────────────────────────────────── */
/* The editor's "Columns" setting on a Grid block emits a fixed
   `repeat(N, minmax(0,1fr))` that applies at every width — it never collapses,
   so on a phone the cards squash to ~70px instead of wrapping. That squashing
   produces no horizontal overflow, which is why it slips past the usual checks.
   These breakpoints step the count down regardless of what N the editor sets.
   Specificity 0,2,0 beats core's generated 0,1,0 container rule. */
@media (max-width: 1024px) {
  .ni-page .ni-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 782px) {
  .ni-page .ni-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .ni-page .ni-photo-grid { grid-template-columns: minmax(0, 1fr); }
}
.ni-page .ni-photo-card {
  background: #10294b;
  border: 1px solid rgba(255, 255, 255, .08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ni-page .ni-photo-card-highlight { border: 2px solid var(--ni-red); }
/* The figure and the portrait link both have to be full-width blocks, or the
   `width: 100%` below has nothing to resolve against. Core leaves the <a>
   inline, so a percentage width falls back to the image's intrinsic size —
   portraits wider than the card still filled it via `max-width: 100%`, but a
   small source (some are only 200px wide) sat short of the edges with the card
   background showing through. Sizing the link fixes it at any source size. */
.ni-page .ni-photo-card figure {
  margin: 0;
  display: block;
  width: 100%;
}
.ni-page .ni-photo-card figure a {
  display: block;
  width: 100%;
}
/* Cards whose portrait links to a candidate profile. The hover zoom alone reads
   as decoration rather than as a link, so give the linked ones a border that
   lights up and a caption arrow that slides in. Keyed off :has() so the CSS
   follows the markup — link a card and it picks this up with no class to add. */
.ni-page .ni-photo-card:has(figure a) {
  transition: border-color .25s;
}
.ni-page .ni-photo-card:has(figure a):hover,
.ni-page .ni-photo-card:has(figure a):focus-within {
  border-color: var(--ni-gold);
}
.ni-page .ni-photo-card:has(figure a) .ni-photo-caption::after {
  content: ' \2192';
  color: var(--ni-gold-soft);
  opacity: 0;
  transition: opacity .25s;
}
.ni-page .ni-photo-card:has(figure a):hover .ni-photo-caption::after,
.ni-page .ni-photo-card:has(figure a):focus-within .ni-photo-caption::after {
  opacity: 1;
}
/* Keyboard focus has to stay visible — the portrait is the link. */
.ni-page .ni-photo-card figure a:focus-visible {
  outline: 3px solid var(--ni-gold);
  outline-offset: -3px;
}
.ni-page .ni-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.ni-page .ni-photo-card:hover img { transform: scale(1.03); }
.ni-page .ni-photo-caption {
  padding: 14px 18px 18px;
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ni-cream);
  margin: 0;
  margin-top: auto;
}
.ni-page .ni-photo-caption-sub {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  color: var(--ni-gold-soft);
  font-size: 12px;
  line-height: 1.4;
  padding: 0 18px 18px;
  margin: -12px 0 0;
}

/* ── Subscribe ────────────────────────────────────────────────────────────── */
.ni-page .ni-subscribe-intro {
  font-size: 1.1rem;
  max-width: 640px;
  margin: 0 auto 28px;
}
.ni-page .ni-subscribe-form {
  max-width: 560px;
  margin: 0 auto;
}
.ni-page .ni-form-note {
  font-size: .85rem;
  font-style: italic;
  margin: 18px 0 0;
  opacity: .85;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .ni-page .ni-about-grid,
  .ni-page .ni-profile-grid,
  .ni-page .ni-profile-grid-alt {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }
  /* portrait first reads better once stacked */
  .ni-page .ni-about-grid > .ni-about-photo { order: -1; }
  .ni-page .ni-profile-grid-alt > .ni-profile-photo { order: -1; }
  /* a full-bleed portrait is overpowering on a phone — rein it in */
  .ni-page .ni-profile-photo {
    max-width: 340px;
    margin-inline: auto;
  }
}

@media (max-width: 782px) {
  .ni-page .ni-section { padding: 60px 20px; }
  .ni-page .ni-section-head { margin-bottom: 36px; }
  .ni-page .ni-hero { padding: 80px 20px 76px; }
  /* the hero accent is a single unbroken uppercase line with no break
     opportunities — tighten its tracking so it fits a phone */
  .ni-page .ni-hero-accent {
    font-size: .5em;
    letter-spacing: .16em;
  }
}

@media (max-width: 480px) {
  .ni-page .ni-priority-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .ni-page .ni-priority-card,
  .ni-page .ni-photo-card img,
  .ni-page .ni-photo-card:has(figure a),
  .ni-page .ni-photo-card:has(figure a) .ni-photo-caption::after { transition: none; }
  .ni-page .ni-priority-card:hover { transform: none; }
  .ni-page .ni-photo-card:hover img { transform: none; }
}
