/* ============================================================
   Search · Privacy · Ask NICF assistant
   ============================================================ */

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header search trigger ---------- */

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--green-deep);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.search-trigger:hover {
  background: #fff;
  border-color: rgba(21, 33, 26, 0.24);
  color: var(--tulip);
}
.search-trigger:focus-visible { outline: 2px solid var(--tulip); outline-offset: 3px; }
.search-trigger svg { flex: none; }

@media (max-width: 1280px) {
  .search-trigger { padding: 0 11px; }
  .search-trigger-label { display: none; }
}
@media (max-width: 820px) {
  .header-portal { display: none; }
}

/* ---------- Hero search bar ---------- */

.hero-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 26px 0 18px;
  max-width: 430px;
  padding: 6px 6px 6px 15px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(21, 33, 26, 0.16);
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.hero-search:focus-within {
  background: #fff;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(29, 90, 59, 0.1);
}
.hero-search-icon { color: var(--green-mid); flex: none; }
.hero-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 8px 0;
}
.hero-search input::placeholder { color: #6f7b73; }
.hero-search input:focus { outline: none; }
.hero-search button {
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.hero-search button:hover { background: var(--green-deep); }

/* ---------- Search overlay ---------- */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 8vh 20px 20px;
}
.search-scrim {
  position: absolute;
  inset: 0;
  background: rgba(18, 60, 39, 0.55);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.18s ease;
}
.search-dialog {
  position: relative;
  width: 100%;
  max-width: 700px;
  background: var(--paper);
  border-radius: 18px;
  box-shadow: 0 40px 90px -40px rgba(18, 60, 39, 0.7);
  padding: 14px 14px 6px;
  animation: searchIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes searchIn { from { opacity: 0; transform: translateY(-8px); } }

.search-field {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 4px 10px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--green-mid);
}
.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  padding: 10px 0;
}
.search-field input:focus { outline: none; }
.search-field input::-webkit-search-cancel-button { cursor: pointer; }
.search-close {
  flex: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 9px;
  border-radius: 7px;
  cursor: pointer;
}
.search-close:hover { color: var(--ink); border-color: rgba(21, 33, 26, 0.3); }

.search-suggest {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 6px 4px;
  font-size: 0.76rem;
  color: var(--muted);
}
.search-suggest span { letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; font-size: 0.66rem; }
.search-suggest button {
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--green-deep);
  font: inherit;
  font-size: 0.78rem;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.search-suggest button:hover { background: var(--green-soft); border-color: rgba(29, 90, 59, 0.3); }

.search-count {
  margin: 10px 8px 4px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  min-height: 1em;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
  max-height: 52vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.search-results li { border-radius: 11px; }
.search-results a {
  display: block;
  padding: 11px 12px;
  border-radius: 11px;
  color: var(--ink);
  border: 1px solid transparent;
}
.search-results a:hover,
.search-results li.is-active a {
  background: var(--cream);
  border-color: rgba(21, 33, 26, 0.09);
  color: var(--ink);
}
.sr-group {
  display: block;
  font-size: 0.63rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--green-mid);
  font-weight: 700;
  margin-bottom: 3px;
}
.sr-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--green-deep);
}
.sr-snippet {
  display: block;
  margin-top: 3px;
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--muted);
}
.sr-arrow { float: right; color: var(--muted); font-size: 0.8rem; margin-left: 8px; }
.search-results mark,
.sr-title mark {
  background: rgba(196, 16, 92, 0.14);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}
.search-empty {
  padding: 18px 12px 22px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
}
.search-empty strong { color: var(--green-deep); }
.search-empty a { text-decoration: underline; text-underline-offset: 3px; }

.search-hint {
  margin: 0;
  padding: 9px 8px 8px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
}
.search-hint kbd {
  font-family: inherit;
  font-size: 0.68rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 4px;
  background: #fff;
}

.is-flash { animation: flashTarget 1.8s ease; }
@keyframes flashTarget {
  0%, 100% { background-color: transparent; }
  15% { background-color: rgba(196, 16, 92, 0.09); }
  60% { background-color: rgba(196, 16, 92, 0.05); }
}

/* ---------- Privacy section ---------- */

.privacy { background: var(--paper); border-top: 1px solid var(--line); }
.privacy-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(28px, 5vw, 70px);
  align-items: start;
}
.privacy-body h3 {
  font-size: 1.02rem;
  font-family: var(--font-body);
  letter-spacing: 0;
  font-weight: 700;
  color: var(--green-deep);
  margin: 0 0 4px;
}
.privacy-body p { font-size: 0.94rem; color: var(--muted); margin-bottom: 16px; }
.privacy-body a { text-decoration: underline; text-underline-offset: 3px; }
.privacy-note {
  font-size: 0.76rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a938d !important;
  margin: 0;
}

/* ---------- Ask NICF launcher ---------- */

