/* =========================================================================
   אתר הנצחה — פרופ' דניאל (דני) דוד
   פלטת "סַלמון-חמרה": מרווה, ברונזה וקרם — אלגנטי, מכובד וחם.
   ========================================================================= */

:root {
  --bg:        #f5efe3;
  --bg-alt:    #ece2d0;
  --paper:     #fbf8f1;
  --ink:       #2a2620;
  --ink-soft:  #4a443b;
  --muted:     #7a7061;
  --sage:      #4f6152;
  --sage-deep: #37473c;
  --bronze:    #a97a3f;
  --bronze-lt: #c39a5f;
  --line:      rgba(55, 45, 30, 0.14);
  --shadow:    0 18px 50px -22px rgba(50, 40, 25, 0.45);
  --shadow-sm: 0 8px 24px -14px rgba(50, 40, 25, 0.4);
  --serif: "Frank Ruhl Libre", "Times New Roman", serif;
  --sans:  "Assistant", "Segoe UI", system-ui, sans-serif;
  --maxw: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; overflow-x: hidden; max-width: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.85;
  font-size: 18px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.25;
  color: var(--sage-deep);
  margin: 0 0 .5em;
}

p { margin: 0 0 1.15em; }
a { color: var(--bronze); text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---- decorative eyebrow / dividers ------------------------------------ */
.eyebrow {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: .22em;
  font-size: .78rem;
  color: var(--bronze);
  text-transform: none;
  margin-bottom: .9rem;
  display: inline-block;
}
.ornament {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; color: var(--bronze); margin: 0 auto 2.6rem;
}
.ornament::before, .ornament::after {
  content: ""; height: 1px; width: 60px;
  background: linear-gradient(90deg, transparent, var(--bronze));
}
.ornament::after { background: linear-gradient(270deg, transparent, var(--bronze)); }
.ornament span { font-size: 1.1rem; }

/* =========================================================================
   NAV
   ========================================================================= */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px clamp(20px, 4vw, 48px);
  transition: background .4s ease, box-shadow .4s ease, padding .4s ease;
}
.nav.scrolled {
  background: rgba(251, 248, 241, .92);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--line);
  padding-top: 12px; padding-bottom: 12px;
}
.nav__brand {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600;
  color: var(--sage-deep); letter-spacing: .02em; transition: color .4s ease;
}
.nav__links { display: flex; gap: clamp(10px, 1.6vw, 26px); align-items: center; }
.nav__links a {
  color: var(--ink-soft); font-weight: 600; font-size: .95rem;
  transition: color .3s ease; position: relative;
}
.nav__links a::after {
  content: ""; position: absolute; bottom: -5px; right: 0; height: 2px;
  width: 0; background: var(--bronze); transition: width .3s ease;
}
.nav__links a:hover::after { width: 100%; }
.nav__toggle { display: none; background: none; border: 0; cursor: pointer; }

/* =========================================================================
   HERO
   ========================================================================= */
