:root {
    --bg: #ffffff;
    --bg-alt: #f8f7f4;
    --surface: #f0efe9;
    --text: #1a1a1a;
    --muted: #6b6560;
    --accent: #9a7b3a;
    --accent-hover: #7a622e;
    --border: #d6d3cc;
    --success: #3a8a54;
    --error: #b04040;
    --font-display: "Libre Baskerville", Georgia, serif;
    --font-body: "Source Sans 3", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-nav a, .nav-dropdown-btn {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.95rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.site-nav a:hover, .nav-dropdown-btn:hover { color: var(--text); text-decoration: none; }
.nav-cta { color: var(--accent) !important; }

.nav-dropdown { position: relative; }
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    max-width: 360px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0;
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
}

.nav-toggle {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
}

.hero {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(196, 163, 90, 0.12), transparent 50%),
        linear-gradient(180deg, var(--bg-alt), var(--bg));
    padding: 4rem 1.25rem 3.5rem;
}

.hero-inner, .section-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.75rem;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.75rem;
}

h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: 1.5rem; }
.lead { color: var(--muted); font-size: 1.15rem; max-width: 38rem; }

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #121212; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-green { background: #3a8a54; color: #fff; }
.btn-green:hover { background: #2e7244; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-small { padding: 0.45rem 0.85rem; font-size: 0.875rem; margin-top: 0.5rem; }

.section { padding: 3rem 1.25rem; }
.section-alt { background: var(--bg-alt); }
.page-hero { padding: 2.5rem 1.25rem 1rem; }

/* 3+1 column layout: content + sidebar */
.content-sidebar-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.content-area { min-width: 0; }

.section-block { margin-bottom: 2.5rem; }
.section-block:last-child { margin-bottom: 0; }
.section-block-alt { background: var(--bg-alt); border-radius: 16px; padding: 2rem; }

.sidebar-widget {
    position: sticky;
    top: 1.5rem;
}

.signup-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
}
.signup-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.signup-card p {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.series-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.series-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.2s;
}
.series-card:hover { border-color: var(--accent); text-decoration: none; }
.series-card p { color: var(--muted); margin: 0.5rem 0 1rem; }
.link-arrow { color: var(--accent); font-weight: 600; font-size: 0.9rem; }

.book-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.book-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem;
}
.book-card-link { color: inherit; text-decoration: none; display: block; }
.book-card h3 { font-size: 0.95rem; margin: 0.75rem 0 0.35rem; }
.book-cover img, .book-detail-cover img, .carousel-slide img {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center;
    border-radius: 6px;
    display: block;
    background: var(--bg-alt);
}

.status-pill {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 0;
}
.status-available { color: var(--success); }
.status-in_progress { color: var(--accent); }

.book-detail {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    align-items: start;
}
.book-detail-body .btn { margin-right: 0.5rem; margin-top: 0.5rem; }

.carousel {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 2rem;
}
.carousel-viewport {
    overflow: hidden;
    flex: 1;
    min-width: 0;
}
.carousel-track {
    display: flex;
    transition: transform 0.35s ease;
}
.carousel-slide {
    flex: 0 0 33.333%;
    width: 33.333%;
    max-width: 33.333%;
    padding: 0;
    box-sizing: border-box;
}
.carousel-slide a {
    color: inherit;
    text-decoration: none;
    display: block;
    padding: 0 0.5rem;
}
.carousel-title {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    text-align: center;
}
.carousel-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.carousel-btn:hover { border-color: var(--accent); color: var(--accent); }

.prose { max-width: 42rem; }
.prose p { color: var(--muted); }
.prose .note { font-size: 0.9rem; opacity: 0.7; font-style: italic; }
.chapter-body { font-family: var(--font-display); font-size: 1.05rem; line-height: 1.75; }
.chapter-body p { color: var(--text); margin: 0 0 0.85em; }
.chapter-body .dialogue {
    font-style: italic;
    color: var(--text);
}
.chapter-body .magic {
    color: #5b4bb5;
    font-weight: 600;
}
.chapter-body .clang {
    text-align: center;
    font-weight: 800;
    letter-spacing: 0.12em;
    font-size: 1.15rem;
    margin: 1.25rem 0;
    color: var(--text);
}
.chapter-body .stasis {
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #1a6b8a;
    margin: 1.25rem 0;
}
.chapter-body .separator {
    display: flex;
    justify-content: center;
    gap: 0.65rem;
    margin: 2rem 0;
}
.chapter-body .separator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.55;
}
.chapter-body .final-lines {
    margin-top: 2rem;
    text-align: center;
}
.chapter-body .djinni {
    font-style: italic;
    color: #1a6b8a;
    letter-spacing: 0.02em;
}

.author-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2.5rem;
    align-items: start;
    max-width: 880px;
}
.author-photo img {
    width: 100%;
    border-radius: 12px;
    display: block;
    border: 1px solid var(--border);
}
.author-layout .prose { max-width: none; }

@media (max-width: 768px) {
    .author-layout {
        grid-template-columns: 1fr;
    }
    .author-photo { max-width: 220px; }
}

.narrow { max-width: 480px; }
.signup-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-weight: 600; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
.form-group textarea {
    resize: vertical;
    min-height: 10rem;
    line-height: 1.5;
}
.form-message { min-height: 1.25rem; font-size: 0.9rem; margin: 0; }
.form-message.success { color: var(--success); }
.form-message.error { color: var(--error); }
.form-message.info { color: var(--muted); }

.callout {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.callout p { margin: 0; color: var(--muted); }

.teaser-gate {
    max-width: 480px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
}
.teaser-gate > p { color: var(--muted); margin-top: 0; }
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-weight: 500;
    cursor: pointer;
}
.checkbox-label input { margin-top: 0.2rem; width: auto; }
.teaser-note { margin-top: 1.25rem; font-size: 0.95rem; }

.cta-band { text-align: center; }
.cta-band p { color: var(--muted); max-width: 36rem; margin: 0 auto 1.25rem; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem 1.25rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}
.site-footer p { margin: 0.25rem 0; }

@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-alt);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.25rem;
        gap: 0.75rem;
    }
    .site-nav.open { display: flex; }
    .nav-dropdown-menu {
        position: static;
        display: none;
        box-shadow: none;
        border: none;
        background: transparent;
        padding-left: 0.75rem;
    }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .carousel-slide { flex: 0 0 100%; }
    .book-detail { grid-template-columns: 1fr; }
    .book-detail-cover { max-width: 200px; }
}

@media (min-width: 769px) and (max-width: 960px) {
    .carousel-slide { flex: 0 0 50%; }
}
