/* ==========================================================================
   Request Your Stay — the parchment inquiry panel.
   Sampled from the template at its 1920px design width.
   ========================================================================== */

.request {
    border-block: 2px solid var(--bb-gold-600);
    background-color: var(--bb-black);
    /*
     * The hat hangs off the panel by 38% of its own width, which is the
     * intended look. Between roughly 1150 and 1800 that overhang is wider
     * than the page gutter, so it pushed past the right edge of the window
     * and gave the whole page a horizontal scrollbar — 8px of it at 1280.
     * This section is full-bleed, so clipping here cuts only what would
     * leave the window and keeps the overhang wherever there is room for it.
     * clip rather than hidden: hidden would make this a scroll container.
     * Paired with an overflow-y of visible, so the hat still rides above
     * the panel.
     */
    overflow-x: clip;
}

.request__inner {
    width: 100%;
    max-width: calc(var(--bb-container) + var(--bb-gutter) * 2);
    margin-inline: auto;
    padding: clamp(1rem, 1.2vw, 1.5rem) var(--bb-gutter);
}

/*
 * The parchment is a 9-slice: the torn edges keep their drawn size while the
 * middle stretches, so the panel can grow tall on narrow screens without the
 * deckle smearing.
 */
.request__panel {
    position: relative;
    border: 40px solid transparent;
    /*
     * Only the torn edges come from the image — no `fill`, because the source
     * is the flat template render and its middle still carries the design's
     * own baked-in copy. The interior is painted here instead, toned to meet
     * the slices without a seam.
     */
    border-image-source: url("../img/decor/parchment.webp");
    border-image-slice: 40;
    border-image-width: 40px;
    border-image-repeat: round;
    background-color: #e8c78e;
    background-image: radial-gradient(
        130% 150% at 46% 38%,
        #f1d5a2 0%,
        #e9c98f 45%,
        #e0bd80 74%,
        #d6b273 100%
    );
    padding: clamp(0.5rem, 1.4vw, 1.5rem) clamp(0.25rem, 1.2vw, 1.25rem);
}

/*
 * The artwork is square: the hat body fills the top 45%, the sash tails hang
 * from 45% down the right (x 65-94%) and the wooden haft down the left.
 * Both offsets are a fraction of the width so the tails stay clear of the
 * submit button at every size instead of being tuned to one viewport.
 */
.request__hat {
    --bb-hat-w: clamp(9rem, 16.8vw, 20.125rem);

    position: absolute;
    top: calc(var(--bb-hat-w) * -0.38);
    right: calc(var(--bb-hat-w) * -0.38);
    z-index: 1;
    width: var(--bb-hat-w);
    height: auto;
    pointer-events: none;
}

.request__layout {
    display: grid;
    grid-template-columns: minmax(16rem, 30fr) auto minmax(20rem, 55fr);
    align-items: center;
    gap: clamp(1.5rem, 2.4vw, 3rem);
}

/* --- Intro column -------------------------------------------------------- */

