/* ============================================
   NUMERIA - FANTASY STORY THEME
   Dark Fantasy aesthetic for the Story section
   ============================================ */

/* Import Fantasy Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&family=UnifrakturMaguntia&display=swap');

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --fantasy-bg-dark: #0a0a0a;
    --fantasy-bg-paper: #1a1410;
    --fantasy-text-primary: #e8d5b7;
    --fantasy-text-secondary: #c4a676;
    --fantasy-accent-gold: #d4af37;
    --fantasy-accent-copper: #b87333;
    --fantasy-accent-red: #8b0000;
    --fantasy-border: #4a3f2f;
    --fantasy-shadow: rgba(0, 0, 0, 0.8);
}

/* ============================================
   BODY & GENERAL
   ============================================ */
body[data-page^="story-"] {
    background: #0a0a0a;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(139, 0, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" /></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.05"/></svg>');
    color: var(--fantasy-text-primary);
    font-family: 'Crimson Text', Georgia, serif;
    position: relative;
    overflow-x: hidden;
}

/* Pergamena texture overlay */
body[data-page^="story-"]::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, .02) 25%, rgba(255, 255, 255, .02) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .02) 75%, rgba(255, 255, 255, .02) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, .02) 25%, rgba(255, 255, 255, .02) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .02) 75%, rgba(255, 255, 255, .02) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    pointer-events: none;
    opacity: 0.3;
    z-index: 1;
}

body[data-page^="story-"] > * {
    position: relative;
    z-index: 2;
}

/* ============================================
   HEADER
   ============================================ */
body[data-page^="story-"] header {
    background: linear-gradient(180deg, rgba(26, 20, 16, 0.95) 0%, rgba(26, 20, 16, 0.8) 100%);
    border-bottom: 3px solid var(--fantasy-accent-gold);
    box-shadow: 0 4px 20px var(--fantasy-shadow);
    position: relative;
}

body[data-page^="story-"] header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--fantasy-accent-copper) 20%,
        var(--fantasy-accent-gold) 50%,
        var(--fantasy-accent-copper) 80%,
        transparent 100%);
}

body[data-page^="story-"] .logo {
    font-family: 'Cinzel', serif;
    font-weight: 900;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--fantasy-accent-gold) 0%, var(--fantasy-accent-copper) 50%, var(--fantasy-accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    letter-spacing: 0.15em;
}

body[data-page^="story-"] .tagline {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--fantasy-text-secondary);
    letter-spacing: 0.05em;
}

/* ============================================
   NAVIGATION
   ============================================ */
body[data-page^="story-"] nav {
    background: rgba(10, 10, 10, 0.9);
    border-bottom: 2px solid var(--fantasy-border);
    backdrop-filter: blur(10px);
}

body[data-page^="story-"] nav a {
    color: var(--fantasy-text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    position: relative;
}

body[data-page^="story-"] nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--fantasy-accent-gold);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

body[data-page^="story-"] nav a:hover {
    color: var(--fantasy-accent-gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

body[data-page^="story-"] nav a:hover::after {
    width: 80%;
}

/* ============================================
   HERO SECTION
   ============================================ */
body[data-page^="story-"] .hero {
    background: linear-gradient(135deg, rgba(26, 20, 16, 0.6) 0%, rgba(10, 10, 10, 0.8) 100%);
    border: 2px solid var(--fantasy-border);
    border-radius: 0;
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.1),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 3rem 2rem;
    margin-bottom: 3rem;
}

body[data-page^="story-"] .hero::before,
body[data-page^="story-"] .hero::after {
    content: '◆';
    position: absolute;
    font-size: 1.5rem;
    color: var(--fantasy-accent-gold);
    opacity: 0.5;
}

body[data-page^="story-"] .hero::before {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
}

body[data-page^="story-"] .hero::after {
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.chapter-title {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--fantasy-accent-gold) 0%, var(--fantasy-accent-copper) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

.chapter-subtitle {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    font-size: 1.8rem;
    color: var(--fantasy-text-secondary);
    margin-bottom: 2rem;
}

/* ============================================
   CARDS & CONTENT BOXES
   ============================================ */
body[data-page^="story-"] .card {
    background: linear-gradient(135deg, rgba(26, 20, 16, 0.9) 0%, rgba(15, 12, 10, 0.95) 100%);
    border: 2px solid var(--fantasy-border);
    border-radius: 0;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(212, 175, 55, 0.1);
    position: relative;
    overflow: visible;
}

/* Ornamental corners */
body[data-page^="story-"] .card::before,
body[data-page^="story-"] .card::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--fantasy-accent-gold);
    opacity: 0.5;
}

