:root {
    --leather: #3a2418;
    --leather-deep: #24160f;
    --leather-ink: #f6ecd8;
    --stitch: #f0d48a;
    --stitch-shadow: #6a4314;
    --gold: #e2b340;
    --gold-ink: #1a110c;
    --parchment: #f4e7c8;
    --parchment-deep: #e7d3a4;
    --ink: #24180f;
    --ink-soft: #4a3424;
    --heading: #6e1c12;
    --link: #7a1e12;
    --red-letter: #7a0000;
    --red-wash: #f6d0d0;
    --line: #8d7048;
    --alert: #fff4d6;
    --alert-ink: #3d2a12;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    color: var(--leather-ink);
    background-color: #140d09;
    background-image: radial-gradient(circle at top, #3a2418 0%, #140d09 55%);
    font-family: Lora, Palatino, "Palatino Linotype", Georgia, serif;
    font-size: 18px;
    line-height: 1.55;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.skip {
    position: absolute;
    left: 12px;
    top: -40px;
    background: var(--gold);
    color: var(--gold-ink);
    padding: 8px 12px;
    z-index: 20;
}

.skip:focus {
    top: 12px;
}

.app {
    display: flex;
    gap: 18px;
    align-items: stretch;
    min-height: 100vh;
    padding: 18px;
}

.leather {
    position: relative;
    background-color: var(--leather);
    background-image:
        radial-gradient(ellipse at 15% 0%, rgba(255, 214, 150, 0.16), transparent 42%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 0, 0, 0.45), transparent 46%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
    border: 3px solid #100905;
    border-radius: 18px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.45), 0 18px 40px rgba(0, 0, 0, 0.45);
    color: var(--leather-ink);
}

.stitching {
    position: absolute;
    inset: 12px;
    border: 2px dashed var(--stitch);
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(90, 50, 12, 0.35);
    pointer-events: none;
    z-index: 3;
}

.stitching::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 1px dashed var(--stitch-shadow);
    border-radius: 8px;
}

.sidebar {
    width: 300px;
    flex: none;
}

.sidebar-inner,
.parchment {
    position: relative;
    z-index: 2;
}

.sidebar-inner {
    padding: 28px 22px 22px;
}

.brand-kicker {
    margin: 0;
    color: var(--stitch);
    font-family: Cinzel, Palatino, Georgia, serif;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.brand {
    margin: 4px 0 14px;
    font-family: Cinzel, Palatino, Georgia, serif;
    font-size: 2rem;
    line-height: 1.1;
}

.brand a {
    color: var(--stitch);
    text-decoration: none;
}

.who {
    margin: 0 0 10px;
    color: var(--leather-ink);
    font-size: 0.95rem;
}

.side-search {
    margin-top: 16px;
}

.side-search label,
.stack label,
.search-panel label {
    display: block;
    margin: 12px 0 6px;
    color: var(--stitch);
    font-family: Cinzel, Palatino, Georgia, serif;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 18px;
}

.side-nav a {
    color: var(--leather-ink);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
}

.side-nav a:hover,
.side-nav a:focus {
    background: rgba(240, 212, 138, 0.16);
    border-color: rgba(240, 212, 138, 0.45);
    color: #fff8e8;
}

.workspace {
    flex: 1;
    min-width: 0;
}

.book {
    display: flex;
    min-height: calc(100vh - 36px);
}

.parchment {
    flex: 1;
    margin: 22px;
    padding: 28px 28px 40px;
    background-color: var(--parchment);
    background-image: linear-gradient(90deg, rgba(90, 60, 30, 0.08), transparent 18px), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23p)' opacity='0.05'/%3E%3C/svg%3E");
    color: var(--ink);
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(90, 60, 20, 0.25), -8px 0 16px rgba(0, 0, 0, 0.12);
}

.page-title,
.parchment h2 {
    font-family: Cinzel, Palatino, Georgia, serif;
    color: var(--heading);
    line-height: 1.2;
}

.page-title {
    margin: 0 0 12px;
    font-size: 2.1rem;
}

.parchment h2 {
    margin: 22px 0 10px;
    font-size: 1.25rem;
}