.assistant-launcher {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px 11px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--green-deep);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 16px 34px -16px rgba(18, 60, 39, 0.85);
  transition: transform 0.2s ease, background 0.2s ease;
}
.assistant-launcher:hover { background: var(--green); transform: translateY(-2px); }
.assistant-launcher:focus-visible { outline: 2px solid var(--tulip); outline-offset: 3px; }
.assistant-launcher img { filter: brightness(0) invert(1); opacity: 0.95; }
.assistant-launcher[aria-expanded="true"] { opacity: 0; pointer-events: none; }
.assistant-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ee0a2;
  box-shadow: 0 0 0 3px rgba(126, 224, 162, 0.25);
}

/* ---------- Ask NICF panel ---------- */

.assistant {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 130;
  width: min(390px, calc(100vw - 44px));
  max-height: min(640px, calc(100vh - 44px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid rgba(21, 33, 26, 0.1);
  border-radius: 20px;
  box-shadow: 0 40px 80px -34px rgba(18, 60, 39, 0.6);
  overflow: hidden;
  animation: assistantIn 0.24s ease;
}
@keyframes assistantIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

.assistant-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 16px;
  background: linear-gradient(135deg, var(--green-deep), var(--green));
  color: #fff;
  flex: none;
}
.assistant-head img { filter: brightness(0) invert(1); opacity: 0.92; flex: none; }
.assistant-head > div { flex: 1 1 auto; min-width: 0; }
.assistant-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.2;
  color: #fff;
}
.assistant-sub {
  margin: 2px 0 0;
  font-size: 0.71rem;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 6px;
}
.assistant-online {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7ee0a2;
  flex: none;
}
.assistant-close {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  cursor: pointer;
}
.assistant-close:hover { background: rgba(255, 255, 255, 0.24); }
.assistant-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.assistant-log {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 15px 8px;
  background: #fbf8f1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 190px;
}

.msg {
  max-width: 88%;
  padding: 11px 14px;
  border-radius: 15px;
  font-size: 0.88rem;
  line-height: 1.55;
  animation: msgIn 0.22s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.msg p { margin: 0 0 8px; }
.msg p:last-child { margin-bottom: 0; }
.msg--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(21, 33, 26, 0.09);
  color: var(--ink);
  border-bottom-left-radius: 5px;
}
.msg--user {
  align-self: flex-end;
  background: var(--green);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg--user a { color: #fff; }
.msg--bot strong { color: var(--green-deep); }
.msg--bot a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.msg--bot a:hover { color: var(--tulip); }

.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 2px 0 8px;
}
.chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--green);
  color: #fff !important;
  font-size: 0.79rem;
  font-weight: 600;
  text-decoration: none !important;
}
.chat-btn:hover { background: var(--green-deep); }
.chat-btn--ghost {
  background: #fff;
  color: var(--green-deep) !important;
  border: 1px solid rgba(29, 90, 59, 0.3);
}
.chat-btn--ghost:hover { background: var(--green-soft); }

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.chat-chip {
  border: 1px solid rgba(29, 90, 59, 0.24);
  background: #fff;
  color: var(--green-deep);
  font: inherit;
  font-size: 0.77rem;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chat-chip:hover { background: var(--green-soft); border-color: var(--green); }

.msg--typing {
  display: flex;
  gap: 4px;
  padding: 14px 16px;
  align-items: center;
}
.msg--typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa79f;
  animation: dotPulse 1s infinite ease-in-out;
}
.msg--typing i:nth-child(2) { animation-delay: 0.15s; }
.msg--typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotPulse {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.assistant-form {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border-top: 1px solid var(--line);
  background: #fff;
}
.assistant-form input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 15px;
  font: inherit;
  font-size: 0.88rem;
  color: var(--ink);
  background: var(--cream);
}
.assistant-form input:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(29, 90, 59, 0.1);
}
.assistant-form button {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.assistant-form button:hover { background: var(--green-deep); }

.assistant-note {
  flex: none;
  margin: 0;
  padding: 0 14px 10px;
  font-size: 0.68rem;
  line-height: 1.5;
  color: #7d8880;
  background: #fff;
}
.assistant-note a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .privacy-grid { grid-template-columns: 1fr; gap: 22px; }
}

@media (max-width: 640px) {
  .hero-search { max-width: none; }
  .search-overlay { padding: 0; align-items: stretch; }
  .search-dialog {
    border-radius: 0;
    max-width: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 12px 12px 0;
  }
  .search-results { max-height: none; flex: 1 1 auto; }
  .search-hint { display: none; }
  .assistant {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    height: 88vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .assistant-launcher { left: 14px; bottom: 14px; padding: 10px 15px 10px 12px; font-size: 0.82rem; }
  .assistant-log { min-height: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .search-dialog, .search-scrim, .assistant, .msg { animation: none !important; }
  .is-flash { animation: none; box-shadow: inset 0 0 0 3px rgba(196, 16, 92, 0.25); }
  .msg--typing i { animation: none; opacity: 0.6; }
}

/* ---------- County cards on the home page ---------- */

a.county { color: inherit; }
a.county:hover { color: inherit; }

.county-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 18px;
  filter: saturate(1.02);
  transition: transform 0.35s ease;
}
a.county:hover .county-thumb { transform: scale(1.015); }

.county-link {
  margin-top: auto;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
a.county:hover .county-link { color: var(--tulip); }
