/* ===================================================================
   Haven's Almanac - Old Book / Almanac Theme
   A completely unique design that looks like an actual leather-bound
   almanac with parchment pages, ornamental dividers, and book styling.
   =================================================================== */

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

:root {
    --ink: #2c2418;
    --parchment: #f5ead0;
    --parchment-deep: #e8d8b4;
    --leather: #5c3a1e;
    --leather-light: #7a5230;
    --gold: #c9982e;
    --gold-bright: #e8b830;
    --gold-dim: #a07820;
    --burnish: #8b6914;
    --copper: #b87333;
    --ribbon: #8b1a1a;
    --shadow: rgba(44, 36, 24, 0.22);
    --spine-width: 8px;
}

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

body {
    font-family: "Crimson Text", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    background: #3d2b1a;
    min-height: 100vh;
    padding: 0;
    color: var(--ink);
    font-size: 17px;
    line-height: 1.7;
}

/* ===== BOOK WRAPPER =====
   The entire page sits inside a "book" with a leather binding
   and parchment pages */

.top-nav {
    background: linear-gradient(180deg, #4a3322, #3d2b1a);
    padding: 14px 40px;
    border-bottom: 3px solid var(--gold-dim);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.nav-home {
    color: var(--gold);
    text-decoration: none;
    font-family: "Cinzel", "Palatino Linotype", serif;
    font-weight: 600;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.nav-home:hover {
    color: var(--gold-bright);
}

.nav-divider {
    color: rgba(201, 152, 46, 0.4);
    margin: 0 10px;
}

.nav-current {
    color: rgba(245, 234, 208, 0.7);
    font-family: "Cinzel", serif;
    letter-spacing: 0.5px;
}

/* The book page container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 0 60px;
    background:
        /* Subtle parchment noise texture via CSS */
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 105, 20, 0.02) 2px,
            rgba(139, 105, 20, 0.02) 4px
        ),
        /* Aged paper gradient */
        linear-gradient(180deg,
            #f5ead0 0%,
            #f0e2c0 20%,
            #ede0be 50%,
            #f0e2c0 80%,
            #e8d8b4 100%
        );
    box-shadow:
        /* Book shadow */
        0 0 60px rgba(0, 0, 0, 0.5),
        /* Inner page glow */
        inset 0 0 80px rgba(139, 105, 20, 0.06);
    border-left: var(--spine-width) solid var(--leather);
    border-right: 2px solid var(--parchment-deep);
    position: relative;
}

/* Book spine stitching effect */
.container::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background:
        linear-gradient(90deg,
            rgba(92, 58, 30, 0.15) 0%,
            transparent 100%
        );
    pointer-events: none;
}

/* Page edge shadow on right */
.container::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background:
        linear-gradient(270deg,
            rgba(92, 58, 30, 0.08) 0%,
            transparent 100%
        );
    pointer-events: none;
}

/* ===== HERO / TITLE PAGE ===== */
.hero {
    text-align: center;
    padding: 70px 40px 50px;
    margin-bottom: 0;
    position: relative;
    background:
        radial-gradient(ellipse at center, rgba(201, 152, 46, 0.08) 0%, transparent 70%);
    border-bottom: none;
}

/* Ornamental corner flourishes */
.hero::before,
.hero::after {
    content: "\2766"; /* Floral heart */
    position: absolute;
    font-size: 2em;
    color: var(--gold-dim);
    opacity: 0.5;
}
.hero::before {
    top: 20px;
    left: 40px;
}
.hero::after {
    top: 20px;
    right: 40px;
    transform: scaleX(-1);
}

.hero-icon {
    font-size: 4em;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 8px rgba(92, 58, 30, 0.3));
}

.hero h1 {
    font-family: "Cinzel", "Palatino Linotype", serif;
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--leather);
    letter-spacing: 3px;
    text-shadow: 0 1px 0 rgba(245, 234, 208, 0.8);
}

.tagline {
    font-size: 1.15em;
    color: var(--burnish);
    font-style: italic;
    letter-spacing: 1px;
}

