/* ==========================================================================
   DESKTOP NAVIGATION & SEARCH CUSTOMIZATION (THEME: MORDEN)
   ========================================================================== */
@media (min-width: 768px) {

    /* 1. Make menu names smaller and lighter */
    .main-navigation ul li a,
    .main-navigation a,
    .site-header .main-navigation a {
        font-size: 14px !important;    /* Decreased text size */
        font-weight: 400 !important;   /* Thinned font profile */
        letter-spacing: 0.05em;        /* Optional: Cleans up compressed letters */
    }

    /* 3. Forces the master header row to treat search and menus as single line elements */
    .site-header .header-navigation-wrapper,
    .site-header-main,
    .header-blocks-wrapper {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
    }

    /* Pulls search block into the immediate tracking line of the menu */
    .site-header .wp-block-search,
    .site-header form.search-form {
        margin: 0 0 0 20px !important; /* Moves it cleanly right after 'Contact' */
        display: inline-block !important;
        vertical-align: middle !important;
    }

   /* 2. Shrink search box container tightly around the lens icon */
.site-header .wp-block-search__inside-wrapper,
.site-header .search-form .search-fields {
    max-width: 42px !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    background: #3a3a3a !important;
    border: 1px solid #4a4a4a !important;
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Search input text */
.site-header .wp-block-search__input,
.site-header input[type="search"].search-field {
    color: #f2f2f2 !important;
    background: transparent !important;
}

/* Search icon/button */
.site-header .wp-block-search__button,
.site-header button.search-submit {
    color: #f2f2f2 !important;
    background: transparent !important;
    border: none !important;
}

    /* Format the core input field */
    .site-header .wp-block-search__input,
    .site-header input[type="search"].search-field {
        width:100% !important;
        max-width: 0px !important;     /* Hides the text track behind the button natively */
        padding: 6px 0px !important;   /* Minimal desktop block profile */
        border: none !important;
        background: transparent !important;
    }

    /* Keep the lens visible and centered within the tight frame */
.site-header .wp-block-search__button,
.site-header button.search-submit {
    background: transparent !important;
    color: #f2f2f2 !important;
    padding: 6px 12px !important;
    margin: 0 !important;
    min-width: 42px !important;
    cursor: pointer;
    border: none !important;
}
    /* Optional UX: Expands smoothly when clicked/focused so users can type naturally */
    .site-header .wp-block-search__inside-wrapper:focus-within,
    .site-header .search-form:focus-within {
        max-width: 180px !important;
    }
    
    .site-header .wp-block-search__inside-wrapper:focus-within .wp-block-search__input,
    .site-header .search-form:focus-within input[type="search"].search-field {
        max-width: 130px !important;
        padding-left: 10px !important;
    }
}
/* ==========================================================================
   UPDATED NAVIGATION, HALF-SIZE LOGO & ULTRA-COMPACT SEARCH (THEME: MORDEN)
   ========================================================================== */
@media (min-width: 768px) {

    /* 1. Scale down logo width and height by 50% */
    .site-branding .site-logo img,
    .custom-logo-link img,
    .site-header .site-logo {
        max-width: 80px !important;    /* Forces the logo box to half its default size */
        height: auto !important;
    }

    /* 2. Style menu text items to be smaller and thinner */
    .main-navigation ul li a,
    .main-navigation a,
    .site-header .main-navigation a {
        font-size: 13px !important;    
        font-weight: 400 !important;   
        letter-spacing: 0.03em;        
    }

    /* 3. Force header sections onto a single row following the menu items */
    .site-header .header-navigation-wrapper,
    .site-header-main,
    .header-blocks-wrapper {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        flex-wrap: nowrap !important;
    }

    /* 4. Shift search block container immediately after the 'Contact' menu link */
    .site-header .wp-block-search,
    .site-header form.search-form {
        margin: 0 0 0 15px !important; 
        display: inline-block !important;
        vertical-align: middle !important;
    }

    /* 5. Force the search background block down to lens-only size */
    .site-header .wp-block-search__inside-wrapper,
    .site-header .search-form .search-fields {
        max-width: 40px !important;    /* Tight box boundary eliminates the remaining white gap */
        width: 40px !important;
        border-radius: 4px;
        overflow: hidden;
        background: #ffffff;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    /* Collapse the inner text entry space completely behind the lens icon */
    .site-header .wp-block-search__input,
    .site-header input[type="search"].search-field {
        width: 0px !important;
        max-width: 0px !important;     
        padding: 0px !important;       
        border: none !important;
        background: transparent !important;
    }

    /* Center-align the search lens cleanly inside the small box profile */
    .site-header .wp-block-search__button,
    .site-header button.search-submit {
        background: transparent !important;
        color: #000000 !important;
        padding: 6px !important;
        margin: 0 !important;
        width: 40px !important;
        min-width: 40px !important;
        height: 34px !important;
        cursor: pointer;
    }

    /* Optional: Automatically expands to text box size when actively clicked */
    .site-header .wp-block-search__inside-wrapper:focus-within {
        max-width: 80px !important;
        width: 80px !important;
    }
    .site-header .wp-block-search__inside-wrapper:focus-within .wp-block-search__input {
        width: 80px !important;
        max-width: 80px !important;
        padding: 6px 10px !important;
    }
}
/* ==========================================================================
   FORCE STRIPPED OVERRIDES FOR MORDEN BLOCK TEMPLATES
   ========================================================================== */

/* 1. BRING LOGO WIDTH AND HEIGHT TO 50% */
.wp-block-site-logo img, 
.site-logo img, 
a.custom-logo-link img {
    width: 60px !important;
    max-width: 60px !important;
    height: auto !important;
}

/* 2. MAKE MENU NAMES SMALLER AND LIGHTER */
.wp-block-navigation-item__content,
.main-navigation a,
.wp-block-navigation .wp-block-navigation-item a {
    font-size: 13px !important;
    font-weight: 400 !important;
    letter-spacing: 0.02em !important;
    text-transform: uppercase !important;
}

/* 3. ALIGN EVERYTHING AND FORCE ULTRA-SMALL SEARCH BOX FOOTPRINT */

/* Force search block to inline status directly following the navigation link */
.wp-block-search, 
form.wp-block-search {
    display: inline-block !important;
    margin-left: 15px !important;
    margin-bottom: 0 !important;
    vertical-align: middle !important;
    width: auto !important;
}

/* Hard constraint on the wrapper to keep the white frame small */
.wp-block-search__inside-wrapper {
    max-width: 38px !important;
    width: 38px !important;
    height: 34px !important;
    border: none !important;
    background: #3a3a3a !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Remove text input box visibility from expanding the layout width */
input.wp-block-search__input {
    width: 0px !important;
    max-width: 0px !important;
    padding: 0px !important;
    border: none !important;
    background: transparent !important;
    pointer-events: none; /* Disables clicking transparent entry box until toggled */
}

/* Size and center lens button container perfectly inside the tight square box */
button.wp-block-search__button {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    color: #111111 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* OPTIONAL: Expand input layout only when actively clicked to allow text entry */
.wp-block-search__inside-wrapper:focus-within {
    max-width: 180px !important;
    width: 180px !important;
}
.wp-block-search__inside-wrapper:focus-within input.wp-block-search__input {
    width: 135px !important;
    max-width: 135px !important;
    padding: 0 8px !important;
    background: #ffffff !important;
    pointer-events: auto;
}
/* Fix the layout structure to force a single line alignment */
.site-header .wp-block-group,
.site-header .header-inner,
.site-header-main,
.header-navigation-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;     /* Centers search button with menu text */
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
}

/* Force shrink the search box wrapper container */
.site-header .wp-block-search,
form.wp-block-search,
.site-header .wp-block-search__inside-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 42px !important;            /* Hard width limits box to icon size */
    max-width: 42px !important;
    min-width: 42px !important;
    height: 36px !important;
    margin: 0 0 0 15px !important;     /* Horizontal gap spacing after CONTACT */
    padding: 0 !important;
}

/* Remove the long white typing section causing the width stretch */
.site-header input.wp-block-search__input {
    display: none !important;          /* Hides the typing field completely */
    width: 0px !important;
}

/* Center and square the button icon container */
.site-header button.wp-block-search__button {
    width: 42px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
/* ==========================================================================
   FORCE ALIGNMENT AND COMPACT BUTTON FIX
   ========================================================================== */

/* 1. Forces the menu element row to align with the search form wrapper */
.site-header-main,
.header-navigation-wrapper,
header.site-header .wp-block-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;     /* Direct vertical centering constraint */
    justify-content: flex-end !important;
    flex-wrap: nowrap !important;
}

/* 2. Shrink the primary structural container of the search form */
.site-header .wp-block-search, 
header .wp-block-search,
form.wp-block-search {
    display: inline-block !important;
    width: 42px !important;            /* Hard lock fixing the massive box width */
    max-width: 42px !important;
    min-width: 42px !important;
    height: 36px !important;
    margin: 0 0 0 15px !important;     /* Moves it directly right of CONTACT */
    vertical-align: middle !important;
}

/* 3. Forces the inner white box block to shrink around the lens */
.site-header .wp-block-search__inside-wrapper,
div.wp-block-search__inside-wrapper {
    width: 42px !important;
    max-width: 42px !important;
    height: 36px !important;
    background: #ffffff !important;
    border-radius: 4px !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;     /* Centers lens vertically */
    justify-content: center !important;  /* Centers lens horizontally */
    overflow: hidden !important;
}

/* 4. Completely drop the visibility of the hidden field text track */
.site-header input.wp-block-search__input,
.wp-block-search__inside-wrapper input[type="search"] {
    display: none !important;          /* Remits the element causing the stretch */
    width: 0px !important;
    visibility: hidden !important;
}

/* 5. Keeps the magnifying button centered inside the small profile */
.site-header button.wp-block-search__button,
div.wp-block-search button.wp-block-search__button {
    width: 42px !important;
    max-width: 42px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
/* ==========================================================================
   BRUTE-FORCE SEARCH CONTAINER FIX (THE RAN NETWORK)
   ========================================================================== */

/* 1. Force the massive white container to shrink tightly around the magnifying glass */
header .wp-block-search__inside-wrapper,
.site-header-main .wp-block-search__inside-wrapper,
div.wp-block-search__inside-wrapper {
    width: 40px !important;
    max-width: 40px !important;
    min-width: 40px !important;
    height: 34px !important;
    background-color: #ffffff !important;
    border-radius: 4px !important;
    padding: 0 !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;     /* Force centers lens vertically */
    justify-content: center !important;  /* Force centers lens horizontally */
    overflow: hidden !important;
}

/* 2. Completely eliminate the broad text-typing gap stretching the bar */
header .wp-block-search__input,
.site-header-main input[type="search"] {
    display: none !important;           /* Deletes the wide input box area */
    width: 0px !important;
    visibility: hidden !important;
}

/* 3. Force the parent block to pull inline right after CONTACT and align perfectly */
header .wp-block-search,
.site-header-main form.wp-block-search {
    display: inline-flex !important;
    align-items: center !important;     /* Centers the entire element row with text */
    vertical-align: middle !important;
    width: 40px !important;
    max-width: 40px !important;
    margin: 0 0 0 15px !important;      /* Moves it comfortably past CONTACT */
}

/* 4. Ensure the actual lens button sits squared inside the white frame */
header button.wp-block-search__button {
    width: 40px !important;
    height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
/* Force vertical center alignment by offsetting the search form block */
.wp-block-search, 
form.wp-block-search,
.wp-block-search__inside-wrapper {
    display: inline-block !important;
    vertical-align: middle !important;
    transform: translateY(2px) !important; /* Moves the box up or down to hit the dead center */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}
/* HOME CAROUSEL: portrait book-cover ratio, no distortion */
.ran-carousel-card > img {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 2 / 3 !important;
    height: auto !important;
    object-fit: cover !important;
    object-position: center center !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* MOBILE HAMBURGER MENU: right-side button links */
@media (max-width: 767px) {

    .site-header .main-navigation,
    .site-header .main-navigation ul,
    .site-header .main-navigation .menu,
    .site-header .main-navigation .nav-menu {
        background: transparent !important;
        text-align: right !important;
    }

    .site-header .main-navigation ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        padding-right: 24px !important;
    }

    .site-header .main-navigation li {
        list-style: none !important;
        margin: 5px 0 !important;
    }

   .site-header .main-navigation a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    width: 240px !important;      /* all buttons same width */
    min-height: 54px !important;  /* all buttons same height */

    background: #3a3a3a !important; /* dark grey */
    color: #f2f2f2 !important;      /* off-white */

    padding: 0 15px !important;
    border-radius: 6px !important;

    font-weight: 700 !important;
    text-decoration: none !important;
    text-align: center !important;

    box-sizing: border-box !important;
}
}
/* MOBILE MENU SEARCH BOX: match dark button style */
@media (max-width: 767px) {

    .site-header .main-navigation .wp-block-search,
    .site-header .main-navigation form.wp-block-search,
    .site-header .main-navigation .wp-block-search__inside-wrapper {
        background: #3a3a3a !important;
        background-color: #3a3a3a !important;
        border: 1px solid #4a4a4a !important;
        border-radius: 6px !important;
        box-shadow: none !important;
    }

    .site-header .main-navigation .wp-block-search__button,
    .site-header .main-navigation button.wp-block-search__button,
    .site-header .main-navigation button.search-submit {
        background: transparent !important;
        background-color: transparent !important;
        color: #f2f2f2 !important;
        border: none !important;
    }

    .site-header .main-navigation .wp-block-search__input,
    .site-header .main-navigation input[type="search"] {
        background: transparent !important;
        color: #f2f2f2 !important;
        border: none !important;
    }
}
/* EMERGENCY FIX: restore working search input */
.site-header .wp-block-search__input,
.site-header input[type="search"],
.site-header input.search-field {
    display: inline-block !important;
    visibility: visible !important;
    pointer-events: auto !important;
    width: 130px !important;
    max-width: 130px !important;
    padding: 6px 10px !important;
    color: #f2f2f2 !important;
    background: transparent !important;
}

.site-header .wp-block-search,
.site-header form.wp-block-search,
.site-header .wp-block-search__inside-wrapper {
    width: auto !important;
    max-width: none !important;
    min-width: 180px !important;
}

.site-header .wp-block-search__button,
.site-header button.search-submit {
    display: inline-flex !important;
    pointer-events: auto !important;
}
/* SEARCH RESULTS PAGE: compact 3-column publishing-style grid */

body.search .site-main {
    max-width: 1100px !important;
    margin: 0 auto !important;
    padding: 40px 24px !important;
}

body.search .page-header,
body.search .page-title {
    text-align: center !important;
    margin-bottom: 35px !important;
}

/* Result cards */
body.search .site-main article {
    display: inline-block !important;
    vertical-align: top !important;
    width: 22% !important;
    margin: 0 1.5% 40px 1.5% !important;

    background: #ffffff !important;
    border: 1px solid #e5e5e5 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08) !important;

    padding-bottom: 18px !important;
}

/* Cover images */
body.search .site-main article img {
    width: 100% !important;
    aspect-ratio: 2 / 3 !important;
    height: auto !important;
    object-fit: cover !important;
    display: block !important;
}

/* Book titles */
body.search .site-main article .entry-title {
    font-size: 16px !important;
    line-height: 1.25 !important;
    padding: 10px 10px 10px 10px !important;
    margin: 0 !important;
    color: #111111 !important;
}

body.search .site-main article .entry-title a {
    color: #111111 !important;
    text-decoration: none !important;
}

/* Snippet text */
body.search .site-main article .entry-summary,
body.search .site-main article .entry-content,
body.search .site-main article p {
    font-size: 14px !important;
    line-height: 1.6 !important;

    padding: 0 22px !important;
    margin: 12px 0 0 0 !important;

    display: -webkit-box !important;
    -webkit-line-clamp: 10 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Mobile */
@media (max-width: 767px) {
    body.search .site-main article {
        width: 100% !important;
        margin: 0 0 28px 0 !important;
    }
}
/* FORCE NARROW SEARCH RESULT PADDING */
body.search .site-main article .entry-summary,
body.search .site-main article .entry-content,
body.search .site-main article p {
    padding-left: 8px !important;
    padding-right: 8px !important;
}