/* ============= GENERAL STYLES ============= */
body {
    margin: 0 5%; 
    padding: 0;
    overflow-x: hidden; 
}

/* Fixes the invisible margin added by the <blockquote> tags in your HTML */
blockquote {
    margin: 0;
    padding: 0;
}

.border {
    width: 100%; 
    max-width: 750px; 
    margin: auto; 
    border: 1px solid #BC0000; 
    overflow-x: hidden; 
    box-sizing: border-box; 
    background-color: #ffffff; 
}

li {
    padding: 5px 10px;
    font-size: 1.2em; 
}

h1, h1.frontpage, h4.frontpage {
    color: #BC0000;
}

span.lightCoral {
    color: #BC0000;
}

/* ============= TYPOGRAPHY & READABILITY ============= */
p.current_default {
    font-family: Arial, sans-serif;
    font-size: 14.0pt;
    line-height: 17.0pt;
    margin: 2.5px;
    padding-bottom: 4px;
    padding-left: 4%;
    padding-right: 4%;
    padding-top: 5px;
    text-align: right;
    text-indent: 6pt;
}

p.writer_works_title {
    font-family: Arial, sans-serif;
    font-size: 13.0pt;
}

p.translator_introduction {
    font-family: Arial, sans-serif;
    font-size: 11.0pt;
}

p.information {
    text-align: right;
}

/* ============= MODERN NAVIGATION MENUS ============= */
.top-menu {
    background-color: transparent; 
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.bottom-menu {
    background-color: transparent; 
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 20px;
    margin-top: 20px;
    width: 100%;
    box-sizing: border-box;
}

.bottom-menu .menu-links {
    width: 100%;
}

.bottom-menu .menu-links ul li {
    flex: 1; 
    text-align: center; 
    margin: 0 10px; 
    display: flex;
    justify-content: center; 
    align-items: center; 
    line-height: 1.4; 
}

.menu-links ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-grow: 1;
}

.menu-links ul li {
    margin-right: 20px; 
}

.menu-links ul li a {
    color: #660000;
    text-decoration: none;
    padding: 5px 2px;
    font-size: 1.15em;
    font-weight: bold;
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    border-bottom: 2px solid transparent; 
    transition: color 0.2s ease-in-out, border-bottom-color 0.2s ease-in-out;
}

.menu-links ul li a:hover {
    color: #BC0000;
    background-color: transparent; 
    border-bottom-color: #BC0000;
}

/* Top Menu Switch / Icons */
.menu-switch {
    display: flex;
    flex-grow: 0;
}

.menu-switch a img {
    height: 40px; 
    margin-left: 10px; 
    transition: transform 0.3s, opacity 0.3s;
}

.menu-switch a img:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

img.menu {
    height: 30px;
    width: 30px;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: right;
}

nav ul li {
    background-color: #fff;
    display: inline-block;
    padding-left: 30px;
}

nav a {
    text-decoration: none;
}

/* ============= HORIZONTAL RULES ============= */
hr.frontpage {
    border: none;
    border-top: 2px solid #BC0000; 
    height: 0;
    margin: 20px auto; 
    box-shadow: none; 
    background: transparent;
}

hr {
    border: none;
    height: 2px;
    background-color: #000; 
    margin: 25px auto; 
    width: 85%; 
    display: block;
}

/* ============= MAIN PAGE IMAGES & LAYOUT ============= */
div.frontpage, h1.frontpage, h2.frontpage, h4.frontpage, h6.frontpage, footer.frontpage {
    margin: 0;
    text-align: center;
}

footer.frontpage ul {
    display: table;
    margin: 0 auto;
    padding: 0px;
}

footer.frontpage ul li {
    display: inline-block;
    font-weight: bold;
    margin-left: 50px;
    margin-right: 50px;
}

/* THE GRID CONTAINER */
.frontpage {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 0; 
    padding: 10px 0;
    width: 100%;
}

.frontpage a {
    display: block;
    margin: 0;
    padding: 0;
    text-decoration: none;
    line-height: 0; 
    box-sizing: border-box; 
}

.frontpage a img {
    display: block;
    width: 175px; 
    height: 250px; 
    object-fit: cover; 
    margin: 0;
    padding: 0;
    vertical-align: top; 
    box-sizing: border-box; 
    border: 1px solid #eaeaea; 
}

/* Target the org logos specifically to override the portrait photo styles */
.frontpage a img.orgs {
    width: 175px; 
    height: 175px; /* Perfect square */
    object-fit: contain; /* Prevents cropping */
    padding: 10px; /* Internal breathing room */
    background-color: #ffffff; 
}

img.writer {
    float: left;
    height: 400px;
    object-fit: contain;
    width: 300px;
}

/* ============= RESPONSIVE DESIGN (MEDIA QUERIES) ============= */

