/*
 * Flatpickr calendar skin — virgo-rudra template.
 *
 * This is a COLOR / TYPOGRAPHY OVERRIDE LAYER, not a standalone theme. It loads
 * AFTER the shared airbnb layout theme (which supplies all positioning, sizing,
 * arrows). Every hard-coded color in that base is re-pointed here at the
 * template's design tokens, so the calendar inherits the broadsheet-editorial
 * world (Lisbon steel blue + Lisbon orange, pure-white frameless surfaces,
 * hairline rules) and follows the visitor across all color palettes, dark mode,
 * and the dynamic font-size scale.
 *
 * The contact-form pickers run in flatpickr static mode (static:true), so the
 * calendar renders inside a .flatpickr-wrapper around the field instead of
 * appended to <body>. The wrapper rule below makes it stretch to the field's
 * full width inside .contact-form-input-wrap; flatpickr's own
 * .flatpickr-calendar.static rule positions the calendar below the field.
 *
 * Token-first by rule: bare hex/rgb literals would lock the skin to one palette.
 * The only literals here are shadows (tinted off the ink token).
 *
 * The airbnb base also ships element-prefixed selectors (span.flatpickr-day,
 * span.flatpickr-weekday) whose element+class specificity plain-class rules
 * cannot beat at any load order. The "Airbnb base parity" section re-declares
 * exactly those properties at matching specificity so the token values win.
 *
 * The Rudra date mark differs from Karma's softer Living Archive in three ways:
 * tighter corners (broadsheet uses sharp hairlines, not rounded cards), an
 * orange tick rather than an outline for "today" (echoing the orange accent rule
 * under section titles across the template), and a hairline-only range corridor.
 *
 * The calendar always renders LTR (flatpickr core direction), independent of
 * the page's RTL language direction, so month/day grids never mirror.
 */

/* ------------------------------------------------------------------ Static-mode wrapper
 * contact-form date pickers use flatpickr static mode, which wraps the field
 * in .flatpickr-wrapper (core gives it position:relative; display:inline-block).
 * Inside .contact-form-input-wrap (a block container) the wrapper must stretch
 * to the field's full width so the visible altInput keeps the same width as a
 * plain text field. The calendar itself is positioned by flatpickr's own
 * .flatpickr-calendar.static rule relative to this wrapper.
 */
.contact-form-input-wrap > .flatpickr-wrapper {
    display: block;
    width: 100%;
}

/* ------------------------------------------------------------------ Calendar shell
 * The frameless editorial card. Rudra surfaces are pure white with hairline
 * rules rather than raised, so we replace the airbnb box-shadow ring with a
 * single hairline border in the token border color, plus a soft ink-tinted drop
 * shadow for the lift the floating calendar needs. Tight corners match the
 * broadsheet radius scale.
 */
.flatpickr-calendar {
    background: var(--card-bg);
    color: var(--text-color);
    border: var(--rule-w) solid var(--border-color);
    /* pure soft drop shadow — no directional ring, frameless editorial */
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
}

/* The little pointer arrow. Rudra draws the card with a hairline border, so the
 * arrow's outer triangle is the border color and the inner is the card fill. */
.flatpickr-calendar.arrowTop:before {
    border-bottom-color: var(--border-color);
}
.flatpickr-calendar.arrowTop:after {
    border-bottom-color: var(--card-bg);
}
.flatpickr-calendar.arrowBottom:before {
    border-top-color: var(--border-color);
}
.flatpickr-calendar.arrowBottom:after {
    border-top-color: var(--card-bg);
}

/* ------------------------------------------------------------------ Month header
 * Month/year title row + prev/next navigation. In the broadsheet voice the
 * header is ink-dominant and quiet; the nav arrows are the only interactive
 * chrome, and they take the steel-blue primary on hover.
 */
.flatpickr-months .flatpickr-month,
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: var(--text-ink);
    fill: var(--text-muted); /* svg chevron fill */
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: var(--primary-color);
    fill: var(--primary-color);
}

