/* ============================================================================
   Voyager — Flatpickr theme (dark navy + gold), matching the site palette.
   Loaded on every page with a date input via partials/datepicker_assets.php.
   Overrides flatpickr's default light theme so all calendars look consistent.
   ============================================================================ */

.flatpickr-calendar {
  background: rgb(var(--c-neutral-900));                 /* slate-900 */
  border: 1px solid rgb(var(--c-neutral-800));           /* slate-800 */
  border-radius: calc(14px * var(--radius-k, 1));
  box-shadow: 0 20px 45px -12px rgba(0, 0, 0, .65), 0 0 0 1px rgb(var(--c-primary-500) / .08);
  color: rgb(var(--c-neutral-200));
  overflow: hidden;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowBottom::before { display: none; }
.flatpickr-calendar.arrowTop::after    { border-bottom-color: rgb(var(--c-neutral-900)); }
.flatpickr-calendar.arrowBottom::after { border-top-color: rgb(var(--c-neutral-900)); }

/* Header (month/year + arrows) */
.flatpickr-months {
  background: linear-gradient(180deg, #111a2e 0%, rgb(var(--c-neutral-900)) 100%);
  padding: 6px 0 4px;
  border-bottom: 1px solid rgb(var(--c-neutral-800));
}
.flatpickr-months .flatpickr-month { color: rgb(var(--c-neutral-50)); fill: rgb(var(--c-neutral-50)); }
.flatpickr-current-month { padding-top: 4px; font-size: 1rem; display: flex; align-items: center; justify-content: center; gap: 6px; }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month select.vy-year,
.flatpickr-current-month input.cur-year { color: rgb(var(--c-neutral-50)); font-weight: 600; }

/* The month picker reads as a control, not as plain text. */
.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: calc(8px * var(--radius-k, 1));
  padding: 3px 26px 3px 10px;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center; background-size: 14px;
  transition: background-color .15s, border-color .15s;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover { background-color: rgb(var(--c-primary-500) / .14); border-color: rgb(var(--c-primary-500) / .35); }
.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month { background: rgb(var(--c-neutral-900)); color: rgb(var(--c-neutral-200)); }

/* The year is a dropdown too (2026-10-03, assets/js/flatpickr-guard.js yearSelect): the years this
   calendar allows, one click away. It replaces Flatpickr's number box, which read as a label, so
   reaching a birth year meant walking back a month at a time. Same look as the month picker. */
.flatpickr-current-month select.vy-year {
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; line-height: inherit;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: calc(8px * var(--radius-k, 1));
  padding: 3px 24px 3px 10px; margin: 0; height: auto; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center; background-size: 14px;
  transition: background-color .15s, border-color .15s;
}
.flatpickr-current-month select.vy-year:hover { background-color: rgb(var(--c-primary-500) / .14); border-color: rgb(var(--c-primary-500) / .35); }
.flatpickr-current-month select.vy-year:focus-visible { outline: 2px solid rgb(var(--c-primary-500)); outline-offset: 1px; }
.flatpickr-current-month select.vy-year option { background: rgb(var(--c-neutral-900)); color: rgb(var(--c-neutral-200)); }
/* The number box it replaces stays for Flatpickr to read and write, out of sight. */
.flatpickr-current-month .numInputWrapper.vy-year-replaced { display: none; }

/* The year box was CLIPPING — "202" instead of "2026".
   Flatpickr sizes .numInputWrapper from the default font weight; at 600 the
   digits are wider than the box it reserves. Give it a real width and stop the
   stepper arrows from eating into the text. */
.flatpickr-current-month .numInputWrapper {
  width: auto;               /* wraps the year input, which is sized below */
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: calc(8px * var(--radius-k, 1));
  padding: 3px 2px;
  transition: background-color .15s, border-color .15s;
}
.flatpickr-current-month .numInputWrapper:hover { background: rgb(var(--c-primary-500) / .14); border-color: rgb(var(--c-primary-500) / .35); }
/* The year is sized from its OWN digits: 4 tabular figures in the input's own
   font (weight 600) plus its 2px + 2px padding and a little slack. The box used
   to be 4.85ch on the WRAPPER, whose "0" is the regular weight — so the bold
   year measured 45px in a 40px box and read "202" on every calendar that uses
   this theme. The home and search pages hid it behind a second theme in
   landing.css (removed 2026-09-25), which had fixed the same arithmetic there. */
.flatpickr-current-month input.cur-year { width: calc(4ch + 10px); padding: 0 2px; text-align: center; font-variant-numeric: tabular-nums; }
/* Chrome/Safari add their own spinner on top of flatpickr's. */
.flatpickr-current-month input.cur-year::-webkit-outer-spin-button,
.flatpickr-current-month input.cur-year::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.numInputWrapper span { border: none; }
.numInputWrapper span:hover { background: rgb(var(--c-primary-500) / .18); }
.numInputWrapper span.arrowUp::after   { border-bottom-color: rgb(var(--c-neutral-400)); }
.numInputWrapper span.arrowDown::after { border-top-color: rgb(var(--c-neutral-400)); }
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  color: rgb(var(--c-neutral-300)); fill: rgb(var(--c-neutral-300)); padding: 8px 10px; border-radius: calc(8px * var(--radius-k, 1)); transition: background .15s, color .15s;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover { background: rgb(var(--c-primary-500) / .14); }
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg { fill: rgb(var(--c-primary-500)); }

/* Weekday row */
span.flatpickr-weekday { color: rgb(var(--c-neutral-400)); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.flatpickr-weekdays { background: transparent; }

/* Day cells */
.flatpickr-day {
  color: rgb(var(--c-neutral-200)); border-radius: calc(9px * var(--radius-k, 1)); font-weight: 500; height: 38px; line-height: 38px;
  border: 1px solid transparent; transition: background .12s, color .12s, border-color .12s;
}
.flatpickr-day:hover,
.flatpickr-day:focus { background: rgb(var(--c-primary-500) / .16); border-color: rgb(var(--c-primary-500) / .35); color: rgb(var(--c-primary-200)); }
.flatpickr-day.today { border-color: rgb(var(--c-primary-500)); color: rgb(var(--c-primary-400)); }
.flatpickr-day.today:hover { background: rgb(var(--c-primary-500) / .2); color: rgb(var(--c-primary-200)); }
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: linear-gradient(135deg, rgb(var(--c-primary-500)) 0%, #d4af37 100%);
  border-color: rgb(var(--c-primary-500)); color: rgb(var(--c-neutral-800)); font-weight: 700;
  box-shadow: 0 2px 8px rgb(var(--c-primary-500) / .35);
}
.flatpickr-day.inRange {
  background: rgb(var(--c-primary-500) / .14); border-color: transparent;
  box-shadow: -5px 0 0 rgb(var(--c-primary-500) / .14), 5px 0 0 rgb(var(--c-primary-500) / .14);
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay { color: rgb(var(--c-neutral-600)); background: transparent; border-color: transparent; }
/* A date in the past is simply unavailable. Striking it through read as an
   error state and made the grid noisy. */
.flatpickr-day.flatpickr-disabled { opacity: .45; cursor: not-allowed; }

/* Give the grid room to breathe — the default is cramped at this font size.
   Never wider than the screen, though: at 21rem (336px) it hung 16px off the edge
   of a 320px phone. The grid below is fluid, so the days simply narrow with it. */
.flatpickr-calendar { width: min(21rem, calc(100vw - 16px)); padding-bottom: 4px; }
.flatpickr-days, .flatpickr-rContainer, .dayContainer { width: 100%; min-width: 0; max-width: none; }
.dayContainer { padding: 4px 6px 0; }
.flatpickr-day { max-width: none; flex-basis: 14.2857%; margin-top: 2px; }
.flatpickr-weekdaycontainer { padding: 0 6px; }

/* Time picker (if enabled) */
.flatpickr-time { background: rgb(var(--c-neutral-900)); border-top: 1px solid rgb(var(--c-neutral-800)); }
.flatpickr-time input,
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time .flatpickr-am-pm { color: rgb(var(--c-neutral-200)); }
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover { background: rgb(var(--c-primary-500) / .12); }

/* The gold outline focus on the visible (alt) input */
input.flatpickr-input.form-control[readonly],
.flatpickr-alt-input:focus { outline: none; }
