/* ===================================================================
   Homadic range calendar — shared between individuallisting + notcertified.
   Custom range picker that replaces the native date inputs. Two months
   side-by-side on desktop, one on mobile. Sticky popover anchored to
   the trigger field. Respects minimum_nights, prefers-reduced-motion.

   Skin: brand.css tokens — EB Garamond display, DM Sans body, single
   green accent, 4-6px radii. No italics (brand direction).
   =================================================================== */

/* The two-cell trigger (Check-in / Check-out) */
.rwrDateRange {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--hairline, #dbd3c2);
  border-radius: 6px;
  background: var(--paper, #fbfaf7);
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color var(--dur-fast, .15s) ease, box-shadow var(--dur-fast, .15s) ease;
}
.rwrDateRange:hover { border-color: var(--ink-soft, #3a382f); }
.rwrDateRange.is-active { border-color: var(--accent, #00907d); box-shadow: 0 0 0 3px rgba(0, 144, 125, .12); }

.rwrDateBtn {
  background: transparent;
  border: none;
  text-align: left;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink, #1c1b16);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--dur-fast, .15s) ease;
  position: relative;
}
.rwrDateBtn + .rwrDateBtn { border-left: 1px solid var(--hairline, #dbd3c2); }
.rwrDateBtn:hover { background: var(--ivory, #fbfaf7); }
.rwrDateBtn.is-focused { background: var(--ivory, #fbfaf7); }
.rwrDateBtn.is-focused::after {
  content: ""; position: absolute;
  left: 12px; right: 12px; bottom: 5px; height: 2px;
  background: var(--accent, #00907d);
  border-radius: 1px;
}

.rwrDateBtnLabel {
  font-family: var(--font-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted, #6b6557);
}
.rwrDateBtnValue {
  font-family: var(--font-display, "EB Garamond", Georgia, serif);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink, #1c1b16);
  letter-spacing: -.005em;
  line-height: 1.25;
}
.rwrDateBtnValue.is-placeholder {
  color: var(--subtle, #968f7e);
}

/* The popover.
   Portaled to <body> so no parent overflow / stacking issues can clip it.
   Positioned via JS using fixed coordinates from the trigger's getBoundingClientRect. */
.rwrCalPopover {
  position: fixed;
  z-index: 9999;
  background: var(--paper, #fbfaf7);
  border: 1px solid var(--hairline, #dbd3c2);
  border-radius: 6px;
  box-shadow: 0 18px 56px -16px rgba(28, 27, 22, .22), 0 4px 12px -4px rgba(28, 27, 22, .08);
  padding: 18px 18px 14px;
  display: none;
  width: 620px;
  max-width: 94vw;
  animation: rwrCalIn .18s cubic-bezier(.2,.8,.2,1);
}
.rwrCalPopover.is-open { display: block; }
@keyframes rwrCalIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .rwrCalPopover { animation: none; }
}

/* Mobile: full-width modal-style overlay instead of anchored popover */
@media (max-width: 720px) {
  .rwrCalPopover {
    position: fixed;
    inset: auto 12px 12px 12px;
    top: auto;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    max-height: 88vh;
    overflow-y: auto;
  }
}

.rwrCalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.rwrCalNav {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--hairline, #dbd3c2);
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink, #1c1b16);
  transition: background var(--dur-fast, .15s) ease, border-color var(--dur-fast, .15s) ease, transform var(--dur-fast, .15s) ease;
}
.rwrCalNav:hover { background: var(--ink, #1c1b16); color: var(--paper, #fbfaf7); border-color: var(--ink, #1c1b16); }
.rwrCalNav:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }
.rwrCalNav svg { width: 14px; height: 14px; stroke-width: 2.2; }

.rwrCalMonths {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
@media (max-width: 720px) {
  .rwrCalMonths { grid-template-columns: 1fr; gap: 24px; }
}

.rwrCalMonth { min-width: 0; }
.rwrCalMonthTitle {
  font-family: var(--font-display, "EB Garamond", Georgia, serif);
  font-weight: 500;
  font-size: 15.5px;
  color: var(--ink, #1c1b16);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -.005em;
}

.rwrCalGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.rwrCalDow {
  font-family: var(--font-mono, 'JetBrains Mono', ui-monospace, monospace);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--subtle, #968f7e);
  text-align: center;
  padding: 6px 0;
}
.rwrCalDay {
  position: relative;
  aspect-ratio: 1 / 1;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-body, "DM Sans", -apple-system, sans-serif);
  font-size: 13.5px;
  color: var(--ink, #1c1b16);
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  transition: background var(--dur-fast, .15s) ease, color var(--dur-fast, .15s) ease;
}
.rwrCalDay:hover:not(:disabled):not(.is-selected) {
  background: var(--ink, #1c1b16);
  color: var(--paper, #fbfaf7);
}
.rwrCalDay:disabled,
.rwrCalDay.is-empty,
.rwrCalDay.is-out-of-range {
  color: var(--subtle, #968f7e);
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(150, 143, 126, .55);
}
.rwrCalDay.is-empty {
  text-decoration: none;
  pointer-events: none;
  background: transparent !important;
}
.rwrCalDay.is-today {
  font-weight: 600;
  outline: 1px solid var(--hairline, #dbd3c2);
  outline-offset: -2px;
}

/* In-range = between from + to (exclusive of endpoints) */
.rwrCalDay.is-in-range {
  background: rgba(0, 144, 125, 0.10);
  border-radius: 0;
}

/* Hover-preview range: when from is set but to isn't yet, hovering
   highlights the prospective range. */
.rwrCalDay.is-preview {
  background: rgba(0, 144, 125, 0.06);
  border-radius: 0;
}

/* Range endpoints get rounded corners on the relevant side so the
   selection reads as a single capsule. */
.rwrCalDay.is-range-start { border-radius: 4px 0 0 4px; }
.rwrCalDay.is-range-end { border-radius: 0 4px 4px 0; }
.rwrCalDay.is-range-start.is-range-end { border-radius: 4px; }

.rwrCalDay.is-selected {
  background: var(--brand, #00907d) !important;
  color: var(--on-brand, #ffffff);
  font-weight: 500;
}

/* Footer with summary + clear */
.rwrCalFooter {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--hairline, #dbd3c2);
}
.rwrCalSummary {
  font-family: var(--font-body, "DM Sans", -apple-system, sans-serif);
  font-size: 12.5px;
  color: var(--muted, #6b6557);
  line-height: 1.4;
}
.rwrCalSummary b {
  font-weight: 600;
  color: var(--ink, #1c1b16);
}
.rwrCalActions { display: flex; gap: 10px; }
.rwrCalBtn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted, #6b6557);
  transition: background var(--dur-fast, .15s) ease, color var(--dur-fast, .15s) ease;
}
.rwrCalBtn:hover { background: var(--soft, #f4eee2); color: var(--ink, #1c1b16); }
.rwrCalBtn.is-primary {
  background: var(--ink, #1c1b16);
  color: var(--paper, #fbfaf7);
}
.rwrCalBtn.is-primary:hover { background: var(--accent, #00907d); color: var(--on-brand, #ffffff); }
.rwrCalBtn:disabled { opacity: .4; cursor: not-allowed; }

/* Min-stay caption above the calendar grid */
.rwrCalMinHint {
  font-family: var(--font-body, "DM Sans", -apple-system, sans-serif);
  font-size: 12px;
  color: var(--muted, #6b6557);
  text-align: center;
  margin-bottom: 10px;
}
.rwrCalMinHint b { font-weight: 600; color: var(--accent-ink, #0a5f53); }