.request__eyebrow {
    color: var(--bb-ink-red);
    font-size: clamp(0.8125rem, 1.05vw, 1.3125rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.request__title {
    margin-top: clamp(0.5rem, 1vw, 1.25rem);
    color: var(--bb-ink-dark);
    font-family: var(--bb-font-serif);
    font-size: clamp(1.875rem, 2.6vw, 3.125rem);
    font-weight: 500;
    line-height: 1.1;
}

.request__ornament {
    display: block;
    width: min(100%, 20.6875rem);
    height: auto;
    margin-top: clamp(0.85rem, 1.4vw, 1.5rem);
    color: var(--bb-gold-700);
}

.request__lead {
    max-width: 26rem;
    margin-top: clamp(0.9rem, 1.5vw, 1.75rem);
    color: var(--bb-ink-soft);
    font-size: clamp(0.875rem, 0.99vw, 1.1875rem);
    line-height: 1.68;
}

/* --- Vertical ornament --------------------------------------------------- */

/*
 * Every cell is placed explicitly. The motif is the only item with a definite
 * position, and grid places those before the auto-flow items — leaving it
 * implicit pushed the rule into column 3 and wrapped the form onto a new row.
 */
.request__intro {
    grid-column: 1;
    grid-row: 1;
}

.request__divider {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    width: 1.25rem;
    height: 100%;
    color: var(--bb-gold-700);
}

.request__divider-motif {
    /* Sits on top of the stretched rule, centred in the same cell. */
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: center;
    width: 1.25rem;
    height: auto;
    color: var(--bb-gold-700);
}

/* --- CTA column ------------------------------------------------------------ */

.request__cta {
    display: flex;
    grid-column: 3;
    grid-row: 1;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: clamp(0.85rem, 1.4vw, 1.5rem);
}

/* --- Fields (shared by the modal form) ------------------------------------ */

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.field--guests {
    min-width: 8.5rem;
}

.field__label {
    margin-bottom: clamp(0.4rem, 0.9vw, 1rem);
    color: var(--bb-ink-dark);
    font-size: clamp(0.75rem, 0.94vw, 1.125rem);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field__control {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--bb-ink-line);
    border-radius: 4px;
    background-color: var(--bb-parchment-field);
    transition: border-color var(--bb-dur) var(--bb-ease),
        box-shadow var(--bb-dur) var(--bb-ease);
}

.field__control:focus-within {
    border-color: var(--bb-ink-dark);
    box-shadow: 0 0 0 3px rgba(109, 76, 25, 0.28);
}

.field__control.is-invalid {
    border-color: var(--bb-ink-red);
}

.field__input {
    width: 100%;
    min-width: 0;
    padding: clamp(0.85rem, 1.5vw, 1.6rem) clamp(0.75rem, 1vw, 1.15rem);
    border: 0;
    background: none;
    color: var(--bb-ink-dark);
    font-family: var(--bb-font-sans);
    font-size: clamp(0.875rem, 1.05vw, 1.25rem);
    line-height: 1;
}

.field__input:focus {
    outline: none;
}

.field__input--select {
    /* The chevron is drawn by .field__icon instead. */
    appearance: none;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Any field with a trailing .field__icon needs room to its right, or long
   text (an e-mail address, the date range) runs under the icon. */
.field__input--icon {
    padding-right: clamp(2.5rem, 3.2vw, 3.25rem);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.field__icon {
    position: absolute;
    right: clamp(0.75rem, 1vw, 1.15rem);
    width: clamp(1.05rem, 1.25vw, 1.5rem);
    height: clamp(1.05rem, 1.25vw, 1.5rem);
    color: var(--bb-ink-dark);
    pointer-events: none;
}

/* Let the whole field open the native picker while showing our own icon. */
.field__input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: auto;
    height: auto;
    opacity: 0;
    cursor: pointer;
}

.field__error {
    margin-top: 0.4rem;
    color: var(--bb-ink-red);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.35;
}

.request__submit {
    padding-block: clamp(0.95rem, 1.6vw, 1.7rem);
    padding-inline: clamp(1rem, 1.5vw, 1.85rem);
    box-shadow: none;
}

.request__note {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    grid-column: 1 / -1;
    margin-top: clamp(0.4rem, 0.9vw, 1rem);
    color: var(--bb-ink-soft);
    font-size: clamp(0.8125rem, 0.94vw, 1.125rem);
    line-height: 1.5;
}

.request__note-icon {
    flex: none;
    width: 1.4em;
    height: 1.4em;
    color: var(--bb-gold-700);
}

.request__note-success {
    color: #1f4d24;
    font-weight: 600;
}

.request__note-error {
    color: var(--bb-ink-red);
    font-weight: 600;
}

/* ==========================================================================
   Stacked layouts
   ========================================================================== */

@media (max-width: 1180px) {
    .request__layout {
        grid-template-columns: 1fr;
    }

    .request__intro,
    .request__cta {
        grid-column: 1;
    }

    .request__intro { grid-row: 1; }
    .request__cta   { grid-row: 2; }

    .request__divider,
    .request__divider-motif {
        display: none;
    }

    .request__hat {
        --bb-hat-w: 9.5rem;
    }
}

@media (max-width: 780px) {
    .request__hat {
        display: none;
    }

    .request__panel {
        border-width: 28px;
        border-image-width: 28px;
    }
}

/* ==========================================================================
   Request modal
   ========================================================================== */

/*
 * A plain fixed overlay, not a native <dialog> — see the note at the top of
 * request-modal.js for why: showModal()'s top layer would otherwise render
 * above the flatpickr calendar instead of below it.
 */
.request-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 2rem 1rem;
    background: rgba(5, 4, 3, 0.72);
}

.request-modal-overlay.is-open {
    display: flex;
}

.request-modal {
    width: min(72rem, 96vw);
    max-height: 88vh;
    margin: auto;
    overflow-y: auto;
    /* Same 40px as .request__panel's border-image-width — mismatching it
       against the source's 40px slice was what made the corners (the top
       right one most visibly) look soft next to the card on the page. */
    border: 40px solid transparent;
    border-image-source: url("../img/decor/parchment.webp");
    border-image-slice: 40;
    border-image-width: 40px;
    border-image-repeat: round;
    background-color: #e8c78e;
    background-image: radial-gradient(
        130% 150% at 46% 38%,
        #f1d5a2 0%,
        #e9c98f 45%,
        #e0bd80 74%,
        #d6b273 100%
    );
    color: var(--bb-ink-dark);
}

.request-modal__form {
    position: relative;
    display: grid;
    gap: clamp(0.9rem, 1.6vw, 1.35rem);
    padding: clamp(1.5rem, 3.5vw, 2.5rem);
}

/* The thank-you card after a successful request: same parchment frame,
   narrower, everything centred. */
.request-modal--thanks {
    display: grid;
    justify-items: center;
    gap: clamp(0.9rem, 1.6vw, 1.35rem);
    width: min(34rem, 96vw);
    padding: clamp(1.5rem, 3.5vw, 2.5rem);
    text-align: center;
}

.request-modal--thanks .request-modal__title {
    padding-right: 0;
}

.request-modal--thanks .request__submit {
    margin: 0.25rem auto 0;
}

.request-thanks__icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto;
    color: var(--bb-ink-dark);
}

.request-thanks__text {
    color: var(--bb-ink-soft);
    font-size: 1.0625rem;
    line-height: 1.55;
}

.request-thanks__hint {
    color: var(--bb-ink-soft);
    font-size: 0.8125rem;
}

.request-modal__close {
    position: absolute;
    top: clamp(0.5rem, 1.2vw, 1rem);
    right: clamp(0.5rem, 1.2vw, 1rem);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--bb-ink-line);
    border-radius: 999px;
    background: none;
    color: var(--bb-ink-dark);
    cursor: pointer;
}

