/* ---------- tokens ---------- */
:root {
  --bg: #f7f7fb;
  --bg-2: #ffffff;
  --text: #14141f;
  --muted: #5d5d73;
  --line: #e4e4ee;
  --accent: #5b4cf0;
  --accent-2: #0ea5a5;
  --node: #f0effd;
  --shadow: 0 1px 2px rgba(20, 20, 40, .04), 0 8px 24px rgba(20, 20, 40, .06);
  --live: #16a34a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b12;
    --bg-2: #13131d;
    --text: #ececf4;
    --muted: #9a9ab2;
    --line: #25253a;
    --accent: #8b7fff;
    --accent-2: #2dd4bf;
    --node: #1c1b2e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .35);
    --live: #4ade80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b12;
  --bg-2: #13131d;
  --text: #ececf4;
  --muted: #9a9ab2;
  --line: #25253a;
  --accent: #8b7fff;
  --accent-2: #2dd4bf;
  --node: #1c1b2e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 30px rgba(0, 0, 0, .35);
  --live: #4ade80;
  color-scheme: dark;
}

/* ---------- language switching ---------- */
html[lang="en"] [lang="he"],
html[lang="he"] [lang="en"] { display: none !important; }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Inter", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html[lang="he"] body { font-family: "Heebo", "Inter", system-ui, sans-serif; }
body::before {
  content: "";
  position: fixed; inset: -20% -10% auto auto;
  width: 60vw; height: 60vw; max-width: 720px; max-height: 720px;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  pointer-events: none; z-index: -1;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
html[lang="he"] h1, html[lang="he"] h2, html[lang="he"] h3 { letter-spacing: 0; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(1.4) blur(12px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 16px; height: 60px; }
.logo { font-weight: 800; font-size: 20px; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 20px; margin-inline-start: auto; font-size: 14px; color: var(--muted); }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 8px; }
@media (max-width: 560px) { .nav-links { display: none; } .nav-actions { margin-inline-start: auto; } }
.icon-btn {
  display: grid; place-items: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text);
  font: 600 13px "Heebo", "Inter", sans-serif; cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }

/* ---------- hero ---------- */
.hero {
  display: grid; gap: 40px; align-items: center;
  padding-top: 72px; padding-bottom: 48px;
}
@media (min-width: 920px) { .hero { grid-template-columns: 1.15fr .85fr; padding-top: 96px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--accent); font-size: 13px; font-weight: 600; text-transform: lowercase; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
h1 { font-size: clamp(34px, 6vw, 58px); font-weight: 800; }
.grad { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 18px; max-width: 60ch; margin: 20px 0 0; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2);
  font-weight: 600; font-size: 15px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 9px 16px; font-size: 14px; }
html[dir="rtl"] .arrow { transform: scaleX(-1); display: inline-block; }

.terminal {
  border-radius: 16px; overflow: hidden;
  background: #0f0f18; border: 1px solid #262638;
  box-shadow: var(--shadow); direction: ltr;
}
.term-bar { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border-bottom: 1px solid #262638; }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-inline-start: auto; font-size: 12px; color: #6e6e88; }
#term { margin: 0; padding: 18px; min-height: 260px; font-size: 13px; line-height: 1.7; color: #d6d6e6; white-space: pre-wrap; }
#term .p { color: #8b7fff; }
#term .c { color: #2dd4bf; }
#term .m { color: #6e6e88; }
#term .cursor { display: inline-block; width: 8px; height: 15px; background: #d6d6e6; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.stat b { display: block; font-size: 30px; font-weight: 800; color: var(--accent); }
.stat span { color: var(--muted); font-size: 14px; }

/* ---------- sections ---------- */
.section { padding-top: 96px; scroll-margin-top: -72px; }
.section-head { margin-bottom: 32px; }
h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font: 500 14px inherit; font-family: inherit;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- project cards ---------- */
.project {
  display: grid; gap: 20px;
  padding: 28px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--bg-2); box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s;
}
@media (max-width: 480px) { .project { padding: 20px; } }
@media (min-width: 820px) { .project { grid-template-columns: 120px 1fr; } }
.project:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.project.hidden { display: none; }
.p-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; align-content: start; }
@media (min-width: 820px) { .p-meta { flex-direction: column; align-items: flex-start; } }
.p-num { font-size: 40px; font-weight: 600; line-height: 1; color: var(--accent); opacity: .9; }
.p-date { font-size: 13px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); }
.badge.live { color: var(--live); border-color: color-mix(in srgb, var(--live) 40%, transparent); }
.badge .dot { width: 6px; height: 6px; }
.p-body h3 { font-size: 26px; font-weight: 700; }
.p-tagline { margin: 10px 0 0; font-size: 17px; color: var(--muted); }
.p-points { margin: 18px 0 0; padding-inline-start: 20px; display: grid; gap: 8px; font-size: 15px; }
.p-points li::marker { color: var(--accent); }
.p-points b { font-weight: 600; }

.flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0;
  margin-top: 22px; padding: 14px; border-radius: 14px;
  background: var(--bg); border: 1px dashed var(--line);
  direction: ltr;
}
.node { padding: 6px 12px; border-radius: 8px; background: var(--node); border: 1px solid var(--line); font: 500 13px "JetBrains Mono", monospace; white-space: nowrap; }
.node.hl { border-color: var(--accent); color: var(--accent); }
.edge { position: relative; width: 26px; height: 2px; background: var(--line); overflow: hidden; }
.edge::after { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: var(--accent); animation: flow 1.6s linear infinite; }
@keyframes flow { to { left: 100%; } }

.stack { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.stack span { padding: 4px 10px; border-radius: 6px; font-size: 13px; background: var(--node); color: var(--text); border: 1px solid var(--line); }
.p-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.note { margin: 12px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- about ---------- */
.about-grid { display: grid; gap: 32px; }
@media (min-width: 880px) { .about-grid { grid-template-columns: 1fr 1fr; } }
.timeline { border-inline-start: 2px solid var(--line); padding-inline-start: 24px; display: grid; gap: 28px; }
.t-item { position: relative; }
.t-item::before { content: ""; position: absolute; inset-inline-start: -32px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.t-date { font-size: 13px; color: var(--accent); }
.t-item h4 { font-size: 18px; margin-top: 4px; }
.t-item p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.skills { display: grid; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg-2); }
.s-group h5 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.s-group .stack { margin-top: 8px; }

/* ---------- contact ---------- */
.contact { text-align: center; }
.contact .lead { margin-inline: auto; }
.contact-links { display: grid; gap: 12px; margin-top: 32px; grid-template-columns: 1fr; text-align: start; }
@media (min-width: 620px) { .contact-links { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .contact-links { grid-template-columns: repeat(4, 1fr); } }
.c-card { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg-2); transition: transform .15s, border-color .15s; min-width: 0; }
.c-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.c-card svg { flex: none; color: var(--accent); }
.c-card span { display: grid; min-width: 0; }
.c-card small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 72px; padding-bottom: 32px; font-size: 12px; color: var(--muted); }

/* ---------- motion ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .edge::after, .dot, #term .cursor { animation: none; }
}

/* keep grid children from overflowing narrow screens */
.hero > *, .project > *, .about-grid > * { min-width: 0; }
