@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Cinzel:wght@400;700&family=Pinyon+Script&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css');

:root {
    /* Mother of Pearl & Mystic Navy Palette */
    --bg-pearl: #E9E1D3;
    /* Mother of Pearl */
    --brand-navy: #13273F;
    /* Mystic Navy */
    --action-red: #4E0B0B;
    /* Red Inferno */
    --accent-slate: #A8B8CF;
    /* Slate Blue */

    /* Standard UI Variable Mapping */
    --bg-color: var(--bg-pearl);
    --surface-color: var(--bg-pearl);
    --primary-color: var(--bg-pearl);
    --secondary-color: var(--accent-slate);
    --text-color: var(--bg-pearl);
    --cta-color: var(--action-red);

    --navbar-height: clamp(100px, 12vh, 150px);
}

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

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    /* Safety against horizontal scroll */
    width: 100%;
    padding-top: var(--navbar-height);
    /* Offset for fixed header */
}

body {
    font-family: 'Playfair Display', serif;
    background-color: var(--brand-navy);
    color: var(--bg-pearl);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* Page Specific Overrides */
.collection-page {
    background-color: var(--bg-pearl);
    color: var(--brand-navy);
}

.collection-page h1,
.collection-page h2,
.collection-page h3,
.collection-page h4,
.collection-page h5,
.collection-page h6 {
    color: var(--brand-navy) !important;
}

.collection-page .hero .subtitle {
    color: var(--brand-navy);
    opacity: 0.8;
}

.collection-page .collection-card h4:hover {
    color: var(--action-red) !important;
}

.collection-page .search-bar {
    background-color: var(--accent-slate);
    color: var(--brand-navy);
    border: 1px solid rgba(19, 39, 63, 0.1);
}

.collection-page .search-bar::placeholder {
    color: rgba(19, 39, 63, 0.5);
}

.collection-page .collection-link {
    color: var(--brand-navy);
}

/* Item Page Specific Overrides */
.item-page {
    background-color: var(--bg-pearl);
    color: var(--brand-navy);
}

.item-page h1,
.item-page h2,
.item-page h4,
.item-page h5,
.item-page h6 {
    color: var(--brand-navy) !important;
}

.item-page .hero .subtitle {
    color: var(--brand-navy);
    opacity: 0.8;
}

.item-page .manuscript-viewer {
    background-color: var(--brand-navy);
    padding: 20px;
    border-radius: 8px;
    color: var(--bg-pearl);
}

.item-page .manuscript-image-wrapper {
    background-color: rgba(233, 225, 211, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.item-page .transcription-box {
    background-color: var(--brand-navy);
    color: var(--bg-pearl);
    border: 1px solid rgba(233, 225, 211, 0.1);
}

.item-page .transcription-title {
    color: var(--bg-pearl);
    border-bottom-color: rgba(233, 225, 211, 0.2);
}

.item-page .transcription-content {
    color: var(--bg-pearl);
}

.item-page .btn-page {
    background-color: var(--bg-pearl);
    color: var(--brand-navy);
}

.item-page .btn-page:hover:not(:disabled) {
    background-color: var(--accent-slate);
}

.item-page .btn-page:disabled {
    background-color: rgba(233, 225, 211, 0.2);
    color: rgba(233, 225, 211, 0.4);
}

.item-page .metadata-section {
    background-color: var(--accent-slate);
    border: none;
    box-shadow: 0 10px 30px rgba(168, 184, 207, 0.2);
}

.item-page .metadata-label {
    color: var(--brand-navy);
}

.item-page .metadata-value {
    color: var(--brand-navy);
    text-align: right !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center;
}

.item-page .metadata-item {
    border-bottom-color: rgba(19, 39, 63, 0.2);
}

.item-page .media-card {
    background-color: var(--action-red);
    border: 1px solid rgba(19, 39, 63, 0.1);
}

.item-page .media-title,
.item-page .media-type {
    color: var(--bg-pearl);
}



main {
    flex: 1 1 auto;
    /* Allow main to grow and shrink as needed */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', serif;
    color: var(--bg-pearl);
}

/* Navbar */
nav {
    width: 100%;
    height: var(--navbar-height);
    background: var(--bg-pearl);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

nav.nav-hidden {
    transform: translateY(-100%);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 25px;
    /* Reduced gap to attach text closer to logo */
    text-decoration: none;
    color: var(--brand-navy);
}

.logo-container img {
    height: calc(var(--navbar-height) * 0.85);
    /* Responsive logo height */
    width: auto;
    transition: transform 0.3s ease;
}

.logo-container:hover img {
    transform: scale(1.05);
}

.logo-text {
    font-family: 'Pinyon Script', cursive;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 400;
    text-transform: none;
    line-height: 0.8;
    display: flex;
    flex-direction: column;
    color: var(--brand-navy);
}

.logo-text span {
    display: block;
}

/* Hamburger Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--brand-navy);
    transition: all 0.3s ease;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 40px;
}

.nav-links a {
    text-decoration: none;
    color: var(--brand-navy);
    font-weight: 600;
    font-size: 1.1rem;
    font-family: 'Playfair Display', serif;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--action-red);
    transition: width 0.3s ease;
}

.nav-links a:hover {
    color: var(--action-red);
}

.nav-links a:hover::after,
.nav-links a:active::after {
    width: 100%;
}

.nav-links a:active {
    color: var(--action-red);
}

/* Tablet & Mobile Styles */
@media (max-width: 820px) {

    /* iPad Air point */
    nav {
        height: 80px;
    }

    .logo-container img {
        height: 60px;
    }

    .menu-toggle {
        display: flex;
        /* Show hamburger */
    }

    .nav-links {
        position: absolute;
        top: 80px;
        /* Below the nav */
        left: 0;
        width: 100%;
        background: rgba(253, 250, 245, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        align-items: center;
        gap: 0;
        max-height: 0;
        /* Hidden by default */
        overflow: hidden;
        transition: max-height 0.4s ease, opacity 0.3s ease;
        opacity: 0;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        border-top: 1px solid rgba(0, 43, 78, 0.05);
        padding: 0;
    }

    .nav-links.active {
        max-height: 300px;
        /* Adjust based on content */
        opacity: 1;
        padding: 20px 0;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 15px 0;
        width: 100%;
    }

    .nav-links a::after {
        display: none;
        /* Hide hover underline in dropdown */
    }
}

/* Mobile specific: Hide name only on small phones */
@media (max-width: 600px) {
    .logo-text {
        display: none;
    }
}

/* Layout */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 10px auto 60px;
    padding: 0 20px;
}

.annotation-page .container {
    max-width: 1600px;
}

.hero {
    text-align: center;
    margin-bottom: 10px;
    /* even tighter */
    padding-top: 0;
}

.hero h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    color: var(--primary-color);
    margin: 0 0 5px;
    letter-spacing: -1px;
    line-height: 1.1;
}

/* Inline Links */
.project-text a,
.prefooter-about a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.project-text a:hover,
.prefooter-about a:hover,
.project-text a:active,
.prefooter-about a:active {
    border-bottom-color: var(--action-red);
}

.hero .subtitle {
    font-size: 1.5rem;
    color: var(--bg-pearl);
    opacity: 0.9;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    margin-bottom: 40px;
    display: block;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: 0 auto 20px;
    position: relative;
}

.search-bar {
    width: 100%;
    padding: 18px 30px;
    border: 1px solid rgba(19, 39, 63, 0.1);
    border-radius: 50px;
    background-color: var(--secondary-color);
    font-size: 1.1rem;
    font-family: 'Playfair Display', serif;
    color: var(--bg-pearl);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.search-bar:focus {
    outline: none;
    border-color: var(--action-red);
    box-shadow: 0 10px 30px rgba(78, 11, 11, 0.1);
}

.search-bar::placeholder {
    color: rgba(233, 225, 211, 0.7);
}

/* Collection Link */
.collection-link-wrapper {
    text-align: right;
    max-width: 600px;
    margin: 0 auto;
}

.collection-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.collection-link:hover {
    color: var(--accent-slate);
    opacity: 1;
    transform: translateX(5px);
}

.collection-link .arrow {
    margin-left: 10px;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.collection-link:hover .arrow {
    transform: translateX(5px);
}


/* Project Section */
.project-section {
    margin-top: 100px;
    padding: 80px 0;
    border-top: 1px solid rgba(0, 43, 78, 0.05);
    text-align: center;
}

.project-section h2 {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 30px;
}

.project-text {
    font-size: 1.15rem;
    color: var(--bg-pearl);
    max-width: 900px;
    margin: 0 auto 50px;
    line-height: 1.8;
}

/* Button Styling */
.btn-campaign {
    display: inline-block;
    padding: 16px 32px;
    background-color: var(--accent-slate);
    color: var(--brand-navy);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid var(--accent-slate);
}

.btn-primary {
    display: inline-block;
    padding: 16px 32px;
    background-color: var(--action-red);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid var(--action-red);
}

.btn-campaign:hover {
    background-color: transparent;
    color: var(--accent-slate);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(168, 184, 207, 0.2);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn-primary:hover {
    background-color: transparent;
    color: var(--action-red);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 11, 11, 0.2);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn-campaign:active,
.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    display: inline-block;
    padding: 12px 24px;
    background-color: transparent;
    color: var(--brand-navy);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 2px solid var(--brand-navy);
}

.btn-secondary:hover {
    background-color: var(--brand-navy);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(19, 39, 63, 0.2);
}

/* Prefooter */
.prefooter {
    padding: 60px 0;
    background-color: var(--bg-pearl);
    border-top: 1px solid var(--accent-slate);
    width: 100%;
    color: var(--brand-navy);
}

.prefooter-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    display: flex;
    justify-content: space-between;
    gap: 80px;
}

.prefooter-about {
    flex: 2;
    color: var(--brand-navy);
}

.prefooter-team {
    flex: 1;
    color: var(--brand-navy);
}

.prefooter h3 {
    font-size: 1.8rem;
    color: var(--brand-navy);
    margin-bottom: 20px;
}

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

.team-list li {
    margin-bottom: 10px;
}

.team-list a {
    text-decoration: none;
    color: var(--brand-navy);
    transition: color 0.3s ease;
    font-weight: 500;
    position: relative;
    padding-bottom: 2px;
}

.team-list a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1.5px;
    bottom: 0;
    left: 0;
    background-color: var(--action-red);
    transition: width 0.3s ease;
}

.team-list a:hover {
    color: var(--action-red);
}

.team-list a:hover::after {
    width: 100%;
}

/* Footer Section Redesign */
footer {
    width: 100%;
    padding: 40px 0;
    background-color: var(--bg-pearl);
    border-top: 1px solid var(--brand-navy);
}

.footer-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    color: var(--brand-navy);
    text-align: center;
}

.github-link {
    color: var(--brand-navy);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    display: inline-flex;
    margin-bottom: 5px;
}

.github-link:hover {
    color: var(--action-red);
}

.copyright {
    font-size: 1rem;
    font-weight: 500;
    color: var(--brand-navy);
    margin: 0;
}

.license-text {
    font-size: 0.85rem;
    font-weight: 300;
    color: rgba(19, 39, 63, 0.8);
    margin: 0;
}

.license-text a {
    color: inherit;
    transition: color 0.3s ease;
}

.license-text a:hover {
    color: var(--action-red);
    text-decoration: underline;
    text-decoration-color: var(--action-red);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 1s ease forwards;
}

/* Collection Page Styles */
.search-section {
    max-width: 600px;
    margin: 0 auto 60px;
    text-align: center;
}

.search-bar {
    width: 100%;
    padding: 15px 25px;
    font-size: 1.1rem;
    border: 1px solid rgba(19, 39, 63, 0.2);
    border-radius: 30px;
    background-color: var(--secondary-color);
    box-shadow: 0 4px 15px rgba(19, 39, 63, 0.05);
    transition: all 0.3s ease;
    font-family: 'Playfair Display', serif;
    outline: none;
    color: var(--bg-pearl);
}

.search-bar:focus {
    border-color: var(--action-red);
    box-shadow: 0 4px 20px rgba(78, 11, 11, 0.15);
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 100px;
}

.collection-card {
    background-color: var(--secondary-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--accent-slate);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    text-decoration: none;
    color: var(--brand-navy);
    display: flex;
    flex-direction: column;
}

.card-caption h4 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--brand-navy);
    font-family: 'Playfair Display', serif;
    transition: color 0.3s ease;
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 4/5;
    overflow: hidden;
}

