/* Auction calendar: /calendar (calendar.html) and the homepage calendar, both
   rendered by includes/prop_calendar.html.

   One unmistakable action per day: "124 properties ->". The whole day is the
   button, and everything around it (empty days, weekday labels, filters) is
   deliberately quiet so the buttons carry the page. Upcoming days are dark
   gray; days already past are light gray, so the eye lands on what's still
   ahead without the upcoming days looking closed off.

   Large surfaces stay gray and white; the brand orange is only an accent
   (today's ring and badge, the arrow on hover). */

.cal-page,
.cal-calendar {
    --cal-ink: #3a3a3a;
    --cal-ink-hover: #262626;
    --cal-past: #e8e8e8;
    --cal-past-hover: #dddddd;
    --cal-accent: #d4851c;
    --cal-line: #e0e0e0;
    --cal-muted: #6b6b6b;
    --cal-radius: 0.75rem;
}

.cal-page {
    max-width: 64rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 0;
}

/* ---- Month header ---- */

.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.cal-month {
    /* Wide enough for "Septiembre 2026" so the month buttons don't shift between months */
    min-width: 9em;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    color: var(--headerColor);
}

/* "← Aug" / "Oct →": each button names the month it goes to */
.cal-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    flex: none;
    min-height: 2.75rem;
    padding: 0 0.875rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--cal-ink);
    background-color: #fff;
    border: 1px solid var(--cal-line);
    border-radius: 999px;
    transition: background-color 0.15s, color 0.15s;
}

.cal-nav:hover,
.cal-nav:focus-visible {
    color: #fff;
    background-color: var(--cal-ink);
}

/* ---- Search and filters (secondary: outlined, never competing with days) ---- */

.cal-filters {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #fff;
    border: 1px solid var(--cal-line);
    border-radius: var(--cal-radius);
}

.cal-filters > summary,
.cal-earlier > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--headerColor);
    list-style: none;
    cursor: pointer;
}

.cal-filters > summary::-webkit-details-marker,
.cal-earlier > summary::-webkit-details-marker {
    display: none;
}

/* Chevron */
.cal-filters > summary::after,
.cal-earlier > summary::after {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    margin: 0 0.25rem 0.25rem auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.15s;
}

.cal-filters[open] > summary::after,
.cal-earlier[open] > summary::after {
    margin-bottom: -0.25rem;
    transform: rotate(-135deg);
}

/* On larger screens the filters are always shown; the toggle is for phones */
.cal-filters[open] > summary {
    display: none;
}

.cal-filter-active {
    padding: 0.125rem 0.625rem;
    font-size: 0.8125rem;
    color: var(--cal-ink);
    background-color: #ececec;
    border-radius: 999px;
}

.cal-filters-body {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
}

/* property-grid.css turns every form into a flex column; these are grid cells */
.cal-filter {
    display: block;
    min-width: 0;
}

.cal-filter label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--cal-muted);
}

.cal-field {
    display: flex;
    gap: 0.5rem;
}

.cal-field input,
.cal-field select {
    flex: 1;
    min-width: 0;
    width: auto;
    height: 2.75rem;
    padding: 0 0.75rem;
    font-size: 1rem;
    color: var(--headerColor);
    background-color: #fff;
    border: 1px solid #cccccc;
    border-radius: 0.5rem;
}

.cal-field button {
    flex: none;
    height: 2.75rem;
    padding: 0 1rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--cal-ink);
    background-color: #fff;
    border: 1px solid var(--cal-ink);
    border-radius: 0.5rem;
    cursor: pointer;
}

.cal-field button:hover {
    color: #fff;
    background-color: var(--cal-ink);
}

/* ---- Month grid (tablets and up) ---- */

.cal-calendar {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.625rem;
}

.cal-weekday {
    padding: 0 0.75rem 0.125rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cal-muted);
}

.cal-day {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 8rem;
    padding: 0.625rem 0.75rem 0.75rem;
    border-radius: var(--cal-radius);
}

.cal-day-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.375rem;
    min-height: 1.5rem;
}

