/* ============================================================
   Daniel Lahav — personal academic site
   Styled per "Main-Design-System" (Presentation Design System):
   light "Editorial" theme — cream canvas, brass gold accent,
   deep-navy pacing surfaces, Palatino display / Cambria serif /
   Inter UI. Fully responsive: desktop, tablet, and phone.
   ============================================================ */

:root {
  /* ---- Raw brand palette ---- */
  --gold:        #c29a4a;
  --gold-strong: #a07f34;
  --gold-soft:   #e4d2a8;
  --gold-bright: #e6a02e;
  --coral:        #cc785c;
  --coral-strong: #a9583e;
  --navy:      #0f1e3a;
  --navy-deep: #0b1929;
  --navy-soft: #16274a;
  --navy-line: #24324f;
  --red: #c00000;

  /* ---- Warm neutrals ---- */
  --cream:        #faf9f5;
  --cream-soft:   #f5f0e8;
  --cream-card:   #efe9de;
  --cream-strong: #e8e0d2;
  --ink:   #141413;
  --ink-2: #252523;
  --ink-3: #3d3d3a;
  --slate:      #5c6470;
  --slate-soft: #7f8b97;
  --muted:      #6c6a64;
  --muted-soft: #8e8b82;
  --hairline:      #e6dfd8;
  --hairline-soft: #ebe6df;
  --white: #ffffff;

  /* ---- Semantic aliases — light "Editorial" theme ---- */
  --bg:              var(--cream);
  --surface:         var(--cream-soft);
  --surface-card:    var(--cream-card);
  --outline-card-bg: var(--cream);
  --nav-bg:          rgba(250, 249, 245, 0.88);
  --text:        var(--ink);
  --text-strong: var(--ink-2);
  --text-body:   var(--ink-3);
  --text-muted:  var(--muted);
  --line:      var(--hairline);
  --line-soft: var(--hairline-soft);
  --primary:        var(--gold);
  --primary-strong: var(--gold-strong);
  --on-primary:     #201603;
  --accent:         var(--coral);
  --accent-strong:  var(--coral-strong);
  --contrast-bg: var(--ink);
  --contrast-fg: var(--cream);
  --focus-ring: rgba(194, 154, 74, 0.42);

  /* ---- Type ---- */
  --font-display: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'Cormorant Garamond', Georgia, serif;
  --font-serif:   'Cambria', 'Spectral', Georgia, 'Times New Roman', serif;
  --font-sans:    'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-display-xl: 64px; --fs-display-md: 36px;
  --fs-heading-md: 18px;
  --fs-body-lg: 18px; --fs-body-md: 16px; --fs-body-sm: 14px;
  --fs-caption: 13px; --fs-overline: 12px; --fs-button: 14px;
  --lh-body: 1.55;
  --ls-display: -0.02em; --ls-overline: 0.14em;

  /* ---- Spacing / radius / elevation ---- */
  --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px;
  --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-section: 96px;
  --container: 1200px;
  --radius-control: 8px;
  --radius-surface: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px rgba(20,20,19,.06);
  --shadow-md: 0 8px 28px rgba(15,30,58,.10);
  --shadow-lg: 0 24px 64px rgba(15,30,58,.16);

  color-scheme: light;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: var(--fs-body-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; color: var(--text); letter-spacing: var(--ls-display); margin: 0; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: rgba(194, 154, 74, 0.35); color: var(--text); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
img { display: block; max-width: 100%; }

.container { max-width: var(--container); margin-inline: auto; padding-inline: var(--space-5); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--primary); color: var(--on-primary);
  padding: 10px 18px; border-radius: 0 0 var(--radius-control) 0;
  font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-button);
}
.skip-link:focus { left: 0; text-decoration: none; }

/* The signature header unit: gold small-caps eyebrow above a Palatino title */
.overline {
  font-family: var(--font-sans); font-weight: 600;
  font-size: var(--fs-overline); line-height: 1.4;
  letter-spacing: var(--ls-overline); text-transform: uppercase;
  color: var(--primary-strong); margin: 0 0 var(--space-3);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: var(--fs-button); font-weight: 500; line-height: 1;
  height: 42px; padding: 11px 20px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--gold-strong); color: var(--on-primary); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-card); border-color: var(--muted-soft); color: var(--text); }
.btn-contrast { background: var(--contrast-bg); color: var(--contrast-fg); }
.btn-contrast:hover { opacity: 0.92; color: var(--contrast-fg); }

