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

:root {
    --bg-dark: #111;
    --text-light: #fff;
    --text-gray: #ddd;
    --accent-gray: #bbb;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;
    --container-width: 85vw;
    --max-container: 1400px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Language Selector */
.language-nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-md);
}

.language-selector {
    position: relative;
}

.language-toggle {
    background: rgba(17, 17, 17, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    border-radius: 4px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.language-toggle:hover {
    background: rgba(17, 17, 17, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
}

.language-toggle:focus {
    outline: 2px solid var(--text-gray);
    outline-offset: 2px;
}

.caret-icon {
    transition: transform 0.3s ease;
}

.language-toggle[aria-expanded="true"] .caret-icon {
    transform: rotate(180deg);
}

.language-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: rgba(17, 17, 17, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    list-style: none;
    min-width: 140px;
    display: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.language-menu.active {
    display: block;
}

.language-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.language-menu li:last-child {
    border-bottom: none;
}

.lang-option {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: var(--spacing-sm);
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.lang-option:hover,
.lang-option:focus {
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: var(--spacing-xl) var(--spacing-md);
    background: radial-gradient(circle at 30% 50%, rgba(48, 48, 48, 0.3) 0%, var(--bg-dark) 70%);
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xl);
    max-width: var(--max-container);
    width: 100%;
    flex-wrap: wrap;
}

.hero-text {
    flex: 1;
    min-width: 300px;
    max-width: 600px;
}

.author-name {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: var(--spacing-md);
    line-height: 1.1;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3),
                 0 4px 20px rgba(0, 0, 0, 0.5),
                 0 2px 10px rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGlow 3s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% { 
        filter: brightness(1);
        text-shadow: 0 0 30px rgba(255, 255, 255, 0.3),
                     0 4px 20px rgba(0, 0, 0, 0.5),
                     0 2px 10px rgba(255, 255, 255, 0.1);
    }
    50% { 
        filter: brightness(1.1);
        text-shadow: 0 0 40px rgba(255, 255, 255, 0.4),
                     0 4px 25px rgba(0, 0, 0, 0.6),
                     0 2px 15px rgba(255, 255, 255, 0.15);
    }
}

.hero-tagline {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--text-gray);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5),
                 0 0 20px rgba(255, 255, 255, 0.1);
    text-transform: uppercase;
    opacity: 0.95;
    transition: all 0.3s ease;
    margin-bottom: var(--spacing-md);
}

.hero-tagline:hover {
    opacity: 1;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.6),
                 0 0 30px rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.hero-cta {
    margin-top: var(--spacing-lg);
}

.hero-image {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    position: relative;
}

.portrait-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    filter: grayscale(100%) contrast(1.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.scroll-indicator {
    position: absolute;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--text-gray);
    font-size: 0.85rem;
    opacity: 0.7;
    animation: fadeInOut 2s ease-in-out infinite;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5),
                 0 0 10px rgba(255, 255, 255, 0.1);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.3; }
}

/* Container */
.container {
    max-width: var(--max-container);
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    width: var(--container-width);
}

/* Book Showcase */
.book-showcase {
    padding: var(--spacing-xl) 0;
    background: var(--bg-dark);
}

.book-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
}

.book-cover-wrapper {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    position: relative;
}

.book-cover {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    filter: contrast(1.05);
}

.book-info {
    flex: 1;
    min-width: 300px;
    max-width: 600px;
}

.book-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 400;
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5),
                 0 0 25px rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #cccccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.book-title:hover {
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6),
                 0 0 35px rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.book-description {
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.9;
    margin-bottom: var(--spacing-lg);
    color: var(--text-gray);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.book-description p {
    margin-bottom: var(--spacing-md);
    transition: all 0.3s ease;
}

.book-description p br {
    display: block;
    content: "";
    margin: var(--spacing-sm) 0;
}

.book-description p:hover {
    color: var(--text-light);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4),
                 0 0 15px rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.book-description p:last-child {
    margin-bottom: 0;
}

/* CTA Button */
.cta-button {
    display: inline-block;
    background: var(--text-gray);
    color: var(--bg-dark);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-align: center;
    border: 2px solid var(--text-gray);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.cta-button:hover {
    background: var(--accent-gray);
    border-color: var(--accent-gray);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(221, 221, 221, 0.4),
                0 0 30px rgba(255, 255, 255, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.cta-button:focus {
    outline: 2px solid var(--text-light);
    outline-offset: 4px;
}

/* Trail Separator */
.trail-separator {
    width: 100%;
    margin: var(--spacing-xl) 0;
    position: relative;
    overflow: visible;
    height: 400px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trail-svg {
    width: 100%;
    height: 100%;
    display: block;
    max-height: 400px;
    min-height: 400px;
}

#scribblePath {
    transition: stroke-dashoffset 0.1s ease-out;
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.4));
}

#penGroup {
    transition: transform 0.1s ease-out, opacity 0.2s ease;
    pointer-events: none;
    transform-origin: 0 0; /* Pen tip is at origin (0,0) */
    opacity: 0;
    visibility: hidden;
}

#penGroup.visible {
    opacity: 1;
    visibility: visible;
}

