/* Medieval Themed Stylesheet */

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

body {
    font-family: 'Grimace', 'Garamond', serif;
    background-color: #f4e4c1;
    background-image: 
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(212, 165, 116, 0.05) 2px,
            rgba(212, 165, 116, 0.05) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(212, 165, 116, 0.05) 2px,
            rgba(212, 165, 116, 0.05) 4px
        );
    color: #5a5a5a;
    line-height: 1.8;
    padding: 2rem;
}

/* Parchment effect container */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(210, 180, 140, 0.03);
    pointer-events: none;
    z-index: -2;
}

body.map-page {
    background-image: none;
}

body.map-page::before {
    display: none;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Crimson Text', 'Georgia', serif;
    color: #8b7355;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 3px solid #d4a574;
    padding-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

h1 {
    font-size: 3rem;
    text-align: center;
    text-transform: uppercase;
    border: 3px double #d4a574;
    padding: 1.5rem;
    background-color: rgba(212, 165, 116, 0.1);
    margin-bottom: 2rem;
    position: relative;
}

h1::before,
h1::after {
    content: '⚜';
    display: inline-block;
    margin: 0 1rem;
    color: #d4a574;
}

h2 {
    font-size: 1.45rem;
    margin-top: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* Paragraphs and text */
p {
    margin-bottom: 1.5rem;
    text-align: justify;
    color: #5a5a5a;
}

/* Links */
a {
    color: #b8860b;
    text-decoration: none;
    border-bottom: 2px solid #d4a574;
    transition: all 0.3s ease;
    font-weight: bold;
}

a:hover {
    color: #8b7355;
    background-color: rgba(212, 165, 116, 0.15);
    padding-bottom: 0.25rem;
}

/* Lists */
ul, ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

li {
    margin-bottom: 0.75rem;
    color: #5a5a5a;
}

ul > li::marker {
    color: #d4af37;
}

/* Blockquotes */
blockquote {
    border-left: 5px solid #d4a574;
    border-right: 5px solid #d4a574;
    padding: 1.5rem;
    margin: 2rem 0;
    background-color: rgba(212, 165, 116, 0.08);
    color: #8b7355;
    font-style: italic;
    font-size: 1.1rem;
}

/* Code blocks */
code, pre {
    background-color: #ede7d9;
    color: #5a5a5a;
    border: 1px solid #d4a574;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

code {
    padding: 0.2rem 0.5rem;
}

pre {
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Buttons */
button, .button {
    background-color: #d4a574;
    color: #fff;
    border: 2px solid #b8860b;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Garamond', serif;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

button:hover, .button:hover {
    background-color: #c19a6b;
    color: #fff;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.5);
}

/* Horizontal rules */
hr {
    border: none;
    height: 3px;
    background: linear-gradient(to right, #d4a574, #c19a6b, #d4a574);
    margin: 2rem 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    border: 3px solid #d4a574;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
    margin: 1.5rem 0;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: rgba(139, 69, 19, 0.1);
}

th, td {
    border: 2px solid #d4a574;
    padding: 0.75rem;
    text-align: left;
    color: #5a5a5a;
}

th {
    background-color: rgba(212, 165, 116, 0.2);
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Forms */
input, textarea, select {
    background-color: #fff;
    color: #5a5a5a;
    border: 2px solid #d4a574;
    padding: 0.75rem;
    font-family: 'Garamond', serif;
    font-size: 1rem;
    margin-bottom: 1rem;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #c19a6b;
    box-shadow: 0 0 5px rgba(212, 165, 116, 0.5);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f4e4c1;
}

::-webkit-scrollbar-thumb {
    background: #d4a574;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c19a6b;
}

/* Navigation Tabs */
.tabs-container {
    background-color: #6b1a27;
    background-image: linear-gradient(to bottom, #7a1f2b, #5e1822);
    border-bottom: 4px solid #4a1119;
    padding: 0;
    margin: 0 0 2rem 0;
    position: relative;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tabs {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.tab-link {
    display: block;
    padding: 1rem 2rem;
    color: #f4e4c1;
    text-decoration: none;
    border: none;
    font-family: 'Garamond', serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: bold;
    transition: all 0.3s ease;
    border-bottom: 4px solid transparent;
    margin-bottom: -4px;
}

.tab-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-bottom-color: #d4af37;
}

.tab-link.active {
    background-color: rgba(0, 0, 0, 0.2);
    color: #fff;
    border-bottom-color: #d4af37;
    box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.2);
}

/* Intro Section */
.intro-section {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.15), rgba(255, 255, 255, 0.1));
    border-left: 5px solid #d4a574;
    border-radius: 5px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.intro-section p {
    color: #5a5a5a;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Document blocks */
.document-item {
    margin: 2rem 0;
}

.document-item h3 {
    margin-bottom: 0.8rem;
}

.document-note {
    background: rgba(212, 165, 116, 0.15);
    border-left: 5px solid #d4a574;
    border-radius: 5px;
    padding: 1rem 1.25rem;
    margin-top: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.document-note p {
    margin: 0;
    color: #5a5a5a;
}

.findings-hero {
    margin: 0 0 1.4rem;
}

.findings-hero-title {
    margin: 0 0 0.9rem;
    border: 0;
    padding: 0;
    text-align: center;
    font-size: clamp(2.1rem, 4vw, 3.2rem);
    line-height: 1.08;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b1a27;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5), 0 5px 14px rgba(0, 0, 0, 0.25);
}

.findings-hero-image {
    width: 100%;
    min-height: clamp(360px, 62vh, 760px);
    object-fit: contain;
    object-position: top center;
    border: 3px double #d4a574;
    border-radius: 6px;
    background: rgba(244, 228, 193, 0.65);
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
    text-align: center;
}

/* Findings database */
.findings-db {
    display: grid;
    gap: 1.25rem;
}

.db-controls-panel {
    display: grid;
    gap: 0.8rem;
}

.db-label {
    font-weight: bold;
    color: #8b7355;
}

.db-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.db-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: bold;
}

.db-toggle input {
    margin: 0;
}

.db-status {
    background: rgba(212, 165, 116, 0.15);
    border-left: 4px solid #d4a574;
    padding: 0.55rem 0.75rem;
    border-radius: 4px;
    font-size: 0.95rem;
}

.db-table-panel.is-hidden {
    display: none;
}

#db-sources-panel h3 {
    margin-top: 1.25rem;
}

.data-table td {
    vertical-align: top;
}

.data-table tbody tr.lord-continued td {
    background: rgba(212, 165, 116, 0.08);
}

.data-table tbody tr.lord-continued td:first-child {
    border-left: 4px solid #b8860b;
}

.data-table tbody tr.is-filtered-out {
    display: none;
}

.sortable-header-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    border: none;
    background: transparent;
    color: inherit;
    padding: 0;
    margin: 0;
    font: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.sortable-header-btn:hover {
    box-shadow: none;
    background: transparent;
    color: #5e1822;
}

.sortable-header-btn .sort-arrow {
    color: #8b7355;
    font-size: 0.95rem;
    line-height: 1;
}

.sortable-header-btn.is-active .sort-arrow {
    color: #6b1a27;
    font-weight: bold;
}

.combined-row-details {
    margin: 0;
}

.combined-row-details summary {
    cursor: pointer;
    color: #6b1a27;
    font-weight: bold;
}

.combined-details-wrap {
    margin-top: 0.45rem;
}

.combined-details-table {
    margin: 0.35rem 0 0;
    background: rgba(255, 255, 255, 0.75);
}

.combined-details-table th,
.combined-details-table td {
    font-size: 0.85rem;
    padding: 0.45rem;
}

.combined-empty-details {
    margin-top: 0.4rem;
    color: #5a5a5a;
    font-size: 0.9rem;
}

/* Map page */
.map-panel {
    margin: 1rem 0 2rem;
}

#italy-map {
    width: 100%;
    height: 78vh;
    min-height: 540px;
    border: none;
    box-shadow: 0 0 10px rgba(212, 165, 116, 0.3);
    border-radius: 4px;
    background: #efe2c5;
}

#italy-map.leaflet-container {
    background: #efe2c5;
}

#italy-map .leaflet-tile {
    outline: 1px solid transparent;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

#italy-map .leaflet-tile-container img {
    width: 257px !important;
    height: 257px !important;
}

#italy-map path {
    stroke-width: 0.7;
}

.map-status {
    margin-top: 0.65rem;
    font-size: 1rem;
    text-align: center;
}

/* Site footer */
.site-footer {
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    padding-bottom: 0.5rem;
    border-top: 2px solid #d4a574;
    text-align: center;
    display: flex;
    justify-content: center;
}

.site-footer p {
    margin: 0;
    text-align: center;
    font-size: 1.15rem;
    line-height: 1.9;
}

.footer-sep {
    display: inline-block;
    width: 0;
    height: 1.1rem;
    margin: 0 0.75rem;
    border-left: 2px solid #6b1a27;
    vertical-align: middle;
    font-size: 0;
    line-height: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }

    .footer-sep {
        display: inline-block;
        width: 0;
        height: 1.1rem;
        margin: 0 0.35rem;
        border-left: 2px solid #6b1a27;
        border-top: none;
    }

    .site-footer p {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.2rem;
    }

    #italy-map {
        height: 68vh;
        min-height: 420px;
    }
}