.cursor {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Wax seal version badge */
.version-badge {
    display: inline-block;
    margin-top: 20px;
    background: radial-gradient(circle at 35% 35%,
        #c9402e 0%,
        #8b1a1a 50%,
        #6b1010 100%
    );
    color: #f5ead0;
    padding: 14px 14px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    font-family: "Cinzel", serif;
    font-weight: 700;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 12px rgba(139, 26, 26, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 200, 200, 0.15);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ===== ORNAMENTAL DIVIDER ===== */
.ornamental-divider {
    text-align: center;
    margin: 40px auto;
    position: relative;
    height: 30px;
    max-width: 500px;
}

.ornamental-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--gold-dim) 20%,
        var(--gold) 50%,
        var(--gold-dim) 80%,
        transparent 100%
    );
}

.ornamental-divider::after {
    content: "\2726"; /* Four-pointed star */
    position: relative;
    background: var(--parchment);
    padding: 0 16px;
    color: var(--gold);
    font-size: 1.2em;
    z-index: 1;
}

/* ===== INTRO (styled as a book epigraph) ===== */
.intro-section {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 10px;
    font-size: 1.05em;
    line-height: 1.8;
    color: rgba(44, 36, 24, 0.8);
    padding: 30px 50px;
    font-style: italic;
    position: relative;
}

.intro-section::before {
    content: "\201C"; /* Opening curly quote */
    font-family: "Cinzel", serif;
    font-size: 4em;
    color: var(--gold-dim);
    opacity: 0.4;
    position: absolute;
    top: 0;
    left: 20px;
    line-height: 1;
}

/* ===== SECTION TITLES (Chapter headings) ===== */
.section-title {
    font-family: "Cinzel", "Palatino Linotype", serif;
    text-align: center;
    font-size: 1.7em;
    font-weight: 600;
    margin: 50px 40px 30px;
    color: var(--leather);
    letter-spacing: 2px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 18px;
}

/* Double-line ornamental underline */
.section-title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    border-top: 1px solid var(--gold);
    border-bottom: 1px solid var(--gold);
}

.section-desc {
    text-align: center;
    color: rgba(44, 36, 24, 0.65);
    font-size: 0.95em;
    margin: 0 40px 24px;
    line-height: 1.6;
    font-style: italic;
}

/* ===== KEYBIND SECTION ===== */
.keybind-section {
    margin: 0 40px 10px;
}

.keybind-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.keybind-card {
    text-align: center;
    background: rgba(232, 216, 180, 0.5);
    border-radius: 4px;
    padding: 18px 24px;
    border: 1px solid rgba(139, 105, 20, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 150px;
    position: relative;
}

.keybind-card::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

.keybind-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(92, 58, 30, 0.15);
}

.keybind-keys {
    margin-bottom: 8px;
    font-family: "Cinzel", serif;
}

.keybind-action {
    color: rgba(44, 36, 24, 0.65);
    font-size: 0.9em;
    font-style: italic;
}

