/* Rami Benbenishty – site styles (shared by every page) */

:root {
  --paper: #f1f2f0;
  --surface: #fafaf8;
  --ink: #151c24;
  --muted: #566370;
  --line: #d5d9d6;
  --accent: #2c5a79;
  --accent-ink: #ffffff;
  --accent-soft: #e1eaef;
  --serif: "Spectral", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --maxw: 1120px;
  --gutter: clamp(20px, 5vw, 48px);
  --radius: 10px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0f151b;
  --surface: #151d25;
  --ink: #e8ecef;
  --muted: #94a1ac;
  --line: #28343e;
  --accent: #86b4d0;
  --accent-ink: #0f151b;
  --accent-soft: #1b2833;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f151b;
    --surface: #151d25;
    --ink: #e8ecef;
    --muted: #94a1ac;
    --line: #28343e;
    --accent: #86b4d0;
    --accent-ink: #0f151b;
    --accent-soft: #1b2833;
    color-scheme: dark;
  }
}

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

html {
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

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

.skip {
  position: absolute; left: 12px; top: -60px;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: 6px; z-index: 100;
}
.skip:focus { top: 12px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; min-height: 68px;
}
.brand {
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 999px;
  transition: color .15s, background-color .15s;
}
.nav a:hover { color: var(--ink); background: var(--accent-soft); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }

.icon-btn {
  appearance: none; border: 1px solid var(--line);
  background: transparent; color: var(--ink);
  width: 40px; height: 40px; border-radius: 999px;
  display: inline-grid; place-items: center; cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }
.nav-toggle { display: none; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

@media (max-width: 1120px) {
  .nav-toggle { display: inline-grid; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; border-radius: 8px; }
  .header-tools { display: flex; gap: 8px; }
}
.header-tools { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font: inherit; font-size: 0.97rem; font-weight: 500;
  text-decoration: none; cursor: pointer;
  border: 1px solid var(--ink);
  color: var(--ink); background: transparent;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------- Home hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  padding-top: clamp(48px, 9vw, 112px);
  padding-bottom: clamp(48px, 9vw, 112px);
}
.hero h1 {
  font-size: clamp(3rem, 8.2vw, 6.6rem);
  font-weight: 300;
  line-height: 0.98;
  letter-spacing: -0.03em;
}
.hero .role {
  margin: 28px 0 0;
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 34ch;
}
.hero .role strong { color: var(--ink); font-weight: 500; }
.hero .actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }

.portrait { position: relative; justify-self: end; width: min(100%, 380px); }
.portrait::before {
  content: ""; position: absolute; inset: 18px -18px -18px 18px;
  border: 1px solid var(--accent); border-radius: var(--radius);
  opacity: .55;
}
.portrait img {
  position: relative; width: 100%; aspect-ratio: 4 / 4.6; object-fit: cover;
  object-position: 42% 20%;
  border-radius: var(--radius);
  filter: saturate(.92);
}

@media (max-width: 820px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .portrait { justify-self: start; width: min(100%, 300px); margin-right: 18px; }
}

/* ---------- Sections ---------- */

.section { padding: clamp(56px, 8vw, 104px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 62ch; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
.section-head p { margin: 14px 0 0; color: var(--muted); }

.prose { max-width: 64ch; font-family: var(--serif); font-size: 1.2rem; line-height: 1.7; }
.prose p { margin: 0 0 1.1em; }

.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.8fr); gap: clamp(32px, 6vw, 80px); }
@media (max-width: 820px) { .about { grid-template-columns: 1fr; } }

.facts { margin: 0; display: grid; gap: 0; align-content: start; }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.facts div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: .95rem; }
.facts dd { margin: 0; }

/* Research areas: full-width rows */
.areas { border-top: 1px solid var(--ink); }
.area {
  display: grid; grid-template-columns: 5fr 7fr auto; gap: 24px; align-items: baseline;
  padding: 28px 8px; border-bottom: 1px solid var(--line);
  color: inherit; text-decoration: none;
  transition: background-color .2s, padding .2s;
}
.area:hover { background: var(--accent-soft); padding-left: 20px; padding-right: 20px; text-decoration: none; }
.area h3 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.area p { margin: 0; color: var(--muted); max-width: 52ch; }
.area .go { color: var(--accent); font-size: 1.3rem; transition: transform .2s; }
.area:hover .go { transform: translateX(6px); }
@media (max-width: 760px) {
  .area { grid-template-columns: 1fr auto; }
  .area p { grid-column: 1 / -1; }
}

/* Timeline (a true sequence, so it carries years) */
.timeline-scroll { overflow-x: auto; padding-bottom: 12px; margin: 0 calc(var(--gutter) * -1); padding-left: var(--gutter); padding-right: var(--gutter); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; min-width: 980px; border-top: 2px solid var(--ink); }
.timeline li { position: relative; flex: 1 0 140px; padding: 26px 24px 0 0; }
.timeline li::before {
  content: ""; position: absolute; top: -7px; left: 0;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--ink);
}
.timeline li.major::before { background: var(--accent); border-color: var(--accent); }
.timeline time { font-family: var(--serif); font-size: 1.7rem; display: block; line-height: 1; margin-bottom: 8px; }
.timeline span { color: var(--muted); font-size: .95rem; line-height: 1.45; display: block; }