.collection-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.card-caption {
    padding: 20px;
    text-align: center;
}

.card-caption h4 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--primary-color);
    font-family: 'Playfair Display', serif;
    transition: color 0.3s ease;
}

/* Card Hover Effects */
.collection-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 43, 78, 0.12);
}

.collection-card:hover img {
    transform: scale(1.05);
}

.collection-card:hover h4 {
    color: white;
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Collection Responsiveness */
@media (max-width: 1024px) {
    .collection-grid {
        gap: 30px;
    }
}

@media (max-width: 600px) {
    .collection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .card-caption h4 {
        font-size: 1.1rem;
    }

    .card-caption {
        padding: 15px;
    }
}

/* Persuasion Page Advanced Features */
.viewer-container {
    display: flex;
    gap: 40px;
    margin: 20px 0 40px;
    align-items: flex-start;
    /* Prevent children from automatically stretching to matching height */
}

.manuscript-viewer {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.manuscript-image-wrapper {
    width: 100%;
    flex: 1 1 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    background-color: #f4eee1;
    /* Height is driven by the image inside; sibling transcription-box will match via align-items: stretch */
}

.manuscript-viewer img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.5s ease;
}

.page-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

.btn-page {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Playfair Display', serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-page:hover:not(:disabled) {
    background-color: var(--accent-color);
    transform: translateY(-2px);
}

.btn-page:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.transcription-box {
    flex: 1;
    background-color: white;
    padding: 40px;
    border-radius: 8px;
    color: var(--brand-navy);
    margin-top: 20px;
    /* Match the 20px padding in .manuscript-viewer */
    /* Use border-box to include padding/borders in the assigned height */
    box-sizing: border-box;
    /* Remove borders if they create visual mismatch, or ensure they are accounted for */
    border: none;
    box-shadow: 0 10px 30px rgba(0, 43, 78, 0.05);
    /* Keep shadow for definition */
    /* Match the image wrapper height and scroll text inside */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.transcription-content {
    font-family: 'Playfair Display', serif;
    line-height: 1.8;
    color: var(--text-color);
    font-size: 1.05rem;
}

.transcription-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
}

.viewer-actions {
    display: flex;
    gap: 20px;
    margin-top: 30px;
}

.btn-action {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-iiif,
.btn-xml {
    background-color: var(--accent-slate);
    border: 1px solid var(--accent-slate);
    color: var(--brand-navy);
}

.btn-iiif:hover,
.btn-xml:hover {
    background-color: transparent;
    color: var(--accent-slate);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* Moved to .metadata-actions scoping below */


/* Metadata Section */
.metadata-section {
    margin: 80px 0;
    padding: 60px;
    background-color: rgba(0, 43, 78, 0.02);
    border-radius: 12px;
}

.metadata-section h2 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 40px;
    text-align: center;
}

.metadata-list {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.metadata-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 43, 78, 0.1);
}

.metadata-label {
    font-weight: 600;
    color: var(--primary-color);
    flex: 1;
}

.metadata-item .metadata-value {
    flex: 2;
    color: var(--brand-navy);
    text-align: right !important;
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center;
}

.metadata-actions {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.metadata-actions .btn-action {
    flex: none;
    width: fit-content;
    padding: 12px 24px;
    position: relative;
}

.metadata-actions .btn-action:hover {
    background-color: transparent;
    color: var(--brand-navy);
}

.metadata-actions .btn-action::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--action-red);
    transition: width 0.3s ease;
}

