:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --border: #e5e5e0;
  --text: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #2d5a8e;
  --accent-light: #eaf0f8;
  --tag-bg: #f0f4fb;
  --tag-text: #2d5a8e;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --max-w: 800px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.65;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 5px;
}

/* ── Layout ── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem; }

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 0.75rem 0;
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  flex-wrap: nowrap;
}

.nav-name {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: auto;
  padding-right: 2rem;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1rem;
  list-style: none;
  flex-wrap: nowrap;
  align-items: center;
}

.nav-links a {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a.nav-demo { color: var(--muted); font-weight: 500; }

/* ── Hero ── */
.hero {
  padding: 5rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 2.5rem;
  align-items: center;
}

.hero-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.hero-joke {
  font-family: var(--font-serif);
  font-size: 2.6rem;
  font-weight: normal;
  line-height: 1.25;
  margin-bottom: 1.5rem;
  letter-spacing: 0;
  color: var(--text);
}

.punchline {
  color: var(--accent);
  display: inline-block;
  position: relative;
}

.punchline::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 2px;
  background: currentColor;
  opacity: 0.25;
  border-radius: 2px;
}

.hero .tagline {
  font-size: 1.0rem;
  color: var(--muted);
  max-width: 600px;
  margin-bottom: 0.45rem;
  line-height: 1.7;
}

.credential-lines {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 1.75rem;
}

.credential-lines p {
  margin-bottom: 0.25rem;
}

.credential-lines a {
  color: var(--accent);
  font-weight: 700;
}

.hero-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #1e4270; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--accent-light); text-decoration: none; }

.profile-card {
  justify-self: end;
  width: min(340px, 100%);
  aspect-ratio: 1 / 1;
}

.profile-headshot {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 45%;
  border: 1px solid var(--border);
}

/* ── Sections ── */
section { padding: 4rem 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: none; }

.section-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.25rem;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: normal;
  letter-spacing: -0.015em;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.research-photo-card {
  margin: 0 0 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.research-photo {
  display: block;
  width: 100%;
  height: clamp(220px, 34vw, 360px);
  object-fit: cover;
  object-position: 42% 42%;
}

.research-photo-card figcaption {
  padding: 0.75rem 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
}

/* ── Project cards ── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.project-card:hover {
  border-color: #c5d5e8;
  box-shadow: 0 2px 12px rgba(45, 90, 142, 0.09);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.project-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.2rem 0.6rem;
  flex-shrink: 0;
}

.project-link:hover { background: var(--accent-light); text-decoration: none; }

.project-card p {
  font-size: 0.875rem;
  color: #444;
  line-height: 1.6;
}

.project-card .paper-tags { margin-top: 0.25rem; }

.project-bridge {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--muted);
  border-left: 2px solid var(--accent-light);
  padding-left: 0.75rem;
}

/* ── Research tabs ── */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:hover:not(.active) { color: var(--text); }
.tab-btn:focus-visible { position: relative; z-index: 1; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Paper card ── */
.paper-list { display: flex; flex-direction: column; gap: 1.25rem; }

.paper-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.paper-card:hover {
  border-color: #c5d5e8;
  box-shadow: 0 2px 10px rgba(45, 90, 142, 0.08);
}

.paper-card h3 {
  font-size: 0.975rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}

.paper-card h3 a:hover { text-decoration: none; }

.paper-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.paper-abstract {
  font-size: 0.875rem;
  color: #444;
  line-height: 1.6;
  margin-bottom: 0.85rem;
}

.contribution-callout {
  border: 1px solid #c5d5e8;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--accent-light);
  padding: 0.75rem 0.85rem;
  margin: 0.2rem 0 0.9rem;
}

.callout-label {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.contribution-callout a {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.contribution-callout p {
  color: #38495d;
  font-size: 0.82rem;
  line-height: 1.55;
  margin-top: 0.35rem;
}

.paper-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

/* ── Democracy section ── */
.democracy-section {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 2rem 2.25rem;
}

.democracy-section p {
  font-size: 0.975rem;
  line-height: 1.75;
  color: #333;
  margin-bottom: 1rem;
}

.democracy-section p:last-child { margin-bottom: 0; }

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--muted);
  font-style: italic;
  margin: 1.5rem 0;
  line-height: 1.7;
}

/* ── Footer ── */
footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); text-decoration: none; }

/* ── Hebrew name ── */
.hebrew-name {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75em;
  font-weight: 400;
  color: var(--muted);
  vertical-align: baseline;
}

@media (max-width: 600px) {
  .hebrew-name {
    display: block;
    margin-left: 0;
    margin-top: 0.25rem;
    font-size: 0.85em;
  }
}

/* ── Video embeds ── */
.video-embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  display: block;
  margin-top: 0.5rem;
}

.video-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.presentation-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

/* ── RTL / Hebrew page ── */
html[lang="he"] body {
  direction: rtl;
  text-align: right;
}

html[lang="he"] .ltr,
html[lang="he"] [dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.language-switch {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  nav .container { align-items: flex-start; gap: 0.75rem; }
  .nav-links { flex-wrap: wrap; gap: 0.65rem 1rem; justify-content: flex-end; }
  .nav-links a { font-size: 0.8rem; }
  .hero-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero h1 { font-size: 2rem; }
  .profile-card {
    justify-self: start;
    width: min(280px, 100%);
  }
  .section-header { flex-direction: column; gap: 0.25rem; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card-header { flex-direction: column; }
  .tab-bar { overflow-x: auto; }
  footer .container { flex-direction: column; align-items: flex-start; }
}
