/* ═══ Newspaper Design — היום בהיסטוריה ═══ */

/* ── TOKENS ── */
:root {
  --bg:        #f5edd8;
  --bg2:       #ede3c8;
  --bg3:       #e4d8b8;
  --ink:       #14110a;
  --ink2:      #362d20;
  --ink3:      #7a6a54;
  --red:       #8b1a1a;
  --gold:      #9a7020;
  --rule:      #14110a;
  --rule-lt:   #b8a888;
  --serif:     'Frank Ruhl Libre', 'David Libre', Georgia, serif;
  --sans:      'Heebo', Arial, sans-serif;
  --max:       1280px;
  --sidebar:   300px;
}

/* Dark mode using existing data-theme attribute (darkmode.js) */
html[data-theme="dark"] {
  --bg:      #131009;
  --bg2:     #1b1710;
  --bg3:     #222018;
  --ink:     #ecdfc0;
  --ink2:    #c8b898;
  --ink3:    #7a6e58;
  --rule:    #ecdfc0;
  --rule-lt: #302820;
  --red:     #c44040;
  --gold:    #c8a040;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  transition: background .3s, color .3s;
  direction: rtl;
  min-height: 100vh;
}

/* ── PAPER TEXTURE ── */
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: .6;
}

/* ── LAYOUT ── */
.page { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ── MASTHEAD ── */
.masthead {
  border-top: 4px double var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 18px 0 14px;
  text-align: center;
}
.mast-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--sans); font-size: 11px; letter-spacing: .08em;
  color: var(--ink2); text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-lt);
}
.mast-home-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: opacity .15s;
}
.mast-home-link:hover { opacity: .75; }
.mast-home-link:hover .mast-title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }

.mast-logo {
  display: inline-block;
  height: 56px; width: auto; margin: 4px auto;
  vertical-align: middle;
  filter: none;
}
html[data-theme="dark"] .mast-logo { filter: invert(.92) hue-rotate(180deg); }

.mast-title {
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 88px);
  font-weight: 900;
  letter-spacing: .05em;
  line-height: 1;
  color: var(--ink);
  margin: 8px 0 6px;
}
.mast-slogan {
  font-family: var(--serif);
  font-size: clamp(11px, 1.5vw, 14px);
  font-style: italic;
  color: var(--ink3);
  letter-spacing: .04em;
}
.mast-bottom {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 3px double var(--rule);
  margin-top: 10px; padding-top: 6px;
  font-family: var(--sans); font-size: 11px;
  color: var(--ink2); text-transform: uppercase; letter-spacing: .06em;
}
.edition-badge {
  background: var(--ink); color: var(--bg);
  padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: .1em;
}

/* ── LEAD STORY ── */
.lead-section {
  border-bottom: 2px solid var(--rule);
  padding: 24px 0 20px;
}
.lead-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
@media (max-width: 768px) { .lead-inner { grid-template-columns: 1fr; } }

.lead-kicker {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--red); border-bottom: 2px solid var(--red);
  display: inline-block; padding-bottom: 2px; margin-bottom: 10px;
}
.lead-headline {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 44px);
  font-weight: 900; line-height: 1.1;
  color: var(--ink); margin-bottom: 8px;
}
.lead-year {
  font-family: var(--sans); font-size: 13px; font-weight: 700;
  color: var(--ink3); margin-bottom: 14px;
}
.lead-img-wrap {
  aspect-ratio: 4/3; overflow: hidden;
  border: 1px solid var(--rule-lt);
  position: relative;
  margin-top: 4px;
}
.lead-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(20%) contrast(1.05); }
html[data-theme="dark"] .lead-img-wrap img { filter: sepia(10%) contrast(.95) brightness(.85); }

.lead-img-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #3a2510 0%, #5c3e22 35%, #2e1c0c 65%, #482e18 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.lead-img-placeholder::after {
  content: '';
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,.06) 3px, rgba(0,0,0,.06) 4px);
}
.lead-img-caption {
  position: absolute; bottom: 0; right: 0; left: 0;
  background: rgba(0,0,0,.65); color: #e0d4b8;
  font-size: 10px; padding: 6px 10px; text-align: center; letter-spacing: .02em;
}
.lead-body p {
  font-family: var(--serif); font-size: 15px; line-height: 1.75;
  color: var(--ink2); text-align: justify;
  hyphens: auto; margin-bottom: 10px;
}
.lead-body p:first-child::first-letter {
  font-size: 4.2em; font-weight: 900; float: right;
  line-height: .78; margin-left: 6px; margin-top: 4px;
  color: var(--ink); font-family: var(--serif);
}

