/* TN Explorer — shared site chrome.
 *
 * Single source of truth for header, footer, brand-mark, primary nav,
 * cookie banner, share bar, and house-ad styles. Loaded by every page in
 * the elections section AFTER any inline <style> blocks so it overrides
 * any legacy duplicated rules cleanly.
 *
 * Edit here once → applies to all 236 pages on next visitor load.
 * Cache-busted via ?v=N query param when content changes.
 */

/* === HEADER ============================================================ */
.site-head {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper, #faf6ee);
  border-bottom: 1px solid var(--line, #c9b893);
  font-family: var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}
.site-head .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}
.head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
  width: 100%;
}

.brand-block {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: inherit;
}
.brand-block:hover { text-decoration: none; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-name {
  font-family: var(--serif, Georgia, serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--ink-strong, #1a1410);
}
.brand-tagline {
  font-family: var(--serif, Georgia, serif);
  font-style: italic;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted, #6b5f4d);
  margin-top: 2px;
  letter-spacing: 0.1px;
}

.primary-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.primary-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft, #4a4036);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.primary-nav a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink-strong, #1a1410);
}
.primary-nav a.active {
  background: var(--leaf-soft, #d4e1d4);
  color: var(--leaf-dark, #1f3520);
  font-weight: 600;
}
.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--line, #c9b893);
  margin: 0 4px;
}
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--muted, #6b5f4d);
  transition: background .15s ease, color .15s ease;
}
.social-icon:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink-strong, #1a1410);
}

