/*
 * Base styles for the Protofictional Emergence website.
 * The palette is intentionally restrained to evoke depth and clarity.
 */

:root {
    /* Base colours: black background, pale text and ice blue headings */
    --background-color: #000000;
    --text-color: #E5E5E5;
    --heading-color: #A8B6C5;
    --transition-duration: 0.3s;
}

/* General layout */
body {
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: "Inter", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

header {
    width: 100%;
}

/* Top navigation bar */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 60px;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(6px);
}

.logo {
    font-family: "EB Garamond", serif;
    font-size: 1.4rem;
    color: var(--heading-color);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.4rem 0.5rem;
    position: relative;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition-duration);
}

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

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background-color: var(--heading-color);
    transition: width var(--transition-duration);
}

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

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

.lang-switch {
    background: none;
    border: 1px solid var(--heading-color);
    color: var(--heading-color);
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color var(--transition-duration), color var(--transition-duration);
}

.lang-switch:hover {
    background-color: var(--heading-color);
    color: var(--background-color);
}

/* Hero section on home page */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 4rem 2rem;
    gap: 2rem;
    text-align: center;
}

/* Add a semi-transparent dark overlay over the hero background image for better readability */
.animation-container {
    position: relative;
}

.animation-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Darken the hero image further to ensure text remains legible */
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1;
}

/* Ensure hero image sits behind the overlay */
.hero-image {
    position: relative;
    z-index: 0;
}

/* Place hero text above the overlay */
.hero-overlay {
    z-index: 2;
}

/* Container for the animated images */
/* Container for the hero image */
.animation-container {
    position: relative;
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
}

/* Overlay for hero text and call-to-action placed over the image */
.hero-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: 0 1rem;
    z-index: 1;
}

/* Headline inside overlay: centred and forced into a single line */
.hero-overlay h1 {
    color: var(--heading-color);
    font-family: "EB Garamond", serif;
    font-weight: 400;
    /* Increase the headline size for stronger impact on the home page */
    font-size: 3rem;
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
}

/* Subtitle inside overlay: centred and on one line */
.hero-overlay p {
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
}

/* Hero image: full-width static image in place of animation */
.hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 60vh;
    margin: 0;
    /* Align the interesting part of the image (the book) toward the bottom */
    object-position: center bottom;
}

