/* Buttons on home page hero banner slides.
   Design: Docs/PublicSite/hero_banner_buttons_design.md

   Button size is tied to the picture's width (cqw = 1% of the picture), so
   the admin previews and the live banner look the same at any size. The live
   site adds a minimum so text never gets too small to read or tap.
   Default colours: site blue, white text, gold border. */

/* ---------- Live banner ---------- */

.hb-frame {
    position: relative;
}

/* Only slides with buttons get the frame; block display stops the small gap
   under an inline image from shifting the % positions. */
.hb-frame picture,
.hb-frame img {
    display: block;
}

.hb-layer {
    position: absolute;
    inset: 0;
    container-type: inline-size;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.3s ease;
}

/* Set by bannerButtons.blade.php until the slide's picture has loaded. */
.hb-layer.hb-wait {
    opacity: 0;
    visibility: hidden;
}

.hb-btn {
    position: absolute;
    left: var(--dx, 50%);
    top: var(--dy, 50%);
    transform: translate(-50%, -50%);
    pointer-events: auto;
    line-height: 1;
}

/* The look, shared by the live button (the link module's <a>) and the admin
   preview button (.hb-pbtn). !important beats the link module's own
   .cbtn-primary sizing and colours. */
.hb-btn a,
.hb-pbtn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0.65em 1.5em !important;
    font-size: max(13px, 1.05cqw) !important;
    font-weight: 600;
    line-height: 1.2 !important;
    white-space: nowrap;
    text-decoration: none !important;
    background: var(--hb-bg, #1a4d8f) !important;
    color: var(--hb-fg, #ffffff) !important;
    border: 0.12em solid var(--hb-bd, #f5cf5b) !important;
    border-radius: 0.4em !important;
    box-shadow: 0 0.15em 0.6em rgba(0, 0, 0, 0.25);
    transition: filter 0.15s ease;
}

.hb-btn a:hover,
.hb-btn a:focus-visible {
    filter: brightness(1.12);
}

.hb-btn a:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Image-type links: show the image itself, sized with the picture. */
.hb-btn a:has(img) {
    padding: 0 !important;
    background: none !important;
    border: 0 !important;
    box-shadow: none;
}

.hb-btn img {
    display: block;
    width: 14cqw;
    height: auto;
}

/* Phones held upright show the mobile picture, so they use the mobile
   positions (same rule as the <picture> in pages/resposiveImage.blade.php). */
@media (max-width: 780px) and (orientation: portrait) {
    .hb-btn {
        left: var(--mx, 50%);
        top: var(--my, 50%);
    }

    .hb-btn a {
        font-size: max(14px, 3.6cqw) !important;
        min-height: 44px;
    }

    .hb-btn img {
        width: 30cqw;
    }

    .hb-hide-m {
        display: none;
    }
}

/* ---------- Admin: Buttons area on each slide ---------- */

.hb-admin {
    clear: both;
    padding-top: 15px;
}

.hb-admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.hb-admin-head h5 {
    margin: 0;
    font-size: 15px;
}

.hb-admin .hb-add.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.hb-admin-note {
    color: #666;
    font-size: 13px;
    margin: 0 0 10px;
}

.hb-stages {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.hb-stage-wrap {
    flex: 0 0 auto;
}

.hb-stage-wrap.hb-sw-d {
    flex: 1 1 420px;
    max-width: 640px;
}

.hb-stage-wrap.hb-sw-m {
    width: 260px;
}

.hb-stage-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #555;
    margin-bottom: 4px;
}

.hb-stage {
    position: relative;
    container-type: inline-size;
    background: #e9edf2;
    border: 1px solid #c9d1db;
    min-height: 60px;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.hb-stage > img {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
}

.hb-stage .hb-pbtn {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: grab;
    font-size: 1.05cqw !important;
    outline: none;
}

.hb-stage.hb-m .hb-pbtn {
    font-size: 3.6cqw !important;
}

.hb-stage .hb-pbtn.hb-dragging {
    cursor: grabbing;
    filter: brightness(1.12);
}

.hb-stage .hb-pbtn.hb-sel,
.hb-stage .hb-pbtn:focus-visible {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #ff5200;
}

.hb-stage .hb-pbtn.hb-off {
    opacity: 0.3;
}

.hb-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hb-item {
    border: 1px solid #dde3ea;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: #fff;
}

.hb-item.hb-sel {
    border-color: #ff5200;
}

.hb-item-top {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    align-items: baseline;
    margin-bottom: 6px;
}

.hb-item-top strong {
    font-size: 14px;
}

.hb-item-top .hb-target {
    color: #666;
    font-size: 13px;
}

.hb-item-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: center;
    font-size: 13px;
    margin-top: 4px;
}

.hb-item-row label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-weight: normal;
}

.hb-item-row input[type="color"] {
    width: 34px;
    height: 26px;
    padding: 0 2px;
    border: 1px solid #ccc;
    cursor: pointer;
}

.hb-item-row input[type="number"] {
    width: 64px;
    padding: 2px 4px;
}

.hb-item-row a {
    cursor: pointer;
}

/* Link-module window opened from the Buttons area */
.hb-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 6vh 16px;
}

.hb-modal-box {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 760px;
    border-radius: 6px;
    padding: 24px 20px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.hb-modal-choose {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hb-modal-choose a {
    cursor: pointer;
}

/* ---------- Buttons in the scrolling marquee ---------- */

/* Link-module buttons typed into a marquee's text get the same gold outer
   border as the banner buttons, so buttons on the home page look alike. */
#page-content .marquee-wrap a.cbtn-primary {
    border: 0.12em solid #f5cf5b !important;
}

/* ---------- Header and footer button (e.g. Enquire Now) ---------- */

/* Same gold outer line as the banner buttons. Drawn as an inset shadow, not a
   border, so the button keeps exactly its current size and the header and
   footer layout doesn't shift. Only the text button; image buttons are left
   as they are. */
.button-header {
    box-shadow: inset 0 0 0 0.12em #f5cf5b;
}

/* ---------- Scrolling marquee ---------- */

/* Safari (iPhones and Macs) wrapped the scrolling message onto a second,
   empty line: the editor leaves an invisible character after a button, and
   Safari pushed it to a new line, so the strip over the banner grew by a
   whole line. A scrolling message is always one line, so keep it on one.
   Chrome never wrapped it, so nothing changes there. The fixed (static)
   marquee is not touched; it may wrap on purpose. */
.homepage .marquee .textmarquee,
.homepage .marquee .textmarquee p {
    white-space: nowrap;
}

/* Phones: the button sits on the middle of the text line. */
@media only screen and (max-width: 767px) and (orientation: portrait) {
    #page-content .marquee-wrap a.cbtn-primary {
        vertical-align: middle;
    }
}
