/* --- CSS Variables --- */
:root {
    --color-primary: #1a0a2a; /* Deep violet-black */
    --color-secondary: #3b0b5e; /* Muted deep purple */
    --color-text-light: #e0e0e0; /* Off-white for light text */
    --color-text-dark: #333333; /* Dark gray for dark text */
    --color-background-dark: #0d0413; /* Even darker background */
    --color-background-light: #f5f5f5; /* Light background for contrast */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --spacing-unit: 1rem;
    --border-radius: 8px;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* --- Base Styles --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--color-text-light);
    background-color: var(--color-background-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 calc(var(--spacing-unit) * 2);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-text-light);
    margin-bottom: var(--spacing-unit);
    font-weight: 700;
}

h1 {
    font-size: 4.5rem;
    letter-spacing: 2px;
    text-shadow: var(--shadow-medium);
}

h2 {
    font-size: 3rem;
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 3);
    position: relative;
    padding-bottom: var(--spacing-unit);
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient_dark(to right, var(--color-accent), var(--color-secondary));
    border-radius: 2px;
}

h3 {
    font-size: 1.8rem;
    margin-top: calc(var(--spacing-unit) * 1.5);
    margin-bottom: var(--spacing-unit);
}

p {
    font-size: 1.1rem;
    margin-bottom: var(--spacing-unit);
    line-height: 1.8;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #c09bdc; /* Lighter shade for hover */
}

/* --- Header & Navigation --- */
.site-header {
    background-color: rgba(13, 4, 19, 0.9); /* Slightly transparent dark background */
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-light);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(155, 89, 182, 0.4);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
}

.nav-links a {
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--color-text-light);
    font-size: 1rem;
    padding: var(--spacing-unit) 0;
    position: relative;
    transition: color 0.3s ease, transform 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 0; /* Changed from 100% to 0 */
    height: 2px;
    background-color: var(--color-accent);
    transition: transform 0.3s ease, width 0.3s ease; /* Transition width too */
}

.nav-links a:hover {
    color: var(--color-accent);
    transform: translateY(-2px);
}

.nav-links a:hover::after {
    transform: translateX(-50%) scaleX(1);
    width: 100%; /* Expand to full width on hover */
}

/* --- Section Base Styles --- */
.section {
    padding: calc(var(--spacing-unit) * 6) 0;
    position: relative;
    overflow: hidden; /* Ensure content doesn't spill on animations */
}

.section-dark {
    background-color: var(--color-primary);
    color: var(--color-text-light);
}

.section-light {
    background-color: var(--color-background-light);
    color: var(--color-text-dark);
}

.section-light h2, .section-light h3 {
    color: var(--color-secondary);
}

.section-light h2::after {
    background: linear-gradient(to right, var(--color-secondary), var(--color-accent));
}

.section-light a {
    color: var(--color-secondary);
}

.section-light a:hover {
    color: var(--color-accent);
}

/* --- Hero Section: The Veil's Embrace --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: url('images/image_19.jpg') no-repeat center center/cover;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, var(--color-primary) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    padding: calc(var(--spacing-unit) * 3);
    max-width: 900px;
}

.hero-content h1 {
    font-size: 6rem;
    margin-bottom: calc(var(--spacing-unit) * 1);
    text-shadow: 0 0 25px rgba(155, 89, 182, 0.7), 0 0 10px rgba(0,0,0,0.8);
    background: -webkit-linear-gradient(45deg, var(--color-accent), var(--color-text-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textGlow 3s infinite alternate ease-in-out;
}

@keyframes textGlow {
    0% {
        text-shadow: 0 0 10px var(--color-accent), 0 0 20px var(--color-accent), 0 0 30px var(--color-secondary);
    }
    100% {
        text-shadow: 0 0 20px var(--color-accent), 0 0 30px var(--color-accent), 0 0 40px var(--color-secondary);
    }
}

.hero-content .tagline {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 1.5px;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 2px 10px rgba(0,0,0,0.7);
}

/* --- Card Grid: Echoes of Eternity --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(var(--spacing-unit) * 3);
    margin-top: calc(var(--spacing-unit) * 4);
}

.card {
    background: linear-gradient(145deg, var(--color-secondary) 0%, rgba(59, 11, 94, 0.7) 100%);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 2);
    text-align: center;
    box-shadow: var(--shadow-light);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Ensures content pushes to top/bottom */
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: var(--shadow-medium);
}