/* ── SHARE BUTTONS ── */
.share-bar {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
}
.share-btn {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; cursor: pointer; border: 1px solid currentColor;
  background: transparent; transition: background .15s, color .15s;
  color: var(--ink3);
  display: inline-flex; align-items: center; gap: 5px;
}
.share-btn svg { width: 11px; height: 11px; }
.share-btn:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ── SECTION HEADER ── */
.sec-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 10px; border-bottom: 1px solid var(--rule);
}
.sec-header-title {
  font-family: var(--serif); font-size: 13px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  color: var(--ink);
}
.sec-header-rule { flex: 1; height: 1px; background: var(--rule-lt); }
.sec-header-count { font-size: 10px; font-family: var(--sans); color: var(--ink3); white-space: nowrap; }

/* ── CONTENT + SIDEBAR SPLIT ── */
.content-sidebar {
  display: grid;
  grid-template-columns: 1fr var(--sidebar);
  gap: 0;
  align-items: start;
}
@media (max-width: 900px) {
  .content-sidebar { grid-template-columns: 1fr; }
}
.main-col { border-left: 1px solid var(--rule-lt); padding-left: 24px; min-width: 0; }
@media (max-width: 900px) { .main-col { border-left: none; padding-left: 0; } }
.sidebar-col { padding-right: 20px; padding-top: 16px; min-width: 0; }
@media (max-width: 900px) {
  .sidebar-col { padding-right: 0; border-top: 2px solid var(--rule); padding-top: 16px; }
}

/* ── EVENT CARDS ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}
@media (max-width: 1100px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .cards-grid { grid-template-columns: 1fr; } }

.event-card {
  padding: 16px 14px;
  border-bottom: 1px solid var(--rule-lt);
  border-left: 1px solid var(--rule-lt);
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.event-card:nth-child(3n+1) { border-right: none; }
@media (max-width: 1100px) { .event-card:nth-child(2n+1) { border-right: none; } }
@media (max-width: 600px) { .event-card { border-left: none; } }

.card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.card-year {
  display: inline-block;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .1em; padding: 2px 7px;
  background: var(--ink2); color: var(--bg);
}
.card-cat {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--red);
}
.card-headline {
  font-family: var(--serif); font-size: 16px; font-weight: 700;
  line-height: 1.25; color: var(--ink); margin: 4px 0 6px;
}
.card-summary {
  font-family: var(--serif); font-size: 13px; line-height: 1.65;
  color: var(--ink2); text-align: justify; hyphens: auto;
  white-space: pre-line;
}
.card-img {
  margin: 10px 0 0;
  margin-top: auto;
  border: 1px solid var(--rule-lt);
  overflow: hidden;
  aspect-ratio: 16/10;
}
/* Cards without image: push share row to bottom via flexer */
.event-card .card-share { margin-top: 10px; }
.event-card:not(.has-img) .card-share { margin-top: auto; }
.card-img img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: sepia(20%) contrast(1.03);
}
html[data-theme="dark"] .card-img img { filter: sepia(10%) contrast(.95) brightness(.85); }

