/* Venue page and room pages. Only what components.css does not cover;
   colours, spacing and type come from tokens.css. */

/* Venue page: photo-led cards, no frame, so the rooms carry the page. */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: var(--space-6) var(--space-5);
    margin: 0;
    padding: 0;
    list-style: none;
}

.room-card {
    display: grid;
    gap: var(--space-1);
    border-radius: var(--radius-card);
    color: var(--color-text);
}

.room-card:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 6px;
}

.room-card__media {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    margin-bottom: var(--space-2);
    overflow: hidden;
    border-radius: var(--radius-card);
    background: var(--color-soft);
    color: color-mix(in srgb, var(--color-primary) 55%, var(--color-soft));
}

.room-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    outline: 1px solid rgba(0, 0, 0, 0.08);
    outline-offset: -1px;
    border-radius: inherit;
    transition: transform 400ms var(--ease-out);
}

.room-card__media svg { width: 32px; height: 32px; }

.room-card__title {
    font-size: var(--text-base);
    font-weight: 600;
    text-wrap: balance;
}

.room-card__meta {
    color: var(--color-text-soft);
    font-size: var(--text-sm);
    font-variant-numeric: tabular-nums;
}

.room-card__text {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--color-text-mid);
    font-size: var(--text-sm);
    text-wrap: pretty;
}

@media (hover: hover) and (pointer: fine) {
    .room-card:hover .room-card__media img { transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
    .room-card__media img { transition: none; }
}

/* Room page photos: one large and up to four small on wide screens,
   swiped sideways on phones. */
.room-gallery {
    display: grid;
    grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    aspect-ratio: 16 / 7;
    overflow: hidden;
    border-radius: var(--radius-card);
}

.room-gallery--1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.room-gallery--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 1fr; }
.room-gallery--3 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.room-gallery__item:first-child { grid-row: span 2; }
.room-gallery--2 .room-gallery__item:first-child { grid-row: auto; }
.room-gallery--4 .room-gallery__item:last-child { grid-column: span 2; }

.room-gallery__item {
    margin: 0;
    background: var(--color-soft);
}

.room-gallery__item img {
    outline: 1px solid rgba(0, 0, 0, 0.08);
    outline-offset: -1px;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (max-width: 860px) {
    .room-gallery {
        display: flex;
        gap: var(--space-3);
        margin: 0 calc(-1 * var(--space-5));
        padding: 0 var(--space-5);
        overflow-x: auto;
        aspect-ratio: auto;
        border-radius: 0;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 var(--space-5);
        scrollbar-width: none;
    }

    .room-gallery::-webkit-scrollbar { display: none; }

    .room-gallery__item {
        flex: 0 0 85%;
        overflow: hidden;
        border-radius: var(--radius-card);
        scroll-snap-align: start;
    }

    .room-gallery--1 .room-gallery__item { flex-basis: 100%; }
    .room-gallery__item img { aspect-ratio: 4 / 3; }
}

/* Booking card. The form is too tall to stay pinned, so it scrolls. */
.article__aside.room-book { position: static; }
.room-heading { margin-bottom: var(--space-2); font-size: var(--text-lg); }
.room-book__note { margin: var(--space-1) 0 var(--space-5); color: var(--color-text-soft); text-wrap: pretty; }
.room-book__note a { color: var(--color-primary-dark); text-decoration: underline; text-underline-offset: 2px; }
.room-book .form-error { margin: 0 0 var(--space-3); }
.room-book__taken { margin: calc(-1 * var(--space-3)) 0 var(--space-5); }
.room-book__room { margin: 0 0 var(--space-4); color: var(--color-text-soft); font-size: var(--text-sm); }

/* Availability calendar: quiet tiles instead of a ruled grid, so the
   booked times are what stands out. The whole tile is the day link. */
.cal {
    padding: var(--space-4);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-card);
    background: var(--color-white);
    transition: opacity 150ms ease;
}

.cal.is-loading { opacity: 0.55; }

.cal__nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.cal__title {
    margin-right: auto;
    padding-left: var(--space-2);
    font-size: var(--text-base);
    font-variant-numeric: tabular-nums;
}

.cal__btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: var(--border-width) solid var(--color-border);
    border-radius: 50%;
    color: var(--color-text);
    transition-property: background-color, border-color, transform;
    transition-duration: 150ms;
    transition-timing-function: var(--ease-out);
}

.cal__btn svg { width: 18px; height: 18px; }
.cal__btn:active { transform: scale(0.96); }

.cal__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    animation: cal-in 200ms var(--ease-out);
}

.cal__dow {
    padding: var(--space-1) 0 var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    text-align: center;
    color: var(--color-text-soft);
}

.cal__day {
    position: relative;
    min-height: 84px;
    padding: 4px;
    border-radius: 10px;
    font-size: var(--text-xs);
    transition: background-color 150ms ease, box-shadow 150ms ease;
}

.cal__day--past { color: var(--color-text-soft); }
.cal__day.is-selected { box-shadow: inset 0 0 0 2px var(--color-primary-dark); }

.cal__num {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    margin-bottom: 2px;
    border-radius: 50%;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: inherit;
}

/* Stretch the link over the tile for a full-size hit area. */
a.cal__num::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

a.cal__num:focus-visible { outline: none; }
.cal__day:has(a.cal__num:focus-visible) { box-shadow: inset 0 0 0 2px var(--color-primary); }
.cal__day--today .cal__num { background: var(--color-primary-dark); color: var(--color-white); }

.cal__slot {
    display: block;
    margin-top: 2px;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--color-primary-dark);
    color: var(--color-white);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
}

/* A slot wraps between its start and end time rather than clipping the end. */
.cal__t { white-space: nowrap; }

.cal__slot--pending {
    background: color-mix(in srgb, var(--color-highlight) 18%, white);
    /* Dashed as well as tinted, so booked and requested differ without relying on colour. */
    outline: 1px dashed color-mix(in srgb, var(--color-highlight-deep) 70%, white);
    outline-offset: -1px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-highlight-deep) 20%, white);
    color: var(--color-highlight-deep);
}

.cal__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--color-text-soft);
    text-wrap: pretty;
}

.cal__key {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: var(--color-primary-dark);
}

.cal__key--pending {
    margin-left: var(--space-2);
    background: color-mix(in srgb, var(--color-highlight) 18%, white);
    outline: 1px dashed color-mix(in srgb, var(--color-highlight-deep) 70%, white);
    outline-offset: -1px;
}

.cal__hint { flex-basis: 100%; }

@keyframes cal-in {
    from { opacity: 0; transform: translateY(4px); }
}

@media (hover: hover) and (pointer: fine) {
    .cal__btn:hover { border-color: var(--color-text-soft); background: var(--color-soft); }
    .cal__day:has(a.cal__num):hover { background: var(--color-soft); }
}

@media (prefers-reduced-motion: reduce) {
    .cal__grid { animation: none; }
    .cal__btn:active { transform: none; }
}

/* Times do not fit a phone-width day, so each booking shows as a dot and
   the times appear under the date field once a day is picked. */
@media (max-width: 640px) {
    .cal { padding: var(--space-3) var(--space-2); }
    .cal__grid { gap: 2px; }
    .cal__day { min-height: 52px; text-align: center; }

    .cal__day .cal__slot {
        display: inline-block;
        width: 6px;
        height: 6px;
        margin: 0 1px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
        outline: none;
    }

    .cal__day .cal__slot--pending { background: var(--color-highlight); box-shadow: none; }
}