.hero {
  position: relative; min-height: 100vh; display: flex; align-items: center;
  overflow: hidden; padding: 96px 0 64px; isolation: isolate;
  background: radial-gradient(130% 110% at 78% 20%, #fcf9f1 0%, var(--bg) 46%, var(--bg-alt) 100%);
}
.hero__inner {
  display: grid; grid-template-columns: 1fr auto;
  gap: clamp(8px, 2vw, 28px); align-items: center; width: 100%;
  position: relative;
}
.hero__text { max-width: 560px; position: relative; z-index: 3; }
.hero__portrait {
  margin: 0; position: relative; z-index: 1;
  transform: translateX(clamp(44px, 5.5vw, 90px)); /* physical right = toward text (RTL) → overlap */
  animation: heroFade 1.1s ease both;
}
@keyframes heroFade { from { opacity: 0; } to { opacity: 1; } }
.hero__portrait img {
  display: block; position: relative; z-index: 1;
  height: min(86vh, 780px); width: auto; max-width: 48vw;
  border-radius: 8px; box-shadow: 0 34px 66px -22px rgba(50, 40, 25, .55);
}
/* stylish sage backdrop panel (peeks up & outward) */
.hero__portrait::before {
  content: ""; position: absolute; z-index: 0;
  top: -30px; inset-inline-end: -38px; width: 84%; height: 93%;
  background: linear-gradient(155deg, var(--sage) 0%, var(--sage-deep) 100%);
  border-radius: 12px;
}
/* thin bronze frame (peeks down & inward) */
.hero__portrait::after {
  content: ""; position: absolute; z-index: 0;
  bottom: -18px; inset-inline-start: -18px; width: 100%; height: 100%;
  border: 1px solid var(--bronze); border-radius: 8px;
}
.hero__kicker {
  font-family: var(--serif); font-style: italic; font-size: clamp(1.3rem, 3vw, 2.1rem);
  color: var(--bronze); margin-bottom: .5rem;
}
.hero h1 {
  color: var(--sage-deep); font-size: clamp(2.6rem, 6vw, 4.8rem); margin: 0 0 .3em;
  letter-spacing: .01em;
}
.hero__role {
  font-size: clamp(1.05rem, 2.2vw, 1.35rem); font-weight: 500;
  color: var(--ink-soft); max-width: 540px; margin-bottom: 1.3rem;
}
.hero__years {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--serif); font-size: 1.15rem; letter-spacing: .08em;
  color: var(--bronze); border-top: 1px solid var(--line);
  padding-top: 14px;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.scrollcue {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 3; color: var(--muted); font-size: .8rem; letter-spacing: .2em;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  animation: floaty 2.4s ease-in-out infinite;
}
@keyframes floaty { 0%,100% { transform: translate(-50%, 0);} 50% { transform: translate(-50%, 8px);} }

/* =========================================================================
   SECTION SHELL
   ========================================================================= */
section { position: relative; }
.section { padding: clamp(64px, 10vh, 128px) 0; }
.section--alt { background: var(--bg-alt); }
.section--paper { background: var(--paper); }
.section__head { text-align: center; max-width: 760px; margin: 0 auto clamp(40px, 6vh, 70px); }
.section__head h2 { font-size: clamp(2rem, 4.6vw, 3.1rem); }
.section__head p { color: var(--muted); font-size: 1.1rem; }

/* ---- prologue ---------------------------------------------------------- */
.prologue { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 5vw, 70px); align-items: center; }
.prologue__img { position: relative; }
.prologue__img img {
  width: 100%; border-radius: 4px; box-shadow: var(--shadow);
  filter: grayscale(.15) contrast(1.02);
}
.prologue__img::after {
  content: ""; position: absolute; inset: 14px 14px auto auto;
  width: 100%; height: 100%; border: 1px solid var(--bronze);
  border-radius: 4px; z-index: -1;
}
.prologue blockquote {
  margin: 0; font-family: var(--serif); font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  line-height: 1.5; color: var(--sage-deep);
}
.prologue blockquote span { color: var(--bronze); }
.prologue cite { display: block; margin-top: 1.2rem; font-style: normal; font-weight: 600; color: var(--muted); font-family: var(--sans); font-size: 1rem; }

/* ---- stats ------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 8px; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 28px 20px; text-align: center; box-shadow: var(--shadow-sm);
  transition: transform .35s ease;
}
.stat:hover { transform: translateY(-5px); }
.stat__num { font-family: var(--serif); font-size: 2.6rem; color: var(--bronze); line-height: 1; }
.stat__label { color: var(--ink-soft); font-size: .98rem; margin-top: 8px; }

/* =========================================================================
   BIOGRAPHY CHAPTERS
   ========================================================================= */
