/* Wikipedia Vector skin clone */
:root {
  --wp-link: #0645ad;
  --wp-link-visited: #0b0080;
  --wp-link-new: #ba0000;
  --wp-text: #202122;
  --wp-bg: #ffffff;
  --wp-sidebar-bg: #f8f9fa;
  --wp-border: #a2a9b1;
  --wp-border-light: #c8ccd1;
  --wp-heading: #000000;
  --wp-grey: #54595d;
  --wp-box-bg: #f8f9fa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--wp-text);
  background: var(--wp-bg);
  min-height: 100vh;
}
.mw-body { max-width: 980px; margin: 0 auto; padding: 1.5rem 2rem; }
.mw-page-title { font-size: 2.4rem; margin-bottom: 0.6rem; }
.mw-content h2 { font-size: 1.6rem; margin: 1.8rem 0 0.6rem; }
.mw-content p { margin: 0.8rem 0; }
.infobox { border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.catlinks { border-radius: 6px; }
.mw-footer { border-radius: 0; }

.hebrew {
  font-family: "SBL Hebrew", "David", "Times New Roman", serif;
  direction: rtl;
  text-align: right;
}

a { color: var(--wp-link); text-decoration: none; }
a:visited { color: var(--wp-link-visited); }
a:hover { text-decoration: underline; }
a.new { color: var(--wp-link-new); }

/* Top header bar */
.mw-header {
  background: #ffffff;
  border-bottom: 1px solid var(--wp-border-light);
  padding: 0.5rem 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.mw-logo { font-size: 1.5rem; font-weight: 400; color: #000; font-family: "Linux Libertine", Georgia, serif; }
.mw-logo .sub { font-size: 0.7rem; color: var(--wp-grey); display: block; line-height: 1; }
.mw-search { flex: 1; max-width: 500px; display: flex; }
.mw-search input { flex: 1; padding: 0.4rem 0.6rem; border: 1px solid var(--wp-border); font-size: 0.9rem; }
.mw-search button { padding: 0.4rem 0.8rem; border: 1px solid var(--wp-border); border-left: none; background: #f8f9fa; cursor: pointer; font-size: 0.9rem; }
.mw-nav { display: flex; gap: 1rem; font-size: 0.85rem; margin-left: auto; }
.mw-nav a { color: var(--wp-link); }

/* Tabs (Vector) */
.mw-tabs {
  background: #f8f9fa;
  border-bottom: 1px solid var(--wp-border);
  padding: 0 1rem;
  display: flex; gap: 0;
}
.mw-tabs a {
  padding: 0.5rem 1rem; font-size: 0.85rem; color: var(--wp-text);
  border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
}
.mw-tabs a.active { background: #fff; border-color: var(--wp-border); border-bottom-color: #fff; font-weight: 600; }
.mw-tabs a:hover { background: #fff; text-decoration: none; }

/* Left sidepanel layout */
.mw-layout { display: flex; min-height: 100vh; }
.mw-sidebar { width: 220px; background: var(--wp-sidebar-bg); border-right: 1px solid var(--wp-border-light); padding: 1rem; flex-shrink: 0; }
.mw-sidebar .mw-logo { display: block; margin-bottom: 1rem; }
.mw-sidebar .mw-nav { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; }
.mw-sidebar .mw-nav a { color: var(--wp-link); padding: 0.3rem 0.5rem; border-radius: 4px; }
.mw-sidebar .mw-nav a:hover { background: #eaecf0; text-decoration: none; }
.mw-sidebar .mw-nav a.pinned { font-weight: 700; background: #fff3cd; }
.mw-main { flex: 1; min-width: 0; }
.mw-main .mw-header { border-bottom: 1px solid var(--wp-border-light); }

/* Page container */
.mw-body { max-width: 960px; margin: 0 auto; padding: 1rem 2rem; }
.mw-page-title { font-family: "Linux Libertine", Georgia, "Times New Roman", serif; font-size: 2.2rem; font-weight: 400; border-bottom: 1px solid var(--wp-border-light); padding-bottom: 0.2rem; margin-bottom: 0.5rem; color: var(--wp-heading); }
.mw-subtitle { font-size: 0.85rem; color: var(--wp-grey); margin-bottom: 1rem; font-style: italic; }

/* Table of contents */
.toc { background: var(--wp-box-bg); border: 1px solid var(--wp-border-light); padding: 0.8rem 1rem; display: inline-block; margin: 1rem 0; font-size: 0.85rem; }
.toc .toc-title { font-weight: 700; margin-bottom: 0.5rem; }
.toc ul { list-style: none; padding-left: 1rem; }
.toc li { margin: 0.2rem 0; }
.toc a { color: var(--wp-link); }

/* Infobox */
.infobox { float: right; width: 280px; margin: 0 0 1rem 1.5rem; border: 1px solid var(--wp-border); background: var(--wp-box-bg); font-size: 0.85rem; }
.infobox .infobox-title { background: #dcdcdc; padding: 0.4rem; text-align: center; font-weight: 700; font-size: 0.95rem; }
.infobox table { width: 100%; border-collapse: collapse; }
.infobox th, .infobox td { padding: 0.3rem 0.5rem; vertical-align: top; border-top: 1px solid var(--wp-border-light); }
.infobox th { width: 40%; font-weight: 600; color: var(--wp-grey); text-align: left; }
.infobox .infobox-image { text-align: center; padding: 0.5rem; background: #fff; }

/* Article content */
.mw-content { font-size: 0.95rem; line-height: 1.65; font-family: "Linux Libertine", Georgia, "Times New Roman", serif; }
.mw-content h2 { font-family: "Linux Libertine", Georgia, serif; font-size: 1.5rem; font-weight: 400; border-bottom: 1px solid var(--wp-border-light); padding-bottom: 0.1rem; margin: 1.5rem 0 0.5rem; color: var(--wp-heading); }
.mw-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.2rem 0 0.4rem; }
.mw-content p { margin: 0.6rem 0; }
.mw-content .hebrew { font-size: 1.15rem; margin: 0.8rem 0; padding: 0.8rem; background: #f8f9fa; border-left: 3px solid var(--wp-border); }
.mw-content ul, .mw-content ol { margin: 0.6rem 0 0.6rem 2rem; }
.mw-content li { margin: 0.3rem 0; }

/* Categories */
.catlinks { background: var(--wp-box-bg); border: 1px solid var(--wp-border-light); padding: 0.5rem 0.8rem; margin: 1.5rem 0; font-size: 0.85rem; }
.catlinks .cat-title { font-weight: 700; margin-right: 0.5rem; }
.catlinks a { margin-right: 0.4rem; }

/* Footer */
.mw-footer { background: #f8f9fa; border-top: 1px solid var(--wp-border-light); padding: 1.5rem 2rem; margin-top: 2rem; font-size: 0.8rem; color: var(--wp-grey); }
.mw-footer .footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.mw-footer a { color: var(--wp-grey); }

/* Search results */
.search-result { padding: 0.8rem 0; border-bottom: 1px solid var(--wp-border-light); }
.search-result .sr-title { font-size: 1.1rem; font-weight: 400; }
.search-result .sr-title a { color: var(--wp-link); }
.search-result .sr-meta { font-size: 0.8rem; color: var(--wp-grey); margin: 0.2rem 0; }
.search-result .sr-snippet { font-size: 0.9rem; color: var(--wp-text); }
.search-result .sr-snippet b { font-weight: 700; }

/* Edit toolbar (minimal) */
.edit-toolbar { background: #f8f9fa; border: 1px solid var(--wp-border); border-bottom: none; padding: 0.4rem; display: flex; gap: 0.3rem; flex-wrap: wrap; }
.edit-toolbar button { padding: 0.3rem 0.6rem; border: 1px solid var(--wp-border-light); background: #fff; cursor: pointer; font-size: 0.85rem; }
.edit-toolbar button:hover { background: #eaecf0; }
.edit-area { min-height: 400px; padding: 1rem; border: 1px solid var(--wp-border); font-size: 0.95rem; line-height: 1.6; outline: none; background: #fff; }
.edit-area:focus { border-color: var(--wp-link); }

/* Form inputs (wiki style) */
.wiki-input { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--wp-border); font-size: 0.9rem; margin-bottom: 0.8rem; }
.wiki-select { padding: 0.4rem 0.6rem; border: 1px solid var(--wp-border); font-size: 0.9rem; background: #fff; }

/* Buttons (wiki style) */
.wiki-btn { padding: 0.4rem 1rem; border: 1px solid var(--wp-border); background: #f8f9fa; cursor: pointer; font-size: 0.9rem; margin-right: 0.3rem; }
.wiki-btn:hover { background: #eaecf0; }
.wiki-btn-primary { background: #36c; color: #fff; border-color: #36c; }
.wiki-btn-primary:hover { background: #2a4b8d; }

/* Dark mode */
body.dark {
  --wp-link: #58a6ff;
  --wp-link-visited: #8a91ff;
  --wp-text: #c9d1d9;
  --wp-bg: #0d1117;
  --wp-sidebar-bg: #161b22;
  --wp-border: #30363d;
  --wp-border-light: #21262d;
  --wp-heading: #f0f6fc;
  --wp-grey: #8b949e;
  --wp-box-bg: #161b22;
}
body.dark .mw-header, body.dark .mw-tabs, body.dark .mw-footer, body.dark .infobox, body.dark .toc, body.dark .catlinks, body.dark .edit-toolbar, body.dark .edit-area { background: #161b22; }
body.dark .mw-logo { color: #f0f6fc; }
body.dark .mw-search input, body.dark .wiki-input, body.dark .wiki-select, body.dark .edit-area { background: #0d1117; color: #c9d1d9; border-color: #30363d; }
body.dark .hebrew { background: #161b22; }
body.dark table { color: var(--wp-text); }
body.dark th, body.dark td { border-color: var(--wp-border-light); }
body.dark .infobox th { color: var(--wp-grey); }
body.dark a { color: var(--wp-link); }
body.dark .mw-page-title, body.dark .mw-content h2, body.dark .mw-content h3 { color: var(--wp-heading); }
body.dark .toc, body.dark .catlinks { background: var(--wp-box-bg); border-color: var(--wp-border-light); }
body.dark .mw-search input { background: #0d1117; color: var(--wp-text); }
body.dark select, body.dark option { background: #0d1117; color: var(--wp-text); }
body.dark .wiki-btn { background: #161b22; color: var(--wp-text); border-color: var(--wp-border); }
body.dark .wiki-btn:hover { background: #21262d; }

/* Dark mode prompt modal */
.dm-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.dm-modal {
  background: var(--wp-bg); color: var(--wp-text);
  border: 1px solid var(--wp-border); border-radius: 8px;
  padding: 2rem; max-width: 360px; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.dm-modal h3 { font-family: "Linux Libertine", Georgia, serif; margin-bottom: 0.8rem; color: var(--wp-heading); }
.dm-modal p { margin-bottom: 1.5rem; color: var(--wp-grey); font-size: 0.9rem; }
.dm-modal .dm-btns { display: flex; gap: 0.8rem; justify-content: center; }
.dm-modal button { padding: 0.6rem 1.6rem; border: 1px solid var(--wp-border); background: var(--wp-box-bg); color: var(--wp-text); border-radius: 6px; cursor: pointer; font-size: 0.9rem; }
.dm-modal button.primary { background: #36c; color: #fff; border-color: #36c; }

/* Toast */
.toast { position: fixed; bottom: 1rem; right: 1rem; background: #202122; color: #fff; padding: 0.6rem 1rem; font-size: 0.85rem; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* Responsive */
@media (max-width: 768px) {
  .infobox { float: none; width: 100%; margin: 0 0 1rem 0; }
  .mw-body { padding: 1rem; }
  .mw-nav { display: none; }
}

.mw-logo img {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  margin-right: 6px;
}

/* === Right sidebar (Parshas) === */

/* Right sidebar (Parashot) */

.parasha-thumb {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 4px;
  border-radius: 2px;
}

.mw-right-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  left: auto;
  width: 200px;
  height: 100vh;
  background: var(--wp-sidebar-bg);
  border-left: 1px solid var(--wp-border-light);
  padding: 1rem 0.8rem;
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 0.8rem;
  transform: translateX(100%);
  transition: transform 0.4s ease;
  z-index: 50;
}
.mw-right-sidebar.visible {
  transform: translateX(0);
}
.right-sidebar-title {
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--wp-grey);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}
.mw-right-sidebar a {
  display: block;
  padding: 0.25rem 0.4rem;
  color: var(--wp-link);
  text-decoration: none;
  border-radius: 3px;
}
.mw-right-sidebar a:hover {
  background: #eaecf0;
}

/* === Animations === */

/* Page load fade-in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.mw-main {
  animation: fadeIn 0.4s ease-out;
}

/* Left sidebar fade-in */
.mw-sidebar {
  animation: fadeIn 0.3s ease-out;
}

/* Right sidebar slide-in (replaces the basic transition) */
.mw-right-sidebar {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Link hover underline animation */
.mw-content a,
.mw-topnav a,
.mw-sidebar-nav a {
  position: relative;
  transition: color 0.2s ease;
}
.mw-content a::after,
.mw-topnav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.25s ease;
}
.mw-content a:hover::after,
.mw-topnav a:hover::after {
  width: 100%;
}

/* Search bar focus glow */
.mw-search input {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mw-search input:focus {
  border-color: var(--wp-link);
  box-shadow: 0 0 0 2px rgba(6, 69, 173, 0.1);
}

/* Button hover lift */
.wiki-btn,
.mw-search button {
  transition: background 0.2s ease, transform 0.15s ease;
}
.wiki-btn:hover,
.mw-search button:hover {
  transform: translateY(-1px);
}
.wiki-btn:active,
.mw-search button:active {
  transform: translateY(0);
}

/* Parasha thumbnail hover */
.parasha-thumb {
  transition: transform 0.2s ease;
}
.mw-right-sidebar a:hover .parasha-thumb {
  transform: scale(1.2);
}

/* Staggered fade-in for list items */
@keyframes staggerIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}
.mw-right-sidebar.visible a {
  animation: staggerIn 0.3s ease-out both;
}
.mw-right-sidebar.visible a:nth-child(1) { animation-delay: 0.05s; }
.mw-right-sidebar.visible a:nth-child(2) { animation-delay: 0.08s; }
.mw-right-sidebar.visible a:nth-child(3) { animation-delay: 0.11s; }
.mw-right-sidebar.visible a:nth-child(4) { animation-delay: 0.14s; }
.mw-right-sidebar.visible a:nth-child(5) { animation-delay: 0.17s; }
.mw-right-sidebar.visible a:nth-child(6) { animation-delay: 0.20s; }
.mw-right-sidebar.visible a:nth-child(7) { animation-delay: 0.23s; }
.mw-right-sidebar.visible a:nth-child(8) { animation-delay: 0.26s; }
.mw-right-sidebar.visible a:nth-child(9) { animation-delay: 0.29s; }
.mw-right-sidebar.visible a:nth-child(10) { animation-delay: 0.32s; }
.mw-right-sidebar.visible a:nth-child(n+11) { animation-delay: 0.35s; }

/* HaMikdash image subtle pulse on hover */
h2 img {
  transition: transform 0.3s ease;
}
h2 img:hover {
  transform: scale(1.1);
}

/* Footer fade */
.mw-footer {
  animation: fadeIn 0.6s ease-out 0.2s both;
}

.mw-main {
  padding-right: 210px;
  transition: padding-right 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top bar (replaces left sidebar) */
.mw-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--wp-bg);
  border-bottom: 1px solid var(--wp-border-light);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.topbar-icon {
  width: 32px;
  height: 32px;
}
.topbar-title {
  font-family: "Linux Libertine", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 400;
}
.topbar-nav {
  display: flex;
  gap: 1rem;
  margin-left: auto;
  font-size: 0.85rem;
}
.topbar-nav a {
  color: var(--wp-link);
  text-decoration: none;
}
.topbar-nav a:hover {
  text-decoration: underline;
}

/* Hide the old left sidebar if it still exists */
.mw-sidebar { display: none; }