.card img {
    width: 100%;
    height: 200px; /* Fixed height for consistency */
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-unit);
    border: 2px solid var(--color-accent);
    transition: transform 0.3s ease;
}

.card:hover img {
    transform: scale(1.05);
}

.card h3 {
    color: var(--color-text-light);
    font-size: 1.6rem;
    margin-bottom: calc(var(--spacing-unit) * 0.5);
}

.card p {
    font-size: 0.95rem;
    opacity: 1;.9;
    margin-bottom: 0;
}

/* --- Split Layout: Whispers from the Beyond --- */
.split-layout {
    display: flex;
    gap: calc(var(--spacing-unit) * 4);
    align-items: center;
}

.split-image {
    flex: 1;
    min-width: 40%; /* Ensure image takes significant space */
}

.split-image img {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    transition: transform 0.5s ease;
    filter: brightness(0.9) grayscale(0.2);
}

.split-image img:hover {
    transform: scale(1.02);
    filter: brightness(1) grayscale(0);
}

.split-content {
    flex: 2;
    max-width: 60%;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
}

.split-content h2 {
    text-align: left;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.split-content h2::after {
    left: 0;
    transform: translateX(0);
}

.split-content p {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    font-size: 1.05rem;
}

/* --- Gallery Grid: Arcane Assemblage --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
    margin-top: calc(var(--spacing-unit) * 4);
}

.gallery-item {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    background-color: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: var(--shadow-medium);
}

.gallery-item img {
    width: 100%;
    height: 100%; /* Make images fill their container */
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.4s ease;
    filter: brightness(0.8) grayscale(0.1);
}

.gallery-item:hover img {
    transform: scale(1.1);
    filter: brightness(1) grayscale(0);
}

/* Dynamic sizing for some gallery items */
.gallery-grid .gallery-item:nth-child(even) {
    grid-column: span 1; /* Default to 1 column */
    grid-row: span 1;
}

.gallery-grid .gallery-item:nth-child(3n+1) { /* Example: make some taller */
    grid-row: span 2;
    height: 400px; /* Specific height for taller items */
}

.gallery-grid .gallery-item:nth-child(4n) { /* Example: make some wider */
    grid-column: span 2;
    height: 250px;
}

/* Reset for items that might get stretched */
.gallery-grid .gallery-item:nth-child(2) {
    height: 300px; /* Default height */
    grid-column: span 1;
    grid-row: span 1;
}
.gallery-grid .gallery-item:nth-child(5) {
    height: 320px;
    grid-column: span 1;
    grid-row: span 1;
}
.gallery-grid .gallery-item:nth-child(7) {
    height: 380px;
    grid-column: span 1;
    grid-row: span 1;
}


/* --- Spectral Chronicles --- */
.chronicles-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column layout for stacked articles */
    gap: calc(var(--spacing-unit) * 5);
    margin-top: calc(var(--spacing-unit) * 4);
}

.chronicle-entry {
    background-color: #ffffff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.chronicle-entry:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-medium);
}

.chronicle-entry img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    border-bottom: 3px solid var(--color-secondary);
    transition: transform 0.3s ease;
}

.chronicle-entry:hover img {
    transform: scale(1.02);
}

.chronicle-entry h3 {
    color: var(--color-secondary);
    font-size: 2.2rem;
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 2) 0;
    text-align: center;
}

.chronicle-entry p {
    color: var(--color-text-dark);
    padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 2);
    font-size: 1rem;
    opacity: 1;.9;
}

/* --- Outro Section: Twilight Tapestry --- */
.outro-section {
    background: url('images/image_20.jpg') no-repeat center center/cover;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.outro-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(26, 10, 42, 0.7) 100%);
    z-index: 1;
}

.outro-statement {
    position: relative;
    z-index: 2;
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 400;
    color: var(--color-text-light);
    max-width: 800px;
    line-height: 1.3;
    text-shadow: 0 0 15px rgba(255,255,255,0.4), 0 0 5px rgba(0,0,0,0.8);
    animation: fadeAndScale 2s forwards ease-out; /* Apply animation */
    opacity: 1; /* Hidden initially */
}