.metadata-actions .btn-action:hover::after {
    width: 100%;
}

/* Media Carousel */
.carousel-section {
    margin: 60px 0 40px;
}

.carousel-section h2 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 40px;
    text-align: center;
}

.carousel-container {
    display: flex;
    gap: 30px;
    overflow-x: auto;
    padding: 20px 0 40px;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.carousel-container::-webkit-scrollbar {
    display: none;
}

.media-card {
    min-width: 300px;
    background-color: var(--action-red);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--accent-slate);
    text-decoration: none;
    color: var(--brand-navy);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.media-thumbnail {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}

.media-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.media-info {
    padding: 12px 15px;
}

.media-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--brand-navy);
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    opacity: 0.8;
}

.media-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: var(--brand-navy);
    line-height: 1.4;
}

.media-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 43, 78, 0.1);
}

.media-card:hover img {
    transform: scale(1.08);
}

.carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.carousel-arrow {
    position: absolute;
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(0, 43, 78, 0.1);
    border-radius: 50%;
    color: var(--brand-navy);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.carousel-arrow:hover {
    background: var(--accent-slate);
    color: var(--bg-pearl);
    transform: scale(1.1);
}

.carousel-arrow.prev {
    left: -22px;
}

.carousel-arrow.next {
    right: -22px;
}

@media (max-width: 1024px) {
    .carousel-arrow {
        display: none;
        /* Hide on small screens where touch is better */
    }
}

/* Responsiveness for Persuasion Page */
@media (max-width: 1024px) {
    .viewer-container {
        gap: 20px;
    }
}

@media (max-width: 820px) {
    .viewer-container {
        flex-direction: column;
    }

    .manuscript-viewer,
    .transcription-box {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .metadata-item {
        flex-direction: column;
        gap: 5px;
    }

    .metadata-section {
        padding: 40px 20px;
    }

    .viewer-actions {
        flex-direction: column;
    }
}



/* Annotation Campaign Styles */
.hero.no-subtitle {
    text-align: center;
    margin-bottom: 80px;
}

.hero.no-subtitle h1 {
    font-size: 4rem;
    margin-bottom: 0;
}

.content-section {
    max-width: 900px;
    margin: 0 auto 100px;
}

.content-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 25px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    display: inline-block;
}

.content-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
}