/* Month/year numerals — broadsheet headings are ink and confident. */
.flatpickr-current-month {
    color: var(--text-ink);
    font-weight: 700;
    letter-spacing: -0.01em; /* matches the template's heading tracking */
}
.flatpickr-current-month input.cur-year {
    color: var(--text-ink);
    font-weight: 700;
}
.flatpickr-current-month input.cur-year:focus {
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* Year <select> dropdown inside the month title. */
.flatpickr-monthDropdown-months,
.flatpickr-monthDropdown-month:focus,
.flatpickr-monthDropdown-month:hover {
    color: var(--text-ink);
    background-color: var(--card-bg);
}
.flatpickr-monthDropdown-option {
    color: var(--text-color);
    background-color: var(--card-bg);
}
.flatpickr-monthDropdown-option:focus,
.flatpickr-monthDropdown-option:hover {
    background-color: var(--primary-tint);
    color: var(--text-ink);
}

/* ------------------------------------------------------------------ Weekday labels
 * Su Mo Tu We Th Fr Sa — broadsheet section labels: small, muted, tracked,
 * semibold. Quiet enough that the day grid reads first. The selector is
 * span-prefixed because the airbnb base writes the weekday as
 * span.flatpickr-weekday with a near-black rgba color and font-weight bolder —
 * a plain class rule cannot override either, and the base color sinks into
 * invisibility on the dark palettes.
 */
span.flatpickr-weekday {
    color: var(--text-muted);
    font-weight: 600;
}

/* ------------------------------------------------------------------ Day cells
 * Four states carry meaning:
 *   default   — selectable day, body-slate, transparent ground
 *   hover     — the visitor is considering this day; a pale-steel lift
 *   today     — a Lisbon-orange tick under the numeral (the template's signature
 *               accent rule, shrunk to a day mark), never a fill
 *   selected  — the committed day; solid steel-blue fill, on-primary foreground
 *   inRange   — a hairline-only corridor between two selected days
 */
.flatpickr-day {
    color: var(--text-color);
}

/* Hover — pale steel lift. A soft square (not a pill) matches the broadsheet
 * radius and keeps hover + selected reading as one gesture. */
.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover,
.flatpickr-day:focus,
.flatpickr-day.prevMonthDay:focus,
.flatpickr-day.nextMonthDay:focus {
    background: var(--primary-tint);
    border-color: var(--primary-tint);
    color: var(--text-ink);
}

/* Adjacent-month days — dimmed slate, still hoverable. */
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: var(--text-muted);
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: var(--text-muted);
    background: transparent;
    border-color: transparent;
}

/* Today — the Lisbon-orange tick. Rather than a full outline, a short rule sits
 * beneath the numeral, echoing the orange accent rule the template draws under
 * every section title. It marks "now" without competing with a selected fill.
 * The cell border itself is cleared in the "Airbnb base parity" section below
 * (the base guards its red underline with span-prefixed selectors that outrank
 * any plain-class rule); this rule only anchors the tick.
 */
.flatpickr-day.today {
    position: relative;
}
.flatpickr-day.today:after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 3px;
    width: 16px;
    height: var(--rule-w-strong); /* the 2px emphasis rule used on mastheads */
    margin-left: -8px;
    background: var(--accent-color);
    border-radius: var(--radius-pill);
}

/* Selected — the committed day. Solid steel-blue fill, on-primary foreground.
 * Hover deepens to the deep-steel primary so the commitment still feels alive. */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.selected.nextMonthDay {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--on-primary);
}
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover {
    background: var(--primary-deep);
    border-color: var(--primary-deep);
}
/* Suppress the orange tick when the today cell is itself selected — the steel-
 * blue commitment is the stronger state and the tick would read as clutter. */
.flatpickr-day.today.selected:after,
.flatpickr-day.today.startRange:after,
.flatpickr-day.today.endRange:after {
    display: none;
}
.flatpickr-day.selected.startRange + .flatpickr-day.endRange:not(:nth-child(7n+1)) {
    box-shadow: -10px 0 0 var(--primary-color);
}

/* Range corridor — hairline-only in the broadsheet voice. A pale-steel ground
 * with no heavy box-shadow seam; the edges between corridor and selected days
 * stay crisp. */
.flatpickr-day.inRange {
    background: var(--primary-tint);
    border-color: var(--primary-tint);
    color: var(--text-ink);
    box-shadow: -5px 0 0 var(--primary-tint), 5px 0 0 var(--primary-tint);
}
.flatpickr-day.week.selected {
    box-shadow: -5px 0 0 var(--primary-color), 5px 0 0 var(--primary-color);
}

