/* Layout: one calm reading column under a slim header; index pages are plain ruled lists. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #17202d;
  --muted: #5a6575;
  --line: #dde1e8;
  --accent: #1e4a8c;
  --accent-soft: #e6edf8;
  --gold: #8f6410;
  --mark: #fde9a8;
  --display: Arial, Helvetica, "Helvetica Neue", sans-serif;
  --body: Arial, Helvetica, "Helvetica Neue", sans-serif;
  --ui: Arial, Helvetica, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1621; --surface: #161f2d; --ink: #e5e9f0; --muted: #9ba7b8; --line: #2a3546;
    --accent: #8fb5ef; --accent-soft: #1b2a42; --gold: #d8aa55; --mark: #5a4a12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1621; --surface: #161f2d; --ink: #e5e9f0; --muted: #9ba7b8; --line: #2a3546;
  --accent: #8fb5ef; --accent-soft: #1b2a42; --gold: #d8aa55; --mark: #5a4a12;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
a { color: var(--accent); text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; height: auto; }

.wrap {
  max-width: 62rem; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.narrow { max-width: 44rem; }

/* header */
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.5rem; padding-block: 0.7rem; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.45rem; color: var(--ink); text-decoration: none; letter-spacing: 0.005em; }
.brand span { color: var(--gold); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-family: var(--ui); font-size: 0.9rem; flex: 1 1 auto; }
.site-nav a { color: var(--muted); text-decoration: none; padding-block: 0.25rem; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }
.head-search { display: flex; flex: 0 1 15rem; min-width: 0; }
.head-search input, .big-search input {
  width: 100%; min-width: 0; font: inherit; font-family: var(--ui); font-size: 0.9rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.7rem;
}
.head-search input:focus, .big-search input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

/* this week line */
.weekbar { background: var(--accent-soft); border-bottom: 1px solid var(--line); font-family: var(--ui); font-size: 0.88rem; }
.weekbar .wrap { padding-block: 0.45rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; }
.weekbar .wk { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.weekbar a { font-weight: 700; text-decoration: none; }
.weekbar a:hover { text-decoration: underline; }
.weekbar .sep { color: var(--muted); }

main { padding-block: 2rem 4rem; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); font-weight: 700; margin: 0 0 0.6rem; }
.kicker { font-family: var(--ui); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 0.6rem; }
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { color: var(--accent); text-decoration: underline; }
.kicker .sep { margin-inline: 0.45em; color: var(--line); }
.crumbs { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.8rem; }
.crumbs .kicker { margin: 0; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 1.5rem; }

/* status chip */
.chip { display: inline-block; font-family: var(--ui); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--gold); border: 1px solid currentColor; border-radius: 3px; padding: 0.05rem 0.4rem; white-space: nowrap; vertical-align: 0.1em; }

/* article body */
.prose { overflow-wrap: break-word; }
.prose h2 { font-size: 1.05rem; font-family: var(--ui); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold);
  margin: 2.4rem 0 0.8rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.prose > h2:first-child, .prose > section:first-child > h2 { margin-top: 1rem; }