.icon-button {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--surface-card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  cursor: pointer; font-size: 16px; line-height: 1;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.icon-button:hover { border-color: var(--muted-soft); }

/* ============ Top navigation ============ */
.top-nav {
  position: sticky; top: 0; z-index: 40;
  height: 64px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.top-nav .container {
  height: 100%; display: flex; align-items: center; gap: var(--space-5);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 12px;
  text-decoration: none; white-space: nowrap;
}
.wordmark:hover { text-decoration: none; }
.wordmark .rule { width: 8px; height: 26px; border-radius: 2px; background: var(--gold); }
.wordmark .name {
  font-family: var(--font-display); font-weight: 500; font-size: 21px;
  letter-spacing: -0.01em; color: var(--text);
}
.nav-links { display: flex; align-items: center; gap: var(--space-5); flex: 1; }
.nav-links a {
  font-family: var(--font-sans); font-size: var(--fs-button); font-weight: 500;
  color: var(--text-muted); text-decoration: none;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.menu-toggle { display: none; font-size: 18px; }

/* Full cream sheet menu (phones) — per the design system's mobile spec */
.menu-sheet {
  display: none;
  position: fixed; inset: 0; z-index: 60;
  background: var(--cream);
  padding: var(--space-5);
  flex-direction: column;
}
.menu-sheet.open { display: flex; }
.menu-sheet-head { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.menu-sheet-links { display: grid; gap: var(--space-2); margin-top: var(--space-7); }
.menu-sheet-links a {
  font-family: var(--font-display); font-weight: 500; font-size: 30px;
  letter-spacing: -0.01em; color: var(--text); text-decoration: none;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--line-soft);
}
.menu-sheet-links a:hover { color: var(--primary-strong); text-decoration: none; }
.menu-sheet .btn { margin-top: var(--space-6); width: 100%; }
body.menu-open { overflow: hidden; }

/* ============ Hero ============ */
.hero { padding: 72px 0 var(--space-8); }
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-8); align-items: center;
}
.hero h1 {
  font-size: clamp(40px, 3.2vw + 24px, var(--fs-display-xl));
  line-height: 1.05;
  max-width: 15ch;
}
.hero .gold-rule { width: 120px; height: 5px; background: var(--gold); border-radius: 3px; margin: var(--space-5) 0; }
.hero .lede {
  font-family: var(--font-serif); font-size: 20px; line-height: 1.5;
  color: var(--text-body); max-width: 46ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

/* Portrait — figure in a hairline-framed rounded-xl navy card */
.portrait-card {
  background: var(--navy); border: 1px solid var(--navy-line);
  border-radius: var(--radius-xl); padding: var(--space-4);
  max-width: 420px; justify-self: end;
}
.portrait-card img { width: 100%; height: auto; border-radius: calc(var(--radius-xl) - 6px); }
.portrait-card figcaption {
  display: flex; align-items: center; gap: 10px;
  padding: var(--space-4) var(--space-2) var(--space-2);
}
.portrait-card figcaption .rule { width: 6px; height: 20px; border-radius: 2px; background: var(--gold); flex: none; }
.portrait-card figcaption span { font-family: var(--font-sans); font-size: var(--fs-caption); color: #9ba8b7; }
.portrait-card figcaption strong { color: #f1ead9; font-weight: 600; }

/* Record stats — miniature big-stat unit */
.record-stats {
  display: flex; flex-wrap: wrap; gap: var(--space-8);
  margin-top: var(--space-8); padding-top: var(--space-6);
  border-top: 1px solid var(--line);
}
.record-stats .stat .num {
  font-family: var(--font-display); font-weight: 500;
  font-size: 44px; line-height: 1.05; letter-spacing: var(--ls-display);
  color: var(--primary-strong);
}
.record-stats .stat .cap { font-size: var(--fs-body-sm); color: var(--text-muted); margin-top: 4px; }

/* ============ Section scaffolding ============ */
.band { padding: var(--space-section) 0; }
.band-surface { background: var(--surface); }
.band-navy { background: var(--navy); }
.band-navy .overline { color: var(--gold-soft); }
.section-head { max-width: 720px; margin-bottom: var(--space-7); }
.section-head h2 {
  font-size: clamp(28px, 2vw + 18px, var(--fs-display-md));
  line-height: 1.15; letter-spacing: -0.01em;
}
.band-navy .section-head h2 { color: #f1ead9; }

/* ============ Profile ============ */
.profile-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-8); align-items: start; }
.prose .serif-lead {
  font-family: var(--font-serif); font-size: 20px; line-height: 1.55; color: var(--text-strong);
}
.prose p + p { margin-top: var(--space-5); }
.prose p { font-size: var(--fs-body-lg); line-height: var(--lh-body); }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--accent-strong); }

/* Navy facts card (fixed navy in both themes — pacing surface) */
.facts-card {
  background: var(--navy); color: #f1ead9;
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-surface); padding: var(--space-6);
}
.facts-card .fact + .fact { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--navy-line); }
.facts-card .overline { color: var(--gold-soft); margin-bottom: var(--space-2); }
.facts-card p { font-size: var(--fs-body-sm); line-height: 1.55; color: #f1ead9; }

/* ============ Research feature cards ============ */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.feature-card {
  background: var(--surface-card); border-radius: var(--radius-surface);
  padding: var(--space-6);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.feature-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-card .overline { margin-bottom: var(--space-3); }
.feature-card h3 {
  font-size: 24px; font-weight: 500; line-height: 1.2; letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}
.feature-card p { font-size: var(--fs-body-md); color: var(--text-body); }

/* ============ Publications (navy band, numbered rows) ============ */
.pub-row {
  display: grid; grid-template-columns: 96px 1fr; gap: var(--space-6);
  padding: var(--space-6) 0; border-top: 1px solid var(--navy-line);
}
.pub-row:last-of-type { border-bottom: 1px solid var(--navy-line); }
.pub-num {
  font-family: var(--font-display); font-weight: 500;
  font-size: 44px; line-height: 1; letter-spacing: var(--ls-display);
  color: var(--gold);
}
.pub-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-2); }
.pub-venue {
  font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-overline);
  letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--gold-soft);
}
.badge-gold {
  display: inline-flex; align-items: center;
  background: var(--gold); color: #201603;
  font-family: var(--font-sans); font-weight: 500; font-size: var(--fs-caption); line-height: 1.4;
  border-radius: var(--radius-pill); padding: 3px 12px;
}
.pub-title {
  font-family: var(--font-display); font-weight: 500;
  font-size: 26px; line-height: 1.2; letter-spacing: -0.01em;
  color: #f1ead9; margin: 0 0 var(--space-2);
}
.pub-authors { font-size: var(--fs-body-sm); color: #9ba8b7; }
.pub-authors strong { color: #f1ead9; font-weight: 600; }
.pub-links { margin-top: var(--space-3); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-5); }
.pub-links a {
  font-family: var(--font-sans); font-weight: 500; font-size: var(--fs-body-sm);
  color: var(--gold-soft);
}
.pub-links a:hover { color: var(--gold-bright); }
.bibtex-btn {
  font-family: var(--font-sans); font-weight: 500; font-size: var(--fs-body-sm);
  background: transparent; color: var(--gold-soft);
  border: 1px solid var(--navy-line); border-radius: var(--radius-control);
  padding: 5px 12px; cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}
.bibtex-btn:hover { border-color: var(--gold-soft); }
.bibtex-btn.copied { color: #5db872; border-color: #5db872; }
.pub-footnote { margin-top: var(--space-6); font-size: var(--fs-body-sm); color: #9ba8b7; }

/* ============ Experience & education ============ */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-8); align-items: start; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 1px; background: var(--line);
}
.timeline li { position: relative; padding-left: var(--space-6); }
.timeline li + li { margin-top: var(--space-6); }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 7px;
  width: 11px; height: 11px; border-radius: var(--radius-pill);
  background: var(--gold); border: 2px solid var(--bg);
}
.t-when {
  font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-overline);
  letter-spacing: var(--ls-overline); text-transform: uppercase; color: var(--primary-strong);
}
.t-what { font-family: var(--font-sans); font-weight: 600; font-size: var(--fs-heading-md); color: var(--text); margin-top: 4px; line-height: 1.35; }
.t-note { font-size: var(--fs-body-sm); color: var(--text-body); margin-top: 4px; }

