/* Pennhurst Historical Archive - Shared Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f4e8d0;
    --bg-secondary: #e8dcc0;
    --text-primary: #3a2a1a;
    --text-secondary: #654321;
    --accent: #8b6d4c;
    --border: #8b6d4c;
    --overlay: rgba(139, 109, 76, 0.15);
    --font-primary: 'Crimson Text', 'Georgia', serif;
    --font-heading: 'IM Fell English', serif;
    --font-subheading: 'Libre Baskerville', serif;
    --base-font-size: 16px;
}

/* High contrast mode */
body.high-contrast {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --text-primary: #000000;
    --text-secondary: #000000;
    --accent: #000000;
    --border: #000000;
    --overlay: rgba(0, 0, 0, 0.1);
}

body {
    font-family: var(--font-primary);
    font-size: var(--base-font-size);
    background: linear-gradient(to bottom, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.8;
    position: relative;
}

/* Aged paper texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 109, 76, 0.03) 2px,
            rgba(139, 109, 76, 0.03) 4px
        ),
        radial-gradient(ellipse at center, transparent 0%, rgba(101, 67, 33, 0.1) 100%);
    pointer-events: none;
    z-index: 1;
}

body.high-contrast::before {
    display: none;
}

/* Skip to content link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    font-weight: bold;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid var(--accent);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 2;
}

/* Header styles */
header {
    text-align: center;
    padding: 60px 20px 40px;
    border-bottom: 3px double var(--border);
    margin-bottom: 40px;
    background: rgba(244, 232, 208, 0.6);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
    font-family: var(--font-heading);
    font-size: 3.5em;
    color: var(--text-primary);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-family: var(--font-subheading);
    font-size: 1.3em;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 20px;
}

.dates {
    font-size: 1.1em;
    color: var(--accent);
    letter-spacing: 3px;
}

/* Breadcrumb navigation */
.breadcrumb {
    background: var(--overlay);
    padding: 15px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    font-size: 0.95em;
}

.breadcrumb nav {
    background: none;
    border: none;
    margin: 0;
    padding: 0;
}

.breadcrumb ul {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
}

.breadcrumb li {
    margin-right: 10px;
    border: none;
}

.breadcrumb li::after {
    content: "›";
    margin-left: 10px;
    color: var(--accent);
}

.breadcrumb li:last-child::after {
    content: "";
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: underline;
    padding: 0;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
    color: var(--text-primary);
    background: none;
}

/* Content warning */
.content-warning {
    background: var(--overlay);
    border: 2px solid var(--border);
    padding: 20px;
    margin: 30px 0;
    border-radius: 4px;
}

.content-warning h2 {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 1.5em;
}

/* Navigation */
nav {
    background: rgba(101, 67, 33, 0.2);
    border: 2px solid var(--border);
    margin: 30px 0;
    padding: 0;
}

nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

nav li {
    margin: 0;
    border-right: 1px solid var(--border);
}

nav li:last-child {
    border-right: none;
}

nav a {
    display: block;
    padding: 15px 25px;
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-subheading);
    font-size: 1.05em;
    transition: background 0.3s ease;
}

nav a:hover,
nav a:focus {
    background: rgba(139, 109, 76, 0.3);
    outline: 2px solid var(--text-secondary);
    outline-offset: -2px;
}

nav a[aria-current="page"] {
    background: rgba(139, 109, 76, 0.4);
    font-weight: bold;
}

/* Main content sections */
.content-section {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--border);
    padding: 30px;
    margin: 30px 0;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.15);
}

.content-section h2 {
    font-family: var(--font-heading);
    font-size: 2.2em;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.content-section h3 {
    font-family: var(--font-subheading);
    font-size: 1.6em;
    color: var(--text-secondary);
    margin-top: 25px;
    margin-bottom: 15px;
}

.content-section h4 {
    font-family: var(--font-subheading);
    font-size: 1.3em;
    color: var(--text-primary);
    margin-top: 20px;
    margin-bottom: 10px;
}

.content-section p {
    font-size: 1.15em;
    margin-bottom: 15px;
    text-align: justify;
}

.content-section ul,
.content-section ol {
    margin: 15px 0 15px 40px;
    font-size: 1.15em;
}

.content-section li {
    margin-bottom: 10px;
}

/* Historical facts boxes */
.fact-box {
    background: var(--overlay);
    border-left: 4px solid var(--text-secondary);
    padding: 20px;
    margin: 20px 0;
    font-style: italic;
}

.fact-box strong {
    font-style: normal;
    color: var(--text-secondary);
}

/* Citation boxes */
.citation {
    background: rgba(101, 67, 33, 0.1);
    border: 1px solid var(--border);
    padding: 15px;
    margin: 20px 0;
    font-size: 0.95em;
    border-radius: 4px;
}

.citation strong {
    color: var(--text-secondary);
}

/* Timeline section */
.timeline {
    margin: 30px 0;
}

.timeline-item {
    display: flex;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px dashed var(--border);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-date {
    font-family: var(--font-heading);
    font-size: 1.4em;
    color: var(--text-secondary);
    min-width: 140px;
    font-weight: bold;
}

.timeline-content {
    flex: 1;
    padding-left: 20px;
}

/* Building list */
.building-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.building-card {
    background: rgba(244, 232, 208, 0.6);
    border: 2px solid var(--border);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.building-card:hover,
.building-card:focus-within {
    transform: translateY(-5px);
    box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.2);
}

.building-card h4 {
    font-family: var(--font-subheading);
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.3em;
}

.building-card a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
}

.building-card a:hover,
.building-card a:focus {
    text-decoration: underline;
    outline: 2px solid var(--text-secondary);
}

/* Footer */
footer {
    background: rgba(101, 67, 33, 0.2);
    border-top: 3px double var(--border);
    padding: 30px 20px;
    margin-top: 60px;
    text-align: center;
}

footer p {
    margin: 10px 0;
}

footer a {
    color: var(--text-secondary);
}

footer a:hover,
footer a:focus {
    color: var(--text-primary);
    outline: 2px solid var(--text-secondary);
}

/* Accessibility features */
.accessibility-tools {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(244, 232, 208, 0.95);
    border: 2px solid var(--border);
    padding: 10px;
    z-index: 1000;
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.accessibility-tools button {
    background: var(--text-secondary);
    color: var(--bg-primary);
    border: none;
    padding: 8px 15px;
    margin: 5px;
    cursor: pointer;
    font-family: var(--font-primary);
    font-size: 0.95em;
    border-radius: 3px;
}

.accessibility-tools button:hover,
.accessibility-tools button:focus {
    background: var(--accent);
    outline: 2px solid var(--text-primary);
}

/* Responsive design */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5em;
    }

    nav ul {
        flex-direction: column;
    }

    nav li {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    nav li:last-child {
        border-bottom: none;
    }

    .timeline-item {
        flex-direction: column;
    }

    .timeline-date {
        margin-bottom: 10px;
    }

    .timeline-content {
        padding-left: 0;
    }

    .accessibility-tools {
        position: static;
        margin-bottom: 20px;
    }

    .building-grid {
        grid-template-columns: 1fr;
    }
}

/* Print styles */
@media print {
    body::before,
    .accessibility-tools,
    nav,
    .skip-link {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .content-section {
        page-break-inside: avoid;
    }

    a {
        text-decoration: underline;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}