/* 1. THEME VARIABLES */
:root {
  --bg-color: #0a0a0b;
  --nav-border: rgba(255,255,255,0.1);
  --gold: #c5a059;
  --text-main: #e0e0e0;
  --text-muted: #88888b;
  --title-color: #ffffff;
  --poetry-text: #d1d1d6;
  --btn-text: #ffffff;
}

.light-mode {
  --bg-color: #fcfaf7;
  --nav-border: rgba(0,0,0,0.1);
  --gold: #947434;
  --text-main: #2c2c2e;
  --text-muted: #636366;
  --title-color: #1c1c1e;
  --poetry-text: #3a3a3c;
  --btn-text: #1c1c1e;
}

/* 2. GLOBAL STYLES */
body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: 'Lora', serif;
  margin: 0;
  line-height: 1.8;
  transition: background-color 0.5s ease, color 0.5s ease;
  -webkit-font-smoothing: antialiased;
}

/* 3. NAVIGATION */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30px 10%;
  border-bottom: 1px solid var(--nav-border);
  position: sticky;
  top: 0;
  background-color: var(--bg-color); 
  z-index: 1000;
  transition: background-color 0.5s ease;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 1px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 30px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: 0.3s;
}

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

#theme-toggle {
  background: none;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  margin-left: 30px;
  transition: 0.3s;
}

#theme-toggle:hover { background-color: var(--gold); color: var(--bg-color); }

/* 4. HERO & FEED */
.hero { text-align: center; padding: 100px 20px; max-width: 900px; margin: 0 auto;
  transition: opacity 1s ease, max-height 0.6s ease, padding 0.6s ease;
  max-height: 500px;
  overflow: hidden; }
.hero h1 { font-family: 'Playfair Display', serif; font-size: 4rem; margin: 0; color: var(--title-color); }
.hero-byline { color: var(--text-muted); font-size: 1.2rem; margin-top: 20px; font-family: 'Inter', sans-serif; }
.hero-hidden {opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; pointer-events: none;}

.author-link {
  color: var(--text-main);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.4s ease;
}

.author-link:hover { color: var(--gold); border-bottom: 1px solid var(--gold); }

.feed { max-width: 700px; margin: 0 auto 100px auto; padding: 0 20px; }
.metadata { font-family: 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 2px; font-size: 0.75rem; color: var(--gold); margin-bottom: 15px; display: block; }

h2 { font-family: 'Playfair Display', serif; font-size: 2.2rem; margin-bottom: 15px; color: var(--title-color); }
.byline { font-family: 'Inter', sans-serif; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 25px; }

.poetry-block {
  white-space: pre-line;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--poetry-text);
  border-left: 1px solid var(--gold);
  padding-left: 30px;
  margin: 40px 0;
}

.btn-read {
  display: inline-block;
  padding: 12px 0;
  color: var(--btn-text);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--gold);
  transition: 0.3s;
}

/* 5. SECTIONS & FOOTER */
.section-divider {
  text-align: center;
  margin: 80px 0 40px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--nav-border);
}

.section-divider h2 {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 5px;
  color: var(--gold);
}

footer {
  border-top: 1px solid var(--nav-border);
  padding: 60px 10%;
  margin-top: 100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Inter', sans-serif;
}

.footer-left { color: var(--text-muted); font-size: 0.8rem; letter-spacing: 1px; }
.footer-right a { color: var(--text-muted); text-decoration: none; font-size: 0.8rem; margin-left: 25px; transition: 0.3s; }
.footer-right a:hover { color: var(--gold); }

.essay-body {
  font-size: 1.15rem;
  color: var(--text-main);
  white-space: pre-line;
  margin-top: 30px;
}

/* THE LENS SYSTEM ANIMATIONS */
.category-section {
  transition: opacity 0.5s ease, transform 0.5s ease; opacity: 1;
}

.article-preview {
  transition: opacity 0.5s ease, transform 0.5s ease, max-height 0.5s ease;
  opacity: 1;
  max-height: 8000px;
}

/* Single class to handle all hidden states */
.hidden-element {
  opacity: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: translateY(10px);
  pointer-events: none;
  overflow: hidden;
  border: none !important;
}

/* Individual article animation for filtering */
.article-preview {
  margin-bottom: 60px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(184, 134, 11, 0.2);
  transition: opacity 0.5s ease, transform 0.5s ease, margin 0.5s ease;
  opacity: 1;
  transform: scale(1);
}

.article-preview.hidden {
  opacity: 0;
  transform: scale(0.95);
  display: none;
}

.hidden-element {
  display: none !important;
  opacity: 0;
}

/* Ensure the article page handles long text well */
.essay-body {
  white-space: pre-line;
  font-size: 1.1rem;
  line-height: 1.8;
  margin-top: 20px;
}

/* Prevent the PDF from being affected by dark mode filters */
embed, iframe, object {
    filter: none !important;
    background-color: white; /* Ensures the background stays visible */
}

.pdf-container {
    width: 100%;
    height: 85vh; /* Makes the document the hero of the page */
    margin: 40px 0;
    border: 1px solid var(--nav-border);
    background-color: var(--bg-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.pdf-container iframe {
    border: none;
    display: block;
    background-color: white;
}

.pdf-fallback-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}


/* Styling for Active Nav Links */
.nav-links a.active {
    border-bottom: 2px solid var(--gold);
    color: var(--gold);
}

.manuscript-section {
    max-width: 800px;
    margin: 100px auto;
    line-height: 1.8;
}

.contact-item a {
    font-size: 1.2rem;
    letter-spacing: 1px;
}

.submission-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 30px auto;
}

.form-group {
    display: flex;
    gap: 20px;
}

.submission-form input, 
.submission-form textarea, 
.submission-form select {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(184, 134, 11, 0.4);
    color: inherit;
    font-family: 'Lora', serif;
    padding: 10px;
    outline: none;
}

/* Midnight Mode specific tweaks for form */
.midnight-mode .submission-form input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.load-more-btn {
  display: block;
  margin: 40px auto;
  background: none;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 10px 25px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.load-more-btn:hover {
  background-color: var(--gold);
  color: var(--bg-color);
}

/* ---MOBILE--- */
@media (max-width: 768px) {
    /* 1. Navigation: Center everything and force rows */
    nav {
        flex-direction: column !important;
        padding: 20px 0;
        height: auto;
        text-align: center;
    }

    .logo {
        margin-bottom: 20px;
        width: 100%;
        display: block;
    }

    .nav-links {
        width: 100%;
        margin: 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .nav-links a {
        margin: 0 !important; /* Force desktop margins out */
    }

    /* 2. Search Bar: Ensure it occupies its own line */
    .search-container {
        width: 100%;
        display: block;
        margin: 20px auto !important;
        box-sizing: border-box;
    }

    #archiveSearch {
        width: 100% !important;
    }

    /* 3. Hero & Content Scaling */
    .hero h1 {
        font-size: 2.2rem;
    }

    /* 4. Contact Page: Alignment Fix for 'Support Here' */
    .contact-methods {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center; /* Centers all children */
    }

    .contact-item {
        width: 100%;
        text-align: center;
    }

    .contact-item div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: center;
    }

    .contact-item p {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    .contact-item .btn-read {
        width: 85% !important;
        max-width: 300px;
        margin: 10px auto;
        text-align: center;
    }
}