/* Base Styles for AMLit */

:root {
    --primary-color: black; /* navbar background */
    --secondary-color: #444;
    --accent-color: #FFD700; /* Gold */
    --text-color-light: #fff;
    --text-color-dark: #333;
    --border-color: #ccc;
    --background-light: #f0f0f0;
    --transition-speed: 0.2s ease-in-out;
    --mobile-breakpoint: 768px;
    --link-color: darkblue;
    --link-hover: #003d7a;
    --page-background: #fffef0;
    --card-background: #ffffff;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
}

/* Basic Reset & Body */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--page-background);
    color: var(--text-color-dark);
    line-height: 1.6;
}

/* Global Link Styling */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover, a:focus {
    color: var(--link-hover);
    text-decoration: underline;
}

.story-title a, 
.story-description a, 
.story-author a,
.collection-intro a,
.collection-footer a,
.story-links a {
    color: var(--link-color);
}

.study-guide {
    font-weight: 600;
}

/* Navigation links */
.nav-logo a {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--text-color-light);
    text-decoration: none;
}

.nav-logo a:hover, .nav-logo a:focus {
    color: var(--accent-color);
    text-decoration: none;
}

.menu-item-link,
.menu-item-button {
    color: var(--text-color-light);
    text-decoration: none;
    padding: 0.5rem 0.25rem;
    display: block;
    font-weight: 500;
    transition: color var(--transition-speed);
    background: none;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
}

.menu-item-link:hover, .menu-item-link:focus,
.menu-item-button:hover, .menu-item-button:focus {
    color: var(--accent-color);
    text-decoration: none;
    outline: none;
}

.menu-item-button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Header & Navigation */
header {
    background: var(--primary-color);
    color: var(--text-color-light);
    /* padding: 0.75rem 1rem; */
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-color-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
    vertical-align: middle;
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.nav-menu {
    display: flex;
    align-items: center;
    flex-grow: 1;
    justify-content: flex-start;
}

.main-navigation {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    width: auto;
}

.main-navigation > li > a, 
.main-navigation > li > .menu-item-button {
    font-weight: 700;
}

.main-navigation li:first-child {
    padding-right: 15px;
}

.menu-item {
    position: relative;
    margin-right: 1.5rem;
}

.menu-item:last-child {
    margin-right: 0;
}

/* Dropdowns */
.dropdown-caret {
    margin-left: 0.3em;
    font-size: 0.8em;
    display: inline-block;
    transition: transform var(--transition-speed);
}

.menu-item.open > .menu-item-button .dropdown-caret {
    transform: rotate(180deg);
}

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--text-color-light);
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    z-index: 1001;
    padding: 0.3rem 0;
    list-style: none;
    margin-top: 0.25rem;
}

.menu-item.open > .dropdown {
    display: block;
}

.login .menu-item.has-dropdown > .dropdown {
    left: auto;
    right: 0;   
    min-width: max-content; 
}

.dropdown-item {
    padding: 0.4rem 1rem;
    line-height: 1.28;
    color: var(--text-color-dark);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    font-weight: 700;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--background-light);
    color: var(--primary-color);
    text-decoration: none;
    outline: none;
}

.dropdown-item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: -2px;
}

/* Featured/highlighted dropdown items */
.dropdown-item.featured {
    color: var(--link-color);
}

.dropdown-item.highlight {
    font-style: italic;
}

.dropdown-item.seasonal {
    color: #c41e3a; /* Holiday red */
}

.dropdown-item.growth {
    color: #0066cc;
}

.dropdown-divider {
    height: 1px;
    margin: 0.3rem 0;
    overflow: hidden;
    background-color: #e9ecef;
    border: 0;
}

/* Search Container & Box */
.search-container {
    display: flex;
    align-items: center;
    margin: 0 1rem;
    border-radius: 4px;
    transition: background-color var(--transition-speed);
}

.search-box {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color); 
    border-radius: 4px 0 0 4px;
    background-color: #ffffff;      
    /* color: var(--text-color-dark);    */
    color: darkblue; 
    font-size: 1.0rem;
    font-weight: 500;
    max-width: 200px; 
    transition: border-color var(--transition-speed);
    flex-grow: 1; 
}

.search-box::placeholder {
    color: darkblue; 
    opacity: 0.8;
}

.search-box:focus {
    outline: none;
    /*
    border-color: lightcyan; 
    box-shadow: 0 0 0 0.2rem rgba(224, 255, 255, 0.5); 
    */
    /* Alternatively, using the accent color variable if you want to define light cyan there: */
    border-color: var(--focus-color, lightcyan); 
    box-shadow: 0 0 0 0.2rem var(--focus-shadow-color, rgba(40, 184, 241, 0.5)); 
}

.search-button {
    background: transparent; 
    border: 1px solid var(--border-color);
    border-left: none; 
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-speed), background-color var(--transition-speed);
}

.search-button svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-color-light); /* CORRECTED: Light icon for dark button background */
}

.search-button:hover, .search-button:focus {
    color: var(--accent-color);
}

.search-button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

/* Login Area */
.login {
    margin-left: auto; 
}

