:root {
--bg: #fafaf7;
--card: #ffffff;
--primary: #1a3a5c;
--accent: #c9a961;
--accent-light: #e8d8a8;
--text: #1a1a1a;
--text-light: #555;
--border: #e0dccc;
--shadow: 0 1px 3px rgba(0,0,0,0.05);
--shadow-md: 0 4px 12px rgba(0,0,0,0.08);
--radius: 8px;
--max-width: 1100px;
}

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

html { scroll-behavior: smooth; }

body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Heebo", "David Libre", sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.6;
font-size: 16px;
}

body.rtl {
font-family: "Heebo", "David Libre", -apple-system, "Segoe UI", sans-serif;
direction: rtl;
text-align: right;
}

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

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.site-header {
background: var(--card);
border-bottom: 1px solid var(--border);
box-shadow: var(--shadow);
position: sticky;
top: 0;
z-index: 100;
}

.header-inner {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 0;
gap: 20px;
flex-wrap: wrap;
}

.logo {
display: flex;
align-items: center;
gap: 8px;
font-size: 22px;
font-weight: 700;
color: var(--primary);
text-decoration: none;
}

.logo:hover { text-decoration: none; }

.logo-diamond { color: var(--accent); font-size: 18px; }

.main-nav {
display: flex;
align-items: center;
gap: 4px;
flex-wrap: wrap;
font-size: 14px;
}

.main-nav a {
padding: 6px 8px;
color: var(--text-light);
border-radius: 4px;
transition: all 0.15s;
}

.main-nav a:hover, .main-nav a.active {
color: var(--primary);
background: var(--accent-light);
text-decoration: none;
}

.nav-sep { color: var(--border); margin: 0 2px; }

.nav-toggle { display: none; }

.lang-switch a {
padding: 6px 12px;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 13px;
color: var(--primary);
}

.lang-switch a:hover { background: var(--accent-light); text-decoration: none; }

.site-main { min-height: 60vh; }

