/* ============================================================
   Navbar layout — links centred, search on the right
   ============================================================ */

@media only screen and (min-width: 768px) {
    #bs-example-navbar-collapse-1 {
        display: flex !important;
        align-items: center;
        position: relative;       /* anchor for absolute-centred links */
        min-height: 61px;         /* match the navbar's natural height */
        padding-top: 0;
        padding-bottom: 0;
        /* Bootstrap's default padding-left/right: 15px — kept intentionally */
    }

    /* Nav links: truly centred regardless of what sits on either side */
    .navbar-center-links {
        position: absolute !important;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);  /* horizontal + vertical centering */
        float: none !important;
        margin: 0 !important;
        white-space: nowrap;
        display: flex;
        flex-direction: row;
    }

    /* Search form: flex-pushed to the far right */
    .navbar-search-outer {
        margin-left: auto;
        flex: 0 0 auto;
        padding: 0;
    }
}

/* ============================================================
   Search input
   ============================================================ */

.search-form-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#search-input {
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 400;
    height: 34px;
    width: 180px;
    padding: 6px 34px 6px 14px; /* 34px right keeps text clear of submit btn */
    border-radius: 17px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-align: center;
    box-shadow: none !important;
    outline: none;
    transition: width 0.25s ease, background 0.2s ease, border-color 0.2s ease;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 400;
}

/* Focus: expand, shift text left, slightly brighter ghost — NO solid white bg */
#search-input:focus {
    width: 240px;
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.55);
    color: #fff;
    text-align: left;
    outline: none;
}

#search-input:focus::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Submit button — small circle on the right edge of the input */
.search-submit-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.search-submit-btn:hover,
.search-submit-btn:focus {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.65);
    outline: none;
}

/* ---- Scrolled navbar (is-fixed / is-visible): white background ---- */

.navbar-custom.is-fixed #search-input,
.navbar-custom.is-visible #search-input {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.18);
    color: #333;
}

.navbar-custom.is-fixed #search-input::placeholder,
.navbar-custom.is-visible #search-input::placeholder {
    color: #aaa;
}

.navbar-custom.is-fixed #search-input:focus,
.navbar-custom.is-visible #search-input:focus {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.3);
    color: #333;
}

.navbar-custom.is-fixed #search-input:focus::placeholder,
.navbar-custom.is-visible #search-input:focus::placeholder {
    color: #bbb;
}

.navbar-custom.is-fixed .search-submit-btn,
.navbar-custom.is-visible .search-submit-btn {
    border-color: rgba(0, 0, 0, 0.2);
    color: rgba(0, 0, 0, 0.35);
}

.navbar-custom.is-fixed .search-submit-btn:hover,
.navbar-custom.is-visible .search-submit-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.75);
    border-color: rgba(0, 0, 0, 0.35);
}

/* ---- Mobile: navbar is white, so use dark input colours ---- */
@media only screen and (max-width: 767px) {
    .navbar-search-outer {
        padding: 8px 15px;
    }

    .search-form-wrapper {
        display: block;
        width: 100%;
    }

    #search-input {
        width: 100%;
        border-radius: 4px;
        background: rgba(0, 0, 0, 0.06);
        border-color: rgba(0, 0, 0, 0.18);
        color: #333;
        text-align: left;
        padding-left: 14px;
    }

    #search-input:focus {
        width: 100%;
        background: rgba(0, 0, 0, 0.09);
        border-color: rgba(0, 0, 0, 0.28);
        color: #333;
    }

    #search-input::placeholder {
        color: #aaa;
    }

    .search-submit-btn {
        border-color: rgba(0, 0, 0, 0.2);
        color: rgba(0, 0, 0, 0.35);
    }

    .search-submit-btn:hover {
        background: rgba(0, 0, 0, 0.07);
        color: rgba(0, 0, 0, 0.7);
    }
}

/* ============================================================
   Search Results Page  (/search/)
   ============================================================ */

.search-page-status {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #999;
    margin: 0 0 30px;
    padding-bottom: 18px;
    border-bottom: 2px solid #f0f0f0;
    line-height: 1.5;
}

.search-page-status strong {
    color: #404040;
}

.search-page-status em {
    color: #404040;
    font-style: italic;
}

.search-page-result {
    margin-bottom: 36px;
    padding-bottom: 36px;
    border-bottom: 1px solid #f0f0f0;
}

.search-page-result:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.search-page-title {
    font-family: 'Open Sans', sans-serif;
    font-weight: 800;
    font-size: 22px;
    margin: 0 0 7px;
    line-height: 1.3;
}

.search-page-title a {
    color: #404040;
    text-decoration: none;
}

.search-page-title a:hover {
    color: #0085a1;
}

.search-page-meta {
    font-family: 'Open Sans', sans-serif;
    font-size: 11px;
    color: #bbb;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.search-page-excerpt {
    font-family: 'Source Serif 4', 'Times New Roman', serif;
    font-size: 17px;
    color: #666;
    line-height: 1.7;
}

.search-page-excerpt p {
    margin: 0 0 12px;
}

.search-page-excerpt p:last-child {
    margin-bottom: 0;
}

.search-page-excerpt a {
    color: #0085a1;
    text-decoration: underline;
}

.search-page-excerpt code {
    font-family: monospace;
    font-size: 0.85em;
    background: #f5f5f5;
    padding: 1px 5px;
    border-radius: 3px;
}

.search-page-excerpt pre {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 0.82em;
    line-height: 1.5;
}

.search-page-excerpt ul,
.search-page-excerpt ol {
    padding-left: 24px;
    margin: 0 0 12px;
}

.search-page-excerpt li {
    margin-bottom: 4px;
}

/* Match the img-responsive behaviour applied to post images by clean-blog.js */
.search-page-excerpt img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ============================================================
   Sticky navbar — always visible when scrolled (≥1170px)
   clean-blog.js sets is-fixed (top:-61px) on scroll-down and
   is-visible (transform:translate3d(0,100%,0)) on scroll-up.
   Override both so the bar stays pinned at top:0.
   ============================================================ */
@media only screen and (min-width: 1170px) {
    .navbar-custom.is-fixed {
        top: 0 !important;
    }
    .navbar-custom.is-visible {
        -webkit-transform: none !important;
        transform: none !important;
    }
}

/* ============================================================
   Back to Top button
   ============================================================ */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0085a1;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s ease;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    padding: 0;
}

#back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

#back-to-top:hover,
#back-to-top:focus {
    background-color: #006f87;
    outline: none;
}