.login-link { 
    color: var(--accent-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: var(--secondary-color);
    border-radius: 4px;
    font-weight: 500;
    transition: background-color var(--transition-speed);
}

.login-link:hover, .login-link:focus {
    background: lighten(var(--secondary-color), 10%);
    color: var(--accent-color);
    text-decoration: none;
    outline: 1px solid var(--accent-color);
}

/* Main Content */
.content {
    padding: 1.5rem;
    flex-grow: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Common card styling */

.story-card, .author-card {
    background-color: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 2rem;
}

.story-card:hover, .author-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

/* Footer */
footer {
    background: var(--primary-color);
    color: var(--text-color-light);
    text-align: center;
    padding: 1rem 0;
    width: 100%;
    font-size: 0.9rem;
}

footer p {
    margin: 0;
}

/* Collection styling */
.collection-header {
    text-align: center;
    margin: 2rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.collection-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-color-dark);
}

.collection-intro {
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left;
}

.collection-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Story and author styling */
.story-description {
    font-size: 1.1rem;
    line-height: 1.6;
}

.story-quote {
    background-color: #f7f7f7;
    border-left: 3px solid #d0d0d0;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-style: italic;
    font-size: 1.1rem;
}

.story-meta {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    color: #666;
}

.story-author {
    margin-right: 1rem;
}

.story-year {
    opacity: 0.8;
}

.al-char {
    font-style: italic;
    font-weight: 500;
}

.al-title {
    font-style: italic;
    color: black;
    font-weight: 600;
}

.al-author {
    font-weight: 600;
}

/* Screen Reader Only Text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background-color: var(--accent-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    z-index: 10000;
    text-decoration: none;
    border-radius: 3px;
}

/* General Focus Styles */
*:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.5);
}

*:focus {
    outline: none; 
}

/* Social sharing */
.social-share, 
.social-share-buttons,
.social-share-container,
.social-buttons-wrapper {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    padding-top: 2.5rem !important;
    text-align: center !important;
    width: 100% !important;
}

.social-buttons-wrapper {
    justify-content: center !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    padding-top: 0 !important;
}

/* Mobile Responsive Styles */
@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--primary-color);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem 0;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
        border-top: 1px solid var(--secondary-color);
        width: 100%;
    }

    .nav-menu.mobile-active {
        display: flex;
    }

    .main-navigation {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .menu-item {
        margin-right: 0;
        width: 100%;
    }

    .menu-item-link, .menu-item-button {
        padding: 0.75rem 1.5rem;
        border-bottom: 1px solid var(--secondary-color);
        width: 100%;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .menu-item:last-child .menu-item-link,
    .menu-item:last-child .menu-item-button {
        border-bottom: none;
    }

    .dropdown {
        position: static;
        width: 100%;
        box-shadow: none;
        background: var(--secondary-color);
        border-radius: 0;
        margin-top: 0;
        padding: 0;
    }

    .dropdown-item {
        padding-left: 2.5rem;
        color: var(--text-color-light);
        border-bottom: 1px solid var(--primary-color);
    }

    .dropdown-item:last-child {
        border-bottom: none;
    }

    .dropdown-item:hover, .dropdown-item:focus {
        background: lighten(var(--secondary-color), 10%);
    }

    .dropdown-divider {
        margin: 0;
        background-color: var(--primary-color);
    }

    .search-container {
        order: 1; 
        margin: 0.5rem 1.5rem; 
        width: auto; 
    }
    
    .search-box {
        max-width: none; 
    }

    .login {
        order: 2; 
        width: 100%;
        margin-left: 0;
        padding: 0 1.5rem; 
    }
    
    .login .menu-item-button { 
        padding: 0.75rem 0; 
        justify-content: center; 
    }

    .login .dropdown { 
        background: var(--secondary-color); 
    }

    .login .dropdown-item {
        padding-left: 2.5rem; 
        color: var(--text-color-light);
        border-bottom: 1px solid var(--primary-color);
    }
    
    .collection-header h1 {
        font-size: 2rem;
    }
    
    .story-card, .author-card {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .story-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .story-author {
        margin-bottom: 0.25rem;
    }
    
    .col-md-6 { 
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .img-container { 
        float: none;
        margin: 1rem auto;
        width: 100%;
        max-width: 350px;
    }

    .nav-actions { 
        flex-direction: column;
        width: 100%;
        align-items: stretch;
        padding: 0 1.5rem;
        margin-top: 1rem; 
        gap: 1rem;
    }
    
    .search-container { 
        margin: 0.5rem 0; 
        width: 100%;
    }
    
    .login {
        margin-top: 0.5rem; 
    }
}

@media (max-width: 480px) {
    header { padding: 0.5rem 0.75rem; }
    .nav-logo a { font-size: 1.25rem; }
    .content { padding: 1rem; }
    footer { padding: 0.75rem 0; font-size: 0.85rem; }

    .menu-item-link, .menu-item-button {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }
    
    .dropdown-item {
        padding-left: 2rem;
        font-size: 0.9rem;
    }
    
    .search-container {
        margin: 0.5rem 1rem;
    }

    .login {
        padding: 0 1rem;
    }
    
    .card-header h2 {
        font-size: 1.4em;
    }
    
    .card-header h3 {
        font-size: 1em;
    }
}


pre, .text-wrap, pre.text-wrap {
    white-space: pre-wrap;   /* CSS3 */
    word-break: break-word;  /* Break long words if needed */
    overflow-x: auto;        /* Allow horizontal scroll if really needed */
    box-sizing: border-box;
    max-width: 100%;         /* Ensure it doesn't exceed the parent */
}