.chapter {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 5vw, 72px); align-items: center;
  margin-bottom: clamp(56px, 9vh, 120px);
}
.chapter:last-child { margin-bottom: 0; }
.chapter--flip .chapter__media { order: 2; }
.chapter__media { position: relative; text-align: center; }
.chapter__media img {
  max-width: 100%; max-height: 580px; width: auto; height: auto;
  border-radius: 5px; box-shadow: var(--shadow);
  display: inline-block; vertical-align: middle;
}
.chapter__media figcaption {
  font-size: .85rem; color: var(--muted); text-align: center; margin-top: 12px; font-style: italic;
}
.chapter__num {
  font-family: var(--serif); font-size: 1rem; color: var(--bronze);
  letter-spacing: .2em; margin-bottom: .5rem;
}
.chapter h3 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: .7rem; }
.chapter p { color: var(--ink-soft); }
.chapter .pull {
  margin: 1.4rem 0 0; padding-right: 20px; border-right: 3px solid var(--bronze);
  font-family: var(--serif); font-size: 1.2rem; font-style: italic; color: var(--sage-deep);
}

/* ---- big pull-quote band ---------------------------------------------- */
.quoteband { background: var(--sage-deep); color: #f3ede0; text-align: center; }
.quoteband .container { max-width: 900px; }
.quoteband p {
  font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.45; margin: 0 0 1rem;
}
.quoteband .mark { color: var(--bronze-lt); font-size: 3rem; line-height: 0; }
.quoteband cite { font-style: normal; font-family: var(--sans); font-weight: 600; letter-spacing: .05em; color: rgba(255,255,255,.7); }

/* =========================================================================
   TIMELINE
   ========================================================================= */
.timeline { position: relative; max-width: 880px; margin: 0 auto; }
.timeline::before {
  content: ""; position: absolute; top: 0; bottom: 0; right: 50%;
  width: 2px; background: linear-gradient(var(--bronze), transparent); transform: translateX(50%);
}
.tl-item { position: relative; width: 50%; padding: 0 0 46px; }
.tl-item:nth-child(odd) { right: 0; padding-left: 46px; text-align: left; }
.tl-item:nth-child(even) { right: 50%; padding-right: 46px; text-align: right; }
.tl-item::after {
  content: ""; position: absolute; top: 4px; width: 15px; height: 15px;
  background: var(--paper); border: 3px solid var(--bronze); border-radius: 50%; z-index: 2;
}
.tl-item:nth-child(odd)::after { right: -8px; }
.tl-item:nth-child(even)::after { left: -8px; }
.tl-year { font-family: var(--serif); font-size: 1.5rem; color: var(--bronze); }
.tl-text { color: var(--ink-soft); font-size: 1rem; }

/* =========================================================================
   GALLERY
   ========================================================================= */
.gallery { columns: 4 240px; column-gap: 16px; }
.gallery figure { margin: 0 0 16px; break-inside: avoid; cursor: pointer; position: relative; overflow: hidden; border-radius: 5px; box-shadow: var(--shadow-sm); }
.gallery img { width: 100%; transition: transform .6s ease, filter .6s ease; filter: saturate(.96); }
.gallery figure:hover img { transform: scale(1.05); filter: saturate(1.05); }
.gallery figure::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(40,30,20,.35), transparent 50%);
  opacity: 0; transition: opacity .4s ease;
}
.gallery figure:hover::after { opacity: 1; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(20,16,12,.94);
  display: none; align-items: center; justify-content: center; padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 4px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.lightbox__btn {
  position: absolute; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3);
  color: #fff; width: 52px; height: 52px; border-radius: 50%; font-size: 1.6rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: background .3s;
}
.lightbox__btn:hover { background: rgba(255,255,255,.25); }
.lightbox__close { top: 24px; left: 24px; }
.lightbox__prev { right: 24px; top: 50%; transform: translateY(-50%); }
.lightbox__next { left: 24px; top: 50%; transform: translateY(-50%); }

/* =========================================================================
   MEMORIAL WALL — stories
   ========================================================================= */