.card-share { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.card-share-btn {
  font-size: 9px; font-family: var(--sans); font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 7px; border: 1px solid var(--rule-lt);
  background: transparent; cursor: pointer; color: var(--ink3);
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.card-share-btn svg { width: 10px; height: 10px; fill: currentColor; }
.card-share-btn:hover { background: var(--ink3); color: var(--bg); }

/* ── SIDEBAR WIDGETS ── */
.widget {
  border: 1px solid var(--rule-lt);
  margin-bottom: 18px; background: var(--bg2);
}
.widget-head {
  background: var(--ink); color: var(--bg);
  padding: 6px 12px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
}
.widget-body { padding: 12px; }

/* Calendar */
.cal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.cal-title { font-family: var(--serif); font-size: 14px; font-weight: 700; color: var(--ink); }
.cal-nav {
  background: none; border: 1px solid var(--rule-lt); cursor: pointer;
  padding: 2px 10px; font-size: 14px; color: var(--ink); transition: background .15s;
  font-family: var(--sans); line-height: 1;
}
.cal-nav:hover:not([disabled]) { background: var(--ink); color: var(--bg); }
.cal-nav[disabled] { opacity: .3; cursor: not-allowed; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow {
  text-align: center; font-size: 9px; font-weight: 700;
  font-family: var(--sans); color: var(--ink3); padding: 3px 0;
  letter-spacing: .06em;
}
.cal-day {
  text-align: center; font-size: 11px; font-family: var(--sans);
  padding: 4px 2px; cursor: default; border: 1px solid transparent;
  transition: all .15s; color: var(--ink2);
  background: none; line-height: 1.4;
}
.cal-day.empty { cursor: default; visibility: hidden; }
.cal-day.available { cursor: pointer; }
.cal-day.available:hover { border-color: var(--ink3); background: var(--bg3); }
.cal-day.unavailable { color: var(--rule-lt); cursor: default; }
.cal-day.today { background: var(--gold); color: #fff; font-weight: 700; }
.cal-day.active { background: var(--ink); color: var(--bg); font-weight: 700; }

/* Sports */
.sport-results-title {
  font-family: var(--serif); font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 10px; padding-bottom: 4px;
  border-bottom: 1px solid var(--rule-lt);
}
.sport-result-card {
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-lt);
}
.sport-result-card:last-child { border-bottom: none; padding-bottom: 0; }
.sport-result-header {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}
.sport-result-year {
  font-size: 9px; font-family: var(--sans); font-weight: 700;
  letter-spacing: .1em; color: var(--ink3);
}
.sport-badge {
  font-size: 9px; font-family: var(--sans); font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--red);
}
.sport-competition {
  font-size: 10px; font-family: var(--sans); color: var(--ink3);
  margin-bottom: 5px;
}
.sport-result-score {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.sport-team { font-family: var(--serif); font-size: 12px; font-weight: 700; flex: 1; color: var(--ink); min-width: 0; }
.sport-team-right { text-align: right; }
.sport-team-left  { text-align: left; }
.sport-score-num {
  font-family: var(--sans); font-size: 13px; font-weight: 900;
  padding: 2px 8px; background: var(--ink2); color: var(--bg);
  letter-spacing: .04em; white-space: nowrap;
}
.sport-vs {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  color: var(--ink3); padding: 2px 8px;
}
.sport-scorers {
  font-size: 10px; font-family: var(--sans); color: var(--ink3);
  margin-top: 4px;
}

/* Social */
.social-feed-title, .social-subtitle { display: none; } /* replaced by widget-head + sub-label */
.social-post {
  border: 1px solid var(--rule-lt);
  margin-bottom: 10px; padding: 10px;
  background: var(--bg);
}
.social-post:last-child { margin-bottom: 0; }
.social-sub-note {
  font-size: 11px; font-family: var(--sans); color: var(--red);
  letter-spacing: .06em;
  margin-bottom: 10px; padding: 6px 8px;
  background: var(--bg3);
  border: 1px dashed var(--red);
  text-align: center; font-weight: 500;
}
.social-sub-note strong {
  font-weight: 900; letter-spacing: .08em;
  text-transform: uppercase;
}
.social-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.social-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; font-family: var(--sans); color: #fff;
}
.social-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.social-who { flex: 1; min-width: 0; }
.social-name { font-size: 12px; font-weight: 700; font-family: var(--sans); color: var(--ink); }
.social-handle { font-size: 10px; color: var(--ink3); }
.social-network {
  margin-right: auto; font-size: 9px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  font-family: var(--sans); color: var(--ink3);
  border: 1px solid var(--rule-lt); padding: 1px 5px;
}
.social-text {
  font-family: var(--serif); font-size: 12px; line-height: 1.6;
  color: var(--ink2); margin-bottom: 8px;
  white-space: pre-line;
}
.social-media {
  margin: 6px 0 8px;
  border: 1px solid var(--rule-lt); overflow: hidden;
  aspect-ratio: 16/10;
}
.social-media img { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(15%); }
html[data-theme="dark"] .social-media img { filter: sepia(10%) brightness(.85); }

.social-metrics {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-size: 9px; font-family: var(--sans); color: var(--ink3); letter-spacing: .06em;
}
.social-time { font-size: 9px; color: var(--ink3); font-family: var(--sans); margin-top: 4px; }

/* Births & Deaths (in main column, 2-col split) */
.bd-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
@media (max-width: 600px) { .bd-split { grid-template-columns: 1fr; } }
.bd-block {
  padding: 10px 14px;
}
.bd-split > .bd-block:first-child {
  border-left: 1px solid var(--rule-lt);
}
@media (max-width: 600px) {
  .bd-split > .bd-block:first-child { border-left: none; border-bottom: 1px solid var(--rule-lt); }
}
.bd-title {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink3);
  border-bottom: 1px solid var(--rule-lt); margin-bottom: 8px; padding-bottom: 4px;
}
.bd-list { list-style: none; padding: 0; margin: 0; }
.bd-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--rule-lt);
}
.bd-list li:last-child { border-bottom: none; }
.bd-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; font-family: var(--sans); color: #fff;
  background: #5a2a1a;
}
.bd-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bd-text { flex: 1; min-width: 0; font-size: 11px; font-family: var(--sans); color: var(--ink2); line-height: 1.4; }
.bd-text .bd-name { font-family: var(--serif); font-weight: 700; font-size: 12px; color: var(--ink); display: block; }
.bd-text .bd-info { font-size: 10px; color: var(--ink3); }
.bd-year { font-size: 10px; color: var(--ink3); font-family: var(--sans); margin-right: auto; white-space: nowrap; }