/* Container for hero text beneath the image */
.hero-text {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Headline: centered and forced into a single line */
.hero-text h1 {
    color: var(--heading-color);
    font-family: "EB Garamond", serif;
    font-weight: 400;
    font-size: 2rem;
    margin: 0 0 1rem;
    line-height: 1.3;
    white-space: nowrap;
}

/* Subtitle: centered and forced into a single line */
.hero-text p {
    margin: 0 0 1.5rem;
    font-size: 1rem;
    white-space: nowrap;
}

/* Primary call-to-action button with a subtle gradient */
.button {
    display: inline-block;
    background: linear-gradient(135deg, var(--heading-color) 0%, #D4DDE9 100%);
    color: var(--background-color);
    padding: 0.6rem 1.4rem;
    text-decoration: none;
    border: none;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: opacity var(--transition-duration);
    cursor: pointer;
}

/* On hover the button subtly dims to indicate interactivity */
.button:hover {
    opacity: 0.85;
}

/* About and page content sections */
.about,
.page-content {
    padding: 2rem 2rem 4rem;
    max-width: 800px;
    margin: 0 auto;
}

.about h2,
.page-content h1 {
    color: var(--heading-color);
    font-family: "EB Garamond", serif;
    font-weight: 400;
    margin-bottom: 1rem;
}

footer {
    text-align: center;
    padding: 2rem 1rem;
    font-size: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsiveness */
@media (max-width: 700px) {
    .hero {
        flex-direction: column;
    }
    .animation-container,
    .hero-text {
        width: 100%;
        text-align: center;
    }
    .animation-container {
        /* Let the static image dictate its own height on small screens */
        height: auto;
    }
}

/*
 * Additional styles for embedded document pages and enhanced footer links.
 */

/* Document content container: ensures original texts and biographies render
   properly with preserved line breaks and comfortable line height. */
.doc-content {
    white-space: pre-wrap;
    font-family: "Inter", sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 800px;
    margin: 2rem auto;
    color: var(--text-color);
}

/* Footer layout with biography and talk links and a home button. */
.footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0;
}
.footer-links a {
    color: var(--heading-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-duration);
}
.footer-links a:hover {
    color: var(--text-color);
}

/* Ensure the home button in the footer has spacing from other links */
.footer-links .button {
    margin-top: 0.5rem;
}

/* Diagram layout for the theories page */
.diagram {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 1.5rem;
    margin: 3rem auto;
    max-width: 1000px;
    justify-items: center;
    align-items: center;
}

/* Central node in the theories diagram */
.center-node {
    grid-row: 2;
    grid-column: 2;
    background-color: var(--background-color);
    color: var(--heading-color);
    border: 1px solid var(--heading-color);
    padding: 1rem 1.5rem;
    min-width: 220px;
    border-radius: 4px;
    text-align: center;
    font-family: "EB Garamond", serif;
    font-size: 1.1rem;
    text-transform: uppercase;
}

/* Individual theory boxes */
.theory-box {
    background: linear-gradient(180deg, #E5E5E5 0%, #A8B6C5 100%);
    color: #000;
    border-radius: 4px;
    padding: 1rem;
    min-width: 200px;
    min-height: 140px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-size: 0.9rem;
    line-height: 1.3;
}

/* SVG container for connecting lines in the diagram */
.diagram-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    stroke: var(--heading-color);
    stroke-width: 1;
    z-index: 0;
}

/* Responsive adjustments for the theories diagram */
@media (max-width: 700px) {
    .diagram {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    .diagram-lines {
        display: none;
    }
    .center-node {
        margin-bottom: 1rem;
    }
}

/* New grid layout for theory listings */
.theory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

/* Card style for each theory */
.theory-card {
    border: 1px solid var(--heading-color);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-color);
    transition: color var(--transition-duration), transform var(--transition-duration);
    display: block;
    border-radius: 4px;
}

/* Title inside card */
.theory-card .theory-title {
    font-family: "EB Garamond", serif;
    font-size: 1.3rem;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

/* Founder text inside card */
.theory-card .founder {
    font-style: italic;
    font-size: 0.9rem;
    margin: 0;
}

/* Hover effects for theory cards */
.theory-card:hover {
    color: var(--heading-color);
    transform: translateY(-4px);
}
.theory-card:hover .theory-title,
.theory-card:hover .founder {
    color: var(--heading-color);
}

/*
 * Simplified list style for the theories page.
 * Each theory is presented as a minimalist item without coloured backgrounds.
 * On hover the text enlarges slightly and changes to the highlight colour.
 */
.theory-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* When theory list is used to present related links on figure and theory pages, add spacing below it */
.related-list {
    margin-bottom: 2rem;
}

.theory-item {
    display: block;
    color: var(--text-color);
    /* Remove default underline from links to ensure a clean, minimalist look */
    text-decoration: none;
    font-family: "EB Garamond", serif;
    font-size: 1.5rem;
    line-height: 1.3;
    transition: transform var(--transition-duration), color var(--transition-duration);
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.theory-item .founder {
    display: block;
    font-family: "Inter", sans-serif;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-color);
    transition: color var(--transition-duration);
}

.theory-item:hover {
    color: var(--heading-color);
    /* Move slightly to the right and scale up to emphasise on hover */
    transform: translateX(12px) scale(1.03);
}

.theory-item:hover .founder {
    color: var(--heading-color);
}

/* Hover link styling for names inside theory descriptions */
.hover-link {
    color: var(--text-color);
    text-decoration: none;
    transition: color var(--transition-duration);
}

.hover-link:hover {
    color: var(--heading-color);
}

/* Photo credits and captions for figures */
.photo-credit,
.fig-credit {
    font-size: 0.75rem;
    color: var(--text-color);
    font-style: italic;
    margin-top: 0.5rem;
    text-align: center;
}

/* Add spacing above back buttons across pages */
#back-button {
    /* Provide extra breathing room above the back buttons on pages like key figures */
    /* Increase margin to separate the back button from preceding content across all pages */
    margin-top: 3rem;
}

/*
 * Figures grid layout for the key figures page.
 * Each card contains a portrait and the name of the figure.
 */
.figures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.figure-card {
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--heading-color);
    border-radius: 4px;
    overflow: hidden;
    transition: transform var(--transition-duration), color var(--transition-duration);
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.03);
}