body[data-page^="story-"] .card::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

body[data-page^="story-"] .card::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

body[data-page^="story-"] .card-title {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--fantasy-accent-gold);
    border-bottom: 2px solid var(--fantasy-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 0.1em;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

body[data-page^="story-"] .card-content {
    color: var(--fantasy-text-primary);
    line-height: 1.8;
}

/* ============================================
   STORY METADATA
   ============================================ */
.story-meta {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.2) 0%, rgba(26, 20, 16, 0.9) 100%);
    border: 2px solid var(--fantasy-accent-copper);
    border-radius: 0;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(139, 0, 0, 0.3);
    position: relative;
}

.story-meta::before {
    content: '◈';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2rem;
    color: var(--fantasy-accent-gold);
    background: var(--fantasy-bg-dark);
    padding: 0 1rem;
}

/* ============================================
   STORY CONTENT
   ============================================ */
.story-content {
    max-width: 900px;
    margin: 0 auto;
    font-size: 1.2rem;
    line-height: 2;
    font-family: 'Crimson Text', Georgia, serif;
}

.story-content p {
    margin-bottom: 1.8rem;
    text-align: justify;
    text-indent: 2rem;
    color: var(--fantasy-text-primary);
}

.story-content p:first-of-type::first-letter {
    font-family: 'UnifrakturMaguntia', cursive;
    font-size: 4rem;
    line-height: 0.8;
    float: left;
    margin: 0.1rem 0.5rem 0 0;
    color: var(--fantasy-accent-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.story-content em {
    font-style: italic;
    color: var(--fantasy-accent-gold);
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

.story-content strong {
    color: var(--fantasy-accent-copper);
    font-weight: 700;
}

/* ============================================
   DIARY ENTRIES
   ============================================ */
.diary-entry {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.15) 0%, rgba(26, 20, 16, 0.8) 100%);
    border-left: 4px solid var(--fantasy-accent-copper);
    border-right: 1px solid var(--fantasy-border);
    padding: 2rem;
    margin: 3rem 0;
    font-family: 'Crimson Text', monospace;
    font-size: 1.1rem;
    box-shadow:
        4px 4px 15px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.diary-entry::before {
    content: '✒';
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    opacity: 0.3;
    color: var(--fantasy-accent-gold);
}

.diary-entry p {
    text-indent: 0 !important;
    color: var(--fantasy-text-secondary);
}

/* ============================================
   SPECIAL EFFECTS
   ============================================ */
.manifestation-box {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(212, 175, 55, 0.05) 100%);
    border: 2px solid var(--fantasy-accent-gold);
    padding: 2rem;
    margin: 3rem 0;
    border-radius: 0;
    text-align: center;
    box-shadow:
        0 0 30px rgba(212, 175, 55, 0.3),
        inset 0 0 50px rgba(212, 175, 55, 0.1);
    position: relative;
    animation: gentle-glow 3s ease-in-out infinite;
}

@keyframes gentle-glow {
    0%, 100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.3), inset 0 0 50px rgba(212, 175, 55, 0.1); }
    50% { box-shadow: 0 0 50px rgba(212, 175, 55, 0.5), inset 0 0 70px rgba(212, 175, 55, 0.2); }
}

.number-marks {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 2rem;
    margin: 2rem 0;
    border: 1px solid var(--fantasy-border);
    border-left: 4px solid var(--fantasy-accent-red);
    text-align: center;
    font-size: 1.5rem;
    line-height: 2;
    color: var(--fantasy-text-secondary);
    box-shadow: inset 0 0 30px rgba(139, 0, 0, 0.3);
}

/* ============================================
   BADGES & LABELS
   ============================================ */
body[data-page^="story-"] .theme-badge {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(184, 115, 51, 0.2) 100%);
    border: 1px solid var(--fantasy-accent-copper);
    color: var(--fantasy-text-secondary);
    padding: 0.5rem 1rem;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* ============================================
   BUTTONS
   ============================================ */
