/* ==========================================================================
   Reynold Macpherson - Custom Styles
   ========================================================================== */

/* --- Design Tokens --- */
:root {
    --navy: #1B365D;
    --navy-dark: #142847;
    --gold: #C5A44E;
    --gold-light: #D4B96A;
    --off-white: #F8F7F4;
    --charcoal: #2D2D2D;
    --light-gray: #E8E6E1;
    --medium-gray: #9B9B9B;
}

/* --- Base --- */
body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--charcoal);
    background-color: var(--off-white);
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    color: var(--navy);
}

a {
    color: var(--navy);
    text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
}

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

/* --- Skip Link --- */
.skip-link:focus {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    background: var(--navy);
    color: #fff;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    text-decoration: none;
}

/* --- Navbar --- */
.bg-navy {
    background-color: var(--navy) !important;
}

.navbar-brand {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.navbar-dark .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
}

.navbar-dark .nav-link:hover,
.navbar-dark .nav-link.active {
    color: var(--gold);
}

/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(135deg, #2a4a7a 0%, var(--navy) 100%);
    color: #fff;
    padding: 4rem 0;
}

.hero-section h1 {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
}

.hero-section .tagline {
    color: var(--gold);
    font-family: 'Lora', Georgia, serif;
    font-size: 1.2rem;
    font-style: italic;
}

.headshot {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--gold);
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* --- Section Spacing --- */
.section {
    padding: 3rem 0;
}

.section-title {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--gold);
    display: inline-block;
}

/* --- Content Width --- */
.content-width {
    max-width: 720px;
}

/* --- Cards --- */
.pub-card {
    background: #fff;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pub-card:hover {
    box-shadow: 0 2px 12px rgba(27, 54, 93, 0.1);
    border-color: var(--gold);
}

.pub-card .pub-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.4rem;
}

.pub-card .pub-meta {
    font-size: 0.9rem;
    color: var(--medium-gray);
    margin-bottom: 0.5rem;
}

.pub-card .pub-abstract {
    font-size: 0.9rem;
    color: #555;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--light-gray);
}

/* --- Badges --- */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 0.4em 0.75em;
}

/* --- Buttons --- */
.btn-gold {
    background-color: var(--gold);
    border-color: var(--gold);
    color: #fff;
    font-weight: 600;
}

.btn-gold:hover {
    background-color: var(--gold-light);
    border-color: var(--gold-light);
    color: #fff;
}

.btn-navy {
    background-color: var(--navy);
    border-color: var(--navy);
    color: #fff;
    font-weight: 600;
}

.btn-navy:hover {
    background-color: var(--navy-dark);
    border-color: var(--navy-dark);
    color: #fff;
}

.btn-outline-navy {
    border-color: var(--navy);
    color: var(--navy);
}

.btn-outline-navy:hover {
    background-color: var(--navy);
    color: #fff;
}

/* --- Filter Bar --- */
.filter-bar {
    background: #fff;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 2rem;
}

/* --- Family History --- */
.chapter-card {
    background: #fff;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}

.chapter-card:hover {
    box-shadow: 0 2px 12px rgba(27, 54, 93, 0.1);
}

.chapter-card .chapter-title {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    color: var(--navy);
}

.chapter-download {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-width: 5.5rem;
}

.chapter-download > i {
    font-size: 2.2rem;
    color: var(--gold);
}

.chapter-download-size {
    font-size: 0.75rem;
    color: var(--medium-gray);
}

.btn-outline-gold {
    border: 1px solid var(--gold);
    color: var(--gold);
    background: transparent;
    font-weight: 500;
}

.btn-outline-gold:hover {
    background-color: var(--gold);
    color: #fff;
}

.section-header {
    background: var(--navy);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin: 2rem 0 1rem;
    font-family: 'Lora', Georgia, serif;
}

.section-header h2 {
    font-size: 1.25rem;
    color: #fff;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--navy);
    color: rgba(255, 255, 255, 0.8);
    padding: 2rem 0;
    margin-top: 4rem;
}

.site-footer a.footer-link {
    color: var(--gold);
    text-decoration: none;
}

.site-footer a.footer-link:hover {
    color: var(--gold-light);
    text-decoration: underline;
}

.site-footer .text-muted-light {
    color: rgba(255, 255, 255, 0.5);
}

/* --- Contact Page --- */
.contact-tile {
    display: block;
    background: #fff;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.contact-tile:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: 0 8px 24px rgba(27, 54, 93, 0.12);
    color: inherit;
    text-decoration: none;
}

.contact-tile-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(197, 164, 78, 0.1);
    font-size: 2rem;
    color: var(--gold);
}

.contact-tile-label {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 0.5rem;
}

.contact-tile-value {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 0;
}

/* --- Admin Styles --- */
.admin-sidebar {
    background: var(--navy);
    min-height: 100vh;
    padding-top: 1rem;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.75);
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    margin: 2px 0.5rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.admin-header {
    background: #fff;
    border-bottom: 2px solid var(--gold);
    padding: 1rem 0;
}