.memorial { background: linear-gradient(var(--bg-alt), var(--bg)); }
.memform {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: clamp(24px, 4vw, 44px); max-width: 720px; margin: 0 auto clamp(40px, 6vh, 64px);
  box-shadow: var(--shadow);
}
.memform h3 { text-align: center; font-size: 1.7rem; margin-bottom: 1.4rem; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); font-size: .98rem; }
.field input, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 1.02rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
  transition: border-color .25s, box-shadow .25s; resize: vertical;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(169,122,63,.15);
}
.field--hp { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  background: var(--sage); color: #fff; border: 0; border-radius: 40px;
  font-family: var(--sans); font-weight: 700; font-size: 1.05rem;
  padding: 14px 40px; cursor: pointer; transition: background .3s, transform .2s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--sage-deep); transform: translateY(-2px); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.formnote { text-align: center; margin-top: 14px; min-height: 1.4em; font-weight: 600; }
.formnote.ok { color: var(--sage); }
.formnote.err { color: #b0492f; }

.stories { columns: 2 340px; column-gap: 26px; }
.story {
  break-inside: avoid; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 26px 28px; margin-bottom: 26px; box-shadow: var(--shadow-sm);
  position: relative;
}
.story::before {
  content: "\201D"; font-family: var(--serif); position: absolute; top: -8px; left: 18px;
  font-size: 4rem; color: var(--bronze); opacity: .28; line-height: 1;
}
.story__msg { color: var(--ink-soft); white-space: pre-wrap; margin-bottom: 14px; }
.story__by { font-family: var(--serif); font-size: 1.15rem; color: var(--sage-deep); }
.story__rel { color: var(--muted); font-size: .9rem; }
.story__date { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.stories__empty { text-align: center; color: var(--muted); font-style: italic; grid-column: 1/-1; }

/* =========================================================================
   FOOTER
   ========================================================================= */
.footer { background: var(--sage-deep); color: rgba(255,255,255,.85); text-align: center; padding: 56px 24px; }
.footer__name { font-family: var(--serif); font-size: 1.6rem; color: #fff; margin-bottom: .3rem; }
.footer__years { color: var(--bronze-lt); letter-spacing: .1em; margin-bottom: 1rem; }
.footer p { color: rgba(255,255,255,.6); font-size: .9rem; margin: .3rem 0; }

/* =========================================================================
   REVEAL ANIMATION
   ========================================================================= */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
@media (max-width: 860px) {
  body { font-size: 17px; }
  .nav__links {
    position: fixed; inset: 0 0 0 auto; width: min(78vw, 320px);
    background: var(--paper); flex-direction: column; align-items: flex-start;
    padding: 90px 32px; gap: 26px; transform: translateX(100%); transition: transform .4s ease;
    box-shadow: -10px 0 40px rgba(0,0,0,.2);
  }
  .nav__links.open { transform: none; }
  .nav__links a { color: var(--ink-soft) !important; font-size: 1.15rem; }
  .nav__toggle { display: block; z-index: 101; }
  .nav__toggle span { display: block; width: 26px; height: 2px; background: var(--sage-deep); margin: 6px 0; transition: .3s; }

  .hero { min-height: auto; padding: 104px 0 56px; text-align: center; }
  .hero__inner { grid-template-columns: 1fr; gap: 30px; }
  .hero__portrait { order: -1; margin-inline-start: 0; justify-self: center; transform: none; max-width: 100%; }
  .hero__portrait img { height: auto; max-height: 50vh; width: auto; max-width: 80vw; }
  .hero__portrait::before, .hero__portrait::after { display: none; }
  .hero__text { max-width: 100%; }
  .hero__role { margin-inline: auto; }
  .hero__years { justify-content: center; }

  .prologue, .chapter, .chapter--flip .chapter__media { grid-template-columns: 1fr; }
  .chapter--flip .chapter__media { order: 0; }
  .stats { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }

  .timeline::before { right: 8px; transform: none; }
  .tl-item { width: 100%; text-align: right !important; padding: 0 34px 40px 0 !important; right: 0 !important; }
  .tl-item::after { right: 1px !important; left: auto !important; }
  .stories { columns: 1; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .hero__portrait img { max-height: 42vh; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