/* About Author */
.about-author {
    padding: var(--spacing-xl) 0;
    background: var(--bg-dark);
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 400;
    text-align: center;
    margin-bottom: var(--spacing-lg);
    letter-spacing: -0.01em;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.5),
                 0 0 25px rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #dddddd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.section-title:hover {
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6),
                 0 0 35px rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.author-bio {
    max-width: 900px;
    margin: 0 auto;
}

.bio-intro,
.bio-details {
    font-size: clamp(1rem, 2vw, 1.15rem);
    line-height: 1.9;
    color: var(--text-gray);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.bio-intro {
    margin-bottom: var(--spacing-md);
    font-size: clamp(1.1rem, 2.2vw, 1.3rem);
    font-weight: 400;
    color: var(--text-light);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4),
                 0 0 15px rgba(255, 255, 255, 0.08);
}

.bio-intro p {
    transition: all 0.3s ease;
}

.bio-intro p:hover {
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5),
                 0 0 20px rgba(255, 255, 255, 0.12);
    transform: translateX(3px);
}

.bio-details p {
    margin-bottom: var(--spacing-md);
    transition: all 0.3s ease;
}

.bio-details p br {
    display: block;
    content: "";
    margin: var(--spacing-sm) 0;
}

.bio-details p:hover {
    color: var(--text-light);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4),
                 0 0 15px rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.bio-details p:last-child {
    margin-bottom: 0;
}

/* Footer */
.site-footer {
    padding: var(--spacing-xl) 0 var(--spacing-md);
    background: var(--bg-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: var(--spacing-xl);
}

.footer-content {
    display: flex;
    justify-content: space-around;
    gap: var(--spacing-lg);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer-section h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
    color: var(--text-light);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4),
                 0 0 15px rgba(255, 255, 255, 0.08);
    letter-spacing: 0.02em;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--spacing-xs);
}

.footer-links a {
    color: var(--text-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    display: inline-block;
}

.footer-links a:hover {
    color: var(--text-light);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4),
                 0 0 15px rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
}

.book-title-footer {
    font-size: 1rem;
    margin-bottom: var(--spacing-sm);
    color: var(--text-gray);
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.4),
                 0 0 15px rgba(255, 255, 255, 0.08);
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
}

.book-title-footer:hover {
    color: var(--text-light);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5),
                 0 0 20px rgba(255, 255, 255, 0.12);
}

.footer-cta {
    display: inline-block;
    background: var(--text-gray);
    color: var(--bg-dark);
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.footer-cta:hover {
    background: var(--accent-gray);
    transform: translateY(-1px);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Responsive Design */
@media (max-width: 1400px) {
    :root {
        --container-width: 90vw;
    }
}

@media (max-width: 1024px) {
    .hero-content,
    .book-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-text {
        text-align: center;
    }

    .book-info {
        text-align: left;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-xl: 4rem;
        --spacing-lg: 2rem;
    }

    body {
        font-size: 0.95rem;
    }

    .language-nav {
        padding: var(--spacing-sm);
    }

    .hero {
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .book-showcase,
    .about-author {
        padding: var(--spacing-lg) 0;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .book-info {
        text-align: center;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 0.9rem;
    }

    .author-name {
        font-size: 2.5rem;
    }

    .book-title,
    .section-title {
        font-size: 1.8rem;
    }

    .cta-button {
        width: 100%;
        padding: var(--spacing-sm);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}

/* Language visibility */
.lang {
    display: block;
}

.lang.hidden {
    display: none !important;
}

