:root {
    /* Color Palette */
    --obsidian: #050505;
    --midnight: #0a0e1a;
    --zenith-gold: #d4af37;
    --gold-glow: rgba(212, 175, 55, 0.4);
    --starlight: #f0f0f0;
    --slate: #a0a0a0;
    --accent-blue: #1a2a4a;

    /* Typography */
    --font-heading: 'Cinzel', serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 2rem;
    --space-lg: 4rem;
    --space-xl: 8rem;

    /* Transitions */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--obsidian);
    color: var(--starlight);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Typography Utility */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--zenith-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Accessibility Focus States */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--zenith-gold);
    outline-offset: 4px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--zenith-gold);
    color: var(--obsidian);
    padding: 8px;
    z-index: 2000;
    transition: top 0.3s;
}

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

/* Background Starfield Effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.15;
    z-index: -1;
    animation: stars 100s linear infinite;
}

@keyframes stars {
    from { transform: translateY(0); }
    to { transform: translateY(-1000px); }
}

/* Layout Utilities */
.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

.section-padding {
    padding: var(--space-xl) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-lg);
    font-size: 2.5rem;
}

.gold-gradient-text {
    background: linear-gradient(to right, #bf953f, #fcf6ba, #b38728, #fbf5b7, #aa771c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Header */
.main-header {
    padding: var(--space-sm) 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--zenith-gold);
}

.emblem-nav {
    height: 40px;
    width: 40px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: var(--space-md);
}

.main-nav a {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--starlight);
}

.main-nav a:hover {
    color: var(--zenith-gold);
}

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 100px;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.bg-emblem-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vh;
    opacity: 0.05;
    animation: rotate 120s linear infinite;
}

@keyframes rotate {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    align-items: center;
}

.hero-text-block h1 {
    font-size: 5rem;
    line-height: 1;
    margin-bottom: var(--space-sm);
}

.tagline {
    font-size: 1.25rem;
    font-style: italic;
    font-family: 'Lora', serif;
    margin-bottom: var(--space-md);
    opacity: 0.8;
}

.hero-actions {
    display: flex;
    gap: var(--space-sm);
}

.hero-image-block {
    display: flex;
    justify-content: center;
}

.book-cover-featured {
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 30px var(--gold-glow);
    border: 1px solid rgba(212, 175, 55, 0.3);
}

/* Unsettled Mark Animation */
.unsettled-mark-container {
    width: 120px;
    height: 120px;
    margin-bottom: var(--space-sm);
    filter: drop-shadow(0 0 10px var(--gold-glow));
}

.unsettled-mark {
    width: 100%;
    height: 100%;
}

.mark-line {
    fill: none;
    stroke: var(--zenith-gold);
    stroke-width: 1.5;
    stroke-linecap: round;
    opacity: 0.6;
}

.line-1 { animation: shift1 8s ease-in-out infinite; }
.line-2 { animation: shift2 10s ease-in-out infinite; }
.line-3 { animation: shift3 12s ease-in-out infinite; }
.line-4 { animation: shift4 14s ease-in-out infinite; }

@keyframes shift1 {
    0%, 100% { d: path("M20,50 Q40,40 80,50"); }
    50% { d: path("M20,52 Q40,45 80,48"); }
}

@keyframes shift2 {
    0%, 100% { d: path("M50,20 Q60,50 50,80"); }
    50% { d: path("M48,20 Q55,50 52,80"); }
}

@keyframes shift3 {
    0%, 100% { d: path("M30,30 Q50,50 70,70"); }
    50% { d: path("M32,28 Q48,52 68,72"); }
}

@keyframes shift4 {
    0%, 100% { d: path("M70,30 Q50,50 30,70"); }
    50% { d: path("M68,32 Q52,48 32,68"); }
}

/* Series Section */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.book-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(212, 175, 55, 0.1);
    padding: var(--space-md);
    transition: var(--transition);
}

.book-card:hover {
    transform: translateY(-10px);
    border-color: var(--zenith-gold);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.featured-book {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--space-lg);
}

.book-card-image img {
    width: 100%;
    height: auto;
}

.placeholder-box {
    aspect-ratio: 2/3;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    color: var(--slate);
    border: 1px dashed var(--slate);
}

.book-card-info h3 {
    margin-bottom: var(--space-xs);
}

.book-meta {
    font-size: 0.8rem;
    color: var(--zenith-gold);
    margin-bottom: var(--space-sm);
}

.book-description {
    font-size: 0.95rem;
    margin-bottom: var(--space-md);
}

/* Lore Section */
.lore-section {
    background: var(--midnight);
    position: relative;
}

.lore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
}

.lore-item {
    padding: var(--space-md);
    border-left: 1px solid var(--zenith-gold);
}

.lore-item h3 {
    font-size: 1.2rem;
    margin-bottom: var(--space-sm);
}

/* Society Section */
.society-card {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: var(--space-lg);
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.society-form {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    justify-content: center;
}

.form-group input {
    padding: 1rem;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--slate);
    color: var(--starlight);
    width: 300px;
}

.form-feedback {
    margin-top: var(--space-sm);
    font-size: 0.9rem;
    font-style: italic;
    min-height: 1.2em;
}

.form-feedback.success {
    color: var(--zenith-gold);
}

.form-feedback.error {
    color: #ff4d4d;
}

/* About Section */
.about-flex {
    display: flex;
    justify-content: center;
}

.about-text {
    max-width: 700px;
    text-align: center;
}

/* Footer */
.main-footer {
    padding: var(--space-lg) 0;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-sm);
    font-size: 0.8rem;
    color: var(--slate);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-text-block h1 {
        font-size: 3rem;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .featured-book {
        grid-template-columns: 1fr;
    }
    
    .main-nav {
        display: none; /* Mobile menu could be added later */
    }

    .society-form {
        flex-direction: column;
    }

    .form-group input {
        width: 100%;
    }
}

/* Screen Reader Only Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