body[data-page^="story-"] .btn {
    background: linear-gradient(135deg, var(--fantasy-accent-gold) 0%, var(--fantasy-accent-copper) 100%);
    color: var(--fantasy-bg-dark);
    font-family: 'Cinzel', serif;
    font-weight: 600;
    border: 2px solid var(--fantasy-accent-gold);
    border-radius: 0;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

body[data-page^="story-"] .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

body[data-page^="story-"] .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.6);
}

body[data-page^="story-"] .btn:hover::before {
    left: 100%;
}

.story-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    gap: 1rem;
}

.story-navigation .btn {
    flex: 1;
    text-align: center;
}

/* ============================================
   GRID LAYOUT
   ============================================ */
body[data-page^="story-"] .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

body[data-page^="story-"] .grid > a {
    text-decoration: none;
    transition: transform 0.3s ease;
}

body[data-page^="story-"] .grid > a:hover {
    transform: translateY(-5px);
}

body[data-page^="story-"] .grid > a:hover .card {
    box-shadow:
        0 12px 40px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(212, 175, 55, 0.2);
}

/* ============================================
   FOOTER
   ============================================ */
body[data-page^="story-"] footer {
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.8) 0%, rgba(26, 20, 16, 0.95) 100%);
    border-top: 3px solid var(--fantasy-accent-gold);
    margin-top: 4rem;
    position: relative;
}

body[data-page^="story-"] footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--fantasy-accent-copper) 20%,
        var(--fantasy-accent-gold) 50%,
        var(--fantasy-accent-copper) 80%,
        transparent 100%);
}

body[data-page^="story-"] .footer-links a {
    color: var(--fantasy-text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
}

body[data-page^="story-"] .footer-links a:hover {
    color: var(--fantasy-accent-gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* ============================================
   WORLD SECTION (for index page)
   ============================================ */
body[data-page^="story-"] .world-section {
    margin: 3rem 0;
}

body[data-page^="story-"] .world-header {
    text-align: center;
    margin-bottom: 2rem;
}

body[data-page^="story-"] .world-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.5));
}

body[data-page^="story-"] .world-title {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: var(--fantasy-accent-gold);
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

body[data-page^="story-"] .world-subtitle {
    font-family: 'Crimson Text', serif;
    font-style: italic;
    color: var(--fantasy-text-secondary);
    font-size: 1.2rem;
}

/* ============================================
   LANGUAGE SWITCHER
   ============================================ */
body[data-page^="story-"] .language-switcher select {
    background: rgba(26, 20, 16, 0.9);
    border: 1px solid var(--fantasy-border);
    color: var(--fantasy-text-secondary);
    font-family: 'Cinzel', serif;
}

body[data-page^="story-"] .language-switcher label {
    color: var(--fantasy-text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
}

/* ============================================
   FANTASY SEPARATOR
   ============================================ */
.story-content .fantasy-separator {
    text-align: center !important;
    text-indent: 0 !important;
    margin: 3rem auto !important;
    padding: 1rem 0;
    font-size: 2rem;
    color: var(--fantasy-accent-gold);
    letter-spacing: 1.5rem;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    animation: gentle-glow-separator 4s ease-in-out infinite;
    position: relative;
    display: block;
}

.story-content .fantasy-separator::before,
.story-content .fantasy-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 25%;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        var(--fantasy-accent-gold),
        transparent
    );
    opacity: 0.3;
}

.story-content .fantasy-separator::before {
    left: 0;
}

.story-content .fantasy-separator::after {
    right: 0;
}

@keyframes gentle-glow-separator {
    0%, 100% {
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
        transform: scale(1);
    }
    50% {
        text-shadow: 0 0 30px rgba(212, 175, 55, 0.8), 0 0 40px rgba(212, 175, 55, 0.4);
        transform: scale(1.05);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .chapter-title {
        font-size: 2rem;
    }

    .chapter-subtitle {
        font-size: 1.3rem;
    }

    .story-content {
        font-size: 1.1rem;
    }

    .story-content p:first-of-type::first-letter {
        font-size: 3rem;
    }

    body[data-page^="story-"] .grid {
        grid-template-columns: 1fr;
    }

    .story-navigation {
        flex-direction: column;
    }
}
