/* ==========================================================================
   Enquiry form - enhanced UI/UX layer.

   Custom calendar, custom dropdowns, filled fields, consent checkbox and
   validation states. Loaded after style.css and fx.css; styles only, the
   behavior lives in assets/js/form-ui.js.
   ========================================================================== */

/* ---- form shell ---- */
.event-form {
  border-radius: 10px;
  box-shadow: 0 28px 70px rgba(23, 23, 17, 0.10);
  position: relative;
  z-index: 200;
}

/* ---- field base: filled inputs ---- */
.c-field {
  display: grid;
  gap: 10px;
  align-content: start;
}

.c-field > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #6f675b;
}

.c-field input,
.c-field select,
.c-field textarea {
  width: 100%;
  border: 1px solid #d9cfbf;
  background: #fbf7ef;
  border-radius: 5px;
  padding: 13px 16px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.c-field input::placeholder,
.c-field textarea::placeholder {
  color: #a89e8d;
  opacity: 1;
}

.c-field input:hover:not(:focus),
.c-field select:hover:not(:focus),
.c-field textarea:hover:not(:focus) {
  border-color: #c3b59e;
}

.c-field input:focus,
.c-field select:focus,
.c-field textarea:focus {
  border-color: var(--clay);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(170, 79, 47, 0.16);
}

.c-field textarea {
  resize: vertical;
  min-height: 104px;
  line-height: 1.55;
}

.c-field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.c-field input[type="number"]::-webkit-outer-spin-button,
.c-field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.c-field.is-invalid input,
.c-field.is-invalid select,
.c-field.is-invalid textarea,
.c-field.is-invalid .c-trigger {
  border-color: #a1271d;
  box-shadow: 0 0 0 3px rgba(161, 39, 29, 0.12);
  background: #fdf6f3;
}

/* ---- custom control shell (date + selects) ---- */
.c-control {
  position: relative;
  display: block;
}

.has-custom-controls .c-field--select select.c-native,
.has-custom-controls .c-field--date input.c-native {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.c-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #fbf7ef;
  border: 1px solid #d9cfbf;
  border-radius: 5px;
  padding: 13px 16px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.c-trigger:hover {
  border-color: #c3b59e;
}

.c-trigger[aria-expanded="true"] {
  border-color: var(--clay);
  background: #fffdf8;
  box-shadow: 0 0 0 3px rgba(170, 79, 47, 0.16);
}

.c-trigger .c-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.c-trigger .c-value.is-placeholder {
  color: #a89e8d;
}

.c-trigger .c-icon {
  display: inline-flex;
  flex: none;
  color: var(--clay);
}

.c-trigger .c-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.c-trigger .c-chev {
  transition: transform 0.25s var(--ease);
}

.c-trigger[aria-expanded="true"] .c-chev {
  transform: rotate(180deg);
}

/* ---- popup shell ---- */
.c-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  background: #fffdf8;
  border: 1px solid #ddd2c0;
  border-radius: 8px;
  box-shadow: 0 22px 48px rgba(23, 23, 17, 0.18);
  padding: 8px;
  max-height: min(320px, 60vh);
  overflow: auto;
}

/* ---- dropdown list ---- */
.c-popup--list button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 0;
  background: none;
  border-radius: 5px;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
}

.c-popup--list button:hover,
.c-popup--list button.is-active {
  background: #f1e7d6;
}

.c-popup--list button.is-selected {
  color: var(--clay);
  font-weight: 600;
}

.c-popup--list button.is-selected::after {
  content: "\2713";
  font-weight: 600;
}

/* Popups must never cover each other. The calendar is the priority layer so
   it always stays usable when it is the active popup. */
.c-popup--list {
  z-index: 60;
}

.c-popup--cal {
  z-index: 80;
}

/* ---- calendar ---- */
.c-popup--cal {
  padding: 12px;
}

.c-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.c-cal-title {
  font-family: var(--serif);
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.c-cal-nav {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ddd2c0;
  background: #fbf7ef;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.c-cal-nav:hover:not(:disabled) {
  border-color: var(--clay);
  color: var(--clay);
}

.c-cal-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.c-cal-nav svg {
  width: 16px;
  height: 16px;
  display: block;
}

.c-cal-dow,
.c-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.c-cal-dow span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8b8376;
  text-align: center;
  padding: 6px 0;
}

.c-cal-day {
  min-height: 38px;
  border: 0;
  background: none;
  border-radius: 5px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.c-cal-day:hover:not(:disabled) {
  background: #f1e7d6;
}

.c-cal-day.is-today {
  box-shadow: inset 0 0 0 1px var(--clay);
}

.c-cal-day.is-selected {
  background: var(--clay);
  color: #fffdf8;
  box-shadow: none;
}

.c-cal-day.is-outside {
  color: #c7bda9;
}

.c-cal-day:disabled {
  color: #d5ccbb;
  cursor: default;
}

.c-cal-day:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 1px;
}

/* ---- progress indicator ---- */
.form-progress {
  margin-bottom: 48px;
}

.form-progress button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 14px;
}

.form-progress span {
  width: 30px;
  height: 30px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9bfad;
  border-radius: 50%;
  margin-right: 0;
  color: #8b8376;
  font-size: 0.72rem;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.form-progress button.is-active span {
  background: var(--clay);
  border-color: var(--clay);
  color: #fffdf8;
}

.form-progress button[aria-current="step"] span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
  box-shadow: 0 0 0 3px rgba(23, 23, 17, 0.12);
}

.form-progress button[aria-current="step"] {
  color: var(--ink);
}

/* ---- consent checkbox ---- */
.c-consent {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.72rem;
  color: #615a50;
  cursor: pointer;
  line-height: 1.45;
}

.c-consent input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.c-check {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1px solid #b9ad98;
  border-radius: 5px;
  background: #fbf7ef;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.c-check svg {
  width: 13px;
  height: 13px;
  display: block;
}

.c-consent input:checked + .c-check {
  background: var(--clay);
  border-color: var(--clay);
  color: #fff;
}

.c-consent input:focus-visible + .c-check {
  box-shadow: 0 0 0 3px rgba(170, 79, 47, 0.2);
}

.c-consent.is-focus .c-check {
  box-shadow: 0 0 0 3px rgba(170, 79, 47, 0.2);
}

.c-consent.is-invalid .c-check {
  border-color: #a1271d;
}

/* ---- validation message ---- */
.form-message {
  font-size: 0.75rem;
  color: #9c3528;
  background: rgba(156, 53, 40, 0.07);
  border: 1px solid rgba(156, 53, 40, 0.22);
  border-radius: 5px;
  padding: 9px 12px;
  max-width: 380px;
}

/* ---- responsive ---- */
@media (max-width: 760px) {
  .event-form {
    padding: 26px 18px;
  }

  .c-popup {
    left: 0;
    right: 0;
  }

  .c-cal-day {
    min-height: 36px;
  }
}

/* Mobile calendar: keep it in normal document flow */
@media (max-width: 768px) {
  .c-field--date .c-control {
    display: grid;
    gap: 8px;
  }

  .c-field--date .c-popup--cal {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    margin-top: 0;
    box-sizing: border-box;
    z-index: auto;
  }

  .c-field--date .c-cal-day {
    min-height: 42px;
  }

  .c-field--date {
    z-index: auto;
  }
}
