/* Date + keyword filter. Uses the theme's own tokens (see :root in style.css). */

.vpf-inline-trigger svg,
.vpf svg,
.vpf-chip svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Triggers ---------- */

.vpf-inline-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: var(--radius-sm, 6px);
  background: #fff;
  color: var(--color-heading, #0a4b95);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.vpf-inline-trigger:hover,
.vpf-inline-trigger[aria-expanded="true"] {
  background: #eef4fb;
  border-color: #b9cde6;
}

.section-heading:has(> .vpf-inline-trigger) {
  flex-wrap: wrap;
}

/* Front page: sits at the right end of the purple "Latest News" bar. */
.home-latest-heading .vpf-inline-trigger {
  margin: 0 0 0.35rem;
}

.vpf-inline-trigger:focus-visible,
.vpf button:focus-visible,
.vpf select:focus-visible,
.vpf input:focus-visible,
.vpf-link:focus-visible,
.vpf-chip-x:focus-visible {
  outline: 2px solid var(--color-brand-blue, #0f82cb);
  outline-offset: 2px;
}

/* ---------- Panel ---------- */

.vpf-overlay {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(10, 25, 50, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.vpf-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

html.vpf-lock {
  overflow: hidden;
}

.vpf {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: min(740px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: hidden;
  background: #fff;
  border: 1px solid #d8e1ef;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(11, 26, 77, 0.18);
  color: var(--color-text, #1d2f43);
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.985);
  transform-origin: top right;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.vpf.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.vpf-form {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.vpf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem 0.5rem;
}

.vpf-head h2 {
  margin: 0;
  color: var(--color-heading, #0a4b95);
  font-family: "Inter", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
}

.vpf-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-muted, #657285);
  cursor: pointer;
}

.vpf-close:hover {
  background: #e8ecf3;
  color: #0b1a4d;
}

.vpf-scope {
  margin: 0;
  padding: 0 1.1rem 0.6rem;
  color: var(--color-muted, #657285);
  font-size: 0.8rem;
}

.vpf-scope strong {
  color: var(--color-text, #1d2f43);
}

.vpf-link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-brand-blue, #0f82cb);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.vpf-body {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 1.4rem;
  flex: 1;
  min-height: 0;
  padding: 0.2rem 1.1rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.vpf-sec[hidden] {
  display: none;
}

.vpf-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--color-muted, #657285);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.vpf-sublabel {
  display: block;
  margin: 0.9rem 0 0.4rem;
  color: var(--color-muted, #657285);
  font-size: 0.74rem;
}

/* ---------- Keyword ---------- */

.vpf-field {
  position: relative;
}

.vpf-input {
  position: relative;
}

.vpf-input svg {
  position: absolute;
  top: 50%;
  left: 0.65rem;
  width: 17px;
  height: 17px;
  color: var(--color-muted, #657285);
  transform: translateY(-50%);
  pointer-events: none;
}

.vpf-input input {
  width: 100%;
  padding: 0.62rem 0.75rem 0.62rem 2.15rem;
  border: 1px solid #cfd8e8;
  border-radius: 8px;
  background: #fff;
  color: #1f3047;
  font: inherit;
  font-size: 0.88rem;
}

.vpf-input input::placeholder {
  color: #8c98aa;
}

.vpf-input input:focus {
  border-color: var(--color-brand-blue, #0f82cb);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 130, 203, 0.18);
}

.vpf-suggest {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 5;
  max-height: 260px;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  list-style: none;
  background: #fff;
  border: 1px solid #d8e1ef;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(11, 26, 77, 0.14);
}

.vpf-suggest[hidden] {
  display: none;
}

.vpf-opt {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

.vpf-opt.is-active,
.vpf-opt:hover {
  background: #eef4fb;
}

.vpf-opt-label {
  font-weight: 600;
}

.vpf-opt-kind {
  flex: none;
  color: var(--color-muted, #657285);
  font-size: 0.72rem;
}

.vpf-popular[hidden] {
  display: none;
}

.vpf-popular-list,
.vpf-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.vpf-pop,
.vpf-preset {
  padding: 0.28rem 0.7rem;
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 999px;
  background: #f6f9fd;
  color: var(--color-heading, #0a4b95);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.vpf-pop:hover,
.vpf-preset:hover {
  background: #e8f1fb;
}

.vpf-pop.is-active,
.vpf-preset.is-active {
  background: var(--color-heading, #0a4b95);
  border-color: var(--color-heading, #0a4b95);
  color: #fff;
}

/* ---------- Calendar ---------- */

.vpf-presets {
  margin-bottom: 0.75rem;
}

.vpf-cal-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.vpf-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 8px;
  background: #fff;
  color: var(--color-heading, #0a4b95);
  cursor: pointer;
}

.vpf-nav:hover:not(:disabled) {
  background: #eef4fb;
}

.vpf-nav:disabled {
  color: #b6c0cd;
  cursor: not-allowed;
}

.vpf-select {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 8px;
  background: #fff;
  color: var(--color-text, #1d2f43);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
}

.vpf-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.vpf-grid th {
  padding: 0.25rem 0;
  color: var(--color-muted, #657285);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.vpf-grid td {
  padding: 1px 0;
  text-align: center;
}

.vpf-day {
  position: relative;
  width: 100%;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text, #1d2f43);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}

.vpf-day:hover:not(:disabled):not(.is-start):not(.is-end) {
  background: #e8f1fb;
}

.vpf-day:disabled {
  color: #b6c0cd;
  cursor: not-allowed;
}

.vpf-day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--color-brand-blue, #0f82cb);
  font-weight: 700;
}

.vpf-day.has-posts {
  font-weight: 600;
}

.vpf-day.has-posts::after,
.vpf-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent, #1da64a);
}

.vpf-day.has-posts::after {
  position: absolute;
  bottom: 4px;
  left: 50%;
  content: "";
  transform: translateX(-50%);
}

.vpf-day.in-range {
  border-radius: 0;
  background: #e3effa;
}

.vpf-day.is-start,
.vpf-day.is-end {
  background: var(--color-heading, #0a4b95);
  color: #fff;
  font-weight: 700;
}

.vpf-day.is-start {
  border-radius: 8px 0 0 8px;
}

.vpf-day.is-end {
  border-radius: 0 8px 8px 0;
}

.vpf-day.is-start.is-end {
  border-radius: 8px;
}

.vpf-day.is-start.has-posts::after,
.vpf-day.is-end.has-posts::after {
  background: #fff;
}

.vpf-day:focus-visible {
  position: relative;
  z-index: 1;
}

.vpf-legend {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
  color: var(--color-muted, #657285);
  font-size: 0.74rem;
}

.vpf-dot {
  display: inline-block;
}

.vpf-range {
  margin: 0.35rem 0 0;
  color: var(--color-text, #1d2f43);
  font-size: 0.82rem;
  font-weight: 600;
}

.vpf-state {
  padding: 1.5rem 0.5rem;
  color: var(--color-muted, #657285);
  text-align: center;
}

.vpf-state p {
  margin: 0 0 0.6rem;
}

.vpf-retry {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-border, #d6dfe7);
  border-radius: 8px;
  background: #fff;
  color: var(--color-heading, #0a4b95);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Footer ---------- */

.vpf-foot {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid #e2ebf2;
  background: #fbfcfe;
}

.vpf-count {
  flex: 1;
  margin: 0;
  color: var(--color-text, #1d2f43);
  font-size: 0.86rem;
  font-weight: 600;
}

.vpf-count.is-empty {
  color: #a35b00;
}

.vpf-reset {
  padding: 0.5rem 0.4rem;
  border: 0;
  background: none;
  color: var(--color-muted, #657285);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.vpf-reset:hover {
  color: var(--color-heading, #0a4b95);
}

.vpf-apply {
  padding: 0.58rem 1.05rem;
  border: 0;
  border-radius: 8px;
  background: var(--color-heading, #0a4b95);
  color: #fff;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.vpf-apply:hover,
.vpf-apply:focus-visible {
  background: #08396f;
}

/* ---------- Result bar under the heading ---------- */

.vpf-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin: -0.25rem 0 1.1rem;
  padding: 0.6rem 0.85rem;
  background: var(--color-surface, #f3f7fb);
  border: 1px solid #e2ebf2;
  border-radius: 10px;
}

.vpf-status-count {
  margin: 0;
  color: var(--color-text, #1d2f43);
  font-size: 0.88rem;
}

.vpf-status-count strong {
  color: var(--color-heading, #0a4b95);
}

.vpf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.vpf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.2rem 0.3rem 0.2rem 0.6rem;
  background: #fff;
  border: 1px solid #cfdbea;
  border-radius: 999px;
  color: var(--color-heading, #0a4b95);
  font-size: 0.8rem;
  font-weight: 600;
}

.vpf-chip > svg {
  width: 14px;
  height: 14px;
}

.vpf-chip-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vpf-chip-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--color-muted, #657285);
}

.vpf-chip-x svg {
  width: 13px;
  height: 13px;
}

.vpf-chip-x:hover {
  background: #e8ecf3;
  color: #0b1a4d;
}

.vpf-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-brand-blue, #0f82cb);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.vpf-status .vpf-link:first-of-type {
  margin-left: auto;
}

/* ---------- Phones: bottom sheet ---------- */

@media (max-width: 720px) {
  .vpf {
    top: auto !important;
    right: 0;
    bottom: 0;
    left: 0 !important;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 16px 16px 0 0;
    transform: translateY(28px);
    transform-origin: bottom center;
  }

  .vpf.is-open {
    transform: none;
  }

  .vpf-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.1rem;
  }

  .vpf-day {
    height: 42px;
  }

  .vpf-foot {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .vpf-presets {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
  }

  .vpf-preset {
    flex: none;
  }
}

@media (max-width: 640px) {
  .vpf-status .vpf-link:first-of-type {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vpf,
  .vpf-overlay,
  .vpf-inline-trigger,
  .vpf-pop,
  .vpf-preset {
    transition: none;
  }
}
