/* ==========================================================================
   Derasha HaShavua — shared stylesheet
   Gold standard: deployed Vayikra + Ki Savo → end of Devarim
   Every content page must link this file and must NOT embed a competing
   font-family or .nav layout.
   Path from a typical unit page:
     3-Vayikra/24-Vayikra/Vayikra-1-1-1.html  →  ../../derasha.css
     (two levels up from parsha folder to site root where derasha.css lives)
   ========================================================================== */

:root {
  --accent: #1a5276;
  --accent-soft: #2874a6;
  --highlight: #fff3b0;
  --border: #e6b800;
  --extra: #e65100;
  --muted: #5d6d7e;
  --bg: #faf9f6;
  --box-source: #eef5fb;
  --box-context: #f0f0f0;
  --box-middah: #f3e5f5;
  --box-middah-border: #ce93d8;
  --box-lesson: #e8f5e9;
  --box-lesson-border: #a5d6a7;
  --box-audio: #fff8e1;
  --box-audio-border: #ffcc80;
  --box-skip: #f5f5f5;
}

/* --- Base ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  font-family: system-ui, "Noto Sans Hebrew", "Segoe UI", sans-serif;
  max-width: 780px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem;
  line-height: 1.6;
  color: #222;
  background: var(--bg);
}

/* Overview pages may be wider */
body.overview-page {
  max-width: 960px;
}

h1 {
  color: var(--accent);
  font-size: 1.45rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.3rem;
  margin: 0 0 0.5rem;
  line-height: 1.3;
}

h2 {
  color: var(--accent-soft);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.12rem;
}

p {
  margin: 0.55rem 0;
}

a {
  color: var(--accent);
}

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 650;
}

/* --- Navigation: PREV left | Master center | NEXT far right ------------- */
/*
  Required markup (three children only, in this order):

  <div class="nav">
    <a href="...">← PREV</a>
    <a href="../../DerashaHaShavua.html">↑ Master Index</a>
    <a href="...">NEXT →</a>
  </div>

  Do not put extra nodes inside .nav. Do not override justify-content.
*/
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  margin-top: 0;
  font-size: 0.95rem;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  width: 100%;
}

.nav a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.nav a:hover {
  text-decoration: underline;
}

/* Bottom nav: same rules, extra top margin */
.nav.nav-bottom {
  margin-top: 2rem;
  margin-bottom: 0;
}

/* --- Passuk / Hebrew ----------------------------------------------------- */
.hebrew,
.passuk-hebrew {
  direction: rtl;
  text-align: right;
  font-family: "Noto Serif Hebrew", "Times New Roman", "Noto Sans Hebrew", serif;
  font-size: 1.3rem;
  line-height: 1.85;
  margin: 0.8rem 0;
}

.passuk-english {
  font-style: italic;
  margin: 0.4rem 0 0.8rem;
}

/* --- Content boxes ------------------------------------------------------- */
.source-box {
  background: var(--box-source);
  border-left: 4px solid var(--accent);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  border-radius: 0 6px 6px 0;
}

.key-region {
  background: var(--highlight);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}

.key-region .hebrew {
  font-weight: 700;
}

.context {
  background: var(--box-context);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.middah {
  background: var(--box-middah);
  border: 1px solid var(--box-middah-border);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}

.lesson {
  background: var(--box-lesson);
  border: 1px solid var(--box-lesson-border);
  border-radius: 8px;
  padding: 1.1rem;
  margin: 1.2rem 0;
}

.audio {
  background: var(--box-audio);
  border: 1px solid var(--box-audio-border);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}

.label {
  display: inline-block;
  background: var(--border);
  color: #222;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.extra-badge {
  display: inline-block;
  background: var(--extra);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-left: 0.4rem;
  vertical-align: middle;
}

/* SKIP pages */
.skip-box {
  background: var(--box-skip);
  border: 2px solid #999;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 1.2rem 0;
}

.skip-list {
  margin: 0.5rem 0 0.8rem;
  padding-left: 1.2rem;
}

.skip-list li {
  margin: 0.2rem 0;
}

/* --- Overview table ------------------------------------------------------ */
.summary {
  background: var(--box-source);
  border-left: 4px solid var(--accent);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0 1.2rem;
  border-radius: 0 6px 6px 0;
}

table.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.overview-table th {
  text-align: left;
  padding: 0.5rem 0.55rem;
  background: var(--accent);
  color: #fff;
  position: sticky;
  top: 0;
}

table.overview-table td {
  padding: 0.35rem 0.55rem;
  vertical-align: top;
  border-bottom: 1px solid #ddd;
}

table.overview-table td.ch {
  width: 2.8rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent);
}

table.overview-table td.ch.muted {
  opacity: 0.35;
}

table.overview-table tr.skip {
  background: var(--box-skip);
}

table.overview-table .dnum {
  font-weight: 700;
  color: var(--accent);
}

table.overview-table a {
  color: var(--accent);
  text-decoration: none;
}

table.overview-table a:hover {
  text-decoration: underline;
}

/* --- Footer -------------------------------------------------------------- */
footer,
.page-footer {
  margin-top: 2rem;
  font-size: 0.88rem;
  color: #555;
  border-top: 1px solid #ddd;
  padding-top: 0.9rem;
}

/* --- Meta line under h1 -------------------------------------------------- */
.meta,
.parsha-line {
  color: #444;
  font-size: 0.98rem;
  margin: 0.25rem 0 1rem;
}

/* --- Small screens ------------------------------------------------------- */
@media (max-width: 520px) {
  body {
    padding: 1rem 0.85rem;
  }
  .nav {
    font-size: 0.9rem;
  }
  .hebrew,
  .passuk-hebrew {
    font-size: 1.15rem;
  }
}
