:root{
  --ink:#1c2a3a;
  --parchment:#f2e9d8;
  --parchment-dim:#e9dec4;
  --brass:#a8823c;
  --brass-light:#c9a35f;
  --burgundy:#6b2737;
  --sand:#e4d6b8;
  --white:#fffdf8;
  --danger:#8f3a2a;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--parchment);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(168,130,60,0.06), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(107,39,55,0.06), transparent 40%);
  color:var(--ink);
  font-family:'Assistant', sans-serif;
  min-height:100vh;
  direction:rtl;
}
h1,h2,h3{ font-family:'Frank Ruhl Libre', serif; }

.app{ max-width:920px; margin:0 auto; padding:28px 20px 80px; }

header.top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:28px;
  border-bottom:2px solid var(--brass);
  padding-bottom:14px;
  flex-wrap:wrap;
  gap:12px;
}
header.top .brand{ display:block; }
header.top .brand a{ text-decoration:none; color:inherit; display:block; }
header.top .site-main-title{
  font-family:'Frank Ruhl Libre', serif;
  font-size:32px;
  font-weight:900;
  color:var(--burgundy);
  line-height:1.2;
  margin-bottom:2px;
}
header.top .brand h1{ font-size:22px; font-weight:900; margin:0; color:var(--ink); line-height:1.3; }
header.top .brand-subtitle{ font-size:13px; color:var(--burgundy); font-weight:600; margin-top:3px; }
.top-left{ display:flex; align-items:center; gap:14px; }
.site-logo{ height:52px; width:auto; }

nav.crumbs{
  font-size:14px;
  color:#5a5347;
  margin-bottom:22px;
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
}
nav.crumbs a{ color:var(--burgundy); text-decoration:none; font-weight:600; }
nav.crumbs a:hover{ text-decoration:underline; }
nav.crumbs .sep{ opacity:.5; }
nav.crumbs .current{ color:var(--ink); font-weight:700; }

/* עמוד הבית: מדף חומשים */
.shelf{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:14px;
  align-items:stretch;
  margin-top:10px;
}
@media (max-width:720px){ .shelf{ grid-template-columns:repeat(2,1fr); } }

