/* Design Tokens */
:root {
    /* Literary Theme Palette - Light & Airy */
    --color-base-bg: #fdfcfa;
    --color-base-surface: #ffffff;
    --color-base-text: #2d2a26;
    --color-base-text-muted: #6b6662;

    /* Warm Literary Accents - Books, Knowledge, Wisdom */
    --color-accent-1: #9b6f4f;
    /* Leather brown */
    --color-accent-2: #6b4e3a;
    /* Deep book binding */
    --color-accent-3: #d4a574;
    /* Golden pages */
    --color-accent-light: #f7f1e8;
    /* Cream paper */
    --color-accent-gradient: linear-gradient(135deg, #9b6f4f 0%, #d4a574 100%);

    /* Functional Colors */
    --color-shadow: rgba(155, 111, 79, 0.12);
    --color-border: rgba(155, 111, 79, 0.15);
    --color-hover: rgba(155, 111, 79, 0.08);

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
    --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --text-3xl: clamp(2rem, 1.6rem + 2vw, 2.75rem);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.06);
    --shadow-theme: 0 10px 30px var(--color-shadow), 0 4px 10px rgba(0, 0, 0, 0.06);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-organic: 63% 37% 54% 46% / 45% 62% 38% 55%;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-base-text);
    background: var(--color-base-bg);
    overflow-x: hidden;
}

/* Background Pattern - Subtle Book Texture */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(90deg,
            transparent,
            transparent 1px,
            rgba(155, 111, 79, 0.02) 1px,
            rgba(155, 111, 79, 0.02) 2px),
        repeating-linear-gradient(0deg,
            transparent,
            transparent 1px,
            rgba(155, 111, 79, 0.02) 1px,
            rgba(155, 111, 79, 0.02) 2px);
    background-size: 30px 30px;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-accent-1);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
    z-index: 100;
}

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

/* Header Navigation */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    backdrop-filter: blur(12px) saturate(180%);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.site-name {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
}

.site-name a {
    color: var(--color-base-text);
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.site-name a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-accent-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.site-name a:hover {
    color: var(--color-accent-1);
}

.site-name a:hover::after {
    transform: scaleX(1);
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    list-style: none;
    flex-wrap: wrap;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
}

.breadcrumbs li::after {
    content: '→';
    color: var(--color-base-text-muted);
    opacity: 0.5;
}

.breadcrumbs li:last-child::after {
    content: '';
}

.breadcrumbs a {
    color: var(--color-base-text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.breadcrumbs a:hover {
    color: var(--color-accent-1);
    background: var(--color-hover);
}

/* Hero Section */
.hero {
    margin-top: 80px;
    padding: var(--space-4xl) var(--space-xl) var(--space-3xl);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 400px;
    background: linear-gradient(180deg, var(--color-accent-light) 0%, transparent 100%);
    opacity: 0.4;
    z-index: -1;
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
}

.hero-content h1 {
    font-size: var(--text-3xl);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    background: var(--color-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content .subtitle {
    font-size: var(--text-lg);
    color: var(--color-base-text-muted);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.hero-content .author-link {
    display: inline-block;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--color-accent-1);
    text-decoration: none;
    padding: var(--space-sm) var(--space-lg);
    border: 2px solid var(--color-accent-1);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.hero-content .author-link:hover {
    background: var(--color-accent-1);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-theme);
}

/* SVG Illustration */
.hero-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-xl);
}

.intro-text {
    font-size: var(--text-lg);
    color: var(--color-base-text-muted);
    margin-bottom: var(--space-3xl);
    padding: var(--space-xl);
    background: var(--color-base-surface);
    border-radius: var(--radius-xl);
    border-left: 4px solid var(--color-accent-1);
    box-shadow: var(--shadow-md);
}

/* Book List - Masonry Grid Style */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
    list-style: none;
    counter-reset: book-counter;
}

.book-item {
    counter-increment: book-counter;
    background: var(--color-base-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.book-item::before {
    content: counter(book-counter);
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-accent-1);
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.book-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--color-accent-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.book-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-theme);
    border-color: var(--color-accent-1);
}

.book-item:hover::before {
    opacity: 0.6;
}

.book-item:hover::after {
    transform: scaleX(1);
}

.book-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-accent-2);
    margin-bottom: var(--space-sm);
    line-height: 1.4;
    display: block;
}

.book-author {
    font-size: var(--text-sm);
    color: var(--color-base-text-muted);
    font-style: italic;
}

.book-item a {
    color: var(--color-accent-1);
    text-decoration: none;
    transition: color 0.3s ease;
}

.book-item a:hover {
    color: var(--color-accent-2);
    text-decoration: underline;
}

/* Footer */
.footer {
    margin-top: var(--space-4xl);
    padding: var(--space-3xl) var(--space-xl) var(--space-2xl);
    background: linear-gradient(180deg, transparent 0%, var(--color-accent-light) 100%);
    border-top: 1px solid var(--color-border);
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}

.footer h3 {
    font-size: var(--text-lg);
    color: var(--color-accent-2);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.language-selector {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
    list-style: none;
    margin-bottom: var(--space-2xl);
}

.language-selector li {
    display: inline-block;
}

.language-selector a {
    display: block;
    padding: var(--space-sm) var(--space-lg);
    background: var(--color-base-surface);
    color: var(--color-base-text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
    font-size: var(--text-sm);
}

.language-selector a:hover {
    background: var(--color-accent-1);
    color: white;
    border-color: var(--color-accent-1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.language-selector .active a {
    background: var(--color-accent-1);
    color: white;
    border-color: var(--color-accent-1);
}

.footer-copyright {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-base-text-muted);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes floatBook {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-15px) rotate(2deg);
    }
}

@keyframes turnPage {

    0%,
    100% {
        transform: rotateY(0deg);
    }

    50% {
        transform: rotateY(15deg);
    }
}

@keyframes shimmer {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

.book-item {
    animation: fadeInUp 0.6s ease backwards;
}

.book-item:nth-child(3n+1) {
    animation-delay: 0.1s;
}

.book-item:nth-child(3n+2) {
    animation-delay: 0.2s;
}

.book-item:nth-child(3n) {
    animation-delay: 0.3s;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: var(--space-2xl);
    }

    .hero-illustration {
        order: -1;
    }

    .book-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        padding: var(--space-md);
    }

    .hero {
        padding: var(--space-2xl) var(--space-md);
    }

    .main-content {
        padding: var(--space-xl) var(--space-md);
    }

    .book-list {
        grid-template-columns: 1fr;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