.subsection {
    margin-top: 40px;
    padding-left: 30px;
    border-left: 3px solid rgba(0, 43, 78, 0.1);
}

.subsection h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* Comparison Viewer (3-Column Layout) */
.evaluation-section {
    max-width: 95%;
    margin: 0 auto 100px;
}

.section-intro {
    max-width: 900px;
    margin: 0 auto 50px;
    text-align: left;
}

.comparison-viewer {
    display: flex;
    gap: 20px;
    margin-top: 50px;
    align-items: stretch;
    /* Match height of all panels */
    background-color: var(--secondary-olive);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--accent-brown);
    max-height: 700px;
}

.annotation-page .content-section a {
    color: var(--accent-slate);
    text-decoration: none;
    position: relative;
    display: inline-block;
    vertical-align: bottom;
    transition: all 0.3s ease;
}

.annotation-page .content-section a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1.5px;
    bottom: 0px;
    left: 0;
    background-color: var(--accent-slate);
    transition: width 0.3s ease;
    z-index: 1;
}

.annotation-page .content-section a:hover::after {
    width: 100%;
}

.transcription-panel {
    flex: 1.5;
    background: var(--accent-slate);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    min-height: 400px;
    position: relative;
    color: var(--brand-navy);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transcription-panel p,
.transcription-panel .transcription-text {
    color: var(--brand-navy);
}


.panel-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--brand-navy);
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 43, 78, 0.05);
    padding-bottom: 10px;
}