/* Dashboard stat cards */
.dash-stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--light-gray);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.dash-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(27, 54, 93, 0.1);
}

.dash-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.dash-stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}

.dash-stat-label {
    color: var(--medium-gray);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Year banner */
.dash-year-banner {
    background: linear-gradient(135deg, var(--navy) 0%, #2a4a7a 100%);
    color: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-year-range {
    color: var(--gold);
    font-weight: 600;
    font-family: 'Lora', Georgia, serif;
}

/* Recent items */
.dash-recent-item {
    padding: 0.75rem 1.25rem !important;
}

.dash-recent-title {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-recent-meta {
    font-size: 0.8rem;
    color: var(--medium-gray);
}

/* Bar chart in table */
.dash-bar-track {
    background: var(--light-gray);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.dash-bar-fill {
    background: linear-gradient(90deg, var(--navy), #2a4a7a);
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* Status dots */
.dash-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dash-status-active {
    background: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.dash-status-missing {
    background: var(--medium-gray);
    box-shadow: 0 0 0 3px rgba(155, 155, 155, 0.2);
}

/* Quick Actions grid */
.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.quick-action-tile:hover {
    background: var(--off-white);
    text-decoration: none;
}

.quick-action-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-action-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--charcoal);
    text-align: center;
    line-height: 1.2;
}

.quick-action-tile:hover .quick-action-label {
    color: var(--navy);
}

/* Badge pill for nav counts */
.bg-navy {
    background-color: var(--navy) !important;
}

/* --- Admin Form Sections --- */
.admin-form-section {
    background: #fff;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.admin-form-section-header {
    background: var(--navy);
    color: #fff;
    padding: 0.65rem 1.25rem;
    font-family: 'Lora', Georgia, serif;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.admin-form-section-body {
    padding: 1.25rem;
    background: #f4f3f0;
}

.admin-form-section-body .form-control,
.admin-form-section-body .form-select {
    background: #fff;
    border-color: #d0cec9;
}

.admin-form-section-body .form-control:focus,
.admin-form-section-body .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(197, 164, 78, 0.2);
}

.admin-form-section-body .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.35rem;
}

.admin-form-actions {
    background: var(--navy);
    padding: 1rem 1.25rem;
    margin-top: 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-form-actions .btn-navy {
    background: var(--gold);
    border-color: var(--gold);
    color: #fff;
    font-weight: 600;
}

.admin-form-actions .btn-navy:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
}

.admin-form-actions .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.4);
    color: rgba(255, 255, 255, 0.8);
}

.admin-form-actions .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-section {
        padding: 2.5rem 0;
        text-align: center;
    }

    .hero-section h1 {
        font-size: 1.75rem;
    }

    .headshot {
        width: 140px;
        height: 140px;
        margin-bottom: 1.5rem;
    }

    .section {
        padding: 2rem 0;
    }

    .section-title {
        font-size: 1.4rem;
    }
}

/* --- Utility --- */
.text-gold {
    color: var(--gold) !important;
}

.text-navy {
    color: var(--navy) !important;
}

.bg-off-white {
    background-color: var(--off-white);
}

/* Search highlight */
mark {
    background-color: rgba(197, 164, 78, 0.3);
    padding: 0.1em 0.2em;
    border-radius: 2px;
}

/* --- Intro Animation --- */
#intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#intro-overlay.intro-hidden {
    display: none !important;
}

#intro-overlay.intro-fade-out {
    opacity: 0;
    transform: scale(1.05);
}

#intro-content {
    text-align: center;
    transform: scale(1);
    transition: transform 0.8s ease;
}

#intro-overlay.intro-zoom-out #intro-content {
    transform: scale(0.85);
}

#intro-headshot {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--gold);
    object-fit: cover;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: scale(0.5);
}

#intro-name {
    color: #fff;
    font-family: 'Lora', Georgia, serif;
    font-size: 3rem;
    font-weight: 700;
    margin-top: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
}

#intro-tagline {
    color: var(--gold);
    font-family: 'Lora', Georgia, serif;
    font-size: 1.3rem;
    font-style: italic;
    margin-top: 0.75rem;
    opacity: 0;
    transform: translateY(15px);
}

/* Animations only start once fonts are ready (or timeout) */
.intro-ready #intro-headshot {
    animation: intro-headshot-in 0.8s ease forwards;
}

.intro-ready #intro-name {
    animation: intro-text-in 0.7s ease forwards 0.5s;
}

.intro-ready #intro-tagline {
    animation: intro-text-in 0.7s ease forwards 1s;
}

@keyframes intro-headshot-in {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes intro-text-in {
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    #intro-headshot {
        width: 160px;
        height: 160px;
    }
    #intro-name {
        font-size: 2rem;
    }
    #intro-tagline {
        font-size: 1rem;
        padding: 0 1rem;
    }
}

/* Print styles */
@media print {
    .navbar, .site-footer, .filter-bar, .pagination {
        display: none !important;
    }
    .pub-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}