/* ===== FEATURES (styled as almanac entries) ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0;
    margin: 0 40px 20px;
    border: 1px solid rgba(139, 105, 20, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.feature-card {
    padding: 28px 26px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 105, 20, 0.15);
    border-right: 1px solid rgba(139, 105, 20, 0.15);
    transition: background 0.25s ease;
    background: transparent;
    position: relative;
}

.feature-card:hover {
    background: rgba(201, 152, 46, 0.06);
}

.feature-icon {
    font-size: 1.8em;
    margin-bottom: 10px;
    float: left;
    margin-right: 14px;
    line-height: 1.2;
}

.feature-card h3 {
    font-family: "Cinzel", serif;
    color: var(--leather);
    margin-bottom: 6px;
    font-size: 1.05em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.feature-card p {
    color: rgba(44, 36, 24, 0.72);
    line-height: 1.65;
    font-size: 0.95em;
}

/* ===== MOD INTEGRATION (styled as book index entries) ===== */
.mod-grid {
    margin: 0 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid rgba(139, 105, 20, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.mod-card {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid rgba(139, 105, 20, 0.12);
    transition: background 0.2s ease;
    background: transparent;
    position: relative;
}

.mod-card:last-child {
    border-bottom: none;
}

.mod-card:hover {
    background: rgba(201, 152, 46, 0.06);
}

/* Dot leader effect between name and description */
.mod-card::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 60px;
    right: 24px;
}

.mod-card-icon {
    font-size: 1.6em;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
}

.mod-card h4 {
    font-family: "Cinzel", serif;
    color: var(--leather);
    font-size: 0.95em;
    font-weight: 600;
    margin-bottom: 2px;
    letter-spacing: 0.3px;
}

.mod-card p {
    color: rgba(44, 36, 24, 0.62);
    font-size: 0.9em;
    line-height: 1.5;
    font-style: italic;
}

/* ===== USAGE STEPS (styled as numbered instructions in old book) ===== */
.usage-steps {
    max-width: 650px;
    margin: 0 auto 20px;
    padding: 0 40px;
    counter-reset: step-counter;
}

.step {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
    padding: 22px 0;
    border-bottom: 1px dashed rgba(139, 105, 20, 0.2);
    background: transparent;
    border-radius: 0;
    align-items: flex-start;
}

.step:last-child {
    border-bottom: none;
}

.step:hover {
    background: transparent;
}

.step-number {
    background: transparent;
    color: var(--gold);
    width: 44px;
    height: 44px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Cinzel", serif;
    font-weight: 700;
    font-size: 1.8em;
    flex-shrink: 0;
    line-height: 1;
    border: none;
}

.step-content h4 {
    font-family: "Cinzel", serif;
    color: var(--leather);
    margin-bottom: 6px;
    font-size: 1.02em;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.step-content p {
    color: rgba(44, 36, 24, 0.72);
    line-height: 1.65;
    font-size: 0.95em;
}

kbd {
    background: rgba(232, 216, 180, 0.6);
    border: 1px solid rgba(139, 105, 20, 0.25);
    border-bottom-width: 2px;
    border-radius: 3px;
    padding: 2px 7px;
    font-family: "Cinzel", serif;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--leather);
    letter-spacing: 0.5px;
}

/* ===== CONFIG TABLE (reference page style) ===== */
.config-table {
    max-width: 700px;
    margin: 0 auto 20px;
    padding: 0 40px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(139, 105, 20, 0.15);
}

th {
    font-family: "Cinzel", serif;
    font-weight: 600;
    font-size: 0.85em;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--leather);
    background: transparent;
    border-bottom: 2px solid var(--gold-dim);
}

td {
    color: rgba(44, 36, 24, 0.75);
    font-size: 0.95em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(201, 152, 46, 0.04);
}

code {
    background: rgba(92, 58, 30, 0.08);
    padding: 2px 6px;
    border-radius: 2px;
    font-family: "Courier New", "Lucida Console", monospace;
    font-size: 0.85em;
    color: var(--leather-light);
}

.config-note {
    text-align: center;
    color: rgba(44, 36, 24, 0.55);
    font-size: 0.9em;
    margin-bottom: 40px;
    font-style: italic;
    padding: 0 40px;
}

/* ===== FOOTER (colophon style) ===== */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 30px 40px;
    background: linear-gradient(180deg, transparent, rgba(92, 58, 30, 0.05));
    position: relative;
}

.footer::before {
    content: "\2042"; /* Asterism */
    display: block;
    text-align: center;
    color: var(--gold-dim);
    font-size: 1.8em;
    margin-bottom: 16px;
    letter-spacing: 8px;
    opacity: 0.6;
}

.footer p {
    font-family: "Cinzel", serif;
    color: rgba(44, 36, 24, 0.5);
    font-size: 0.85em;
    margin-bottom: 14px;
    letter-spacing: 1px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.footer-links a {
    color: var(--burnish);
    text-decoration: none;
    font-family: "Cinzel", serif;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: color 0.3s;
    position: relative;
}

.footer-links a::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--gold-dim);
    opacity: 0;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    color: var(--gold);
}