.figure-card img {
    width: 100%;
    height: 260px;
    object-fit: cover;
}

.figure-card .name {
    padding: 1rem;
    font-family: "EB Garamond", serif;
    font-size: 1.2rem;
    line-height: 1.3;
}

.figure-card:hover {
    transform: translateY(-4px);
    color: var(--heading-color);
}

.figure-card:hover .name {
    color: var(--heading-color);
}

/* Figures list for key-figures page: portrait on the left and text on the right */
.figures-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1000px;
    margin: 2rem auto;
}

/* Individual figure item: flex container with image and info */
.figure-item {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--heading-color);
    border-radius: 4px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.03);
    transition: transform var(--transition-duration), color var(--transition-duration);
}

.figure-item img {
    width: 150px;
    height: 200px;
    object-fit: cover;
    flex-shrink: 0;
}

.figure-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.figure-info .fig-name {
    margin: 0 0 0.5rem;
    font-family: "EB Garamond", serif;
    font-size: 1.3rem;
    line-height: 1.2;
    color: var(--heading-color);
}

.figure-info .fig-snippet {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.figure-item:hover {
    transform: translateY(-4px);
    color: var(--heading-color);
}

.figure-item:hover .fig-name,
.figure-item:hover .fig-snippet {
    color: var(--heading-color);
}

/* Styling for lists of original text links on theory pages */
/* Styling for lists of original text links on theory pages */
/* Use the same minimalist look as the theory list for original text links. */
.original-links {
    margin: 1rem 0 1.5rem;
}

/* Reset default link styles inside original-links so they inherit the theory-item styling. */
.original-links a {
    text-decoration: none;
}

.original-links a:hover {
    color: var(--heading-color);
}

@media (max-width: 700px) {
    /* Stack figure items vertically with full-width images on small screens */
    .figure-item {
        flex-direction: column;
        align-items: center;
    }
    .figure-item img {
        width: 100%;
        height: auto;
    }
    .figure-info {
        align-items: center;
        text-align: center;
    }
    .figure-info .fig-name {
        font-size: 1.2rem;
    }
}
/* Subheadings color for figure pages */
.subhead{display:block;margin-top:1rem;font-weight:600;color:#A8B6C5;}


.oto-section-heading {
    color: #A8B6C5;
}

/* Accessibility improvements */
/* Skip navigation link for screen readers */
.skip-nav {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--heading-color);
    color: var(--background-color);
    padding: 0.5rem 1rem;
    text-decoration: none;
    z-index: 100;
    font-weight: 600;
}

.skip-nav:focus {
    top: 0;
}

/* Visible focus indicators for keyboard navigation */
a:focus,
button:focus,
.lang-switch:focus,
.nav-links a:focus {
    outline: 2px solid var(--heading-color);
    outline-offset: 2px;
}

/* Ensure sufficient touch targets on mobile (min 44x44px) */
@media (max-width: 768px) {
    .nav-links a,
    .lang-switch,
    .button {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Mobile UX improvements */
@media (max-width: 768px) {
    /* Improve navigation spacing on mobile */
    .top-nav {
        padding: 0 1rem;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
    }
    
    .nav-links {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    /* Reduce hero text size on mobile */
    .hero-overlay h1 {
        font-size: 2rem;
        white-space: normal;
        text-align: center;
    }
    
    .hero-overlay p {
        font-size: 0.9rem;
        white-space: normal;
        text-align: center;
    }
    
    /* Improve button spacing on mobile */
    .button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
    
    /* Improve page content padding on mobile */
    .page-content {
        padding: 2rem 1rem;
    }
    
    /* Improve theory cards on mobile */
    .theory-item {
        padding: 1.2rem;
    }
}

/* Performance: Reduce animations on mobile for better performance */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
