@font-face {
    font-family: 'RosmarinusText';
    src: url('../asset/fonts/textFonts.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'RosmarinusTitle';
    src: url('../asset/fonts/titleFonts.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --color-bg-dark: #140f0a;
    --color-bg-overlay: rgba(20, 15, 10, 0.7);
    --color-text-gold: #d4af37;
    --color-text-pale: #c9b896;
    --color-text-brown: #2b1d0e;
    --color-parchment: #f4e4bc;
    --color-border: #8b7355;
    
    --font-serif: 'RosmarinusText', 'Crimson Text', serif;
    --font-gothic: 'UnifrakturMaguntia', cursive;
    --font-hero: 'RosmarinusTitle', 'Old English Text MT regular', 'Cinzel', serif; /* Using same font for now as requested */
    --font-logo: 'Old English Text MT regular', 'RosmarinusTitle', 'Cinzel', serif; /* Using same font for now as requested */
}

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

body {
    background-color: var(--color-bg-dark);
    /* Background image with 50% opacity overlay of #140f0a (20, 15, 10) */
    background-image: url('../asset/img/PaperTextureSeamless/homeBg.webp');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    color: var(--color-text-pale);
    font-family: var(--font-serif);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3 {
    font-weight: normal;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

ul {
    list-style: none;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Parchment Components (SVG Filter) */
.parchment-card {
    /* Core: Apply SVG filter */
    filter: url(#parchment-filter) drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
    
    /* Base Style */
    background-color: var(--color-parchment);
    color: var(--color-text-brown);
    padding: 2rem;
    position: relative;
    font-size: 1.1rem; /* Increased font size */
    
    /* Texture Image */
    background-image: url('../asset/img/PaperTextureSeamless/parchment.webp');
    background-size: cover;
    background-blend-mode: multiply;
    
    /* Shadow for placement effect */
    box-shadow: 0 10px 20px rgba(0,0,0,0.4), 0 6px 6px rgba(0,0,0,0.23);
    
    /* Margin to avoid edge clipping */
    margin: 20px;
    transition: all 0.3s ease;
}

.parchment-card:hover {
    filter: url(#parchment-filter) drop-shadow(5px 10px 12px rgba(0,0,0,0.2));
    transform: translateY(-4px);
    box-shadow: 0 14px 28px rgba(0,0,0,0.5), 0 10px 10px rgba(0,0,0,0.3);
}

.parchment-card--character {
    filter: none !important;
    background: transparent !important;
    background-image: none !important;
    position: relative;
    padding: 2.5rem 3rem 2.5rem 2.5rem; /* Increased right padding for avatar */
        /* Shadow for placement effect */
    box-shadow: 0 10px 20px rgba(0,0,0,0.3), 0 6px 6px rgba(0,0,0,0.13);
}

.parchment-card--character::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-parchment);
    background-image: url('../asset/img/PaperTextureSeamless/parchment.webp');
    background-size: cover;
    background-blend-mode: multiply;
    filter: url(#parchment-filter) drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
    box-shadow: 0 14px 28px rgba(0,0,0,0.5), 0 10px 10px rgba(0,0,0,0.3);
    z-index: 0;
    pointer-events: none;
}

.parchment-card--character:hover {
    filter: none !important;
    box-shadow: none !important;
}

.parchment-card--character:hover::before {
    filter: url(#parchment-filter) drop-shadow(5px 10px 12px rgba(0,0,0,0.2));
}

.parchment-card--character > * {
    position: relative;
    z-index: 1;
}

/* Character Avatar */
.character-avatar-container {
    flex: 0 0 120px;
    height: 120px;
    margin-left: 1.5rem;
    position: relative;
    /* Drop shadow for the stacked paper effect */
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.4));
}

.character-avatar-bg {
    position: absolute;
    inset: 0;
    background-color: #f3dcad;
    background-image: url('../asset/img/PaperTextureSeamless/parchment.webp');
    background-size: cover;
    background-blend-mode: multiply;
    /* Irregular parchment shape mask */
    clip-path: polygon(
        5% 0%, 95% 2%, 100% 10%, 98% 90%, 
        90% 100%, 10% 98%, 0% 90%, 2% 10%
    );
    z-index: 1;
}

.character-avatar-img {
    position: absolute;
    inset: 5px; /* Smaller than background to create border effect */
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    object-fit: cover;
    /* Same irregular shape but slightly smaller */
    clip-path: polygon(
        5% 0%, 95% 2%, 100% 10%, 98% 90%, 
        90% 100%, 10% 98%, 0% 90%, 2% 10%
    );
    z-index: 2;
    /* Ensure image itself isn't warped/filtered */
    filter: none !important;
}

.no-filter {
    filter: none !important;
}

.ancient-scroll {
    background-color: var(--color-parchment);
    background-image: url('../asset/img/PaperTextureSeamless/parchment.webp');
    background-size: cover;
    background-blend-mode: multiply;
    
    filter: url(#parchment-filter) drop-shadow(3px 5px 8px rgba(0,0,0,0.4));
    color: var(--color-text-brown);
    padding: 3rem;
    font-family: var(--font-serif);
    line-height: 1.4;
    font-size: 2.7rem; /* Increased font size */
    
    /* Shadow for placement effect */
    box-shadow: inset 0 0 60px rgba(139, 69, 19, 0.15), 0 10px 20px rgba(0,0,0,0.4);
    
    transition: transform 0.3s ease, filter 0.3s ease;
    margin: 2rem auto;
    max-width: 800px;
}

.ancient-scroll p {
    font-family: var(--font-serif);
}

.ancient-scroll:hover {
    transform: scale(1.01) translateY(-2px);
    filter: url(#parchment-filter) drop-shadow(8px 12px 16px rgba(0,0,0,0.3));
    box-shadow: inset 0 0 60px rgba(139, 69, 19, 0.15), 0 15px 30px rgba(0,0,0,0.5);
}

/* Header */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(20, 15, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    z-index: 1000;
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-logo);
    font-size: 2rem;
    color: var(--color-text-gold);
    letter-spacing: 0.1em;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    color: var(--color-text-pale);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--color-text-gold);
    transition: width 0.3s ease;
}

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

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

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-pale);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Hero Section */
.hero-section {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* Transparent background to show body image */
    background: transparent;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Replace with actual image */
    /* background-image: url('../asset/img/hero-bg.jpg'); */
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.hero-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Initially solid dark color to hide body background */
    background: var(--color-bg-dark);
    transition: background 1.5s ease;
}

/* Reveal background state */
.hero-section.reveal-bg .hero-background::after {
    background: rgba(20, 15, 10, 0.6);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 2rem;
}

/* Initial hidden state for post-signature elements */
.site-header,
.hero-quote,
.scroll-hint {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.site-header {
    transform: translateY(-20px); /* Header slides down */
}

/* Visible state */
.site-header.fade-in,
.hero-quote.fade-in,
.scroll-hint.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.hero-title {
    font-family: var(--font-hero);
    font-size: clamp(5rem, 12vw, 8rem);
    color: var(--color-text-gold);
    letter-spacing: 0.1em;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.8);
    margin-bottom: 1rem;
}

/* Hero Signature Animation */
#hero-signature-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    gap: 0.5rem;
}

.signature-svg {
    width: clamp(300px, 80vw, 600px);
    height: auto;
    overflow: visible;
}

.signature-svg path {
    fill: transparent;
    stroke: var(--color-text-gold);
    stroke-width: 1px;
    stroke-linecap: round;
    stroke-linejoin: round;
    /* Animation will be set via JS to handle dynamic length */
    opacity: 0; /* Initially hidden to prevent flash */
}

/* User provided animation structure, adapted for JS usage */
.animate-signature path {
    opacity: 1;
    animation: write 2s ease forwards, fillIn 1s ease forwards 2s;
}

@keyframes write {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fillIn {
    to {
        fill: var(--color-text-gold);
    }
}

.hero-quote {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    color: var(--color-text-pale);
    font-style: italic;
    max-width: 600px;
    margin: 0 auto;
}

.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    animation: bounce 2s infinite;
}

.scroll-icon {
    font-size: 2rem;
    color: var(--color-text-gold);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* World Overview */
.world-overview-section {
    padding: 8rem 2rem;
    /* 40% transparency (0.6 alpha) */
    background: rgba(30, 25, 20, 0.6);
}

.overview-title {
    text-align: center;
    font-family: var(--font-hero);
    font-size: 2.5rem;
    color: var(--color-text-gold);
    margin-bottom: 3rem;
}

/* Timeline Preview */
.timeline-section {
    padding: 6rem 0;
    /* 40% transparency (0.6 alpha) */
    background-color: rgba(20, 15, 10, 0.6);
    overflow: hidden;
}

.timeline-container {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 3rem 2rem;
    scroll-behavior: smooth;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.timeline-container::-webkit-scrollbar {
    height: 8px;
}
.timeline-container::-webkit-scrollbar-track {
    background: transparent;
}
.timeline-container::-webkit-scrollbar-thumb {
    background-color: var(--color-border);
    border-radius: 4px;
}

.timeline-card-wrapper {
    flex: 0 0 300px;
}

.timeline-year {
    font-family: var(--font-gothic);
    font-size: 2rem;
    color: var(--color-text-brown);
    margin-bottom: 0.5rem;
    text-align: center;
}

.timeline-title {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    color: var(--color-text-brown);
    font-weight: bold;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(43, 29, 14, 0.2);
    padding-bottom: 0.5rem;
}

/* Content Preview */
.content-preview-section {
    padding: 6rem 0;
    /* 40% transparency (0.6 alpha) */
    background: rgba(31, 22, 16, 0.6);
    overflow: hidden; /* Prevent horizontal scroll during animation */
}

.mini-tabbar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 4rem;
    flex-wrap: wrap;
}

.tab-item {
    padding: 0.8rem 2rem;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-pale);
    font-family: var(--font-serif);
    font-size: 1.6rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-item:hover, .tab-item.active {
    border-color: var(--color-text-gold);
    color: var(--color-text-gold);
    background: rgba(139, 115, 85, 0.1);
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 0 2rem;
    transition: opacity 0.3s ease; /* Ensure opacity transition works with new animations */
}

/* View All Button */
.view-all-container {
    text-align: center;
    margin-top: 3rem;
}

.view-all-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(180deg, #3d2f1f 0%, #2a1f15 100%);
    border: 2px solid var(--color-border);
    color: var(--color-text-gold);
    font-family: var(--font-serif);
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    border-color: var(--color-text-gold);
    background: linear-gradient(180deg, #4d3b2a 0%, #3a2b1f 100%);
}

.view-all-btn::before {
    content: '✦';
    margin-right: 0.5rem;
    color: var(--color-text-gold);
}

.view-all-btn::after {
    content: '✦';
    margin-left: 0.5rem;
    color: var(--color-text-gold);
}

/* Animation Classes */
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100px); opacity: 0; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100px); opacity: 0; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.slide-out-left {
    animation: slideOutLeft 0.4s ease forwards;
}

.slide-out-right {
    animation: slideOutRight 0.4s ease forwards;
}

.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

/* Footer */
.site-footer {
    background: #0f0a08;
    border-top: 1px solid rgba(139, 115, 85, 0.2);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-column h3 {
    font-family: var(--font-serif);
    color: var(--color-text-gold);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.footer-column p, .footer-column a {
    color: var(--color-text-pale);
    opacity: 0.8;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(139, 115, 85, 0.1);
    padding-top: 2rem;
    color: #5d4d3d;
    font-size: 1.3rem;
    font-family: serif;

}

/* Responsive */
@media (max-width: 830px) {
    .nav-links {
        display: none; /* Mobile menu implementation later */
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .timeline-container {
        padding: 2rem 1rem;
    }

    /* Mobile Drawer */
    .nav-links {
        display: flex; /* Override display none */
        position: fixed;
        top: 0;
        right: -100%; /* Initially hidden off-screen */
        width: 250px;
        height: 100vh;
        background: rgba(20, 15, 10, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
        padding-top: 60px; /* Space for close button if needed, or just padding */
    }

    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        margin: 1.5rem 0;
    }

    .mobile-menu-toggle {
        z-index: 1001;
    }
}