.footer-links a:hover::after {
    opacity: 1;
}

/* ===== ANIMATIONS ===== */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero {
    animation: fade-in 0.8s ease-out;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .container {
        border-left-width: 4px;
        border-right: none;
    }

    .container::after {
        display: none;
    }

    .hero {
        padding: 50px 24px 40px;
    }

    .hero h1 {
        font-size: 2.2em;
        letter-spacing: 1px;
    }

    .hero-icon {
        font-size: 3em;
    }

    .hero::before, .hero::after {
        font-size: 1.4em;
        top: 14px;
    }

    .hero::before { left: 16px; }
    .hero::after { right: 16px; }

    .intro-section {
        padding: 24px 24px;
    }

    .intro-section::before {
        left: 8px;
        font-size: 3em;
    }

    .section-title {
        margin: 40px 20px 24px;
        font-size: 1.4em;
    }

    .section-desc {
        margin: 0 20px 20px;
    }

    .keybind-section {
        margin: 0 20px 10px;
    }

    .features-grid {
        margin: 0 20px 20px;
        grid-template-columns: 1fr;
    }

    .feature-card {
        border-right: none;
    }

    .mod-grid {
        margin: 0 20px 20px;
    }

    .usage-steps {
        padding: 0 20px;
    }

    .step {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }

    .step-number {
        margin: 0 auto;
    }

    .config-table {
        padding: 0 20px;
    }

    .config-note {
        padding: 0 20px;
    }

    .top-nav {
        padding: 12px 20px;
    }

    .footer {
        padding: 30px 20px;
    }

    .footer-links {
        flex-direction: column;
        gap: 12px;
    }

    .ornamental-divider {
        margin: 30px 20px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8em;
    }

    .hero::before, .hero::after {
        display: none;
    }

    .keybind-grid {
        flex-direction: column;
        align-items: center;
    }

    .keybind-card {
        width: 100%;
        max-width: 260px;
    }

    .version-badge {
        width: 60px;
        height: 60px;
        font-size: 0.72em;
    }
}

/* ===================================================================
   DARK MODE - Midnight leather-bound almanac
   =================================================================== */
[data-theme="dark"] body {
    background: #1a140e;
}

[data-theme="dark"] .top-nav {
    background: linear-gradient(180deg, #1f1810, #1a140e);
    border-bottom-color: rgba(201, 152, 46, 0.25);
}

[data-theme="dark"] .nav-current {
    color: rgba(232, 216, 180, 0.6);
}

[data-theme="dark"] .nav-divider {
    color: rgba(201, 152, 46, 0.3);
}

[data-theme="dark"] .container {
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(201, 152, 46, 0.015) 2px,
            rgba(201, 152, 46, 0.015) 4px
        ),
        linear-gradient(180deg,
            #2a2018 0%,
            #261e14 20%,
            #241c12 50%,
            #261e14 80%,
            #221a10 100%
        );
    border-left-color: #3d2b1a;
    border-right-color: #1f1810;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .container::before {
    background: linear-gradient(90deg,
        rgba(61, 43, 26, 0.3) 0%,
        transparent 100%
    );
}

[data-theme="dark"] .container::after {
    background: linear-gradient(270deg,
        rgba(0, 0, 0, 0.15) 0%,
        transparent 100%
    );
}

[data-theme="dark"] .hero {
    background: radial-gradient(ellipse at center, rgba(201, 152, 46, 0.05) 0%, transparent 70%);
}

[data-theme="dark"] .hero::before,
[data-theme="dark"] .hero::after {
    color: var(--gold-dim);
    opacity: 0.3;
}

[data-theme="dark"] .hero h1 {
    color: #e8d8b4;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .tagline {
    color: rgba(201, 152, 46, 0.7);
}

[data-theme="dark"] .intro-section {
    color: rgba(232, 216, 180, 0.75);
}

[data-theme="dark"] .intro-section::before {
    color: rgba(201, 152, 46, 0.25);
}

[data-theme="dark"] .section-title {
    color: var(--gold);
}

