/* Events page (/events/). Builds on /css/styles.css. */
.events-page { background: var(--ivory); }
.ev-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; margin-bottom: clamp(28px, 4vw, 44px); }
.ev-hol-toggle { margin-left: auto; }
.ev-loading { color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--copper-dk); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Upcoming list ---------- */
.ev-list .empty-state { margin-bottom: 32px; }
.ev-month-title { font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0 0 .6rem; padding-bottom: .6rem; border-bottom: 1px solid var(--copper-lt); }
.ev-rows + .ev-month-title { margin-top: clamp(36px, 5vw, 56px); }
.ev-rows { list-style: none; margin: 0; padding: 0; }
.ev-rows > li { border-bottom: 1px solid var(--line); }
.ev-row {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 20px;
  padding: 18px 12px 18px 0; text-decoration: none; color: inherit; border-radius: var(--radius); transition: background .2s;
}
.ev-row:hover { background: rgba(255,253,249,.8); }
.ev-row:hover .ev-title { color: var(--copper-dk); }
.ev-date { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ev-date-d { font: 500 2.2rem/1 var(--serif); color: var(--ink); font-variant-numeric: lining-nums; }
.ev-date-w { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.ev-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ev-title { font: 500 1.45rem/1.2 var(--serif); color: var(--ink); transition: color .2s; }
.ev-row.is-featured .ev-title::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--copper); margin-left: 10px; vertical-align: middle; }
.ev-meta { font-size: .92rem; color: var(--muted); }
.ev-cat { align-self: flex-start; margin-top: 6px; font-size: .75rem; font-weight: 600; color: var(--copper-dk); background: rgba(165,104,60,.09); padding: 3px 10px; border-radius: 999px; }
.ev-thumb { width: 132px; height: 88px; object-fit: cover; border-radius: var(--radius); }
.ev-row:not(:has(.ev-thumb)) { grid-template-columns: 64px 1fr; }

/* Holidays: quiet entries between events */
.ev-hol { display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-items: center; padding: 10px 0; }
.ev-hol .ev-date-d { font-size: 1.35rem; color: var(--muted); }
.ev-hol .ev-date-w { font-size: .7rem; }
.ev-hol-text { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--copper-dk); }
.ev-hol-text [lang="he"] { font-style: normal; font-size: .95rem; color: var(--muted); margin-left: 8px; }
.ev-hol.is-major .ev-hol-text { color: var(--copper-dk); font-weight: 500; }

