/* Professional styles for Jerred D. Ruble Family Charitable Foundation website */

:root {
    --primary: #2c5234;
    --primary-dark: #1e3a24;
    --primary-light: #3a6b44;
    --secondary: #b08d57;
    --secondary-light: #d3c4a8;
    --neutral-dark: #333333;
    --neutral: #666666;
    --neutral-light: #f5f5f5;
    --white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: var(--neutral-dark);
    background-color: var(--neutral-light);
}

p {
    margin-bottom: 1.2rem;
    font-size: 1.25rem;
    color: var(--neutral);
    line-height: 1.8;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--white);
    box-shadow: 0 0 20px var(--shadow);
}

/* Header Styles */
header {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--white);
    border-bottom: 1px solid var(--secondary-light);
}

.logo {
    flex: 0 0 150px;
}

.logo img {
    max-width: 100%;
    height: auto;
}

.title {
    flex: 1;
    text-align: center;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Libre Baskerville', serif;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
}

h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--secondary);
    text-align: center;
}

h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

/* Hero Section */
.hero {
    background-color: var(--neutral-light);
    padding: 1rem;
}

.hero-images {
    display: flex;
    gap: 1rem;
}

.hero-images img {
    flex: 1;
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 3px 10px var(--shadow);
}

/* Soft edges for JPG images - only blending the outer edges */
img[src$=".jpg"]:not(.modal-content) {
    -webkit-mask-image: radial-gradient(ellipse 95% 95% at center, black 80%, rgba(0, 0, 0, 0.8) 85%, rgba(0, 0, 0, 0.6) 90%, rgba(0, 0, 0, 0.3) 95%, transparent 100%);
    mask-image: radial-gradient(ellipse 95% 95% at center, black 80%, rgba(0, 0, 0, 0.8) 85%, rgba(0, 0, 0, 0.6) 90%, rgba(0, 0, 0, 0.3) 95%, transparent 100%);
    background-color: var(--neutral-light);
    /* Match the page background for better blending */
}

/* Main Content */
main {
    padding: 2rem;
}

section {
    margin-bottom: 3rem;
}

.mission p {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Resources Section */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    /* Creates columns as needed with minimum width of 250px */
    gap: 2rem;
    margin-bottom: 2rem;
    justify-content: center;
}

/* For when there are fewer than 3 cards, limit their width and center them */
@media (min-width: 769px) {
    .resource-grid {
        grid-template-columns: repeat(3, 1fr);
        /* Default to 3 columns on larger screens */
    }
    
    .resource-grid.fewer-cards {
        grid-template-columns: repeat(auto-fit, minmax(250px, 300px));
        justify-content: center;
    }
}

/* Adjust to 2 columns for medium screens */
@media (max-width: 1000px) and (min-width: 769px) {
    .resource-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.resource-card {
    background-color: var(--white);
    border-radius: 4px;
    box-shadow: 0 3px 10px var(--shadow);
    padding: 1.5rem;
}

/* Links and Buttons */
a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary);
}

ul {
    list-style-type: none;
    padding: 0;
}

/* Ensure consistent spacing in regular resource cards */
.resource-card:not(.resource-card-2col) ul {
    display: grid;
    gap: 0.5rem;
}

li {
    margin-bottom: 0;
}

/* Unified Button Styles */
.resource-card a,
.filing-card a {
    display: grid;
    grid-template-columns: 1fr 2rem;
    /* Create a two-column grid: text and icon space */
    padding: 0.8rem 1rem;
    border-left: 3px solid var(--primary);
    background-color: var(--neutral-light);
    color: var(--neutral-dark);
    transition: all 0.3s ease;
    height: 70px;
    /* Fixed height for consistent button sizing */
    line-height: 1.4;
    box-sizing: border-box;
    align-items: center;
    position: relative;
}

.resource-card a:hover,
.filing-card a:hover {
    color: var(--secondary);
    transform: translateX(5px);
    border-left-width: 5px;
}