.spine{
  border-radius:10px;
  min-height:260px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:space-between;
  padding:22px 10px;
  color:var(--white);
  text-decoration:none;
  box-shadow:0 6px 16px rgba(28,42,58,0.18), inset 0 0 0 1px rgba(255,255,255,0.06);
  transition:transform .18s ease, box-shadow .18s ease;
  position:relative;
  overflow:hidden;
}
.spine:nth-child(1){ background:linear-gradient(180deg, #6b2737, #4c1c28); }
.spine:nth-child(2){ background:linear-gradient(180deg, #7a5a1f, #4f3a12); }
.spine:nth-child(3){ background:linear-gradient(180deg, #274a5c, #17303c); }
.spine:nth-child(4){ background:linear-gradient(180deg, #3f5334, #253320); }
.spine:nth-child(5){ background:linear-gradient(180deg, #4a2f5c, #2e1c3a); }
.spine:nth-child(6){ background:linear-gradient(180deg, #b5651d, #7a4413); }
.spine:hover{ transform:translateY(-4px); box-shadow:0 12px 22px rgba(28,42,58,0.28), inset 0 0 0 1px rgba(255,255,255,0.1); }
.spine::after{
  content:"";
  position:absolute; inset:0;
  background:repeating-linear-gradient(90deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 8px);
  pointer-events:none;
}
.spine .num{ font-family:'Frank Ruhl Libre', serif; font-size:13px; color:var(--brass-light); font-weight:700; letter-spacing:1px; }
.spine .title{ font-family:'Frank Ruhl Libre', serif; font-size:29px; font-weight:700; letter-spacing:1px; text-align:center; }
.spine .count{ font-size:12px; color:rgba(255,255,255,0.75); background:rgba(255,255,255,0.1); padding:3px 10px; border-radius:20px; }

.spine:nth-child(1) .title{ color:#e8b4bf; }
.spine:nth-child(2) .title{ color:#f0d9a0; }
.spine:nth-child(3) .title{ color:#a8d0e6; }
.spine:nth-child(4) .title{ color:#b8d4a0; }
.spine:nth-child(5) .title{ color:#d4b8e8; }
.spine:nth-child(6) .title{ color:#f5d0a0; }

/* רשימת פרשות */
.parasha-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(210px,1fr));
  gap:12px;
}
.parasha-card{
  display:block;
  background:var(--white);
  border:1px solid var(--sand);
  border-radius:10px;
  padding:16px;
  text-decoration:none;
  color:inherit;
  transition:border-color .15s ease, transform .15s ease;
}
.parasha-card:hover{ border-color:var(--brass); transform:translateY(-2px); }
.parasha-card h3{ margin:0 0 6px; font-size:19px; color:var(--ink); }
.parasha-card .meta{ font-size:13px; color:#7a7264; }

/* עמוד פרשה */
.parasha-header{
  background:var(--sand);
  border-radius:12px;
  padding:22px;
  margin-bottom:20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:10px;
}
.parasha-header h2{ margin:0; font-size:28px; }
.parasha-header .sub{ font-size:14px; color:var(--burgundy); font-weight:600; }

.upload-zone{
  display:none;
  border:2px dashed var(--brass);
  border-radius:12px;
  padding:24px;
  text-align:center;
  color:#6b5f4a;
  background:rgba(168,130,60,0.05);
  margin-bottom:22px;
}
.is-admin .upload-zone{ display:block; }
.upload-zone .icon{ font-size:26px; margin-bottom:6px; }
.upload-zone .hint{ font-size:12px; color:#948968; margin-top:8px; }
.upload-zone input[type="file"]{ margin-top:10px; }

.file-list{ list-style:none; padding:0; display:flex; flex-direction:column; gap:10px; }
.file-list li{
  display:flex;
  align-items:center;
  gap:14px;
  background:var(--white);
  border:1px solid var(--sand);
  border-radius:10px;
  padding:12px 16px;
}
.pdf-icon{
  width:38px; height:38px;
  background:var(--burgundy);
  color:var(--white);
  border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:800;
  flex-shrink:0;
}
.file-info{ flex:1; min-width:0; }
.file-list a.fname{
  font-weight:600;
  font-size:15px;
  color:var(--ink);
  text-decoration:none;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  display:block;
}
.file-list a.fname:hover{ text-decoration:underline; }
.fmeta{ font-size:12px; color:#8a806c; margin-top:2px; }

.btn{
  border:none;
  border-radius:8px;
  padding:8px 14px;
  font-family:'Assistant', sans-serif;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  transition:opacity .15s ease;
}
.btn:hover{ opacity:.85; }
.btn-primary{ background:var(--brass); color:var(--white); }
.btn-secondary{ background:var(--ink); color:var(--white); }
.btn-danger{ display:none; background:transparent; color:var(--danger); border:1px solid var(--danger); }
.is-admin .btn-danger{ display:inline-block; }

.admin-input{
  padding:7px 12px;
  border-radius:8px;
  border:1px solid var(--sand);
  font-family:'Assistant', sans-serif;
}
.admin-status{ font-size:13px; color:var(--burgundy); font-weight:600; }
.login-error{ color:var(--danger); font-size:12px; }
#admin-bar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

.empty-state{ text-align:center; padding:40px 20px; color:#9a8f78; }

/* ---------- פסקת פתיחה (רוחב מלא, בולטת) ---------- */
.intro-section{ margin-bottom:14px; }
.intro-text{
  position:relative;
  display:flex;
  gap:22px;
  align-items:stretch;
  background:
    radial-gradient(circle at 15% 20%, rgba(168,130,60,0.10), transparent 55%),
    radial-gradient(circle at 90% 85%, rgba(107,39,55,0.08), transparent 55%),
    linear-gradient(160deg, #fffaf0, var(--sand));
  border:1px solid var(--brass);
  border-radius:4px 16px 4px 16px;
  padding:22px 28px;
  box-shadow:0 4px 14px rgba(28,42,58,0.09);
  overflow:hidden;
  flex-wrap:wrap;
}
.intro-text::before{
  content:"";
  position:absolute;
  top:0; bottom:0; right:0;
  width:5px;
  background:linear-gradient(180deg, var(--brass), var(--burgundy));
}
.intro-paragraphs{ flex:1 1 320px; }
.intro-line{
  margin:0 0 10px;
  font-family:'Frank Ruhl Libre', serif;
  font-size:18px;
  font-weight:500;
  line-height:1.85;
  letter-spacing:0.2px;
  color:#3c342a;
}
.intro-line:last-child{ margin-bottom:0; }

/* ---------- הקדשה — מלבן משני, בתוך ריבוע הפתיחה, בצד שמאל ---------- */
.dedication-box.dedication-box--sidebar{
  flex:0 0 auto;
  width:fit-content;
  max-width:100%;
  flex-direction:column;
  margin-bottom:0;
  padding:20px 22px;
  gap:8px;
  align-self:center;
  background:linear-gradient(160deg, #eceae6, #cfccc6);
  border-color:#aba79f;
  box-shadow:none;
}
.dedication-box--sidebar .dedication-candle{ font-size:30px; margin-bottom:4px; }
.dedication-box--sidebar .dedication-text{ flex:0 1 auto; width:auto; }
.dedication-box--sidebar .dedication-line--main{
  font-family:'Frank Ruhl Libre', serif;
  font-size:21px;
  margin-bottom:6px;
  white-space:nowrap;
}
.dedication-box--sidebar .dedication-line{ font-size:15px; line-height:1.5; white-space:nowrap; }
@media (max-width:480px){
  .dedication-box--sidebar .dedication-line--main,
  .dedication-box--sidebar .dedication-line{ white-space:normal; }
}

/* ---------- כניסת מנהל: מיקום שולי בתחתית העמוד ---------- */
.site-footer{
  display:flex;
  justify-content:flex-end;
  margin-top:40px;
  padding-top:16px;
  border-top:1px solid var(--sand);
}

/* ---------- קובץ Word (לצד PDF) ---------- */
.pdf-icon--doc{ background:#2b579a; }

.upload-status{ margin-top:10px; font-size:13px; color:#6b5f4a; }
.progress-row{ display:flex; align-items:center; gap:8px; margin-top:6px; justify-content:center; }
progress{ width:200px; }

/* ---------- הקדשה והנצחה ---------- */
.dedication-box{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  text-align:center;
  background:linear-gradient(135deg, #eceae6, #cfccc6);
  border:1px solid #aba79f;
  border-radius:12px;
  padding:20px 24px;
  margin-bottom:22px;
  box-shadow:0 4px 12px rgba(28,42,58,0.08);
}
.dedication-candle{ font-size:46px; flex-shrink:0; line-height:1; }
.dedication-text{ flex:0 1 auto; min-width:0; }
.dedication-line{ font-size:14px; color:#4a4740; line-height:1.6; }
.dedication-line--main{
  font-family:'Frank Ruhl Libre', serif;
  font-size:19px;
  font-weight:700;
  color:#3c2f30;
  margin-bottom:6px;
}
@media (max-width:520px){
  .dedication-candle{ font-size:30px; }
}

/* ---------- פרשת השבוע (עדכון אוטומטי) ---------- */
.current-parasha-box{
  background:linear-gradient(180deg, #fffdf8, var(--sand));
  border:1px solid var(--brass);
  border-radius:12px;
  padding:18px 20px;
  margin-bottom:24px;
}
.current-parasha-box h3{
  margin:0 0 12px;
  font-size:19px;
  color:var(--ink);
}
.current-parasha-box h3 a{
  color:var(--burgundy);
  text-decoration:none;
}
.current-parasha-box h3 a:hover{ text-decoration:underline; }

/* ---------- פודקאסט ---------- */
.podcast-box{
  display:flex;
  align-items:center;
  gap:16px;
  background:linear-gradient(135deg, #1db954, #14833b);
  color:var(--white);
  border-radius:12px;
  padding:18px 22px;
  margin-top:26px;
  flex-wrap:wrap;
  box-shadow:0 6px 16px rgba(20,131,59,0.22);
}
.podcast-icon{ font-size:30px; }
.podcast-text{ flex:1; min-width:200px; }
.podcast-line{ font-size:13px; opacity:.92; }
.podcast-line--main{ font-size:14px; }
.podcast-line--title{
  font-family:'Frank Ruhl Libre', serif;
  font-size:18px;
  font-weight:700;
  margin:2px 0;
  opacity:1;
}
.podcast-btn{
  background:var(--white);
  color:#14833b;
  text-decoration:none;
  font-weight:700;
  font-size:14px;
  padding:9px 18px;
  border-radius:20px;
  white-space:nowrap;
  transition:transform .15s ease;
}
.podcast-btn:hover{ transform:translateY(-2px); }

/* ---------- הערות חופשיות (טקסט מעוצב) בעמוד הפרשה ---------- */
.note-section{ margin-top:26px; }
.note-heading{ margin:0 0 10px; font-size:19px; color:var(--ink); }
.note-toolbar{
  display:none;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  background:var(--sand);
  border:1px solid var(--brass);
  border-radius:8px 8px 0 0;
  padding:8px 10px;
}
.note-toolbar button{
  border:1px solid var(--brass);
  background:var(--white);
  color:var(--ink);
  border-radius:6px;
  padding:5px 10px;
  font-size:13px;
  cursor:pointer;
  font-family:'Assistant', sans-serif;
}
.note-toolbar button:hover{ background:var(--brass); color:var(--white); }
.note-toolbar select{
  border:1px solid var(--brass);
  border-radius:6px;
  padding:5px 8px;
  font-family:'Assistant', sans-serif;
  font-size:13px;
  background:var(--white);
}
.note-toolbar input[type="color"]{
  width:34px; height:30px;
  border:1px solid var(--brass);
  border-radius:6px;
  padding:2px;
  cursor:pointer;
  background:var(--white);
}
.note-content{
  min-height:60px;
  background:var(--white);
  border:1px solid var(--sand);
  border-radius:0 0 10px 10px;
  padding:16px;
  font-size:15px;
  line-height:1.7;
}
.note-content--editable{
  border-color:var(--brass);
  border-radius:0 0 10px 10px;
  outline:none;
}
.note-content:empty::before{
  content: 'אין עדיין הערה לפרשה זו.';
  color:#9a8f78;
}
.note-content--editable:empty::before{
  content: 'כתבו כאן הערה חופשית לפרשה...';
  color:#b5aa8f;
}
.note-actions{
  display:none;
  align-items:center;
  gap:12px;
  margin-top:10px;
}