/* ---------- Month view ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.cal-head h2 { margin: 0; font-size: clamp(1.9rem, 3.4vw, 2.6rem); }
.cal-nav { display: flex; gap: 6px; }
.cal-btn {
  height: 42px; min-width: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px;
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; cursor: pointer; color: var(--ink); font: 600 .85rem var(--sans);
}
.cal-btn:hover { border-color: var(--copper-lt); }
.cal-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.cal-row, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays > span { padding: 12px 10px; font-size: .8rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.cal-weekdays .short { display: none; }
.cal-cell { min-height: 124px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); position: relative; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-grid .cal-cell:nth-last-child(-n+7) { border-bottom: 0; }
.cal-cell.is-shabbat { background: rgba(235,228,216,.35); }
.cal-cell.is-other { background: rgba(235,228,216,.18); }
.cal-cell.is-other .cal-day, .cal-cell.is-other .cal-items { opacity: .45; }
.cal-day {
  width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; cursor: pointer;
  font: 600 .88rem/1 var(--sans); color: var(--ink); font-variant-numeric: lining-nums;
}
.cal-day:hover { background: var(--stone); }
.cal-cell.is-today .cal-day { background: var(--copper); color: #fff; }
.cal-cell.is-selected { box-shadow: inset 0 0 0 2px var(--copper-lt); }
.cal-items { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.cal-items li { min-width: 0; }
.cal-hol { font: italic 500 .9rem/1.2 var(--serif); color: var(--copper-dk); padding: 1px 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev {
  display: block; font-size: .78rem; line-height: 1.3; color: var(--ink); text-decoration: none;
  background: var(--ivory); border-left: 2px solid var(--copper); border-radius: 2px; padding: 3px 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-ev:hover { background: var(--stone); }
.cal-ev.is-featured { background: rgba(165,104,60,.1); }
.cal-ev-time { color: var(--muted); font-weight: 600; }
.cal-dots { display: none; }

.cal-day-panel { margin-top: 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.cal-day-panel h3 { font-size: 1.5rem; margin-bottom: .5rem; }
.cal-day-panel .ev-row { grid-template-columns: 1fr; padding: 12px 0; }
.cal-day-panel .ev-rows > li:last-child { border-bottom: 0; }
.cal-panel-hol { font: italic 1.1rem var(--serif); color: var(--copper-dk); margin: 0 0 .4rem; }
.cal-panel-hol [lang="he"] { font-style: normal; font-size: .9rem; color: var(--muted); margin-left: 6px; }
.cal-day-panel .muted { margin: 0; }

/* ---------- Event dialog ---------- */
.ev-modal {
  width: min(680px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 6px;
  background: var(--paper); color: var(--ink-2); box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); overflow: auto;
}
.ev-modal::backdrop { background: rgba(25,21,18,.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.ev-modal[open] { animation: evIn .25s ease; }
@keyframes evIn { from { opacity: 0; transform: translateY(12px); } }
.ev-modal-inner { position: relative; }
.ev-modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,253,249,.92); color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,.15);
}
.ev-modal-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.ev-modal-media { margin: 0; }
.ev-modal-media img { width: 100%; max-height: 340px; object-fit: cover; }
.ev-modal-content { padding: clamp(24px, 4vw, 40px); }
.ev-modal-content h2 { font-size: clamp(1.9rem, 4vw, 2.5rem); margin-bottom: 1rem; padding-right: 40px; }
.ev-modal-media + .ev-modal-content h2 { padding-right: 0; }
.ev-facts { margin: 0 0 1.4rem; display: grid; gap: 0; border-top: 1px solid var(--line); }
.ev-facts > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.ev-facts dt { font-size: .85rem; font-weight: 600; color: var(--muted); }
.ev-facts dd { margin: 0; color: var(--ink); }
.ev-desc { color: var(--ink-2); }
.ev-desc a { overflow-wrap: anywhere; }
.ev-modal-actions { margin-top: 1.6rem; }

@media (max-width: 760px) {
  .ev-hol-toggle { margin-left: 0; }
  .ev-row { grid-template-columns: 48px 1fr; gap: 14px; padding: 14px 0; }
  .ev-row:not(:has(.ev-thumb)) { grid-template-columns: 48px 1fr; }
  .ev-thumb { display: none; }
  .ev-hol { grid-template-columns: 48px 1fr; gap: 14px; }
  .ev-date-d { font-size: 1.8rem; }
  .ev-title { font-size: 1.25rem; }
  .ev-meta { font-size: .86rem; }

  .cal-weekdays .full { display: none; }
  .cal-weekdays .short { display: inline; }
  .cal-weekdays > span { padding: 10px 0; text-align: center; font-size: .72rem; }
  .cal-cell { min-height: 58px; padding: 4px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
  .cal-items { display: none; }
  .cal-dots { display: flex; gap: 3px; }
  .cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--copper); }
  .cal-cell:has(.cal-hol)::after { content: ""; width: 14px; height: 1.5px; background: var(--copper-lt); margin-top: 1px; }
  .cal-day { width: 34px; height: 34px; font-size: .9rem; }
  .cal-btn.cal-today { display: none; }
  .cal-day-panel { padding: 16px 18px; }
  .ev-facts > div { grid-template-columns: 1fr; gap: 0; }
  .ev-modal-actions .btn { flex: 1 1 100%; }
}