.hero {
background: linear-gradient(135deg, var(--primary) 0%, #2c5282 100%);
color: #ffffff;
padding: 50px 0 40px;
text-align: center;
}

.hero-h1 {
font-size: 36px;
font-weight: 700;
margin-bottom: 12px;
line-height: 1.2;
color: #ffffff;
}

.hero-sub {
font-size: 16px;
color: #d6e0ec;
margin-bottom: 24px;
}

.today-card {
background: rgba(255,255,255,0.12);
border: 1px solid rgba(255,255,255,0.3);
border-radius: var(--radius);
padding: 20px 28px;
display: inline-block;
backdrop-filter: blur(8px);
}

.today-label { font-size: 13px; color: #b8c8d8; text-transform: uppercase; letter-spacing: 1px; }
.today-date { font-size: 22px; font-weight: 600; color: #ffffff; margin: 4px 0; }
.today-hebrew { font-size: 18px; color: var(--accent-light); }
.today-parsha { font-size: 14px; color: #d6e0ec; margin-top: 4px; }

.section { padding: 20px 10px; }

.section-head { margin-bottom: 24px; }
.section-head h2 { font-size: 26px; color: var(--primary); margin-bottom: 6px; }
.section-head p { color: var(--text-light); font-size: 15px; }

h1 { font-size: 32px; color: var(--primary); margin: 16px 0 12px; }
h2 { font-size: 24px; color: var(--primary); margin: 28px 0 12px; }
h3 { font-size: 18px; color: var(--text); margin: 14px 0 8px; }
p { margin-bottom: 12px; color: var(--text); }
.lead { font-size: 17px; color: var(--text-light); margin-bottom: 24px; }

.city-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 16px;
margin: 16px 0;
}

.city-card {
display: block;
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px;
box-shadow: var(--shadow);
transition: all 0.15s;
text-decoration: none;
color: var(--text);
}

.city-card:hover {
box-shadow: var(--shadow-md);
border-color: var(--accent);
transform: translateY(-1px);
text-decoration: none;
}

.city-card h3 { margin: 0 0 8px; color: var(--primary); }
.hebrew-name { color: var(--text-light); font-size: 14px; }
.city-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.city-row .lbl { color: var(--text-light); }
.city-row .val { font-weight: 600; color: var(--primary); }
.city-parsha { font-size: 13px; color: var(--accent); margin-top: 6px; font-style: italic; }

.view-all { text-align: center; margin-top: 24px; }

.btn {
display: inline-block;
padding: 10px 22px;
background: var(--primary);
color: white;
border-radius: 6px;
font-size: 15px;
font-weight: 500;
text-decoration: none;
border: none;
cursor: pointer;
transition: background 0.15s;
}

.btn:hover { background: #2c5282; text-decoration: none; }

.tools-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 16px;
}

.tool-card {
display: block;
background: var(--card);
border: 1px solid var(--border);
border-left: 3px solid var(--accent);
border-radius: var(--radius);
padding: 20px;
box-shadow: var(--shadow);
color: var(--text);
text-decoration: none;
transition: all 0.15s;
}

.tool-card:hover { box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.tool-card h3 { color: var(--primary); margin-top: 0; }
.tool-card p { color: var(--text-light); font-size: 14px; margin: 0; }

.holiday-links-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
margin: 24px 0;
}

.holiday-card {
display: block;
background: var(--card);
border: 1px solid var(--border);
border-top: 3px solid var(--accent);
border-radius: var(--radius);
padding: 18px;
box-shadow: var(--shadow);
color: var(--text);
text-decoration: none;
transition: all 0.15s;
}

.holiday-card:hover { box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.holiday-card h3 { color: var(--primary); margin: 0 0 8px; font-size: 17px; }
.holiday-card .holiday-date { font-weight: 600; font-size: 15px; color: var(--text); }
.holiday-card .holiday-hebrew { font-size: 14px; color: var(--text-light); margin-top: 4px; }

.times-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
margin: 20px 0;
}

.time-card {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
text-align: center;
box-shadow: var(--shadow);
}

.time-card.primary {
border-top: 3px solid var(--accent);
}

.time-label { font-size: 13px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.time-value { font-size: 32px; font-weight: 700; color: var(--primary); margin: 6px 0; }
.time-note { font-size: 13px; color: var(--text-light); }

.parsha-bar {
background: var(--accent-light);
border-radius: var(--radius);
padding: 14px 20px;
margin: 20px 0;
display: flex;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}

.parsha-label { font-weight: 600; color: var(--primary); }
.parsha-name { font-size: 18px; color: var(--primary); font-weight: 500; }
.hebrew-date { color: var(--text-light); margin-left: auto; }
body.rtl .hebrew-date { margin-left: 0; margin-right: auto; }

.custom-note {
background: #fff8e1;
border-left: 3px solid var(--accent);
padding: 12px 16px;
border-radius: 4px;
margin: 16px 0;
font-size: 14px;
color: var(--text);
}
body.rtl .custom-note { border-left: none; border-right: 3px solid var(--accent); }

.zmanim-table, .holidays-table, .result-table, .opinion-table, .zmanim-formula-table, .candle-table {
width: 100%;
border-collapse: collapse;
margin: 16px 0;
background: var(--card);
box-shadow: var(--shadow);
border-radius: var(--radius);
overflow: hidden;
}

.zmanim-table th, .holidays-table th, .result-table th, .opinion-table th, .zmanim-formula-table th, .candle-table th {
background: var(--primary);
color: white;
text-align: left;
padding: 12px 14px;
font-size: 14px;
font-weight: 600;
}
body.rtl .zmanim-table th, body.rtl .holidays-table th, body.rtl .result-table th, body.rtl .opinion-table th, body.rtl .zmanim-formula-table th, body.rtl .candle-table th { text-align: right; }

.zmanim-table td, .holidays-table td, .result-table td, .opinion-table td, .zmanim-formula-table td, .candle-table td {
padding: 10px 14px;
border-bottom: 1px solid var(--border);
font-size: 14px;
}

.zmanim-table tr:last-child td, .holidays-table tr:last-child td, .result-table tr:last-child td, .opinion-table tr:last-child td, .zmanim-formula-table tr:last-child td, .candle-table tr:last-child td { border-bottom: none; }

.zmanim-table tr:nth-child(even), .holidays-table tr:nth-child(even), .result-table tr:nth-child(even), .opinion-table tr:nth-child(even), .zmanim-formula-table tr:nth-child(even), .candle-table tr:nth-child(even) { background: #faf8f3; }

.rabbeinu-tam {
background: #f0f4f8;
border-radius: var(--radius);
padding: 16px 20px;
margin: 20px 0;
border-left: 3px solid var(--primary);
}
body.rtl .rabbeinu-tam { border-left: none; border-right: 3px solid var(--primary); }

.rt-time { font-size: 24px; font-weight: 700; color: var(--primary); margin: 8px 0; }
.rt-note { font-size: 13px; color: var(--text-light); }

.content-block, .info-block {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px 24px;
margin: 16px 0;
}

.content-block p, .info-block p { color: var(--text); }
.content-block ul, .info-block ul { margin: 8px 0 12px 20px; }
body.rtl .content-block ul, body.rtl .info-block ul { margin: 8px 20px 12px 0; }

.api-note {
background: #e8f4f8;
border-radius: var(--radius);
padding: 14px 18px;
margin: 20px 0;
font-size: 14px;
}

.api-note code {
background: rgba(0,0,0,0.08);
padding: 2px 6px;
border-radius: 3px;
font-family: "SF Mono", Monaco, Consolas, monospace;
font-size: 13px;
}

.breadcrumbs { font-size: 13px; color: var(--text-light); margin-bottom: 12px; }
.breadcrumbs a { color: var(--text-light); }
.breadcrumbs a:hover { color: var(--primary); }

.converter-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 20px;
margin: 20px 0;
}

.converter-form {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
box-shadow: var(--shadow);
}

.converter-form h2 { font-size: 18px; margin-top: 0; color: var(--primary); }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.form-row input, .form-row select {
width: 100%;
padding: 8px 10px;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 15px;
font-family: inherit;
}

.result-box {
background: #e8f5e9;
border: 1px solid #a5d6a7;
border-radius: var(--radius);
padding: 20px;
margin: 20px 0;
}

.result-box h2 { margin-top: 0; color: #2e7d32; }
.result-table th { background: #2e7d32; }

.faq-list { margin: 16px 0; }
.faq-item {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
margin-bottom: 8px;
box-shadow: var(--shadow);
}

.faq-item summary {
padding: 14px 18px;
cursor: pointer;
font-weight: 500;
color: var(--primary);
list-style: none;
position: relative;
padding-right: 36px;
}
body.rtl .faq-item summary { padding-right: 18px; padding-left: 36px; }

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+"; position: absolute; right: 16px; color: var(--accent); font-weight: 700; }
body.rtl .faq-item summary::before { right: auto; left: 16px; }
.faq-item[open] summary::before { content: "−"; }

.faq-item p { padding: 0 18px 14px; color: var(--text-light); font-size: 14px; }

.formula {
background: #1a1a1a;
color: #f0f0f0;
padding: 16px 20px;
border-radius: 6px;
font-family: "SF Mono", Monaco, Consolas, monospace;
overflow-x: auto;
margin: 12px 0;
font-size: 14px;
}

.error-page { text-align: center; padding: 60px 20px; }
.error-page ul { list-style: none; margin-top: 20px; }
.error-page li { margin: 8px 0; }

.site-footer {
background: var(--primary);
color: #d6e0ec;
padding: 36px 0 18px;
margin-top: 40px;
}

.footer-inner {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 28px;
margin-bottom: 24px;
}

.footer-col h4 { color: #ffffff; font-size: 15px; margin-bottom: 12px; font-weight: 600; }
.footer-col p { color: #c8d4e0; font-size: 14px; }
.footer-col ul { list-style: none; }
.footer-col li { margin: 6px 0; }
.footer-col a { color: #b8c8d8; font-size: 14px; }
.footer-col a:hover { color: #ffffff; text-decoration: underline; }

.footer-bottom {
border-top: 1px solid rgba(255,255,255,0.3);
padding-top: 18px;
text-align: center;
font-size: 13px;
color: #ffffff;
}

.footer-bottom p { color: #ffffff; }
.footer-bottom a { color: #c9a961; text-decoration: none; }
.footer-bottom a:hover { text-decoration: underline; }
.footer-legal { margin-top: 8px; }
.footer-legal a { margin: 0 6px; }
.footer-note { margin-top: 6px; font-size: 12px; color: #e0e8f0; }

@media (max-width: 768px) {
.header-inner { flex-wrap: wrap; align-items: center; }
.nav-toggle {
display: inline-flex;
flex-direction: column;
justify-content: center;
gap: 4px;
width: 36px;
height: 36px;
padding: 6px;
background: transparent;
border: 1px solid var(--border);
border-radius: 4px;
cursor: pointer;
order: 3;
}
.nav-toggle-bar {
display: block;
width: 22px;
height: 2px;
background: var(--primary);
transition: 0.3s;
}
.nav-toggle-active .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle-active .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle-active .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.main-nav {
display: none;
flex-basis: 100%;
flex-direction: column;
gap: 0;
padding: 8px 0 4px;
font-size: 15px;
}
.main-nav.nav-open { display: flex; }
.main-nav a { padding: 10px 4px; border-bottom: 1px solid var(--border); }
.main-nav a:last-of-type { border-bottom: none; }
.main-nav .nav-sep { display: none; }
.hero-h1 { font-size: 26px; }
.today-date { font-size: 18px; }
.city-grid { grid-template-columns: 1fr 1fr; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
.time-value { font-size: 26px; }
.table-cards { overflow: visible; }
.table-cards thead { display: none; }
.table-cards tbody, .table-cards tr, .table-cards td { display: block; }
.table-cards tr {
margin-bottom: 10px;
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 8px 12px;
background: var(--card);
box-shadow: var(--shadow);
}
.table-cards tr:nth-child(even) { background: var(--card); }
.table-cards td {
display: flex;
gap: 8px;
align-items: baseline;
border: none;
padding: 3px 0;
font-size: 14px;
}
.table-cards td::before {
content: attr(data-label);
font-weight: 600;
color: var(--primary);
flex-shrink: 0;
min-width: 100px;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.3px;
}
}

@media (max-width: 480px) {
.city-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.holiday-links-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.city-card { padding: 12px; }
.city-card h3 { font-size: 15px; }
.city-row { font-size: 13px; flex-wrap: wrap; }
.holiday-card { padding: 14px; }
.holiday-card h3 { font-size: 15px; }
.holiday-card .holiday-date { font-size: 13px; }
.converter-grid { grid-template-columns: 1fr; }
.tools-grid { grid-template-columns: 1fr; }
.times-grid { grid-template-columns: 1fr; }
}

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-accent { background: var(--accent); color: #1a1a1a; }
.btn-accent:hover { background: #b89851; }
.btn-geo { display: block; margin: 16px auto 0; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4); color: #ffffff; padding: 8px 20px; }
.btn-geo:hover { background: rgba(255,255,255,0.25); }
.btn-geo:disabled { opacity: 0.6; cursor: wait; }
.btn-geo-inline {
display: inline-block;
padding: 6px 14px;
font-size: 13px;
background: var(--accent-light);
border: 1px solid var(--accent);
color: var(--primary);
border-radius: 4px;
cursor: pointer;
white-space: nowrap;
}
.btn-geo-inline:hover { background: var(--accent); color: #fff; }

.calendar-toolbar {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 12px;
margin: 20px 0;
}

.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-current { font-size: 18px; font-weight: 600; color: var(--primary); }
.cal-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.city-selector { margin: 16px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.city-selector label { font-size: 14px; color: var(--text-light); white-space: nowrap; }
.city-selector select {
padding: 8px 12px;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 14px;
font-family: inherit;
background: var(--card);
flex: 0 1 auto;
min-width: 180px;
max-width: 320px;
}

.calendar-grid-wrap { overflow-x: auto; margin: 20px 0; }

.calendar-grid {
width: 100%;
border-collapse: collapse;
background: var(--card);
box-shadow: var(--shadow);
border-radius: var(--radius);
overflow: hidden;
min-width: 700px;
}

.calendar-grid th {
background: var(--primary);
color: #ffffff;
padding: 10px 8px;
font-size: 12px;
font-weight: 600;
text-align: center;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.calendar-grid th.day-shabbat-head { background: #2c5282; }

.calendar-grid td {
border: 1px solid var(--border);
padding: 6px 8px;
vertical-align: top;
height: 90px;
width: 14.28%;
font-size: 13px;
}

.cal-day.out-of-month { background: #f5f5f0; color: #aaa; }
.cal-day.is-today { background: #fff8e1; border: 2px solid var(--accent); }
.cal-day.is-friday { background: #fefcf3; }
.cal-day.is-shabbat { background: #f0f4f8; }

.cal-greg { font-size: 16px; font-weight: 700; color: var(--primary); }
.cal-heb { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.cal-events { margin-top: 4px; }
.cal-event {
display: inline-block;
background: var(--accent-light);
color: var(--primary);
padding: 1px 6px;
border-radius: 3px;
font-size: 10px;
font-weight: 500;
margin: 1px 2px 1px 0;
}
.cal-parsha { font-size: 10px; color: var(--accent); font-style: italic; margin-top: 2px; font-weight: 600; }
.cal-time { font-size: 11px; margin-top: 2px; }
.cal-candle { color: #b8860b; font-weight: 600; }
.cal-havdalah { color: var(--primary); font-weight: 600; }

.calendar-list { display: none; }
.cal-list-item {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 10px 12px;
margin-bottom: 8px;
box-shadow: var(--shadow);
}
.cal-list-item.is-today { background: #fff8e1; border: 2px solid var(--accent); }
.cal-list-item.is-friday { background: #fefcf3; }
.cal-list-item.is-shabbat { background: #f0f4f8; }
.cal-list-head {
display: flex;
align-items: baseline;
gap: 8px;
flex-wrap: wrap;
margin-bottom: 4px;
}
.cal-list-dow {
font-size: 12px;
font-weight: 600;
color: var(--text-light);
text-transform: uppercase;
min-width: 64px;
}
.cal-list-greg {
font-size: 18px;
font-weight: 700;
color: var(--primary);
}
.cal-list-heb {
font-size: 13px;
color: var(--text-light);
}
body.rtl .cal-list-head { flex-direction: row-reverse; align-items: baseline; }
body.rtl .cal-list-dow { text-align: left; }

.calendar-legend {
background: var(--card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 16px 20px;
margin: 20px 0;
}
.calendar-legend h3 { margin-top: 0; font-size: 16px; }
.legend-items { display: flex; flex-wrap: wrap; gap: 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-light); }
.legend-color { display: inline-block; width: 16px; height: 16px; border-radius: 3px; border: 1px solid var(--border); }
.legend-color.friday { background: #fefcf3; }
.legend-color.shabbat { background: #f0f4f8; }
.legend-color.today { background: #fff8e1; border-color: var(--accent); }
.legend-dot { font-size: 16px; }

@media (max-width: 768px) {
.calendar-toolbar { flex-direction: column; align-items: stretch; }
.cal-nav { justify-content: space-between; }
.city-selector { flex-direction: column; align-items: stretch; gap: 10px; }
.city-selector label { white-space: normal; }
.city-selector select { width: 100%; max-width: none; }
.city-selector .btn-geo-inline { width: 100%; text-align: center; }
.calendar-grid-wrap { display: none; }
.calendar-list { display: block; }
.cal-list-item { padding: 10px; }
.cal-list-greg { font-size: 20px; }
.cal-list-dow { min-width: 70px; }
.cal-event { font-size: 11px; }
.cal-time { font-size: 13px; }
.cal-parsha { font-size: 12px; }
}

@media print {
.site-header, .site-footer, .calendar-toolbar, .city-selector, .calendar-legend, .breadcrumbs, .calendar-list { display: none; }
.calendar-grid-wrap { display: block !important; overflow: visible; }
.calendar-grid { min-width: auto; box-shadow: none; }
.calendar-grid td { height: 60px; }
}