/* --- Footer --- */
.site-footer {
    background-color: var(--color-background-dark);
    color: var(--color-text-light);
    text-align: center;
    padding: calc(var(--spacing-unit) * 3) 0;
    border-top: 1px solid rgba(var(--color-accent), 0.2);
    font-size: 0.9rem;
}

.site-footer p {
    margin: 0;
    opacity: 1;.8;
}

/* --- Scroll Reveal Animations (JS controlled) --- */
.reveal-item, .section.animate-fade-in {
    opacity: 1;
    transform: translateY(30px);
    transition: opacity 1s ease-out, transform 1s ease-out;
}

.reveal-item.is-revealed, .section.animate-fade-in.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Special animation for the outro statement */
.outro-statement {
    animation: none; /* Reset if previously set */
}

.outro-statement.is-revealed {
    animation: fadeAndScale 2s forwards ease-out;
}

@keyframes fadeAndScale {
    0% {
        opacity: 1;
        transform: scale(0.95) translateY(20px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}


/* --- Responsive Design --- */
@media (max-width: 1024px) {
    .hero-content h1 {
        font-size: 5rem;
    }
    .hero-content .tagline {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 2.5rem;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 cards per row on smaller desktops/tablets */
    }

    .split-layout {
        flex-direction: column;
    }
    .split-image, .split-content {
        max-width: 100%;
        width: 100%;
    }
    .split-content h2 {
        text-align: center;
    }
    .split-content h2::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    /* Reset specific gallery item spans for smaller screens if needed */
    .gallery-grid .gallery-item:nth-child(4n), .gallery-grid .gallery-item:nth-child(3n+1) {
        grid-column: span 1;
        grid-row: span 1;
        height: auto; /* Reset explicit height */
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
    }
    .main-nav {
        flex-direction: column;
        gap: var(--spacing-unit);
    }
    .nav-links {
        gap: var(--spacing-unit);
        flex-wrap: wrap;
        justify-content: center;
        margin-top: var(--spacing-unit);
    }
    .nav-links a {
        font-size: 0.9rem;
        padding: var(--spacing-unit) calc(var(--spacing-unit) * 0.5);
    }
    .logo {
        font-size: 1.8rem;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }
    .hero-content .tagline {
        font-size: 1.2rem;
    }

    h2 {
        font-size: 2rem;
    }

    .card-grid {
        grid-template-columns: 1fr; /* 1 card per row on mobile */
    }

    .card {
        padding: calc(var(--spacing-unit) * 1.5);
    }

    .split-content {
        padding: 0;
    }
    .split-image img {
        margin-bottom: var(--spacing-unit) * 2;
    }

    .chronicle-entry img {
        height: 250px;
    }
    .chronicle-entry h3 {
        font-size: 1.8rem;
    }
    .chronicle-entry p {
        font-size: 0.9rem;
    }

    .outro-statement {
        font-size: 2rem;
        padding: var(--spacing-unit) * 2;
    }

    .gallery-grid {
        grid-template-columns: 1fr; /* Single column for gallery on very small screens */
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 3rem;
    }
    .hero-content .tagline {
        font-size: 1rem;
    }
    h2 {
        font-size: 1.7rem;
    }
    .section {
        padding: calc(var(--spacing-unit) * 4) 0;
    }
    .container {
        padding: 0 var(--spacing-unit);
    }
    .outro-statement {
        font-size: 1.5rem;
    }
}


/* Animation states when visible - FIXED: Only opacity: 1 */
.animate-fade-in-up.visible,
.animate-fade-in-left.visible,
.animate-fade-in-right.visible,
.animate-bounce-y.visible,
.section-scroll-animate.visible,
.text-animate-up.visible,
.reveal-item.visible,
.scroll-reveal.visible,
.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-in-up.visible.fade-in,
.section-scroll-animate.visible.fade-in {
    opacity: 1;
}

.animate-fade-in-up.visible.slide-up,
.section-scroll-animate.visible.slide-up {
    transform: translateY(0);
}
/* Safe visibility overrides (auto-added) */
:root, html, body, main, header, footer, section, .container, .content {
  opacity: 1 !important;
  visibility: visible !important;
}