/* ============ Teaching / conferences outline cards ============ */
.outline-card {
  background: var(--outline-card-bg); border: 1px solid var(--line);
  border-radius: var(--radius-surface); padding: var(--space-6);
}
.outline-card h3 { font-size: 24px; letter-spacing: -0.01em; margin-bottom: var(--space-4); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { position: relative; padding-left: var(--space-5); }
.plain-list li + li { margin-top: var(--space-4); }
.plain-list li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--gold);
}
.plain-list .what { font-family: var(--font-sans); font-weight: 500; color: var(--text); }
.plain-list .where { font-size: var(--fs-body-sm); color: var(--text-muted); margin-top: 2px; }

/* ============ Gold callout band ============ */
.callout {
  background: var(--gold); color: #201603;
  border-radius: var(--radius-2xl); padding: 56px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-6);
}
.callout h2 {
  font-size: clamp(26px, 2vw + 16px, var(--fs-display-md));
  line-height: 1.15; letter-spacing: -0.01em; color: #201603;
  max-width: 22ch;
}
.callout .sub { font-family: var(--font-serif); font-size: var(--fs-body-lg); color: rgba(32, 22, 3, 0.8); margin-top: var(--space-2); }
.callout .btn-contrast { background: #141413; color: #faf9f5; }
.callout .btn-contrast:hover { background: #252523; color: #faf9f5; }

/* ============ Contact dialog ============ */
.contact-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-surface);
  background: var(--bg); color: var(--text-body);
  box-shadow: var(--shadow-lg);
  padding: var(--space-7);
  width: min(460px, calc(100vw - 40px));
}
.contact-dialog::backdrop {
  background: rgba(15, 30, 58, 0.55);
  backdrop-filter: blur(2px);
}
.contact-dialog h3 {
  font-size: 30px; letter-spacing: -0.01em; margin-bottom: var(--space-2);
}
.contact-dialog .sub { font-family: var(--font-serif); font-size: var(--fs-body-lg); color: var(--text-body); margin-bottom: var(--space-5); }
.contact-actions { display: grid; gap: var(--space-3); }
.contact-actions .btn { width: 100%; }
.dialog-close {
  position: absolute; top: var(--space-4); right: var(--space-4);
  background: transparent; border: 0; color: var(--text-muted);
  font-size: 22px; line-height: 1; cursor: pointer; padding: 6px;
  border-radius: var(--radius-pill);
}
.dialog-close:hover { color: var(--text); }
.dialog-links {
  display: flex; flex-wrap: wrap; gap: var(--space-4);
  margin-top: var(--space-5); padding-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.dialog-links a { font-size: var(--fs-body-sm); font-weight: 500; color: var(--accent); }

/* ============ Footer (navy — never inverts) ============ */
.site-footer { background: var(--navy); color: var(--slate-soft); padding: var(--space-8) 0; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-5); }
.site-footer .wordmark .name { color: #f1ead9; }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.footer-links a { font-size: var(--fs-body-sm); font-weight: 500; color: var(--slate-soft); }
.footer-links a:hover { color: var(--gold-soft); text-decoration: none; }
.footer-note {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3);
  margin-top: var(--space-6); padding-top: var(--space-4);
  border-top: 1px solid var(--navy-line);
  font-size: var(--fs-body-sm); color: var(--slate-soft);
}