/* Resource Card Links */
.resource-card a,
.filing-card a {
    margin-bottom: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* PDF Indicator */
.pdf-link::after {
    content: "PDF";
    font-size: 0.7rem;
    color: var(--secondary);
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: normal;
    opacity: 0.8;
}

/* External Link Indicator */
.external-link::after {
    content: "↗";
    font-size: 0.8rem;
    color: var(--secondary);
    grid-column: 2;
    /* Place in the second column */
    justify-self: center;
    /* Center in the column */
    font-weight: bold;
    opacity: 0.8;
    align-self: center; /* Ensure vertical alignment */
}

/* Ensure text doesn't overlap with the icon */
.external-link {
    word-wrap: break-word;
    /* Allow long words to break and wrap to the next line */
    display: grid;
    align-items: center; /* Ensure vertical alignment matches other buttons */
    line-height: 1.4; /* Match line-height with other buttons */
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    margin: 2rem 0;
    box-shadow: 0 3px 10px var(--shadow);
    border-radius: 4px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table thead {
    background-color: var(--neutral-light);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border: none;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--neutral-light);
}

/* Right-align the Amount column (4th column) */
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    text-align: right;
}

.data-table tbody tr:nth-child(even) {
    background-color: rgba(245, 245, 245, 0.5);
}

.data-table tbody tr:hover {
    background-color: rgba(44, 82, 52, 0.05);
}

/* Filings Grid */
.filings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.filing-card {
    background-color: var(--white);
    border-radius: 4px;
    box-shadow: 0 3px 10px var(--shadow);
}

/* Awards and Filings Sections */
.awards-section,
.filings-section {
    max-width: 1100px;
    margin: 0 auto;
}

/* Two-column Resource Card */
.resource-card-2col {
    grid-column: span 2;
}

.resource-card-2col ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 0.5rem;
}

.resource-card-2col li {
    margin-bottom: 0;
}

.resource-card-2col a {
    height: 70px;
    /* Fixed height to match other buttons */
}

/* Ensure images in 2-column cards are responsive */
.resource-card-2col img {
    width: 100%;
    height: auto;
    min-height: 250px;
    display: block;
    margin: 0 auto;
    object-fit: contain;
}

/* Ensure videos in resource cards fill the card */
.resource-card-2col video {
    width: calc(100% + 3rem); /* Account for padding on both sides */
    height: auto;
    display: block;
    margin: 0 -1.5rem; /* Negative margin to counteract padding */
    object-fit: cover;
    border-radius: 0; /* Remove border radius to fill corners */
    max-height: 500px; /* Limit height for better proportions */
}

/* When there are only 2 columns in the grid, make the 2-col card span the full width */
@media (max-width: 1000px) and (min-width: 769px) {
    .resource-card-2col {
        grid-column: 1 / -1;
        /* Span all columns */
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .resource-grid {
        grid-template-columns: 1fr;
    }

    .resource-card-2col {
        grid-column: 1;
    }

    .resource-card-2col ul {
        grid-template-columns: 1fr;
    }

    header {
        flex-direction: column;
        text-align: center;
    }

    .logo {
        display: none; /* Hide logo completely on mobile */
    }
    
    .resource-card-2col img {
        max-width: 80%; /* Make images in 2-col cards smaller on mobile */
    }

    h1 {
        font-size: 1.8rem;
    }

    .hero-images {
        flex-direction: column;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.6rem;
    }

    .filings-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .filings-grid {
        grid-template-columns: 1fr;
    }
}

/* Additional Info */
.note {
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--neutral-light);
    color: var(--neutral);
}

.note p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Normal link style override */
.resource-card a.normal-link,
.resource-card p a {
    display: inline;
    grid-template-columns: initial;
    padding: 0;
    border-left: none;
    background-color: transparent;
    color: #0066CC; /* Standard blue hyperlink color */
    height: auto;
    line-height: inherit;
    align-items: initial;
    position: relative;
}

.resource-card a.normal-link:hover,
.resource-card p a:hover {
    color: #0056b3; /* Darker blue for hover state */
    transform: none;
    border-left-width: 0;
}

/* Full-screen Image Modal Functionality */
.zoomable-image {
    width: 150px;
    cursor: pointer;
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95%;
    max-height: 95%;
    width: 95%;
    height: auto;
    object-fit: contain;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

/* Responsive adjustments for zoomable images */
@media screen and (max-width: 768px) {
    .zoomable-image {
        width: 100%;
        max-width: 300px;
    }
}