/* Books */
.books { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.books li { display: grid; grid-template-columns: 5.5rem 1fr; gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.books .yr { font-family: var(--serif); font-size: 1.4rem; color: var(--muted); }
.books .t { font-family: var(--serif); font-size: 1.35rem; line-height: 1.25; }
.books .m { color: var(--muted); font-size: .95rem; margin-top: 4px; }

/* Honours */
.honors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 40px; }
.honors li { padding: 18px 0; border-top: 1px solid var(--line); }
.honors b { font-family: var(--serif); font-size: 1.2rem; font-weight: 500; display: block; line-height: 1.3; }
.honors span { color: var(--muted); font-size: .95rem; }

.contact-row { display: flex; flex-wrap: wrap; gap: 12px 40px; font-size: 1.1rem; }
.contact-row a { color: var(--ink); }

/* ---------- Inner pages ---------- */

.page-head { padding: clamp(48px, 7vw, 88px) 0 clamp(32px, 4vw, 48px); border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(2.4rem, 5.6vw, 4.2rem); font-weight: 300; letter-spacing: -0.025em; max-width: 18ch; }
.page-head .lede { margin: 22px 0 0; max-width: 58ch; font-size: 1.2rem; color: var(--muted); font-family: var(--serif); line-height: 1.6; }
.crumbs { margin: 0 0 20px; font-size: .95rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); padding-top: clamp(32px, 5vw, 56px); padding-bottom: clamp(64px, 8vw, 112px); }
.toc { position: sticky; top: 96px; align-self: start; }
.toc p { margin: 0 0 10px; font-size: .9rem; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 7px 0 7px 16px; margin-left: -1px;
  border-left: 2px solid transparent; color: var(--muted);
  text-decoration: none; font-size: .95rem; line-height: 1.35;
}
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); border-left-color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc ul { display: flex; flex-wrap: wrap; gap: 8px; border: 0; }
  .toc a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; margin: 0; }
  .toc a.active { border-color: var(--accent); background: var(--accent-soft); }
}

.block { padding-bottom: clamp(40px, 6vw, 72px); }
.block + .block { padding-top: clamp(40px, 6vw, 72px); border-top: 1px solid var(--line); }
.block > h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin-bottom: 24px; }
.block > .intro { color: var(--muted); max-width: 62ch; margin: -8px 0 28px; }

.topic { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 22px 0; border-top: 1px solid var(--line); max-width: 70ch; }
.topic:first-of-type { border-top: 1px solid var(--ink); }
.topic h3 { font-size: 1.35rem; }
.topic p { margin: 0; color: var(--muted); }
.topic p + p { margin-top: 8px; }

/* Rows used for education, career, service, awards */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.rows li { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.rows .when { font-variant-numeric: tabular-nums; color: var(--muted); }
.rows .what b { font-weight: 500; }
.rows .what small { display: block; color: var(--muted); font-size: .93rem; line-height: 1.5; margin-top: 2px; }
@media (max-width: 600px) { .rows li { grid-template-columns: 1fr; gap: 2px; } }

/* Publications */
.pub-tools { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 20px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  appearance: none; font: inherit; font-size: .95rem; cursor: pointer;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 16px;
  transition: background-color .15s, color .15s, border-color .15s;
}
.tab:hover { border-color: var(--accent); color: var(--ink); }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search {
  flex: 1 1 240px; min-width: 200px; font: inherit; font-size: .98rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 18px;
}
.search::placeholder { color: var(--muted); }
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.count { color: var(--muted); font-size: .93rem; margin: 0 0 8px; min-height: 1.5em; }

.pubs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.pubs li { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr); gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: .98rem; line-height: 1.55; }
.pubs .y { font-family: var(--serif); font-size: 1.15rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pubs b { font-weight: 600; }
.pubs i { font-style: italic; }
.pubs .tag { display: inline-block; margin-left: 6px; font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; vertical-align: 1px; }
.pubs li[hidden] { display: none; }
.empty { padding: 28px 0; color: var(--muted); }

.stats { display: flex; flex-wrap: wrap; gap: 8px 36px; margin: 0 0 32px; padding: 0; list-style: none; }
.stats li { color: var(--muted); }
.stats b { font-family: var(--serif); font-size: 2rem; font-weight: 400; color: var(--ink); margin-right: 8px; }

.files { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--ink); }
.files li { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.note { color: var(--muted); font-size: .97rem; max-width: 60ch; }

.more { margin-top: 22px; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; color: var(--muted); font-size: .93rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

@media print {
  .site-header, .toc, .hero canvas, .pub-tools, .site-footer { display: none; }
  body { background: #fff; color: #000; }
}
