:root {
    --bg: #f3e8ce;
    --paper: #fdf9ee;
    --text: #38290f;
    --accent: #a4631f;
    --accent-dark: #7a4813;
    --gold: #b4890f;
    --maroon: #7c3223;
    --highlight: #f5dd9a;
    --highlight-border: #c1860f;
    --border: #ddc998;

    --font-hebrew: "Frank Ruhl Libre", Georgia, serif;
    --font-display: "Frank Ruhl Libre", Georgia, serif;
    --font-body: "PT Serif", Georgia, serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    font-size: 18px;
    line-height: 1.5;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse at 15% 20%, rgba(180, 137, 15, 0.07), transparent 45%),
        radial-gradient(ellipse at 85% 15%, rgba(124, 50, 35, 0.05), transparent 40%),
        radial-gradient(ellipse at 50% 100%, rgba(124, 50, 35, 0.05), transparent 55%);
    background-attachment: fixed;
}

.site-header {
    position: relative;
    padding: 1.1rem 1.5rem 1.3rem;
    background: linear-gradient(180deg, #fffdf5, var(--paper));
    border-bottom: 3px double var(--gold);
    box-shadow: 0 2px 10px rgba(56, 41, 15, 0.1);
}
.site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -5px;
    height: 2px;
    background: repeating-linear-gradient(135deg, var(--gold) 0 5px, transparent 5px 10px);
    opacity: .55;
}

.site-title {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: .02em;
    color: var(--maroon);
    text-decoration: none;
}
.site-emblem {
    width: 1.8rem;
    height: 1.8rem;
    color: var(--gold);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2.5rem 4rem;
}

h1 { font-family: var(--font-display); color: var(--maroon); }

