/* ==========================================================================
   JABER LAW — Base
   ========================================================================== */

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

html {
  font-size: 16px;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: auto;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-base);
  background: var(--bg);
  color: var(--fg);
  direction: rtl;
  min-height: 100vh;
  overflow-x: clip;
  position: relative;
}

/* Paper grain: a printed feel on every surface */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9990; opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 300px 300px;
  animation: grain 0.6s steps(3) infinite;
}
@keyframes grain { 0% { background-position: 0 0; } 33% { background-position: 120px 60px; } 66% { background-position: 40px 180px; } 100% { background-position: 0 0; } }

/* Ambient ledger grid: barely there ruled paper */
.ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to bottom, rgba(205, 178, 122, 0.05) 1px, transparent 1px),
    radial-gradient(60% 50% at 85% 10%, rgba(178, 146, 79, 0.08), transparent 70%);
  background-size: 100% 96px, 100% 100%;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.15) 40%, transparent 70%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0.15) 40%, transparent 70%);
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
strong, b { font-weight: 700; }
em { font-style: italic; }
::selection { background: var(--brass-500); color: #fff; }

:focus-visible { outline: 2px solid var(--brass-400); outline-offset: 3px; border-radius: 4px; }

.skip-link { position: fixed; top: 10px; inset-inline-start: 10px; z-index: 10000; padding: 0.6rem 1rem; background: var(--brass-500); color: #fff; border-radius: var(--r-pill); font-weight: 600; transform: translateY(-200%); transition: transform var(--d-fast); }
.skip-link:focus { transform: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Type ----------------------------------------------------------------- */
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: var(--lh-snug); letter-spacing: var(--ls-tight); text-wrap: balance; }
.display-xl { font-size: var(--t-display-xl); font-weight: 900; line-height: 0.98; }
.display-l { font-size: var(--t-display-l); font-weight: 900; line-height: 1.02; }
.display-m { font-size: var(--t-display-m); font-weight: 700; line-height: 1.12; }
.h3 { font-size: var(--t-h3); }
.lead { font-size: var(--t-lead); font-weight: 300; line-height: var(--lh-relaxed); color: var(--fg-2); max-width: 54ch; text-wrap: pretty; }
.small { font-size: var(--t-small); }
.muted { color: var(--fg-3); }
.accent { color: var(--brass-400); }
.display-xl .accent, .display-l .accent, .display-m .accent { font-style: italic; font-weight: 700; }
.mono { font-family: var(--font-mono); font-size: var(--t-label); letter-spacing: 0.14em; text-transform: uppercase; }
.grotesk { font-family: var(--font-grotesk); }

/* Section label: "§ 02 — תחומי עיסוק" */
.label { display: inline-flex; align-items: center; gap: 0.7rem; font-family: var(--font-mono); font-size: var(--t-label); letter-spacing: 0.16em; color: var(--brass-400); text-transform: uppercase; }
.label::before { content: ''; width: 28px; height: 1px; background: var(--brass-400); }
.label[data-n]::after { content: '§ ' attr(data-n); color: var(--fg-3); letter-spacing: 0.1em; direction: ltr; unicode-bidi: isolate; }
.section--light .label::after, .cta .label::after { color: var(--fg-on-light-2); }

/* Double rule (ledger line), the signature motif */
.rule { position: relative; height: 7px; }
.rule::before, .rule::after { content: ''; position: absolute; inset-inline: 0; height: 1px; background: var(--line-2); }
.rule::before { top: 0; } .rule::after { bottom: 0; }
.rule--brass::before, .rule--brass::after { background: var(--brass-500); opacity: 0.6; }
.section--light .rule::before, .section--light .rule::after { background: var(--line-on-light); }

/* Layout helpers -------------------------------------------------------- */
.container { width: 100%; max-width: var(--max-w); margin-inline: auto; padding-inline: var(--page-x); }
.container--narrow { max-width: var(--max-w-narrow); }
.section { position: relative; padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.section--surface { background: var(--bg-2); }
.section--light { background: var(--bg-light); color: var(--fg-on-light); }
.section--light .lead { color: var(--fg-on-light-2); }
.section--light .muted { color: var(--fg-on-light-2); }
.section--light .accent { color: var(--brass-600); }
.section-head { display: flex; flex-direction: column; gap: 1rem; margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.section-head--split { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: end; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; } .wrap { flex-wrap: wrap; } .gap-4 { gap: 1rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: var(--s-4); } .mt-2 { margin-top: var(--s-6); } .mt-3 { margin-top: var(--s-7); }

/* Reveals: final state when JS is off or motion is reduced */
html:not([data-js]) [data-reveal], [data-reveal].is-done { opacity: 1 !important; transform: none !important; clip-path: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .grain { animation: none; }
}

/* Prose (guides, legal pages) ----------------------------------------- */
.prose { max-width: var(--max-w-prose); font-size: 1.05rem; line-height: 1.85; color: var(--fg-2); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: var(--t-display-m); color: var(--fg); margin-top: 2.2em; }
.prose h3 { font-size: 1.35rem; color: var(--fg); margin-top: 1.8em; font-family: var(--font-sans); font-weight: 700; }
.prose p strong { color: var(--fg); }
.prose ul, .prose ol { padding-inline-start: 1.4rem; }
.prose ul { list-style: disc; } .prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--brass-400); }
.prose a { color: var(--brass-400); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--brass-300); }
.prose blockquote { border-inline-start: 2px solid var(--brass-500); padding: 0.4rem 1.2rem; font-family: var(--font-display); font-size: 1.3rem; color: var(--fg); }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.prose th, .prose td { text-align: start; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--fg); font-weight: 600; background: var(--glass-light); }
.prose .note { padding: 1.1rem 1.3rem; border-radius: var(--r-md); background: rgba(64, 144, 208, 0.08); border: 1px solid rgba(64, 144, 208, 0.3); color: var(--fg); font-size: 0.97rem; }
.prose .note b { color: var(--brass-300); }
.section--light .prose { color: var(--fg-on-light-2); }
.section--light .prose h2, .section--light .prose h3, .section--light .prose p strong, .section--light .prose blockquote { color: var(--fg-on-light); }
.section--light .prose th, .section--light .prose td { border-color: var(--line-on-light); }
