/* The European Journal of Applied Linguistics and TEFL — OJS journal stylesheet
   Purpose:
   - keep the journal title clear of the search bar
   - place the journal title on exactly two desktop lines
   - move the search bar upward
   - keep the navigation bar unchanged in function
   - provide a stable four-column footer with a graceful fallback
   - use a refined Academic Navy + Burgundy + Soft Ivory + Gold colour palette

   Upload in OJS: Website > Appearance > Advanced > Journal Style Sheet
*/

/* ==============================
   HEADER
   ============================== */

/* Colour palette
   Deep teal: #7B1E2B
   Dark teal: #55131D
   Title teal: #173F5F
   Sage: #D7C7A3
   Warm ivory: #FFFDF7
   Accent gold: #D3A84B
*/

.pkp_structure_head {
    background: linear-gradient(103deg, #FFFDF7 0%, #fff 28%, #F8F4EA 51%, #EEF2F3 77%, #F5F1E8 100%) !important;
    border-bottom: 0 !important;
}

.pkp_structure_head .pkp_site_name .is_text {
    color: #173F5F !important;
    text-decoration: none !important;
}

@media (min-width: 992px) {
    .pkp_structure_head .pkp_head_wrapper {
        position: relative !important;
        padding: 8px 2.1% 0 !important;
    }

    /* Extra vertical room: search sits above, title sits below it. */
    .pkp_structure_head .pkp_site_name_wrapper {
        height: auto !important;
        min-height: 112px !important;
        padding: 42px 0 12px !important;
        box-sizing: border-box !important;
    }

    .pkp_structure_head .pkp_site_name {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 18px !important;
        box-sizing: border-box !important;
        text-align: left !important;
    }

    /*
       The visible desktop title is rebuilt from the existing journal-name link.
       The original OJS title remains in the HTML/link for accessibility and SEO,
       while these two generated lines control only its visual presentation.
    */
    .pkp_structure_head .pkp_site_name .is_text {
        display: block !important;
        width: auto !important;
        max-width: 720px !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 0 !important;
        line-height: 1 !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .pkp_structure_head .pkp_site_name .is_text::before {
        content: "THE EUROPEAN JOURNAL";
        display: block;
        color: #173F5F;
        font-size: 25px;
        font-weight: 700;
        line-height: 1.05;
        letter-spacing: .3px;
    }

    .pkp_structure_head .pkp_site_name .is_text::after {
        content: "OF APPLIED LINGUISTICS AND TEFL";
        display: block;
        margin-top: 5px;
        color: #48697F;
        font-size: 17px;
        font-weight: 600;
        line-height: 1.15;
        letter-spacing: .15px;
    }

    .pkp_structure_head .pkp_navigation_user_wrapper {
        top: 6px !important;
    }

    .pkp_structure_head .pkp_navigation_primary_row {
        min-height: 50px !important;
    }

    .pkp_structure_head .pkp_navigation_primary_wrapper {
        position: static !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 6px 18px !important;
        width: 100% !important;
    }

    .pkp_structure_head .pkp_navigation_primary {
        display: flex !important;
        flex-wrap: wrap !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: none !important;
        justify-content: flex-start !important;
    }

    .pkp_structure_head .pkp_navigation_primary > li > a {
        padding: 6px 18px !important;
        color: #fff !important;
    }

    /* Search bar moved to the top of the header, clear of the title. */
    .pkp_structure_head .pkp_navigation_search_wrapper {
    position: static !important;
    display: flex !important;
    flex: 0 0 250px !important;
    width: 250px !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    float: none !important;
    transform: none !important;
    align-items: center !important;
}

.pkp_structure_head .pkp_navigation_search_wrapper a {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 8px 14px !important;

    border: 1px solid rgba(255,255,255,.55) !important;
    border-radius: 4px !important;

    background: #ffffff !important;
    color: #7B1E2B !important;

    font-size: 15px !important;
    text-align: left !important;
    white-space: nowrap !important;
}

    .pkp_structure_head .pkp_navigation_search_wrapper a {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
        margin: 0 !important;
        padding: 8px 14px !important;
        border: 1px solid #D7C7A3 !important;
        border-radius: 5px;
        background: rgba(255, 255, 255, .96) !important;
        color: #173F5F !important;
        font-size: 16px !important;
        text-align: left;
        white-space: nowrap !important;
    }

    .pkp_structure_head::after {
        display: none !important;
        content: none !important;
        height: 0 !important;
    }

    .pkp_structure_head .pkp_site_nav_menu,
    .pkp_structure_head .pkp_navigation_primary_row {
        background: #7B1E2B !important;
        background-image: none !important;
    }

    .pkp_structure_head .pkp_navigation_primary > li,
    .pkp_structure_head .pkp_navigation_primary > li:last-child {
        border-color: rgba(255, 255, 255, .35) !important;
    }

    .pkp_structure_head .pkp_navigation_primary > li > a:hover,
    .pkp_structure_head .pkp_navigation_primary > li > a:focus {
        background: #55131D !important;
        color: #fff !important;
        border-bottom-color: #fff !important;
    }

    .pkp_structure_head .pkp_navigation_search_wrapper a:hover,
    .pkp_structure_head .pkp_navigation_search_wrapper a:focus {
        background: #fff !important;
        border-color: #173F5F !important;
        color: #173F5F !important;
    }

    /* Dropdowns have white backgrounds, so their text remains teal. */
    .pkp_structure_head .pkp_navigation_primary ul a,
    .pkp_structure_head .pkp_navigation_primary ul a:hover,
    .pkp_structure_head .pkp_navigation_primary ul a:focus {
        color: #173F5F !important;
    }

    .pkp_structure_head .pkp_navigation_primary ul a:hover,
    .pkp_structure_head .pkp_navigation_primary ul a:focus {
        background: #F8F5ED !important;
    }
}

/* Normal mobile/tablet title behaviour. */
@media (max-width: 991px) {
    .pkp_structure_head .pkp_site_name .is_text {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        line-height: 1.2 !important;
    }
}

/* ==============================
   PUBLIC PAGE WIDTH
   ============================== */

@media (min-width: 992px) {
    .pkp_structure_content {
        box-sizing: border-box;
        width: calc(100% - 48px) !important;
        max-width: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .pkp_structure_content:not(.has_sidebar) > .pkp_structure_main:first-child:last-child {
        box-sizing: border-box;
        width: 100% !important;
        max-width: none !important;
    }

    .pkp_structure_content:not(.has_sidebar) > .pkp_structure_main:first-child:last-child::before {
        left: 0 !important;
    }

    .pkp_structure_content:not(.has_sidebar) > .pkp_structure_main:first-child:last-child::after {
        left: auto !important;
        right: 0 !important;
    }

    .pkp_page_index .pkp_structure_content {
        padding-top: 54px !important;
        margin-top: 0 !important;
    }

    .pkp_page_index .pkp_structure_main,
    .pkp_page_index .page_index_journal {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
}

/* ==============================
   HOMEPAGE COVER
   ============================== */

.pkp_page_index .page_index_journal .homepage_image {
    position: relative;
    overflow: hidden;
    background: #173F5F;
}

.pkp_page_index .page_index_journal .homepage_image img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 350px !important;
    object-fit: cover;
    object-position: center center;
}

.pkp_page_index .page_index_journal .homepage_image::before {
    content: "The European Journal";
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    padding: 0 clamp(24px, 5vw, 80px);
    background: linear-gradient(90deg, rgba(23, 70, 65, .84), rgba(23, 70, 65, .34) 58%, transparent 85%);
    color: #fff;
    font-family: Georgia, serif;
    font-size: clamp(28px, 3.4vw, 54px);
    font-weight: 700;
    line-height: 1.15;
    text-shadow: 0 2px 5px rgba(0, 0, 0, .6);
    pointer-events: none;
}

.pkp_page_index .page_index_journal .homepage_image::after {
    content: "of Applied Linguistics and TEFL";
    position: absolute;
    z-index: 2;
    top: calc(50% + 46px);
    left: clamp(24px, 5vw, 80px);
    max-width: min(720px, 78%);
    color: #fff;
    font-size: clamp(16px, 1.55vw, 23px);
    line-height: 1.4;
    text-shadow: 0 2px 5px rgba(0, 0, 0, .75);
    pointer-events: none;
}

@media (max-width: 767px) {
    .pkp_page_index .page_index_journal .homepage_image img {
        height: 260px !important;
    }

    .pkp_page_index .page_index_journal .homepage_image::before {
        align-items: flex-start;
        padding-top: 68px;
        background: linear-gradient(90deg, rgba(23, 70, 65, .88), rgba(23, 70, 65, .36));
    }

    .pkp_page_index .page_index_journal .homepage_image::after {
        top: 163px;
        max-width: calc(100% - 48px);
    }
}

/* ==============================
   FOOTER
   ============================== */

.pkp_structure_footer_wrapper {
    background: #7B1E2B !important;
    border-top: 4px solid #D3A84B;
}

.pkp_structure_footer {
    width: calc(100% - 48px) !important;
    max-width: 1350px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.pkp_footer_content {
    box-sizing: border-box !important;
    width: 100% !important;
    padding: 38px 0 26px !important;
    color: #fff !important;
}

/* Support both existing custom footer wrapper classes for compatibility. */
.pkp_footer_content .lc-footer,
.pkp_footer_content .tar-footer {
    display: grid !important;
    grid-template-columns: minmax(260px, 1.7fr) repeat(3, minmax(160px, 1fr)) !important;
    gap: 34px !important;
    align-items: start !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.pkp_footer_content .lc-footer > *,
.pkp_footer_content .tar-footer > * {
    min-width: 0 !important;
    margin-top: 0 !important;
}

.pkp_footer_content h2,
.pkp_footer_content h3,
.pkp_footer_content .lc-footer h2,
.pkp_footer_content .tar-footer h2 {
    margin: 0 0 14px !important;
    color: #fff !important;
    font-size: 19px !important;
    line-height: 1.3 !important;
}

.pkp_footer_content p,
.pkp_footer_content li {
    color: #fff !important;
    line-height: 1.6 !important;
}

.pkp_footer_content p {
    margin: 0 0 10px !important;
}

.pkp_footer_content ul {
    margin-top: 0 !important;
    padding-left: 20px !important;
}

.pkp_footer_content a,
.pkp_footer_content a:visited {
    color: #fff !important;
    text-decoration: none !important;
}

.pkp_footer_content a:hover,
.pkp_footer_content a:focus {
    color: #fff !important;
    text-decoration: underline !important;
}

/*
   Fallback for footer HTML that was pasted without .lc-footer/.tar-footer.
   This changes the long single vertical footer into balanced newspaper-style
   columns without requiring a theme plugin.
*/
@media (min-width: 992px) {
    .pkp_footer_content:not(:has(.lc-footer)):not(:has(.tar-footer)) {
        column-count: 4;
        column-gap: 38px;
        column-rule: 1px solid rgba(255, 255, 255, .12);
    }

    .pkp_footer_content:not(:has(.lc-footer)):not(:has(.tar-footer)) > * {
        break-inside: avoid;
        -webkit-column-break-inside: avoid;
    }

    .pkp_footer_content:not(:has(.lc-footer)):not(:has(.tar-footer)) h2,
    .pkp_footer_content:not(:has(.lc-footer)):not(:has(.tar-footer)) h3 {
        break-after: avoid-column;
        -webkit-column-break-after: avoid;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .pkp_footer_content .lc-footer,
    .pkp_footer_content .tar-footer {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 28px !important;
    }

    .pkp_footer_content:not(:has(.lc-footer)):not(:has(.tar-footer)) {
        column-count: 2;
        column-gap: 28px;
    }
}

@media (max-width: 767px) {
    .pkp_structure_footer {
        width: calc(100% - 32px) !important;
    }

    .pkp_footer_content .lc-footer,
    .pkp_footer_content .tar-footer {
        grid-template-columns: 1fr !important;
        gap: 22px !important;
    }

    .pkp_footer_content:not(:has(.lc-footer)):not(:has(.tar-footer)) {
        column-count: 1;
    }
}

.pkp_structure_footer .pkp_brand_footer {
    display: none !important;
}

.pkp_footer_content img {
    max-width: 210px !important;
    height: auto !important;
}

/* ==============================
   HOMEPAGE ARTICLE GRID
   ============================== */

.pkp_page_index .current_issue .cmp_article_list.articles {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    padding: 0;
    list-style: none;
}

.pkp_page_index .current_issue .cmp_article_list.articles > li {
    min-width: 0;
    margin: 0 !important;
    padding: 20px !important;
    background: #fff;
    border: 1px solid #E5DDD0;
    border-radius: 8px;
    overflow-wrap: anywhere;
}

.pkp_page_index .current_issue .cmp_article_list.articles > li:nth-child(n+9) {
    display: none;
}

@media (min-width: 768px) and (max-width: 1199px) {
    .pkp_page_index .current_issue .cmp_article_list.articles {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .pkp_page_index .current_issue .cmp_article_list.articles {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   EJALTEFL FIX — uploaded logo + visible journal title
   ========================================================== */

@media (min-width: 992px) {
    .pkp_structure_head {
    background: #D3A84B !important;
}

    .pkp_structure_head .pkp_site_name_wrapper {
        min-height: 150px !important;
        padding: 16px 0 14px !important;
    }

    .pkp_structure_head .pkp_site_name {
        display: flex !important;
        align-items: center !important;
        gap: 28px !important;
        width: 100% !important;
        padding: 0 28px !important;
        text-align: left !important;
    }

    /* Restore uploaded journal logo */
    .pkp_structure_head .pkp_site_name .is_img {
        display: block !important;
        flex: 0 0 190px !important;
        width: 190px !important;
        max-width: 190px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    .pkp_structure_head .pkp_site_name .is_img img {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 185px !important;
        max-height: 122px !important;
        margin: 0 auto !important;
        object-fit: contain !important;
    }

    /*
     * When OJS uses a logo image it does not render .is_text.
     * Build the journal title beside the logo from the image link.
     */
    .pkp_structure_head .pkp_site_name .is_img::after {
        content: "The European Journal of\A Applied Linguistics and TEFL";
        white-space: pre;
        position: absolute;
        left: 245px;
        top: 37px;
        color: #173F5F;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 29px;
        font-weight: 700;
        line-height: 1.18;
        letter-spacing: .15px;
        text-align: left;
    }

    /* Search stays above and clear of logo/title */
    .pkp_structure_head .pkp_navigation_search_wrapper {
        top: 5px !important;
        width: min(31vw, 420px) !important;
    }

    .pkp_structure_head .pkp_navigation_search_wrapper a {
        border-color: #D7C7A3 !important;
        color: #173F5F !important;
        background: rgba(255,255,255,.98) !important;
    }

    /* Strongly visible new navigation colour */
    .pkp_structure_head .pkp_site_nav_menu,
    .pkp_structure_head .pkp_navigation_primary_row {
        background: #7B1E2B !important;
        background-image: none !important;
    }

    .pkp_structure_head .pkp_navigation_primary > li > a {
        color: #FFFFFF !important;
    }

    .pkp_structure_head .pkp_navigation_primary > li > a:hover,
    .pkp_structure_head .pkp_navigation_primary > li > a:focus {
        background: #55131D !important;
        color: #FFFFFF !important;
        border-bottom-color: #D3A84B !important;
    }
}

/* Uploaded-logo support on tablets and phones */
@media (max-width: 991px) {
    .pkp_structure_head .pkp_site_name .is_img {
        display: block !important;
        text-align: center !important;
    }

    .pkp_structure_head .pkp_site_name .is_img img {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 160px !important;
        max-height: 110px !important;
        margin: 0 auto !important;
    }

    .pkp_structure_head .pkp_site_name .is_img::after {
        content: "The European Journal of Applied Linguistics and TEFL";
        display: block;
        margin: 7px auto 0;
        color: #173F5F;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.2;
        text-align: center;
    }

    .pkp_structure_head .pkp_site_nav_menu,
    .pkp_structure_head .pkp_navigation_primary_row {
        background: #7B1E2B !important;
    }
}

/* Footer in matching burgundy with gold accent */
.pkp_structure_footer_wrapper {
    background: #7B1E2B !important;
    border-top-color: #D3A84B !important;
}
