/* By Every Word Foundation - Main Stylesheet */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: 
        linear-gradient(135deg, rgba(139, 0, 0, 0.85) 0%, rgba(165, 42, 42, 0.85) 100%),
        url('../images/open-bible-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    padding: 20px 0;
    border-bottom: 4px solid #660000;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/open-bible-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 1;
}

/* Welcome Section with Background */
.welcome-section {
    position: relative;
    background: url('../images/sheep-pasture-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 60px 40px;
    margin: 40px 0;
    border-radius: 8px;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 1;
}

.welcome-section h2,
.welcome-section p {
    position: relative;
    z-index: 2;
    color: #333;
}

.welcome-section h2 {
    color: #8B0000;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.welcome-section p {
    font-size: 1.2em;
    line-height: 1.8;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.header-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.site-title {
    font-size: 42px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.tagline {
    font-size: 14px;
    font-style: italic;
    opacity: 0.9;
}

/* Navigation Styles */
.navigation {
    background-color: #000;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navigation .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    max-width: 100%;
    overflow-x: auto;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    flex-wrap: wrap;
    min-width: 0;
}

.nav-menu li {
    margin: 0;
}

.nav-link {
    display: block;
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background-color: #8B0000;
    color: white;
}

.search-box {
    position: relative;
    margin-right: 20px;
    min-width: 0;
    flex-shrink: 1;
}

.search-input {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    width: 200px;
    max-width: 100%;
    font-size: 14px;
    box-sizing: border-box;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 200;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
}

/* Page Content Styles */
.page-content {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.8;
}

.page-content h1 {
    font-size: 36px;
    color: #8B0000;
    margin-bottom: 30px;
    border-bottom: 3px solid #8B0000;
    padding-bottom: 10px;
}

.page-content h2 {
    font-size: 28px;
    color: #333;
    margin: 30px 0 20px;
}

.page-content p {
    margin-bottom: 20px;
    font-size: 16px;
}

/* Article Formatting System */
.article-title {
    font-size: 32px !important;
    font-weight: bold !important;
    color: #8B0000 !important;
    margin-bottom: 30px !important;
    line-height: 1.2 !important;
}

.article-heading {
    font-size: 24px !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 24px 0 16px !important;
    border-bottom: 2px solid #eee;
    padding-bottom: 8px;
}

.article-subheading {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #8B0000 !important;
    margin: 30px 0 16px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #ddd !important;
}

.article-minor-heading {
    font-size: 18px !important;
    font-weight: 500 !important;
    color: #555 !important;
    margin: 24px 0 12px !important;
}

.article-body {
    font-size: 16px !important;
    line-height: 1.8 !important;
    margin-bottom: 24px !important;
    color: #333;
}

/* Article Content Paragraph Spacing */
.article-content p {
    font-size: 16px !important;
    line-height: 1.8 !important;
    margin-bottom: 24px !important;
    color: #333 !important;
    text-align: justify;
}

.article-content h3 {
    font-size: 20px !important;
    font-weight: 600 !important;
    color: #8B0000 !important;
    margin: 30px 0 16px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #ddd !important;
}

.article-quote {
    font-style: italic !important;
    border-left: 4px solid #8B0000 !important;
    padding-left: 16px !important;
    margin: 20px 0 !important;
    background-color: #f9f9f9;
    padding: 16px;
    border-radius: 4px;
}

.article-list-item {
    margin-bottom: 8px !important;
    padding-left: 20px !important;
}

/* Homepage Sections */
.welcome-section {
    text-align: center;
    margin-bottom: 50px;
}

.welcome-section h2 {
    font-size: 36px;
    color: #8B0000;
    margin-bottom: 20px;
}

.featured-section {
    margin-bottom: 50px;
}

.featured-section h2 {
    font-size: 28px;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.featured-article {
    background: #f8f8f8;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid #8B0000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.featured-article:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.featured-article h3 {
    margin-bottom: 15px;
}

.featured-article h3 a {
    color: #8B0000;
    text-decoration: none;
    font-size: 20px;
}

.featured-article h3 a:hover {
    text-decoration: underline;
}

/* Article Cards */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.article-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 25px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.article-card h2,
.article-card h3 {
    margin-bottom: 15px;
}

.article-card h2 a,
.article-card h3 a {
    color: #8B0000;
    text-decoration: none;
    font-size: 18px;
}

.article-card h2 a:hover,
.article-card h3 a:hover {
    text-decoration: underline;
}

.article-summary {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.5;
}

.article-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #888;
    flex-wrap: wrap;
}

.category {
    background-color: #8B0000;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.category-badge {
    background-color: #8B0000;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Articles Page */
.articles-page {
    max-width: 1000px;
    margin: 0 auto;
}

.articles-controls {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 8px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.category-link:hover,
.category-link.active {
    background-color: #8B0000;
    color: white;
}

.article-count {
    background-color: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

/* Article Detail Page */
.article-detail {
    max-width: 800px;
    margin: 0 auto;
}

.article-header {
    margin-bottom: 30px;
}

.breadcrumb {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #8B0000;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.article-content {
    margin-bottom: 40px;
    line-height: 1.8;
}

.article-footer {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-bottom: 40px;
}

.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link,
.category-link {
    color: #8B0000;
    text-decoration: none;
    font-weight: 500;
}

.back-link:hover,
.category-link:hover {
    text-decoration: underline;
}

/* Fellowship Page */
.fellows-section {
    margin-top: 40px;
}

.fellow {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    margin-bottom: 40px;
    padding: 30px;
    background: #f8f8f8;
    border-radius: 8px;
}

.fellow-image img {
    width: 100%;
    border-radius: 8px;
}

.fellow h3 {
    color: #8B0000;
    margin-bottom: 15px;
    font-size: 22px;
}

/* Buttons */
.read-more-btn {
    display: inline-block;
    background-color: #8B0000;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    margin: 30px 0 60px 0;
}

.read-more-btn:hover {
    background-color: #660000;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 50px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .site-title {
        font-size: 32px;
    }
    
    .navigation .container {
        flex-direction: column;
        padding: 0;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: center;
    }
    
    .search-box {
        margin: 10px 0;
    }
    
    .articles-controls {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .fellow {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .featured-grid,
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .article-actions {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}



/* Articles Page Layout - Optimized for Performance */
.articles-layout {
    display: flex;
    gap: 30px;
    margin-top: 20px;
}

.articles-sidebar {
    flex: 0 0 280px;
    background: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.articles-main {
    flex: 1;
    min-width: 0;
}

.articles-grid {
    display: grid;
    gap: 25px;
}

.article-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: box-shadow 0.2s ease;
}

.article-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-card h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
}

.article-card h2 a {
    color: #8B0000;
    text-decoration: none;
}

.article-card h2 a:hover {
    text-decoration: underline;
}

.article-summary {
    color: #555;
    line-height: 1.6;
    margin-bottom: 15px;
}

.article-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #666;
    flex-wrap: wrap;
}

.article-meta .category {
    background: #8B0000;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.no-articles {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-articles p {
    margin-bottom: 10px;
}

/* Category List Styles */
.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.category-link:hover {
    background-color: #e0e0e0;
}

.category-link.active {
    background-color: #8B0000;
    color: white;
}

.article-count {
    background: #ddd;
    color: #333;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.category-link.active .article-count {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* Search Form */
.search-form {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-btn {
    padding: 8px 16px;
    background: #8B0000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.search-btn:hover {
    background: #660000;
}

/* Fellowship Page Styles */
.fellows-section {
    margin-top: 30px;
}

.fellow {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.fellow-image {
    flex: 0 0 200px;
}

.fellow-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.fellow-content {
    flex: 1;
}

.fellow-content h3 {
    color: #8B0000;
    font-size: 24px;
    margin-bottom: 15px;
}

.fellow-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .articles-layout {
        flex-direction: column;
        gap: 20px;
    }
    
    .articles-sidebar {
        flex: none;
        position: static;
    }
    
    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .category-list li {
        flex: none;
        margin-bottom: 0;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .fellow {
        flex-direction: column;
        text-align: center;
    }
    
    .fellow-image {
        flex: none;
        align-self: center;
    }
}

/* Performance optimizations */
.article-card,
.category-link,
.search-btn {
    will-change: auto;
}

/* Ensure proper rendering */
.articles-page {
    contain: layout style;
}



/* Enhanced Mobile Responsiveness */

/* Mobile Navigation Improvements */
@media (max-width: 768px) {
    /* Navigation fixes */
    .navigation .container {
        flex-direction: column;
        padding: 10px 20px;
    }
    
    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }
    
    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid #ddd;
    }
    
    .nav-link {
        display: block;
        padding: 15px 20px;
        text-align: center;
        width: 100%;
    }
    
    /* Search box mobile optimization */
    .search-box {
        width: 100%;
        margin: 15px 0 0 0;
    }
    
    .search-input {
        width: 100%;
        padding: 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Header mobile optimization */
    .site-title {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 10px;
    }
    
    .tagline {
        font-size: 14px;
        line-height: 1.4;
    }
    
    /* Welcome section mobile */
    .welcome-section {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .welcome-section h2 {
        font-size: 28px;
        line-height: 1.3;
    }
    
    /* Featured grid mobile */
    .featured-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }
    
    .featured-article {
        padding: 20px 15px;
    }
    
    /* Article content mobile */
    .article-title {
        font-size: 24px !important;
        line-height: 1.3 !important;
    }
    
    .article-heading {
        font-size: 20px !important;
    }
    
    .article-subheading {
        font-size: 18px !important;
    }
    
    /* Container padding for mobile */
    .container {
        padding: 0 15px;
    }
    
    /* Page content mobile */
    .page-content {
        padding: 20px 15px;
    }
    
    /* Footer mobile */
    .footer {
        padding: 20px 0;
        text-align: center;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .site-title {
        font-size: 24px;
    }
    
    .tagline {
        font-size: 12px;
    }
    
    .welcome-section h2 {
        font-size: 24px;
    }
    
    .article-title {
        font-size: 22px !important;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .nav-link {
        padding: 12px 15px;
        font-size: 14px;
    }
}

/* Tablet specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .site-title {
        font-size: 36px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .nav-link,
    .category-link,
    .article-card {
        min-height: 44px; /* iOS recommended touch target */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 15px 0;
    }
    
    .site-title {
        font-size: 24px;
    }
    
    .nav-menu {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .nav-menu li {
        width: auto;
        border-bottom: none;
        border-right: 1px solid #ddd;
    }
    
    .nav-menu li:last-child {
        border-right: none;
    }
}



/* Welcome Text Line Break Control */
.welcome-text {
    max-width: 750px;
    margin: 0 auto;
    text-align: center;
    white-space: nowrap;
    line-height: 1.6;
}

.welcome-text br {
    white-space: normal;
}

@media (max-width: 900px) {
    .welcome-text {
        max-width: 90%;
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .welcome-text {
        max-width: 100%;
        padding: 0 10px;
        white-space: normal;
    }
    
    .welcome-text br {
        display: none;
    }
}


/* Breadcrumb Navigation Fix */
nav ol {
    list-style: none !important;
    counter-reset: none !important;
    padding-left: 0 !important;
}

nav ol li {
    list-style: none !important;
    list-style-type: none !important;
    counter-increment: none !important;
}

/* Ensure breadcrumb displays horizontally */
nav ol.flex {
    display: flex !important;
    list-style: none !important;
}

nav ol.flex li {
    display: flex !important;
    align-items: center !important;
    list-style: none !important;
}

/* Additional breadcrumb styling */
.breadcrumb-nav {
    list-style: none !important;
}

.breadcrumb-nav ol {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.breadcrumb-nav li {
    list-style: none !important;
    list-style-type: none !important;
}

.search-box {
    position: relative;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 200;
    display: none;
}

.search-result-item {
    border-bottom: 1px solid #eee;
}

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

.search-result-link {
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}

.search-result-link:hover {
    background-color: #f8f8f8;
    text-decoration: none;
    color: inherit;
}

.search-result-title {
    font-weight: 600;
    color: #8B0000;
    margin-bottom: 4px;
    font-size: 16px;
}

.search-result-summary {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
    line-height: 1.4;
}

.search-result-meta {
    font-size: 12px;
    color: #888;
}

.search-result-author {
    font-weight: 500;
    margin-right: 10px;
}

.search-result-date {
    color: #999;
}

.search-loading, .search-no-results, .search-error {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.search-error {
    color: #d32f2f;
}