.cal-date {
    margin-right: auto;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* On a day button the date is a small header above a hairline, well apart
   from the count at the bottom; the client read the old tile as "numbers on
   numbers" */
.cal-day.has-props .cal-day-top {
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.cal-day.has-props .cal-date {
    opacity: 0.75;
}

.cal-badge {
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    background-color: var(--cal-accent);
    border-radius: 999px;
}

.cal-seen {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
    opacity: 0.75;
}

.cal-holiday {
    margin-top: 0.125rem;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--cal-muted);
}

/* Days without auctions: present for orientation, but out of the way */
.cal-day.no-props {
    color: var(--cal-muted);
    border: 1px solid var(--cal-line);
}

.cal-day.no-props.is-past {
    opacity: 0.55;
}

/* The call to action */
.cal-day.has-props {
    color: #fff;
    text-decoration: none;
    background-color: var(--cal-ink);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.cal-day.has-props:hover,
.cal-day.has-props:focus-visible {
    background-color: var(--cal-ink-hover);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
    transform: translateY(-2px);
}

.cal-day.has-props .cal-holiday {
    color: rgba(255, 255, 255, 0.75);
}

.cal-cta {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.375rem;
    margin-top: auto;
    padding-top: 0.75rem;
}

/* The count with its unit tucked directly under it. Always stacked: side by
   side only fits 1-2 digit counts, and a grid mixing both layouts looked
   accidental. */
.cal-qty {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.cal-count {
    font-size: clamp(1.625rem, 1rem + 1.2vw, 2.25rem);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cal-qty-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cal-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1rem;
    line-height: 1;
    background-color: rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.cal-day.has-props:hover .cal-arrow,
.cal-day.has-props:focus-visible .cal-arrow {
    background-color: var(--cal-accent);
    transform: translateX(2px);
}

/* Past days: still a button, in light gray so upcoming days lead */
.cal-day.has-props.is-past,
.cal-row.is-past {
    color: var(--cal-ink);
    background-color: var(--cal-past);
    box-shadow: none;
}

.cal-day.has-props.is-past:hover,
.cal-day.has-props.is-past:focus-visible {
    background-color: var(--cal-past-hover);
    box-shadow: none;
}

.cal-day.has-props.is-past .cal-holiday {
    color: var(--cal-muted);
}

.cal-day.has-props.is-past .cal-day-top {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.cal-day.is-past .cal-arrow,
.cal-row.is-past .cal-arrow,
.cal-row.is-past .cal-row-date {
    background-color: rgba(0, 0, 0, 0.07);
}

.cal-day.has-props.is-past:hover .cal-arrow {
    color: #fff;
    background-color: var(--cal-ink);
}

.cal-day.is-today,
.cal-row.is-today {
    outline: 3px solid var(--cal-accent);
    outline-offset: 2px;
}

/* ---- Agenda list (phones) ---- */

.cal-agenda {
    display: none;
}

.cal-rows {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.cal-row {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-height: 4.5rem;
    padding: 0.625rem 0.875rem 0.625rem 0.625rem;
    color: #fff;
    text-decoration: none;
    background-color: var(--cal-ink);
    border-radius: var(--cal-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.cal-row-date {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 3.25rem;
    height: 3.25rem;
    line-height: 1;
    background-color: rgba(255, 255, 255, 0.12);
    border-radius: 0.5rem;
}

.cal-row-wd {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.8;
}

/* "TODAY" replaces the weekday; the row's gold ring carries the color */
.cal-row.is-today .cal-row-wd {
    opacity: 1;
}

.cal-row-day {
    margin-top: 0.125rem;
    font-size: 1.125rem;
    font-weight: 600;
}

/* The count sits at the far end of the row with its unit, next to the arrow,
   instead of right beside the day number */
.cal-row-main {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: flex-end;
    gap: 0.25rem 0.5rem;
    min-width: 0;
    text-align: right;
}

.cal-row-count {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.cal-row-label {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Viewed: a check notched into the date tile's corner, so it reads as a
   property of the day and scanning the counts stays "108 properties" */
.cal-row-seen {
    position: absolute;
    top: -0.375rem;
    right: -0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.125rem;
    height: 1.125rem;
    color: var(--cal-ink);
    background-color: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--cal-ink);
}

.cal-row.is-past .cal-row-seen {
    color: #fff;
    background-color: var(--cal-ink);
    box-shadow: 0 0 0 2px var(--cal-past);
}

/* Visually hidden, still read by screen readers */
.cal-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.cal-row .cal-arrow {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.125rem;
}

.cal-earlier {
    margin-bottom: 0.625rem;
}

.cal-earlier > summary {
    padding: 0 0.875rem;
    font-size: 0.875rem;
    color: var(--cal-muted);
    background-color: #fff;
    border: 1px solid var(--cal-line);
    border-radius: var(--cal-radius);
}

.cal-earlier[open] > summary {
    margin-bottom: 0.625rem;
}

.cal-earlier-count {
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    color: var(--headerColor);
    background-color: #ececec;
    border-radius: 999px;
}

.cal-none {
    margin: 0;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--cal-muted);
    border: 1px dashed var(--cal-line);
    border-radius: var(--cal-radius);
}

/* ---- Breakpoints ---- */

@media screen and (max-width: 64rem) {
    .cal-filters-body {
        grid-template-columns: 1fr 1fr;
    }

    .cal-filter-search {
        grid-column: 1 / -1;
    }

    .cal-qty-label {
        font-size: 0.6875rem;
        letter-spacing: 0.02em;
    }
}

@media screen and (max-width: 48rem) {
    .cal-page {
        padding-top: 0;
    }

    /* Month and search stay in view while scrolling the list of days. The top
       offset is the site header's height, measured by calendar.html. */
    .cal-sticky {
        position: sticky;
        top: var(--cal-sticky-top, 3.5rem);
        z-index: 20;
        /* An open filter panel on a short screen scrolls inside the bar
           instead of covering the whole list */
        max-height: calc(100vh - var(--cal-sticky-top, 3.5rem));
        max-height: calc(100dvh - var(--cal-sticky-top, 3.5rem));
        overflow-y: auto;
        margin: 0 -1rem 1rem;
        padding: 0.625rem 1rem;
        background-color: #fff;
        border-bottom: 1px solid var(--cal-line);
    }

    .cal-sticky .cal-toolbar {
        margin-bottom: 0.625rem;
    }

    .cal-sticky .cal-filters {
        margin-bottom: 0;
    }

    .cal-toolbar {
        justify-content: space-between;
        gap: 0.5rem;
    }

    .cal-month {
        min-width: 0;
        font-size: 1.25rem;
    }

    .cal-nav {
        padding: 0 0.75rem;
        font-size: 0.875rem;
    }

    .cal-filters {
        margin-bottom: 1rem;
        padding: 0 1rem;
    }

    .cal-filters[open] {
        padding-bottom: 1rem;
    }

    .cal-filters[open] > summary {
        display: flex;
        margin-bottom: 0.5rem;
    }

    .cal-filters-body {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .cal-grid {
        display: none;
    }

    .cal-agenda {
        display: block;
    }
}