/* ============ 404 ============ */
.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: var(--space-8) var(--space-5); }
.error-page .num { font-family: var(--font-display); font-weight: 500; font-size: 96px; color: var(--primary-strong); letter-spacing: var(--ls-display); line-height: 1; }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .profile-grid { grid-template-columns: 1fr; }
}

/* Tablet & phone: hero stacks, centered composition, portrait first */
@media (max-width: 900px) {
  .hero { padding-top: var(--space-7); }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    justify-items: center;
    text-align: center;
  }
  .portrait-card {
    order: -1;
    max-width: 216px;
    padding: 9px;
    justify-self: center;
  }
  .portrait-card figcaption { display: none; }
  .hero h1 { max-width: none; }
  .hero .gold-rule { margin-inline: auto; }
  .hero .lede { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .record-stats {
    justify-content: center;
    text-align: center;
    gap: var(--space-7);
  }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .menu-toggle { display: inline-grid; }
  .hero h1 { font-size: 40px; }
  .band { padding: var(--space-8) 0; }
  .card-grid { grid-template-columns: 1fr; }
  .pub-row { grid-template-columns: 1fr; gap: var(--space-3); }
  .pub-num { font-size: 32px; }
  .pub-title { font-size: 22px; }
  .callout { padding: var(--space-6); text-align: center; justify-content: center; }
  .callout h2 { max-width: none; }
  .section-head h2 { font-size: 26px; }
  .facts-card, .outline-card, .feature-card { padding: var(--space-5); }
}

/* Small phones */
@media (max-width: 480px) {
  .container { padding-inline: var(--space-4); }
  .hero h1 { font-size: 34px; }
  .hero .lede { font-size: 18px; }
  .hero-actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 320px; margin-inline: auto; }
  .record-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }
  .record-stats .stat .num { font-size: 32px; }
  .record-stats .stat .cap { font-size: 12px; }
  .top-nav .container { gap: var(--space-3); }
  .wordmark .name { font-size: 19px; }
  .nav-actions .btn { padding-inline: 14px; }
  .callout .btn { width: 100%; }
  .footer-top, .footer-note { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .feature-card { transition: none; }
}

/* ============ Print ============ */
@media print {
  .top-nav, .callout, .contact-dialog, .menu-sheet, .skip-link, .bibtex-btn { display: none !important; }
  body { background: #fff; color: #141413; }
  .band, .hero { padding: 16px 0; }
  .band-navy, .facts-card, .portrait-card, .site-footer { background: #fff !important; border-color: #ddd; }
  .pub-title, .band-navy .section-head h2, .facts-card p, .site-footer .wordmark .name { color: #141413 !important; }
  .pub-authors, .pub-venue, .pub-footnote { color: #555 !important; }
  a { color: #141413; text-decoration: none; }
  .record-stats, .hero-actions { display: none; }
}