.request-modal__close svg {
    width: 1.1rem;
    height: 1.1rem;
}

.request-modal__close:hover {
    border-color: var(--bb-ink-dark);
}

.request-modal__title {
    padding-right: 2.5rem;
    color: var(--bb-ink-dark);
    font-family: var(--bb-font-serif);
    font-size: clamp(1.5rem, 2.2vw, 2rem);
    font-weight: 500;
    line-height: 1.15;
}

.request-modal__lead {
    margin-top: -0.5rem;
    color: var(--bb-ink-soft);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.request-modal__row {
    display: grid;
    gap: 1.1rem 1.5rem;
}

.request-modal__hint {
    margin-top: -0.6rem;
    color: var(--bb-ink-soft);
    font-size: 0.8125rem;
    line-height: 1.4;
}

.request-modal__row--2 {
    grid-template-columns: 1fr 1fr;
}

/* Dates renders "09/09/26 → 09/11/26", a touch longer than a phone number
   or "2 Guests", so it gets a slightly bigger share of the row. */
.request-modal__row--3 {
    grid-template-columns: 0.95fr 1.1fr 0.95fr;
}

.field--wide {
    grid-column: 1 / -1;
}

.request-modal__row .field__label {
    white-space: nowrap;
}

/* Short screens (a 1920×945 laptop/browser window): the field sizes above
   grow with the viewport *width*, so a wide but short window gets the
   tallest fields with the least room. Cap them by height instead, so the
   whole form fits without scrolling. */
@media (max-height: 1100px) {
    .request-modal-overlay {
        padding-block: 1rem;
    }

    .request-modal {
        max-height: calc(100vh - 2rem);
        max-height: calc(100dvh - 2rem);
        border-width: 28px;
        border-image-width: 28px;
    }

    .request-modal__form {
        gap: min(1.6vh, 1rem);
        padding: min(2.6vh, 1.75rem) clamp(1.5rem, 3.5vw, 2.5rem);
    }

    .request-modal .field__label {
        margin-bottom: min(0.8vh, 0.5rem);
        font-size: min(0.94vw, 1.6vh, 0.9375rem);
    }

    .request-modal .field__input {
        padding-block: min(1.3vh, 0.85rem);
        font-size: min(1.05vw, 1.7vh, 1rem);
    }

    .request-modal textarea.field__input {
        height: 4.5em;
    }

    .request-modal .request__submit {
        padding-block: min(1.6vh, 1rem);
    }

    .request-modal .request__note {
        margin-top: 0;
        font-size: min(0.94vw, 1.5vh, 0.9375rem);
    }
}

/* Below this, "Phone / WhatsApp" starts to crowd a three-way split. */
@media (max-width: 760px) {
    .request-modal__row--3 {
        grid-template-columns: 1fr 1fr;
    }

    .request-modal__row--3 .field--guests {
        grid-column: 1 / -1;
    }
}

@media (max-width: 560px) {
    .request-modal__row--2,
    .request-modal__row--3 {
        grid-template-columns: 1fr;
    }

    .request-modal__row .field__label {
        white-space: normal;
    }
}