.prose h3 { font-size: 1.35rem; margin: 2rem 0 0.6rem; }
.prose h4, .prose h5 { font-size: 1.1rem; margin: 1.6rem 0 0.4rem; }
.prose p { margin: 0 0 1.05em; }
.prose small { font-size: 0.85em; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose sup { font-size: 0.7em; line-height: 0; }
.prose [dir="rtl"] { font-size: 1.08em; }
.prose .tc { text-align: center; }
.prose blockquote { margin: 1.2rem 0; padding-inline-start: 1rem; border-inline-start: 3px solid var(--line); color: var(--muted); }
.prose ul, .prose ol { padding-inline-start: 1.4rem; }
.prose li { margin-bottom: 0.35em; }
.table-scroll { overflow-x: auto; margin: 1.2rem 0; }
.prose table { border-collapse: collapse; font-size: 0.92rem; line-height: 1.45; min-width: 100%; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: start; vertical-align: top; font-weight: 400; }
.prose th { background: var(--surface); }
.prose td p:last-child, .prose th p:last-child { margin-bottom: 0; }

/* source reference links (Hebrew text pages, external links) */
.sec-refs p, .sec-refs div { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.6rem; }
.sec-refs br { display: none; }
.sec-refs a { font-family: var(--ui); font-size: 0.82rem; text-decoration: none; background: var(--accent-soft); color: var(--accent);
  border-radius: 4px; padding: 0.2rem 0.55rem; }
.sec-refs a:hover { text-decoration: underline; }

.page-meta { font-family: var(--ui); font-size: 0.8rem; color: var(--muted); margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 0.3rem 1.5rem; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2rem; font-family: var(--ui); font-size: 0.9rem; }
.pager a { text-decoration: none; max-width: 100%; }
.pager a:hover { text-decoration: underline; }
.pager .next { margin-inline-start: auto; text-align: end; }
.pager small { display: block; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }

/* lists of sichos */
.list { list-style: none; margin: 1.5rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.list li { border-bottom: 1px solid var(--line); padding: 0.75rem 0; }
.list a.t { font-family: var(--display); font-size: 1.15rem; font-weight: 700; text-decoration: none; margin-inline-end: 0.5rem; }
.list a.t:hover { text-decoration: underline; }
.list p { margin: 0.15rem 0 0; font-size: 0.95rem; line-height: 1.5; color: var(--muted); }
.count { font-family: var(--ui); font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* compact multi-column index (parshiot, years) */
.cols { list-style: none; margin: 1.5rem 0 0; padding: 0; columns: 15rem; column-gap: 2.5rem; }
.cols li { break-inside: avoid; display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.cols a { text-decoration: none; font-family: var(--display); font-size: 1.1rem; min-width: 0; }
.cols a:hover { text-decoration: underline; }

/* volume grid */
.vols { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.6rem; }
.vols a { display: grid; grid-template-columns: auto 1fr; column-gap: 0.7rem; align-items: baseline; height: 100%; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0.6rem 0.75rem; }
.vols a:hover { border-color: var(--accent); }
.vols .n { font-family: var(--display); font-size: 1.5rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.vols .he { font-size: 1.05rem; color: var(--gold); justify-self: end; }
.vols .b { grid-column: 1 / -1; font-family: var(--ui); font-size: 0.78rem; color: var(--muted); line-height: 1.35; }

/* home */
.home-top { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 2.5rem; align-items: start; }
.hero { padding-block: 1.5rem 0.5rem; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 3.6rem); margin-bottom: 0.2rem; }
.hero h1 span { color: var(--gold); }
.hero .lead { max-width: 38rem; }
.big-search { display: flex; gap: 0.5rem; max-width: 36rem; margin: 1.2rem 0 0; }
.big-search input { font-size: 1.05rem; padding: 0.7rem 0.9rem; background: var(--surface); }
.btn { font-family: var(--ui); font-size: 0.95rem; font-weight: 600; color: var(--surface); background: var(--accent); border: 0; border-radius: 6px; padding: 0 1.1rem; cursor: pointer; }
.btn:hover { filter: brightness(1.1); }
.home-sec { margin-top: 2.8rem; }
.home-sec > h2 { font-size: 1.5rem; margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; }
.home-sec > h2 a { font-family: var(--ui); font-size: 0.85rem; font-weight: 400; }
.doors { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 2.5rem; }
.doors li { border-top: 1px solid var(--line); padding: 0.8rem 0; }
.doors a { font-family: var(--display); font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.doors a:hover { text-decoration: underline; }
.doors p { margin: 0.1rem 0 0; font-size: 0.92rem; line-height: 1.45; color: var(--muted); }

/* this week's parsha box */
.week { margin-top: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 6px; padding: 0.8rem 0.9rem; font-family: var(--ui); font-size: 0.85rem; line-height: 1.4; }
.week .kicker { color: var(--gold); font-weight: 700; font-size: 0.7rem; margin: 0 0 0.2rem; }
.week h2 { font-size: 1.25rem; margin: 0; }
.week .when { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.78rem; }
.wlist { list-style: none; margin: 0.6rem 0 0; padding: 0; max-height: 13.5rem; overflow-y: auto; border-top: 1px solid var(--line); }
.wlist li { border-bottom: 1px solid var(--line); }
.wlist a { display: block; padding: 0.3rem 0; text-decoration: none; }
.wlist a:hover { text-decoration: underline; }
.week .all { margin: 0.5rem 0 0; font-size: 0.78rem; }
.week .open { margin: 0.7rem 0 0; }
.week .open a { display: block; text-align: center; font-weight: 700; text-decoration: none; color: var(--surface); background: var(--accent); border-radius: 6px; padding: 0.45rem 0.6rem; }
.week .open a:hover { filter: brightness(1.1); }

/* dictionary */
.az { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 1rem 0 1.5rem; font-family: var(--ui); font-size: 0.9rem; }
.az a { min-width: 2rem; text-align: center; text-decoration: none; padding: 0.25rem 0.4rem; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.az a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.az a.wide { padding-inline: 0.7rem; }

/* search */
.results { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.results li { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.results a { font-family: var(--display); font-size: 1.2rem; font-weight: 700; text-decoration: none; }
.results a:hover { text-decoration: underline; }
.results p { margin: 0.2rem 0 0; font-size: 0.95rem; line-height: 1.5; color: var(--muted); }
.results mark { background: var(--mark); color: var(--ink); border-radius: 2px; padding: 0 0.1em; }
.status { font-family: var(--ui); font-size: 0.85rem; color: var(--muted); margin-top: 1rem; }
.more { margin-top: 1.5rem; padding-block: 0.6rem; }

.site-foot { border-top: 1px solid var(--line); font-family: var(--ui); font-size: 0.82rem; color: var(--muted); }
.site-foot .wrap { padding-block: 1.5rem 2.5rem; display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; justify-content: space-between; }
.site-foot a { color: inherit; }
.off { color: var(--muted); text-decoration: none; cursor: default; }

@media (max-width: 52rem) { .home-top { grid-template-columns: minmax(0, 1fr); gap: 0; } .week { margin-top: 0.5rem; } }
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  .head-search { flex-basis: 100%; }
}
@media print {
  .site-head, .site-foot, .pager, .head-search, .weekbar { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
}
