/* ========================================
   CODEX NUMERICA — Shared Styles
   ======================================== */

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --gold: #c9a84c;
  --gold-dim: #8a6f30;
  --text: #d4d0c8;
  --text-dim: #7a7770;
  --accent: #4a7c9b;
  --accent2: #9b4a6a;
  --red: #c44a4a;
  --green: #4a9b6a;
  --border: #2a2a34;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
}
.noise {
  position: fixed; top:0; left:0; width:100%; height:100%;
  opacity: 0.03; pointer-events: none; z-index: 999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Navigation ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1.5rem;
}
.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: none;
  letter-spacing: -0.01em;
}
.nav-brand:hover { color: var(--gold); opacity: 0.85; border-bottom: none; }
.nav-links {
  display: flex;
  gap: 0.2rem;
  flex-wrap: wrap;
  align-items: center;
}
.nav-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
  transition: all 0.3s;
  white-space: nowrap;
  border-bottom: none;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  background: rgba(201,168,76,0.08);
  border-bottom: none;
}
.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 0.3rem;
  flex-shrink: 0;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--gold);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  margin-left: auto;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  max-width: 900px;
  margin: 1.5rem auto 0;
  padding: 0 2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}
.breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: none;
}
.breadcrumb a:hover { color: var(--gold); border-bottom: none; }
.breadcrumb span { margin: 0 0.4rem; }

/* ---- Page Header (subpages) ---- */
.page-header {
  text-align: center;
  padding: 4rem 2rem 3rem;
  position: relative;
  background: radial-gradient(ellipse at 50% 50%, rgba(201,168,76,0.04) 0%, transparent 70%),
              var(--bg);
}
.page-header .category-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--gold-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}
.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  animation: fadeIn 1s ease;
}
.page-header .page-subtitle {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 700px;
  margin: 0 auto;
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* ---- Homepage Header ---- */
header {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 2rem;
  position: relative;
  background: radial-gradient(ellipse at 50% 30%, rgba(201,168,76,0.06) 0%, transparent 70%),
              radial-gradient(ellipse at 30% 70%, rgba(74,124,155,0.04) 0%, transparent 60%),
              var(--bg);
}
header::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 500px; height: 500px;
  border: 1px solid rgba(201,168,76,0.08);
  border-radius: 50%;
  animation: pulse 8s ease-in-out infinite;
}
header::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 350px; height: 350px;
  border: 1px solid rgba(201,168,76,0.05);
  border-radius: 50%;
  animation: pulse 8s ease-in-out infinite 4s;
}
@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%,-50%) scale(1); }
  50% { opacity: 0.8; transform: translate(-50%,-50%) scale(1.05); }
}
.hebrew-deco {
  font-size: 2.5rem;
  color: var(--gold);
  opacity: 0.4;
  letter-spacing: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeIn 2s ease;
}
header h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  color: var(--gold);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  animation: fadeIn 1.5s ease 0.3s both;
}
.subtitle {
  font-size: 1.15rem;
  color: var(--text-dim);
  max-width: 600px;
  font-weight: 300;
  letter-spacing: 0.03em;
  animation: fadeIn 1.5s ease 0.6s both;
}
@keyframes fadeIn {
  from { opacity:0; transform: translateY(15px); }
  to { opacity:1; transform: translateY(0); }
}
.scroll-hint {
  position: absolute; bottom: 3rem;
  color: var(--gold-dim);
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: bob 2s ease-in-out infinite;
}
@keyframes bob {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ---- Main Content ---- */
main { max-width: 900px; margin: 0 auto; padding: 2rem; }

.section {
  margin-bottom: 5rem;
  padding-top: 2rem;
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 1.5rem;
  line-height: 1.25;
}
h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e0d8c8;
  margin: 2rem 0 0.8rem;
  border-left: 3px solid var(--gold-dim);
  padding-left: 1rem;
}
p { margin-bottom: 1.2rem; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: all 0.3s; }
a:hover { color: var(--gold); border-bottom-color: var(--gold); }

/* ---- Cards ---- */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.8rem;
  margin: 1.5rem 0;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute; top:0; left:0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.card.highlight {
  border-color: rgba(201,168,76,0.2);
  background: linear-gradient(135deg, var(--bg2), rgba(201,168,76,0.03));
}

/* ---- Code blocks ---- */
.code-block {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  margin: 1.2rem 0;
  overflow-x: auto;
  line-height: 1.8;
  color: #b0b0a8;
}
.code-block .kw { color: var(--accent); }
.code-block .num { color: var(--gold); }
.code-block .str { color: var(--green); }
.code-block .cmt { color: var(--text-dim); font-style: italic; }