.ai-panel .transcription-text {
    font-style: italic;
    color: var(--brand-navy);
    transition: opacity 0.3s ease;
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding-right: 15px;
    line-height: 1.6;
}

.ai-panel .transcription-text p {
    font-size: 1rem;
    margin: 0;
}

.transcription-key {
    font-size: 0.7rem;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 43, 78, 0.1);
    line-height: 1.6;
}

.transcription-key strong {
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
}

/* Custom scrollbar for better aesthetics */
.ai-panel .transcription-text::-webkit-scrollbar {
    width: 6px;
}

.ai-panel .transcription-text::-webkit-scrollbar-track {
    background: rgba(19, 39, 63, 0.05);
    border-radius: 3px;
}

.ai-panel .transcription-text::-webkit-scrollbar-thumb {
    background: rgba(19, 39, 63, 0.2);
    border-radius: 3px;
}

.manuscript-panel {
    flex: 2;
    display: flex;
    flex-direction: column;
}

.manuscript-frame {
    width: 100%;
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background-color: var(--action-red);
    margin-bottom: 20px;
}

.manuscript-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Changed from cover to prevent clipping */
    transition: opacity 0.3s ease;
}

.page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.btn-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-circle:hover:not(:disabled) {
    background-color: var(--accent-slate);
    transform: scale(1.1);
}