/* ------------------------------------------------------------------ Airbnb base parity
 * The airbnb layout base draws its day grid and today mark with element-
 * prefixed selectors (span.flatpickr-day, span.flatpickr-day.today:not(...)).
 * Element+class specificity outranks every plain-class rule above regardless
 * of load order, so the base's hard-coded #e9e9e9 grid, #f64747 today
 * underline and #4f99ff range edges were punching through the tokens —
 * loudest on the dark palettes, where a light gray grid sits on a dark card.
 * Each rule below mirrors the base selector exactly; this file loads after
 * the base, so parity wins by source order.
 */
span.flatpickr-day,
span.flatpickr-day.prevMonthDay,
span.flatpickr-day.nextMonthDay {
    /* The hairline grid STAYS — in the broadsheet voice it reads as an almanac
     * data table — but every line is re-pointed at the border token so the
     * dark palettes get a dark hairline instead of light gray. The right edge
     * stays transparent (base pattern) so adjacent cells form one 1px rule.
     * The !important is unavoidable — the base locks its square corners with
     * one; --radius-xs keeps the corners broadsheet-sharp anyway. */
    border-color: var(--border-color);
    border-right-color: transparent;
    border-radius: var(--radius-xs) !important;
}

/* "Now" — the cell border clears entirely so the grid opens a quiet frame
 * around the orange tick (the base draws a red underline here, and a full red
 * ring on hover/focus, which also overrode keyboard focus). */
span.flatpickr-day.today:not(.selected),
span.flatpickr-day.prevMonthDay.today:not(.selected),
span.flatpickr-day.nextMonthDay.today:not(.selected) {
    border-color: transparent;
}
span.flatpickr-day.today:not(.selected):hover,
span.flatpickr-day.prevMonthDay.today:not(.selected):hover,
span.flatpickr-day.nextMonthDay.today:not(.selected):hover,
span.flatpickr-day.today:not(.selected):focus,
span.flatpickr-day.prevMonthDay.today:not(.selected):focus,
span.flatpickr-day.nextMonthDay.today:not(.selected):focus {
    border-color: var(--primary-tint);
    background: var(--primary-tint);
    color: var(--text-ink);
}

/* Range edges — the base hard-codes #4f99ff. No frontend picker runs range
 * mode today; this keeps the geometry on-palette if one ever does. */
span.flatpickr-day.startRange,
span.flatpickr-day.prevMonthDay.startRange,
span.flatpickr-day.nextMonthDay.startRange,
span.flatpickr-day.endRange,
span.flatpickr-day.prevMonthDay.endRange,
span.flatpickr-day.nextMonthDay.endRange {
    border-color: var(--primary-color);
}

/* ------------------------------------------------------------------ Time row
 * Hour / minute / am-pm inputs shown when enableTime is on. Editorial inputs
 * stay slate, lift to ink on focus with a hairline ring in the steel-blue
 * primary.
 */
.flatpickr-calendar.hasTime .flatpickr-time {
    border-top-color: var(--border-color);
    height: 44px;
}
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm,
.flatpickr-time .numInputWrapper span {
    color: var(--text-color);
}
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
    background: var(--surface-hover);
    color: var(--text-ink);
    box-shadow: 0 0 0 1px var(--primary-color);
}
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover {
    background: var(--surface-hover);
    color: var(--text-ink);
}
.flatpickr-time .flatInputWrapper,
.flatpickr-time .flatpickr-am-pm {
    color: var(--text-muted);
}
.flatpickr-time .numInputWrapper span:hover {
    color: var(--accent-color);
}
.flatpickr-time .numInputWrapper span.arrowUp:after {
    border-bottom-color: var(--text-muted);
}
.flatpickr-time .numInputWrapper span.arrowDown:after {
    border-top-color: var(--text-muted);
}

/* The blinking colon between hh and mm reads as ink on the frameless card. */
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time input::placeholder {
    color: var(--text-muted);
}

/* ------------------------------------------------------------------ Mobile (inline) calendar
 * Inline on small screens: the calendar sits on the page ground. A hairline
 * border + soft shadow is enough — no floating ring.
 */
.flatpickr-calendar.inline {
    box-shadow: var(--shadow);
}
