/* 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;
    }
}


/* ==============================
   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;
}


.cmp_breadcrumbs {
    display: none !important;
}

.pkp_structure_sidebar .pkp_block {
    background: #f9f9f9;
    border: 1px solid #d9d9d9;
    padding: 18px;
    margin-bottom: 22px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}


/* Hide issue publication date */
.current_issue .obj_issue_toc .published {
    display: none !important;
}

/* Reduce space below issue information */
.current_issue .obj_issue_toc .heading {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
}

/* Remove unnecessary height and spacing */
.current_issue .obj_issue_toc {
    min-height: 0 !important;
}

.current_issue .obj_issue_toc .sections {
    margin-top: 15px !important;
    padding-top: 0 !important;
}

/* Reduce gap below issue title */
.current_issue .current_issue_title {
    margin-bottom: 10px !important;
}

/* EJALTEFL - Reduce current issue spacing */

.pkp_page_index .current_issue .obj_issue_toc .sections,
.pkp_page_index .current_issue .obj_issue_toc .sections:not(:first-child) {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Reduce space before Articles */
.pkp_page_index .current_issue .obj_issue_toc .section {
    margin-top: 0 !important;
    padding-top: 12px !important;
}

/* Keep the Articles divider aligned */
.pkp_page_index .current_issue .obj_issue_toc .section::before {
    top: 27px !important;
}

/* Reduce spacing after the issue heading */
.pkp_page_index .current_issue .obj_issue_toc .heading {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* =========================================
   EJALTEFL - Homepage cover and About
   OJS 3.5
   ========================================= */

/* Two-column homepage layout */
.pkp_page_index .page_index_journal {
    display: grid !important;
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 30px;
    row-gap: 0;
    align-items: start;
}

/* Other homepage sections take full width */
.pkp_page_index .page_index_journal > * {
    grid-column: 1 / -1;
    min-width: 0;
}

/* Cover image - left column */
.pkp_page_index .page_index_journal > .homepage_image {
    grid-column: 1 !important;
    grid-row: 1;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 0 25px !important;
    padding: 0 !important;
    overflow: visible !important;
    background: transparent !important;
}

/* Display complete portrait cover */
.pkp_page_index .page_index_journal
.homepage_image img {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    border: 1px solid #e4ded6;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* About the Journal - right column */
.pkp_page_index .page_index_journal > .homepage_about {
    grid-column: 2 !important;
    grid-row: 1;
    width: 100% !important;
    min-width: 0;
    margin: 0 0 25px !important;
    padding: 0 !important;
}

/* About heading */
.pkp_page_index .homepage_about h2 {
    color: #781d2b;
    font-size: 25px;
    margin: 0 0 15px !important;
}

/* Journal description */
.pkp_page_index .homepage_about p {
    font-size: 16px;
    line-height: 1.7;
    margin: 0 0 12px;
    text-align: left;
}

/* Current Issue remains below both columns */
.pkp_page_index .page_index_journal > .current_issue {
    grid-column: 1 / -1 !important;
    grid-row: auto;
    clear: both;
    margin-top: 15px !important;
}

/* Mobile responsiveness */
@media (max-width: 767px) {

    .pkp_page_index .page_index_journal {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 15px;
    }

    .pkp_page_index .page_index_journal
    > .homepage_image {
        grid-column: 1 !important;
        grid-row: auto;
        width: 200px !important;
        max-width: 100%;
        margin: 0 auto 10px !important;
    }

    .pkp_page_index .page_index_journal
    > .homepage_about {
        grid-column: 1 !important;
        grid-row: auto;
    }

    .pkp_page_index .page_index_journal
    > .current_issue {
        grid-column: 1 !important;
    }
}

.pkp_page_index .page_index_journal > .homepage_about {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove extra space around the cover */
.pkp_page_index .page_index_journal > .homepage_image {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Remove excess grid spacing */
.pkp_page_index .page_index_journal {
    row-gap: 0 !important;
}

/* Bring Current Issue closer to About */
.pkp_page_index .page_index_journal > .current_issue {
    margin-top: 10px !important;
    padding-top: 0 !important;
}


/* EJALTEFL - Force smaller About section text */

/* About the Journal heading */
.pkp_page_index .page_index_journal
section.homepage_about h2,
.pkp_page_index .page_index_journal
section.homepage_about .title {
    font-size: 28px !important;
    line-height: 1.3 !important;
}

/* All description text */
.pkp_page_index .page_index_journal
section.homepage_about .content,
.pkp_page_index .page_index_journal
section.homepage_about p {
    font-size: 14px !important;
    line-height: 1.5 !important;
}

/* Text formatting inside descriptions */
.pkp_page_index .page_index_journal
section.homepage_about p * {
    font-size: inherit !important;
    line-height: inherit !important;
}


/* EJALTEFL - Adjust sidebar width on desktop only */

@media (min-width: 992px) {

    /* Main content: 75% */
    .pkp_structure_content.has_sidebar
    > .pkp_structure_main {
        width: 75% !important;
        max-width: 75% !important;
        box-sizing: border-box !important;
    }

    /* Sidebar: 25% */
    .pkp_structure_content.has_sidebar
    > .pkp_structure_sidebar {
        width: 25% !important;
        max-width: 25% !important;
        box-sizing: border-box !important;
    }

    /* Keep sidebar images responsive */
    .pkp_structure_sidebar img {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* EJALTEFL: Prevent About text touching sidebar divider */
@media (min-width: 992px) {

    .pkp_page_index .page_index_journal {
        box-sizing: border-box !important;
        padding-right: 25px !important;
    }

    .pkp_page_index .homepage_about {
        min-width: 0 !important;
        overflow-wrap: break-word;
    }

    .pkp_page_index .homepage_about p {
        max-width: 100%;
        line-height: 1.5 !important;
    }
}

/* ==========================================
   EJALTEFL - Narrower Right Sidebar
   OJS 3.5 - Desktop Only
   ========================================== */

@media (min-width: 992px) {

    /* Main content - 75% */
    .pkp_structure_content.has_sidebar
    > .pkp_structure_main {
        width: 75% !important;
        max-width: 75% !important;
        box-sizing: border-box !important;
    }

    /* Right sidebar - 25% */
    .pkp_structure_content.has_sidebar
    > .pkp_structure_sidebar {
        width: 25% !important;
        max-width: 25% !important;
        box-sizing: border-box !important;
    }

    /* Keep sidebar images responsive */
    .pkp_structure_sidebar img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Prevent main content from overflowing */
    .pkp_structure_main {
        min-width: 0 !important;
    }
}