.promo-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-bottom: 2.5rem;
}
.promo-card {
    padding: 1.2rem 1.4rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-top: 3px solid var(--gold);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(56, 41, 15, 0.08);
    transition: transform .12s ease, box-shadow .12s ease;
}
.promo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(56, 41, 15, 0.12);
}
.promo-card h2 {
    margin: 0 0 .5rem 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
    color: var(--maroon);
    border: none;
    padding: 0;
}
.promo-card p { margin: 0 0 .8rem 0; font-size: 1.15rem; color: #4a3d24; }
.channel-links { display: flex; gap: .7rem; flex-wrap: wrap; }
.channel-link, .zoom-link {
    display: inline-block;
    padding: .55rem 1.1rem;
    background: var(--accent-dark);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: bold;
    transition: background-color .12s ease, transform .12s ease;
}
.channel-link:hover, .zoom-link:hover { background: var(--maroon); transform: translateY(-1px); }

@media (max-width: 640px) {
    .promo-section { grid-template-columns: 1fr; }
    main { padding: 1rem 1rem 3rem; }
    body { font-size: 16px; }
    .site-header { padding: .9rem 1rem 1.1rem; }
    .site-title { font-size: 1.15rem; gap: .4rem; }
    .site-emblem { width: 1.4rem; height: 1.4rem; }
    h1 { font-size: 1.4rem; }
    .verses { padding: .3rem .8rem; border-radius: 4px; }
}

.about-section {
    margin-bottom: 2.5rem;
    padding: 1.2rem 1.4rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(56, 41, 15, 0.08);
}
.about-section h2 {
    margin: 0 0 .6rem 0;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--maroon);
}
.about-section p { margin: 0; font-size: 1.05rem; line-height: 1.7; color: #4a3d24; }

.nav-section { margin-bottom: 2rem; font-size: 1.15rem; }
.nav-section h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--maroon);
    border-bottom: 1px solid var(--border);
    padding-bottom: .3rem;
}
.parasha-list { list-style: none; padding: 0; }
.parasha-list li { padding: .4rem 0; }
.parasha-list .range { color: #7a6a4a; font-size: .95rem; margin-left: .5rem; }

.category-block { margin-bottom: 1rem; }
.category-summary {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--maroon);
    cursor: pointer;
    padding: .35rem 0;
}
.subcategory-block { margin: .3rem 0 .3rem 1rem; padding-left: .8rem; border-left: 2px solid var(--border); }
.subcategory-summary {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-dark);
    cursor: pointer;
    padding: .3rem 0;
}
.he-label { color: #8a7a55; font-weight: normal; font-size: .9rem; font-family: var(--font-hebrew); }
.book-entry {
    margin: .2rem 0 .2rem 1rem;
    padding: .3rem 0;
    font-size: 1.15rem;
}
.book-entry summary { cursor: pointer; }
.book-entry .nav-row { margin-top: .5rem; }
.empty-note { color: #8a7a55; font-size: .85rem; margin: .2rem 0 .2rem 1rem; font-style: italic; }

summary { list-style-position: outside; }
summary::marker { color: var(--gold); }

.breadcrumbs { margin-bottom: 1rem; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }

.chapter-marker {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2.5rem 0 1.2rem 0;
    color: var(--maroon);
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}
.chapter-marker:first-child { margin-top: 0; }
.chapter-marker::before,
.chapter-marker::after {
    content: "";
    flex: 1;
    height: 0;
    border-top: 2px dotted var(--gold);
}

.topics-intro { color: #6a5a3a; font-size: 1.05rem; margin-bottom: 1.5rem; }
.book-marker { font-size: 1.6rem; }
.topics-chapter-marker {
    margin: 1.8rem 0 .6rem 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--accent-dark);
}
.topics-chapter-marker a { color: inherit; text-decoration: none; }
.topics-chapter-marker a:hover { text-decoration: underline; }
.topics-flow {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin: 0 0 1.2rem 0;
}
.topic-entry {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    cursor: pointer;
    padding: .5rem .8rem;
    background: var(--paper);
    border: 1px solid var(--highlight-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: .95rem;
    color: var(--text);
    text-align: left;
    box-shadow: 0 1px 3px rgba(56, 41, 15, 0.06);
    transition: background-color .12s ease, transform .12s ease;
}
.topic-entry:hover { background: var(--highlight); transform: translateY(-1px); }
.topic-entry-verse {
    flex-shrink: 0;
    color: var(--accent-dark);
    font-size: .8rem;
    font-weight: bold;
    white-space: nowrap;
}
.topics-panel { margin: -.3rem 0 1rem 0; }
.topics-panel-ref { margin-bottom: .8rem; font-size: .85rem; }
.topics-panel-ref a { color: var(--accent-dark); }

.parasha-marker {
    display: block;
    margin: 1.5rem 0;
    padding: .6rem 1rem;
    background: var(--maroon);
    color: #fff;
    text-decoration: none;
    text-align: center;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .02em;
}
.parasha-marker:hover { background: var(--accent-dark); }

.quick-nav {
    margin-bottom: 1rem;
    padding: .9rem 1.1rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(56, 41, 15, 0.08);
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .9rem;
    padding-top: .8rem;
    border-top: 1px dashed var(--border);
    font-size: .95rem;
    color: var(--text);
    cursor: pointer;
}
.filter-toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--maroon); cursor: pointer; }
.filter-star { color: var(--gold); }
.nav-row-label {
    font-size: .75rem;
    color: #8a7a55;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin: .5rem 0 .3rem 0;
}
.nav-row-label:first-child { margin-top: 0; }
.nav-row {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}
.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: #fff;
    color: var(--text);
    font-family: var(--font-body);
    font-size: .85rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform .1s ease, box-shadow .1s ease, background-color .1s ease;
}
.nav-btn:hover { background: #f2e6c4; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(56, 41, 15, 0.15); }
.nav-btn.active {
    background: var(--highlight);
    border: 2px solid var(--maroon);
    color: var(--text);
    font-weight: bold;
}
.nav-btn.has-materials {
    background: var(--highlight);
    border-color: var(--highlight-border);
    font-weight: bold;
}
.nav-btn.has-materials:hover { filter: brightness(0.95); }
.nav-btn.active.has-materials {
    background: var(--highlight);
    border: 2px solid var(--maroon);
    color: var(--text);
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-family: var(--font-display);
    font-weight: 700;
}
.chapter-nav a { color: var(--accent-dark); text-decoration: none; }

.verses {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .5rem 2rem;
    box-shadow: 0 2px 10px rgba(56, 41, 15, 0.08);
}

.verse-row {
    display: grid;
    grid-template-columns: 3.5rem 1fr 1fr;
    gap: 1.5rem;
    padding: .8rem .5rem;
    margin: 0 -.5rem;
    border-bottom: 1px solid var(--border);
    border-radius: 3px;
    align-items: start;
    transition: background-color .12s ease;
}
.verse-row:last-child { border-bottom: none; }
.verse-row:not(.has-materials):hover { background: rgba(180, 137, 15, 0.06); }

.verse-num {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
    color: #a3936a;
    font-size: .85rem;
    padding-top: .3rem;
}
.has-materials .verse-num::after {
    content: "✦";
    display: block;
    margin-top: .3rem;
    color: var(--gold);
    font-size: .8rem;
}

.verse-he {
    font-family: var(--font-hebrew);
    font-size: 1.5rem;
    line-height: 1.6;
    text-align: right;
}

.verse-ru {
    font-family: var(--font-body);
    font-size: 1.2rem;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .verse-row {
        grid-template-columns: 1fr;
        gap: .3rem;
        padding: .8rem .6rem;
    }
    .verse-num { flex-direction: row; align-items: center; padding-top: 0; }
    .has-materials .verse-num::after { display: inline-block; margin: 0 0 0 .4rem; }
    .verse-he { font-size: 1.35rem; }
    .verse-ru { font-size: 1.05rem; padding-top: .2rem; border-top: 1px dashed var(--border); margin-top: .3rem; }
}

.has-materials {
    cursor: pointer;
    background: var(--highlight);
    border-left: 3px solid var(--highlight-border);
    border-radius: 3px;
}

.has-materials:hover {
    filter: brightness(0.97);
}

.materials-panel {
    margin: .2rem 0 .8rem 0;
    padding: 1.2rem 1.4rem;
    background: var(--paper);
    border: 1px solid var(--highlight-border);
    border-left: 3px solid var(--highlight-border);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(56, 41, 15, 0.08);
}

.rashi-toggle {
    font-family: var(--font-hebrew);
    font-size: .72rem;
    line-height: 1.3;
    color: #8a7a55;
    background: none;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: .1rem .4rem;
    cursor: pointer;
    white-space: nowrap;
}
.rashi-toggle:hover { background: #f2ede0; color: var(--text); }
.rashi-panel {
    margin: 0 0 .8rem 0;
    padding: .9rem 1.1rem;
    background: #faf6ea;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-hebrew);
    font-size: 1.05rem;
    line-height: 1.8;
    text-align: right;
    color: #4a3d24;
}

@media (max-width: 640px) {
    .materials-panel { padding: 1rem; }
    .material a.platform-link { width: 100%; justify-content: center; }
    .nav-btn { width: 2.3rem; height: 2.3rem; font-size: .9rem; }
}

[x-cloak] { display: none !important; }

.material { margin-bottom: 1rem; }
.material:last-child { margin-bottom: 0; }
.material h3 { margin: 0 0 .4rem 0; font-family: var(--font-display); font-size: 1.05rem; color: var(--maroon); }
.material a { color: var(--accent-dark); }
.video-embed { position: relative; padding-bottom: 56.25%; height: 0; max-width: 480px; }
.video-embed iframe {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 2px;
}
.material-body { color: #4a3d24; font-size: .95rem; line-height: 1.6; margin: 0 0 .8rem 0; }

.material-links { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-top: .4rem; }
.material a.platform-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .9rem;
    background: var(--accent-dark);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: .95rem;
    font-weight: bold;
    transition: background-color .12s ease, transform .12s ease;
}
.material a.platform-link:hover { background: var(--maroon); transform: translateY(-1px); }
.platform-icon { width: 1.3rem; height: 1.3rem; flex-shrink: 0; }
.platform-youtube .platform-icon rect { fill: #d3312b; }
.platform-rutube .platform-icon rect { fill: #1c1c1e; }