/* ---- Math displays ---- */
.math-display {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg3);
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--gold);
  letter-spacing: 0.05em;
}
.math-display .label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---- Hebrew display ---- */
.hebrew {
  font-size: 1.8rem;
  direction: rtl;
  text-align: center;
  padding: 1.2rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  line-height: 2;
}
.hebrew-word {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin: 0.2rem;
  background: rgba(201,168,76,0.06);
  border-radius: 4px;
  border-bottom: 2px solid rgba(201,168,76,0.2);
}
.word-val {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--accent);
  direction: ltr;
  text-align: center;
  margin-top: 0.3rem;
}

/* ---- Tables ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.data-table th {
  background: var(--bg3);
  color: var(--gold);
  font-weight: 600;
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 2px solid var(--gold-dim);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.data-table td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td { background: rgba(201,168,76,0.03); }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }
.gold { color: var(--gold); }
.accent { color: var(--accent); }
.dim { color: var(--text-dim); }
.red { color: var(--red); }
.green { color: var(--green); }

/* ---- Verdict badges ---- */
.verdict {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
}
.verdict.verified { background: rgba(74,155,106,0.15); color: var(--green); border: 1px solid rgba(74,155,106,0.3); }
.verdict.disputed { background: rgba(196,74,74,0.15); color: var(--red); border: 1px solid rgba(196,74,74,0.3); }
.verdict.remarkable { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.verdict.neutral { background: rgba(74,124,155,0.15); color: var(--accent); border: 1px solid rgba(74,124,155,0.3); }

/* ---- Separator ---- */
.sep {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 4rem 0;
  opacity: 0.3;
}

/* ---- TOC ---- */
.toc {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin: 3rem 0;
}
.toc-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}
.toc ol {
  list-style: none;
  counter-reset: toc;
}
.toc li {
  counter-increment: toc;
  margin-bottom: 0.6rem;
}
.toc li::before {
  content: counter(toc, decimal-leading-zero) " ";
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--gold-dim);
  margin-right: 0.5rem;
}
.toc a { color: var(--text); font-size: 1rem; border-bottom: none; }
.toc a:hover { color: var(--gold); border-bottom: none; }

/* ---- Blockquote ---- */
blockquote {
  border-left: 3px solid var(--gold-dim);
  padding: 0.8rem 1.5rem;
  margin: 1.5rem 0;
  color: var(--text-dim);
  font-style: italic;
  background: rgba(201,168,76,0.02);
  border-radius: 0 6px 6px 0;
}

/* ---- Grid ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin: 1.5rem 0;
}

/* ---- Category Cards (Homepage) ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.category-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.8rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  text-decoration: none;
  display: block;
}
.category-card::before {
  content: '';
  position: absolute; top:0; left:0;
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.category-card:hover {
  border-color: rgba(201,168,76,0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.category-card .card-icon {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}
.category-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0 0 0.6rem;
  border: none;
  padding: 0;
}
.category-card p {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}
.category-card .card-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--gold-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

/* ---- Section group titles (Homepage) ---- */
.section-group-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--gold-dim);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin: 3rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ---- Footer ---- */
footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.footer-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  border-bottom: none;
}
.footer-links a:hover { color: var(--gold); border-bottom: none; }

/* ---- Numerical Passport Card ---- */
.num-passport {
  display: flex;
  gap: 2rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 4px;
}
.passport-number {
  font-family: 'Playfair Display', serif;
  font-size: 4rem;
  font-weight: 900;
  color: var(--gold);
  min-width: 80px;
  line-height: 1;
}
.passport-stats {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
}

/* ---- Edition Warning ---- */
.edition-warning {
  background: rgba(201,168,76,0.05);
  border: 1px solid rgba(201,168,76,0.2);
  border-left: 4px solid var(--gold-dim);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  border-radius: 4px;
  color: var(--text);
}

/* ---- Counting Verification Block ---- */
.counting-block {
  background: rgba(74,155,106,0.05);
  border: 1px solid rgba(74,155,106,0.15);
  border-left: 4px solid var(--green);
  padding: 1.5rem;
  margin: 2rem 0;
  border-radius: 4px;
}
.counting-block h4 {
  color: var(--green);
  margin-top: 0;
  font-size: 1rem;
  margin-bottom: 0.8rem;
}
.counting-block ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}
.counting-block li {
  margin-bottom: 0.4rem;
}
.badge-note {
  margin-bottom: 0;
  font-size: 0.85rem;
}

/* ---- Wide reference tables ---- */
.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; flex-direction: column; width: 100%; gap: 0; padding-top: 0.5rem; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.5rem 0.8rem; width: 100%; }
  .nav-sep { display: none; }
  .nav-toggle { display: block; }
  .nav-inner { flex-wrap: wrap; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.5rem; }
  .num-passport { flex-direction: column; }
  .passport-number { font-size: 3rem; }
}