[data-theme="dark"] .section-title::after {
    border-top-color: rgba(201, 152, 46, 0.4);
    border-bottom-color: rgba(201, 152, 46, 0.4);
}

[data-theme="dark"] .section-desc {
    color: rgba(232, 216, 180, 0.55);
}

[data-theme="dark"] .ornamental-divider::before {
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(201, 152, 46, 0.25) 20%,
        rgba(201, 152, 46, 0.4) 50%,
        rgba(201, 152, 46, 0.25) 80%,
        transparent 100%
    );
}

[data-theme="dark"] .ornamental-divider::after {
    background: #261e14;
    color: rgba(201, 152, 46, 0.5);
}

/* Keybinds dark */
[data-theme="dark"] .keybind-card {
    background: rgba(42, 32, 24, 0.5);
    border-color: rgba(201, 152, 46, 0.15);
}

[data-theme="dark"] .keybind-card::before {
    background: linear-gradient(90deg, transparent, rgba(201, 152, 46, 0.2), transparent);
}

[data-theme="dark"] .keybind-action {
    color: rgba(232, 216, 180, 0.55);
}

/* Feature cards dark */
[data-theme="dark"] .features-grid {
    border-color: rgba(201, 152, 46, 0.12);
}

[data-theme="dark"] .feature-card {
    border-color: rgba(201, 152, 46, 0.1);
}

[data-theme="dark"] .feature-card:hover {
    background: rgba(201, 152, 46, 0.04);
}

[data-theme="dark"] .feature-card h3 {
    color: #e8d8b4;
}

[data-theme="dark"] .feature-card p {
    color: rgba(232, 216, 180, 0.65);
}

/* Mod cards dark */
[data-theme="dark"] .mod-grid {
    border-color: rgba(201, 152, 46, 0.12);
}

[data-theme="dark"] .mod-card {
    border-color: rgba(201, 152, 46, 0.08);
}

[data-theme="dark"] .mod-card:hover {
    background: rgba(201, 152, 46, 0.04);
}

[data-theme="dark"] .mod-card h4 {
    color: #e8d8b4;
}

[data-theme="dark"] .mod-card p {
    color: rgba(232, 216, 180, 0.55);
}

/* Steps dark */
[data-theme="dark"] .step {
    border-bottom-color: rgba(201, 152, 46, 0.12);
}

[data-theme="dark"] .step-number {
    color: rgba(201, 152, 46, 0.6);
}

[data-theme="dark"] .step-content h4 {
    color: #e8d8b4;
}

[data-theme="dark"] .step-content p {
    color: rgba(232, 216, 180, 0.65);
}

[data-theme="dark"] kbd {
    background: rgba(201, 152, 46, 0.1);
    border-color: rgba(201, 152, 46, 0.2);
    color: #e8d8b4;
}

/* Table dark */
[data-theme="dark"] th {
    color: var(--gold);
    border-bottom-color: rgba(201, 152, 46, 0.3);
}

[data-theme="dark"] td {
    color: rgba(232, 216, 180, 0.7);
    border-bottom-color: rgba(201, 152, 46, 0.08);
}

[data-theme="dark"] tr:hover td {
    background: rgba(201, 152, 46, 0.03);
}

[data-theme="dark"] code {
    background: rgba(201, 152, 46, 0.08);
    color: var(--gold);
}

[data-theme="dark"] .config-note {
    color: rgba(232, 216, 180, 0.45);
}

/* Footer dark */
[data-theme="dark"] .footer {
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.15));
}

[data-theme="dark"] .footer::before {
    color: rgba(201, 152, 46, 0.3);
}

[data-theme="dark"] .footer p {
    color: rgba(232, 216, 180, 0.4);
}

[data-theme="dark"] .footer-links a {
    color: rgba(201, 152, 46, 0.6);
}

[data-theme="dark"] .footer-links a::after {
    background: rgba(201, 152, 46, 0.3);
}

[data-theme="dark"] .footer-links a:hover {
    color: var(--gold);
}