.btn-circle:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary-color);
}

/* Responsiveness for Annotation Page */
@media (max-width: 1024px) {
    .comparison-viewer {
        flex-direction: column;
        align-items: center;
        max-height: none;
    }

    .transcription-panel,
    .manuscript-panel {
        width: 100%;
        max-width: 600px;
    }

    .transcription-panel {
        min-height: 600px;
    }
}

@media (max-width: 600px) {
    .hero.no-subtitle h1 {
        font-size: 2.8rem;
    }

    .content-section {
        padding: 0 20px;
    }

    .comparison-viewer {
        padding: 15px;
    }
}

/* --- Transcription Styling --- */
.transcription-box {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 43, 78, 0.05);
    border: 1px solid rgba(0, 43, 78, 0.1);
    color: var(--brand-navy);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.transcription-content {
    line-height: 1.8;
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    padding: 1.5rem;
    overflow-y: auto;
    flex-grow: 1;
    position: relative;
}

.transcription-line,
.transcription-p {
    margin-bottom: 0.5rem;
    min-height: 1.2em;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.transcription-line:hover,
.transcription-p:hover {
    background-color: rgba(168, 184, 207, 0.1);
}

.transcription-line.active,
.transcription-p.active {
    background-color: rgba(168, 184, 207, 0.2);
}

.entity-link {
    color: #a8b8cf;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.entity-link:hover {
    opacity: 0.8;
}

.del-text {
    text-decoration: line-through;
    color: #888;
    opacity: 0.7;
}

.add-text {
    vertical-align: super;
    font-size: 0.75em;
    color: var(--accent-color);
    margin-left: 2px;
}



/* Line-sync Overlay */
.manuscript-overlay {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.highlight-zone {
    fill: #a8b8cf;
    fill-opacity: 0.3;
    /* Slightly higher for visibility */
    stroke: #a8b8cf;
    stroke-width: 2;
    stroke-opacity: 0.5;
}

.loading-msg,
.error-msg {
    text-align: center;
    padding: 2rem;
    font-style: italic;
    color: #666;
}

.error-msg {
    color: #c0392b;
}


@media (max-width: 820px) {

    /* Match navbar breakpoint */
    .container {
        margin: 40px auto;
    }

    .hero {
        margin-bottom: 50px;
    }

    .hero h1 {
        font-size: 3.5rem;
    }

    .project-section {
        margin-top: 60px;
        padding: 50px 0;
    }

    .project-section h2 {
        font-size: 2.5rem;
    }

    .prefooter-container {
        flex-direction: column !important;
        /* Force vertical stacking */
        gap: 40px;
        text-align: center;
        align-items: center;
    }

    .prefooter-about,
    .prefooter-team {
        flex: none !important;
        width: 100%;
        max-width: 600px;
    }

    .team-list {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 3rem;
        /* Further reduced for mobile */
    }

    .transcription-panel {
        min-height: 300px;
        max-height: 400px;
    }

    .hero .subtitle {
        font-size: 1.1rem;
        margin-bottom: 20px;
    }

    .btn-campaign {
        padding: 14px 20px;
        font-size: 0.9rem;
        width: 100%;
        display: block;
        box-sizing: border-box;
        line-height: 1.4;
    }
}

.centered-image {
    display: block;
    margin: 20px auto;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Guided Tour Styles */
.guide-popup {
    position: absolute;
    background-color: var(--accent-slate);
    color: var(--action-red);
    padding: 20px;
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    max-width: 280px;
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    line-height: 1.4;
    font-size: 1.1rem;
    pointer-events: auto;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
}

.guide-popup::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Position tail based on alignment */
.guide-popup.point-left::after {
    border-width: 15px 20px 15px 0;
    border-color: transparent var(--accent-slate) transparent transparent;
    left: -18px;
    top: 50%;
    transform: translateY(-50%);
}

.guide-popup.point-top::after {
    border-width: 0 15px 20px 15px;
    border-color: transparent transparent var(--accent-slate) transparent;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
}

.guide-popup.point-bottom::after {
    border-width: 20px 15px 0 15px;
    border-color: var(--accent-slate) transparent transparent transparent;
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
}

.guide-popup.point-top-left::after {
    border-width: 0 15px 20px 15px;
    border-color: transparent transparent var(--accent-slate) transparent;
    top: -18px;
    left: 20%;
    transform: translateX(-50%);
}

.guide-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.guide-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--action-red);
    font-size: 1.2rem;
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.guide-close:hover {
    opacity: 1;
}

.guide-btn {
    align-self: flex-end;
    background-color: var(--action-red);
    color: var(--accent-slate);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.guide-btn:hover {
    transform: scale(1.05);
    background-color: #3a0808;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.guide-popup-active {
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.guide-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 10000;
    backdrop-filter: blur(2px);
    pointer-events: none;
}

/* Faceted Research Styles */
.faceted-research-container {
    margin-top: 5px;
    text-align: right;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.faceted-toggle {
    background: none;
    border: none;
    color: var(--brand-navy);
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    /* Bigger */
    font-weight: 700;
    /* Bolder */
    cursor: pointer;
    padding: 5px 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: color 0.3s ease;
    position: relative;
    /* For the underline */
}

.faceted-toggle::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--action-red);
    transition: width 0.3s ease;
}

.faceted-toggle:hover::after,
.faceted-toggle-active::after {
    width: 100%;
}

.faceted-toggle:hover {
    color: var(--action-red);
}

.toggle-icon {
    font-size: 0.8rem;
    /* Match sub-category icon size */
    line-height: 1;
    transition: transform 0.3s ease;
    display: inline-block;
}

.faceted-dropdown.active~.faceted-toggle .toggle-icon,
/* This selector depends on HTML order, let's use a simpler one with JS toggle if needed */
.faceted-toggle-active .toggle-icon {
    transform: rotate(90deg);
}

.faceted-dropdown {
    display: none;
    background-color: var(--brand-navy);
    color: var(--bg-pearl);
    border-radius: 8px;
    padding: 20px;
    margin-top: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: fadeInDown 0.3s ease forwards;
    text-align: left;
    /* Keep content left aligned */
}

.faceted-dropdown.active {
    display: block;
}

.filter-categories {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.filter-group {
    border-bottom: 1px solid rgba(233, 225, 211, 0.1);
    padding-bottom: 10px;
}

.filter-group:last-child {
    border-bottom: none;
}

.category-toggle {
    background: none;
    border: none;
    color: var(--bg-pearl);
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-toggle::after {
    content: '▶';
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.filter-group.active .category-toggle::after {
    transform: rotate(90deg);
}

.category-options {
    display: none;
    padding: 10px 0 5px 15px;
    flex-direction: column;
    gap: 10px;
}

.filter-group.active .category-options {
    display: flex;
}

.category-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 300;
}

.category-options input[type="checkbox"] {
    accent-color: var(--action-red);
    width: 16px;
    height: 16px;
}

.filter-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(233, 225, 211, 0.2);
    display: flex;
    justify-content: flex-end;
}

.btn-clear {
    background-color: transparent;
    border: 1px solid var(--bg-pearl);
    color: var(--bg-pearl);
    padding: 6px 15px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-clear:hover {
    background-color: var(--bg-pearl);
    color: var(--brand-navy);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}