/* TABLETS & MOBILE SEAMLESS SCALING */
@media (max-width: 768px) {
    body {
        margin: 0; 
        padding: 15px 3%; 
        box-sizing: border-box;
    }

    .border {
        width: 100%; 
        margin: 0 auto;
        border: 1px solid #BC0000; 
    }
    
    p.current_default {
        font-size: 16px;
        line-height: 1.6;
        margin-left: 2%;
        margin-right: 2%;
    }
    
    h1, h2 {
        font-size: 20px;
        text-align: center;
    }

    .frontpage {
        font-size: 16px;
    }

    .frontpage a {
        width: 33.333%; 
    }

    .frontpage a img {
        width: 100%;
        height: auto; 
        aspect-ratio: 175 / 250; 
    }

    /* FIX: Explicitly forces logos to shrink to 100% of their mobile container */
    .frontpage a img.orgs {
        width: 100%; 
        height: auto;
        aspect-ratio: 1 / 1; 
        padding: 5px; /* Slightly tighter padding for small screens */
    }

    .top-menu {
        flex-direction: row; 
        justify-content: space-between;
        align-items: center;
        padding: 10px;
    }
    
    .menu-links ul {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .menu-links ul li {
        margin: 0 5px; 
    }

    .menu-links ul li a {
        font-size: 1em; 
    }
    
    .menu-switch {
        margin-top: 0;
    }

    img.menu {
        height: 18px;
        width: 18px;
    }

    .menu-switch a img {
        height: 25px; 
        width: auto;
        margin-left: 5px;
    }
}

/* SMALL PHONES (Max-width: 480px) */
@media (max-width: 480px) {
    body {
        padding: 10px 3%; 
    }

    p.current_default {
        font-size: 14px;
        margin-left: 1%;
        margin-right: 1%;
    }
    
    h1, h2 {
        font-size: 18px;
    }

    .top-menu {
        padding: 8px;
    }

    .menu-links ul li {
        margin: 0 3px;
    }

    .menu-links ul li a {
        font-size: 0.85em; 
        letter-spacing: 0;
    }

    .frontpage a {
        width: 33.333%; 
    }

    img.menu {
        height: 15px;
        width: 15px;
    }

    .menu-switch a img {
        height: 22px;
    }

    
}
/* ============= COMPACT UNIFORM PERIODICAL BOXES ============= */

/* 1. Shrinking the container by ~25% and removing gaps */
.frontpage a:has(.periodicals) {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 230px !important;  /* Reduced from 320px (~28% smaller) */
    height: 110px !important; /* Reduced from 150px (~26% smaller) */
    margin: 0 !important;      /* Removed gap between objects */
    background-color: #ffffff;
    border: 1px solid #ddd;
    box-sizing: border-box;
    overflow: hidden;
}

/* 2. Keeping the images centered and proportional inside the smaller box */
.frontpage a img.periodicals {
    width: 90% !important;   
    height: 90% !important;  
    object-fit: contain;     
    display: block;
    margin: 0 auto;
    border: none;            
}

/* 3. Mobile adjustments */
@media (max-width: 768px) {
    .frontpage a:has(.periodicals) {
        width: 100% !important; /* Stacked on mobile to fit screen width */
        height: 100px !important;
        margin: 0 auto !important;
    }
}
/* ============= MOBILE SPACING OPTIMIZATION ============= */

@media (max-width: 768px) {
    /* 1. Reduce overall page padding */
    body {
        padding: 5px 2% !important; 
    }

    /* 2. Tighten Headings and Horizontal Rules */
    h1.frontpage, h2.frontpage, h4.frontpage {
        margin: 8px 0 !important; /* Forces smaller gaps above/below text */
        line-height: 1.1;
    }

    hr.frontpage {
        margin: 8px auto !important; /* Reduces gap between lines */
    }

    hr {
        margin: 12px auto !important; 
    }

    /* 3. Tighten the Top Menu */
    .top-menu {
        padding: 5px 10px !important;
    }

    /* 4. Ensure Periodicals stay compact and gapless */
    .frontpage {
        padding: 0 !important;
    }

    .frontpage a:has(.periodicals) {
        width: 100% !important; 
        height: 100px !important;
        margin: 0 auto !important; /* Removes vertical gaps between them */
        border-bottom: none; /* Optional: prevents double-borders when stacked */
    }
    
    .frontpage a:last-child:has(.periodicals) {
        border-bottom: 1px solid #ddd; /* Adds border back to the bottom of the last item */
    }

    /* 5. Minimize empty space from <br> tags */
    br {
        display: block;
        margin: 5px 0;
        content: "";
    }
    div.frontpage {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    div.frontpage hr.frontpage:last-child {
        margin-bottom: 0 !important;
    }

    footer.bottom-menu {
        margin-top: 5px !important;
        padding-top: 5px !important;
    }
}