/* ── RELATED DAYS NAV ── */
.related-days { margin-top: 8px; }
.related-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 16px 0;
}
.related-link {
  display: block;
  padding: 10px 14px;
  border: 1px solid var(--rule-lt);
  background: var(--bg2);
  text-decoration: none;
  color: var(--ink);
  transition: all .15s;
  font-family: var(--sans);
}
.related-link:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.related-link.today-link {
  border-color: var(--red);
  border-width: 2px;
}
.related-label {
  display: block;
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--red); margin-bottom: 4px;
}
.related-link:hover .related-label { color: var(--bg); }
.related-date {
  display: block;
  font-family: var(--serif); font-size: 15px; font-weight: 700;
  line-height: 1.3;
}
.related-sub {
  display: block; font-size: 10px; color: var(--ink3); margin-top: 2px;
}
.related-link:hover .related-sub { color: var(--bg); }

/* ── FOOTER ── */
.site-footer {
  border-top: 3px double var(--rule);
  padding: 28px 0 16px; margin-top: 24px;
  background: transparent;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 28px; margin-bottom: 20px;
}
@media (max-width: 640px) { .footer-grid { grid-template-columns: 1fr; gap: 16px; } }
.footer-brand-name {
  font-family: var(--serif); font-size: 24px; font-weight: 900;
  letter-spacing: .06em; margin-bottom: 4px; color: var(--ink);
}
.footer-slogan { font-family: var(--serif); font-style: italic; font-size: 12px; color: var(--ink3); margin-bottom: 8px; }
.footer-desc { font-size: 11px; color: var(--ink3); font-family: var(--sans); line-height: 1.6; }
.footer-col-title {
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  border-bottom: 1px solid var(--rule-lt); margin-bottom: 8px; padding-bottom: 4px;
}
.footer-col a, .footer-col p, .footer-col li {
  font-size: 11px; color: var(--ink3); font-family: var(--sans);
  display: block; margin-bottom: 4px; text-decoration: none; list-style: none;
}
.footer-col a:hover { color: var(--ink); }
.footer-bottom {
  border-top: 1px solid var(--rule-lt); padding-top: 12px;
  font-size: 10px; color: var(--ink3); font-family: var(--sans);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px;
}

/* ── DARK MODE TOGGLE ── */
#theme-toggle {
  position: fixed; bottom: 24px; left: 24px; z-index: 100;
  width: 44px; height: 44px; border-radius: 0;
  border: 2px solid var(--rule); background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, color .2s; color: var(--ink);
  box-shadow: 2px 2px 0 var(--rule);
  padding: 0;
}
#theme-toggle:hover { background: var(--ink); color: var(--bg); }
#theme-toggle svg { width: 20px; height: 20px; }

/* ── SHARE TOAST ── */
.share-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px;
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  letter-spacing: .06em; z-index: 9999;
  border: 2px solid var(--rule);
  box-shadow: 3px 3px 0 var(--rule);
}

/* ── LOADING STATE ── */
.loading-placeholder { color: var(--ink3); font-style: italic; }