/* Search button + dropdown */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted, #6b5f4d);
  transition: background .15s ease, color .15s ease;
}
.nav-search-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink-strong, #1a1410);
}
.nav-search-panel {
  position: absolute;
  top: 60px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--line, #c9b893);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 12px;
  display: none;
  z-index: 200;
}
.nav-search-panel[data-open="true"] { display: block; }
.nav-search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--line, #c9b893);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.nav-search-input:focus {
  border-color: var(--accent, #c9531e);
  box-shadow: 0 0 0 3px rgba(201, 83, 30, 0.12);
}
.nav-search-results {
  margin-top: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.nav-search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink-strong, #1a1410);
  font-size: 14px;
  transition: background .12s ease;
}
.nav-search-results a:hover,
.nav-search-results a.is-active {
  background: var(--paper-soft, #f3ebd9);
  text-decoration: none;
}
.nav-search-result-meta {
  font-size: 12px;
  color: var(--muted, #6b5f4d);
  margin-left: 8px;
}
.nav-search-pp {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 4px;
  background: var(--paper-soft, #f3ebd9);
  color: var(--ink-soft, #4a4036);
  text-transform: uppercase;
  vertical-align: 2px;
}
.nav-search-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--muted, #6b5f4d);
  text-align: center;
}
@media (max-width: 600px) {
  .nav-search-panel {
    right: 8px;
    left: 8px;
    width: auto;
  }
}

/* === FOOTER ============================================================ */
.site-foot {
  background: var(--leaf-dark, #1f3520);
  color: #f4ecd8;
  padding: 32px 0 28px;
  font-family: var(--sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}
.foot-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 720px) {
  .foot-grid { grid-template-columns: 1.3fr 1fr; gap: 40px; }
}
.foot-brand-col .brand-block.dark .brand-name { color: #fff; }
.foot-brand-col .brand-block.dark .brand-tagline {
  display: block;
  color: #c2cbe3;
  font-size: 12px;
}
.foot-brand-col .brand-block.dark .brand-mark {
  /* Logo image fills the circle; subtle white ring on dark bg, no fill. */
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.foot-meta {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(244, 236, 216, 0.82);
}
.foot-views {
  margin-top: 10px;
  font-size: 13px;
  color: rgba(254, 245, 227, 0.72);
  letter-spacing: 0.2px;
}
.foot-views strong {
  color: #ffd9a8;
  font-weight: 700;
  font-feature-settings: "tnum";
}
.foot-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.foot-nav-h {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(244, 236, 216, 0.55);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.foot-nav a {
  color: #e8edd2;
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
}
.foot-nav a:hover {
  color: #fff;
  text-decoration: underline;
}

/* === COOKIE CONSENT ==================================================== */
/* Anchored bottom-left so it never overlays the hero's "Live updates"
   timestamp (which sits bottom-right) or the floating share/back-to-top
   buttons (also bottom-right). Mobile keeps it left-anchored at narrow
   width — users dismiss quickly. */
.cookie-banner {
  position: fixed;
  bottom: 16px;
  left: 16px;
  max-width: 360px;
  background: var(--ink-strong, #1a1410);
  color: #faf6ee;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  z-index: 1000;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.45;
  transform: translateY(120%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
@media (max-width: 480px) {
  .cookie-banner {
    /* Phones: stretch a bit, but leave gutter for FABs at bottom-right */
    right: 76px;
    max-width: none;
  }
}
.cookie-banner[data-show="true"] { transform: translateY(0); }
.cookie-banner p { margin: 0 0 12px; }
.cookie-banner a { color: #ffd9a8; text-decoration: underline; }
.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cookie-banner button {
  flex: 1 1 auto;
  padding: 8px 14px;
  border-radius: 6px;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease;
}
.cookie-banner-accept {
  background: var(--accent, #c9531e);
  color: #fff;
}
.cookie-banner-decline {
  background: transparent;
  color: #faf6ee;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.cookie-banner button:hover { opacity: 0.88; }

/* === HOUSE-AD CROSS-PROMO (in lieu of AdSense) ========================= */
.house-ad {
  margin: 24px 0;
  padding: 18px 22px;
  background: linear-gradient(135deg, var(--paper-soft, #f3ebd9) 0%, var(--paper, #faf6ee) 100%);
  border: 1px solid var(--line, #c9b893);
  border-radius: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  font-family: var(--sans, system-ui, sans-serif);
  text-decoration: none;
  color: inherit;
  transition: all .25s ease;
}
.house-ad:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(80, 50, 20, 0.12);
  text-decoration: none;
}
.house-ad-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--leaf-dark, #1f3520);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.house-ad-icon svg { width: 22px; height: 22px; color: #faf6ee; }
.house-ad-text { display: flex; flex-direction: column; gap: 2px; }
.house-ad-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent, #c9531e);
}
.house-ad-headline {
  font-family: var(--serif, Georgia, serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-strong, #1a1410);
  line-height: 1.25;
}
.house-ad-sub {
  font-size: 12.5px;
  color: var(--muted, #6b5f4d);
}
.house-ad-cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #c9531e);
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .house-ad { grid-template-columns: auto 1fr; }
  .house-ad-cta { grid-column: 1 / -1; text-align: right; }
}

/* === MOBILE TUNING ===================================================== */
@media (max-width: 720px) {
  .site-head .container,
  .head-row { height: 50px; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 15px; }
  .primary-nav { gap: 0; flex-wrap: nowrap; align-items: center; }
  .primary-nav a { font-size: 12.5px; padding: 5px 8px; }
  .nav-divider { display: none; }
  .nav-search-btn { padding: 6px; flex-shrink: 0; }
  /* Hide social icons on all phones + phablets — they live in the footer.
     Search is the only icon kept in the header on narrow screens. */
  .primary-nav .social-icon { display: none !important; }
}
@media (max-width: 600px) {
  /* Phones: drop social icons + the "All 234 " prefix from nav labels.
     Social icons live in the footer; abbreviating to "Seats / MLAs / Orders"
     keeps Elections + 3 nav links + search comfortably on one row. */
  .primary-nav .social-icon { display: none; }
  .primary-nav .nav-prefix { display: none; }
  .primary-nav a { font-size: 11.5px; padding: 4px 6px; letter-spacing: 0; }
  .primary-nav a.active { padding: 4px 8px; }
  .brand-text { white-space: nowrap; }
  .brand-name { font-size: 14px; }
  /* Search button stays compact, right-aligned */
  .nav-search-btn { margin-left: 2px; padding: 5px; }
  .nav-search-btn svg { width: 16px; height: 16px; }
}
@media (max-width: 420px) {
  /* iPhone-width: tighten further so search stays on the same row.
     Brand text shrinks; nav items lose more padding. */
  .brand-name { font-size: 13px; }
  .brand-mark { width: 28px; height: 28px; }
  .head-row { gap: 4px; }
  .primary-nav a { font-size: 11px; padding: 4px 5px; }
  .primary-nav a.active { padding: 4px 7px; }
}
@media (max-width: 360px) {
  /* Very narrow phones (iPhone SE etc): drop brand text — logo alone
     still signals the brand. Saves ~85px so all 4 nav items + search fit. */
  .brand-text { display: none; }
}
