/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ──────────────────────────────────────────────────────────────────── */
html, body { max-width: 100%; overflow-x: hidden; }
body {
    font-family: 'Heebo', sans-serif;
    direction: rtl;
    background: #fdfbf7;
    color: #1a1a1a;
    line-height: 1.7;
}

a { color: #a6804a; text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
    background: #fff;
    border-bottom: 2px solid #a6804a;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.site-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: #a6804a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.main-nav a {
    margin-inline-start: 1.5rem;
    color: #444;
    font-weight: 600;
}

/* ── Main ──────────────────────────────────────────────────────────────────── */
.main-content {
    max-width: 1100px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
    background: #f0ebe0;
    border-top: 1px solid #d4b896;
    margin-top: 4rem;
    padding: 2rem;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary  { background: #a6804a; color: #fff; }
.btn-outline  { background: transparent; border: 2px solid #a6804a; color: #a6804a; }
.btn-danger   { background: #c0392b; color: #fff; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
input, textarea, select {
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #1a1a1a;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #a6804a;
    box-shadow: 0 0 0 3px rgba(166,128,74,.15);
}

label { display: block; font-weight: 600; margin-bottom: 0.35rem; }

.form-group { margin-bottom: 1.25rem; }

/* ── Flash messages ─────────────────────────────────────────────────────────── */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}
.flash-success { background: #d4edda; color: #155724; }
.flash-error   { background: #f8d7da; color: #721c24; }

/* ── Nav (מובייל: תפריט המבורגר) ──────────────────────────────────────────── */
.main-nav a { padding-bottom: 2px; border-bottom: 2px solid transparent; }
.main-nav a.active { border-bottom-color: #a6804a; color: #a6804a; }
.nav-toggle {
    display: none;
    background: none; border: none; font-size: 1.4rem; color: #a6804a; cursor: pointer;
}

/* ── Hero: תאריך + מיקום ───────────────────────────────────────────────────── */
.hero-card {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
}
.hero-date { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 1rem; }
.hero-hebrew-date { font-size: 2rem; font-weight: 800; color: #5a2318; }
.hero-parasha { font-size: 1.1rem; color: #8b6938; font-weight: 600; }

.location-pill {
    display: inline-flex; align-items: center; gap: .5rem;
    background: #fff; border: 2px solid #a6804a; border-radius: 999px;
    padding: .5rem 1.25rem; font-size: 1rem; font-weight: 600; color: #5a2318;
    cursor: pointer; font-family: inherit;
}
.location-pill:hover { background: #f7f1e3; }

.location-map-wrap {
    margin: .75rem auto 0; max-width: 420px; border-radius: .8rem; overflow: hidden;
    border: 1px solid #ecdfc7;
}
.location-map { display: block; width: 100%; height: 160px; border: 0; }

/* ── רשת הזמנים ────────────────────────────────────────────────────────────── */
.zmanim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .9rem;
    margin: 1.5rem 0 2.5rem;
}
.zman-card {
    background: #fff;
    border: 1px solid #ecdfc7;
    border-radius: .9rem;
    padding: 1rem 1.1rem;
    display: flex; flex-direction: column; gap: .35rem;
    box-shadow: 0 1px 3px rgba(90,35,24,.05);
    transition: transform .15s, box-shadow .15s;
}
.zman-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(90,35,24,.08); }
.zman-card-highlight { background: #fdf6e8; border-color: #d4b06a; }
.zman-label { font-size: .85rem; color: #8a7a5c; font-weight: 600; }
.zman-time { font-size: 1.5rem; font-weight: 800; color: #1a1a1a; font-variant-numeric: tabular-nums; }

/* ── כרטיס שבת ─────────────────────────────────────────────────────────────── */
.shabbat-card {
    background: linear-gradient(135deg, #5a2318, #7a3520);
    color: #fdf6e8;
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.shabbat-card h2 { font-size: 1.3rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.shabbat-times { display: flex; gap: 2rem; flex-wrap: wrap; }
.shabbat-time-item { display: flex; flex-direction: column; gap: .25rem; }
.shabbat-time-label { font-size: .85rem; opacity: .85; }
.shabbat-time-value { font-size: 1.6rem; font-weight: 800; }

/* ── בורר מיקום (dialog) ───────────────────────────────────────────────────── */
.location-dialog {
    border: none; border-radius: 1rem; padding: 1.5rem;
    max-width: 400px; width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.location-dialog::backdrop { background: rgba(26,26,26,.5); }
.location-dialog h3 { margin-bottom: 1rem; color: #5a2318; }
.location-list { list-style: none; max-height: 260px; overflow-y: auto; margin-top: .75rem; }
.location-list li {
    padding: .65rem .5rem; cursor: pointer; border-radius: .5rem; font-weight: 600;
}
.location-list li:hover { background: #f7f1e3; }
.location-list li[hidden] { display: none; }

/* ── לוח שנה ────────────────────────────────────────────────────────────────── */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .25rem; flex-wrap: wrap; }
.calendar-title { font-size: 1.6rem; color: #5a2318; text-align: center; flex: 1; }
.calendar-subtitle { text-align: center; color: #8a7a5c; margin-bottom: 1.5rem; }
.calendar-grid-header {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem;
    text-align: center; font-weight: 700; color: #8b6938; margin-bottom: .5rem; font-size: .8rem;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; margin-bottom: 1.5rem; }
.calendar-cell {
    background: #fff; border: 1px solid #ecdfc7; border-radius: .8rem;
    aspect-ratio: 1; padding: .5rem .3rem; font-family: inherit; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
    transition: transform .1s, box-shadow .1s;
}
.calendar-cell:hover { box-shadow: 0 3px 10px rgba(90,35,24,.1); transform: translateY(-1px); }
.calendar-cell-empty { background: transparent; border: none; cursor: default; }
.calendar-cell-empty:hover { box-shadow: none; transform: none; }
.calendar-cell-today { border: 2px solid #a6804a; background: #fdf6e8; }
.calendar-cell-selected { border: 2px solid #5a2318; background: #fbeee0; }
.calendar-cell-heb { font-weight: 800; color: #5a2318; font-size: 1.05rem; }
.calendar-cell-greg { color: #b3a68c; font-size: .65rem; }
.calendar-cell-label {
    font-size: .58rem; line-height: 1.1; max-width: 100%; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calendar-cell-label-holiday { color: #b5443a; font-weight: 700; }
.calendar-cell-label-parasha { color: #a6804a; font-weight: 600; }
.calendar-cell-dots { display: flex; gap: 3px; height: 6px; }
.calendar-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.calendar-dot-omer { background: #6b8f52; }

/* פרטי היום הנבחר (לחיצה על יום) */
.calendar-detail {
    background: #fff; border: 1px solid #ecdfc7; border-radius: 1rem; padding: 1.25rem;
    margin-bottom: 2rem; animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.calendar-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; }
.calendar-detail-date { font-size: 1.2rem; font-weight: 800; color: #5a2318; }
.calendar-detail-close { background: none; border: none; font-size: 1.1rem; color: #8a7a5c; cursor: pointer; padding: .25rem; }
.calendar-detail-badges { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.badge { padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge-holiday { background: #fbe4e0; color: #b5443a; }
.badge-parasha { background: #f7f1e3; color: #a6804a; }
.badge-omer { background: #eaf3e4; color: #6b8f52; }
.calendar-detail-zmanim { display: flex; flex-wrap: wrap; gap: .75rem; }
.detail-zman {
    background: #fdfbf7; border: 1px solid #ecdfc7; border-radius: .6rem;
    padding: .5rem .9rem; display: flex; flex-direction: column; gap: .15rem; min-width: 90px;
}
.detail-zman span { font-size: .7rem; color: #8a7a5c; font-weight: 600; }
.detail-zman b { font-size: 1.1rem; color: #1a1a1a; }
.calendar-detail .loading { color: #8a7a5c; font-size: .9rem; }

/* חגים/שבתות קרובים */
.upcoming-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 2rem; }
.upcoming-card { background: #fff; border: 1px solid #ecdfc7; border-radius: 1rem; padding: 1.25rem; }
.upcoming-card h2 { font-size: 1.1rem; color: #5a2318; margin-bottom: .85rem; display: flex; align-items: center; gap: .5rem; }
.upcoming-list { list-style: none; }
.upcoming-list li { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid #f2ead8; font-size: .9rem; }
.upcoming-list li:last-child { border-bottom: none; }
.upcoming-name { font-weight: 700; color: #1a1a1a; }
.upcoming-date { color: #8a7a5c; }

/* ── תוכן טקסטואלי (אודות/נגישות) ─────────────────────────────────────────── */
.prose { max-width: 760px; margin: 0 auto; }
.prose h1 { font-size: 1.9rem; color: #5a2318; margin-bottom: 1.25rem; }
.prose h2 { font-size: 1.3rem; color: #8b6938; margin: 1.75rem 0 .75rem; }
.prose h3 { font-size: 1.05rem; color: #5a2318; margin: 1.25rem 0 .5rem; }
.prose p { margin-bottom: 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem 0; padding-inline-start: 1.5rem; }
.prose li { margin-bottom: .4rem; }
.prose .text-muted { color: #6b6b6b; font-size: .92rem; }
.prose blockquote {
    background: #fbf3e3;
    border-inline-start: 3px solid #a6804a;
    border-radius: 4px;
    padding: .85rem 1.1rem;
    margin: 0 0 1rem 0;
    font-size: .95rem;
    color: #4a4a4a;
}
.prose blockquote cite {
    display: block;
    margin-top: .5rem;
    font-style: normal;
    font-size: .85rem;
    color: #8b6938;
}
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25rem;
    font-size: .92rem;
}
.prose table th, .prose table td {
    border: 1px solid #e5dcc8;
    padding: .5rem .6rem;
    text-align: start;
}
.prose table th { background: #fbf3e3; color: #5a2318; }
.prose .sources { font-size: .88rem; color: #6b6b6b; padding-inline-start: 1.25rem; }
.prose .sources li { margin-bottom: .3rem; }
.footer-links { margin-top: .5rem; font-size: .85rem; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .nav-toggle { display: block; flex-shrink: 0; }
    .site-logo { font-size: 1.05rem; max-width: 65vw; }
    .main-nav {
        display: none; flex-direction: column; width: 100%; gap: .75rem;
        padding-top: .75rem; border-top: 1px solid #ecdfc7; margin-top: .75rem;
    }
    .main-nav.open { display: flex; }
    .nav-container { flex-wrap: wrap; }
    .hero-hebrew-date { font-size: 1.5rem; }
    .zmanim-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .zman-time { font-size: 1.25rem; }
    .upcoming-grid { grid-template-columns: 1fr; }
    .calendar-cell-heb { font-size: .85rem; }
    .calendar-cell-label { font-size: .5rem; }
}

/* ── Dark mode (מכבד prefers-color-scheme) ───────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    body { background: #1a1611; color: #f0e9dc; }
    .site-header { background: #241f18; border-bottom-color: #8b6938; }
    .zman-card, .location-dialog, .calendar-cell, .calendar-detail, .upcoming-card { background: #241f18; border-color: #3a3226; color: #f0e9dc; }
    .zman-card-highlight { background: #2e2517; }
    .zman-time, .calendar-cell-heb, .calendar-detail-date, .upcoming-name { color: #f0e9dc; }
    .location-pill { background: #241f18; }
    .location-map-wrap { border-color: #3a3226; }
    .location-pill:hover { background: #2e2517; }
    .calendar-cell-today, .calendar-cell-selected { background: #2e2517; }
    .detail-zman { background: #1c1812; border-color: #3a3226; }
    .detail-zman b { color: #f0e9dc; }
    .site-footer { background: #14110d; border-top-color: #3a3226; color: #a89a80; }
}