.summary,
.meta-line,
.parchment p,
.parchment li,
.parchment blockquote,
.study-body {
    color: var(--ink);
}

.summary {
    margin-top: 0;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    display: inline-block;
    background: var(--parchment-deep);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.92rem;
}

.ink-link,
.card-title,
.verse {
    color: var(--link);
}

.ink-link,
.card-title {
    font-weight: 700;
}

.parchment code {
    color: var(--ink);
    background: #fff8ea;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 4px;
}

input[type="search"],
input[type="text"],
select,
textarea {
    width: 100%;
    color: var(--ink);
    background: #fff8ea;
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

input::placeholder,
textarea::placeholder {
    color: var(--ink-soft);
    opacity: 1;
}

.side-search input {
    margin-bottom: 8px;
}

.search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-row input {
    flex: 1;
}

.search-panel label {
    color: var(--heading);
}

.btn {
    display: inline-block;
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
    font-family: Cinzel, Palatino, Georgia, serif;
    font-size: 0.92rem;
    letter-spacing: 0.03em;
}

.gate {
    text-align: center;
    padding: 48px 16px 32px;
}

.gate .page-title {
    margin-bottom: 28px;
}

#google-signin {
    display: inline-block;
    min-height: 44px;
}

.btn-gold {
    background: var(--gold);
    color: var(--gold-ink);
}

.btn-ink {
    background: #5c1d12;
    color: #f8efe2;
}

.btn-quiet {
    background: transparent;
    color: var(--heading);
    border: 2px solid var(--heading);
}

.btn-block {
    width: 100%;
    text-align: center;
}

.btn:hover,
.btn:focus {
    filter: brightness(1.05);
}

.book-grid,
.chapter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-block;
    background: #fff8ea;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
    text-decoration: none;
}

.chip-on {
    background: var(--gold);
    color: var(--gold-ink);
    border-color: #8a6412;
}

.section-gap {
    margin-top: 18px;
}

.chapter-nav {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.scripture {
    font-size: 1.12rem;
    line-height: 1.75;
}

.verse {
    text-decoration: none;
    border-radius: 4px;
}

.verse:hover,
.verse:focus,
.verse-on {
    background: rgba(110, 28, 18, 0.1);
}

.verse-num {
    color: var(--heading);
    font-weight: 700;
    font-size: 0.75em;
}

.red-letter {
    color: var(--red-letter);
    background: var(--red-wash);
    font-weight: 700;
    padding: 0 2px;
}

.panel,
.card,
.alert {
    background: #fff8ea;
    border: 1px solid var(--line);
    border-radius: 10px;
}

.panel {
    margin-top: 22px;
    padding: 16px;
}

.cards {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.card {
    padding: 14px;
}

.card p,
.note-body {
    margin: 8px 0;
}

.verse-cite {
    font-family: Cinzel, Palatino, Georgia, serif;
    color: var(--heading);
    font-weight: 700;
}

blockquote {
    margin: 8px 0;
    padding-left: 12px;
    border-left: 4px solid var(--heading);
}

.alert {
    padding: 12px 14px;
    color: var(--alert-ink);
    background: var(--alert);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.plain {
    padding-left: 1.2rem;
}

.plain li {
    margin: 6px 0;
}

.check {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--ink);
}

.check input {
    width: auto;
    accent-color: #5c1d12;
}

.study-body {
    white-space: normal;
    font-size: 1.05rem;
}

mark {
    background: #f3d36b;
    color: var(--gold-ink);
    padding: 0 2px;
}

:focus-visible {
    outline: 3px solid #1a110c;
    outline-offset: 2px;
}

.leather :focus-visible {
    outline-color: #fff8e8;
}

@media (max-width: 860px) {
    .app {
        flex-direction: column;
        padding: 10px;
    }

    .sidebar,
    .book {
        width: 100%;
        min-height: 0;
    }

    .parchment {
        margin: 16px;
        padding: 18px 14px 28px;
    }

    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .page-title {
        font-size: 1.7rem;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .sidebar,
    .stitching,
    .chapter-nav,
    .panel,
    .chooser {
        display: none;
    }

    .parchment,
    .leather {
        box-shadow: none;
        background: #fff;
        color: #000;
        border: 0;
    }
}
