/* Kurt Loewenstein archive — modern chrome, historical artifacts.
   The scans are the only old thing on the page. Everything around them is
   current: a grotesque for structure, a serif reserved for reading, generous
   scale, real dark mode. */

:root {
  color-scheme: light dark;

  --ink:      #15171C;
  --ink-2:    #3A3F48;
  --muted:    #5F6570;
  --surface:  #FFFFFF;
  --raised:   #F5F5F3;
  --line:     #E4E4E4;
  --accent:   #9B2C2C;   /* binding-cloth red, the one thread kept */
  --accent-2: #7E2222;   /* hover */
  --on-accent:#FFFFFF;   /* text that sits on the accent — flips in dark */
  --link:     #24509E;

  --ui:      "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Faustina", Georgia, "Times New Roman", serif;
  --read:    "Spectral", Georgia, serif;
  --hebrew:  "Frank Ruhl Libre", "Times New Roman", serif;

  --measure: 36rem;
  --gut: clamp(1.25rem, 4vw, 3.5rem);
  --shell: 78rem;
  --r: 5px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:     #EDEEF0;
    --ink-2:   #C3C7CE;
    --muted:   #939AA5;
    --surface: #101216;
    --raised:  #191C22;
    --line:    #2A2E36;
    --accent:  #E0797A;
    --accent-2:#EFA0A0;
    /* the accent is light here, so what sits on it must be dark */
    --on-accent:#14161A;
    --link:    #8FB2F0;
  }
}
:root[data-theme="dark"] {
  --ink: #EDEEF0; --ink-2: #C3C7CE; --muted: #939AA5;
  --surface: #101216; --raised: #191C22; --line: #2A2E36;
  --accent: #E0797A; --accent-2: #EFA0A0; --on-accent: #14161A; --link: #8FB2F0;
}
:root[data-theme="light"] {
  --ink: #15171C; --ink-2: #3A3F48; --muted: #5F6570;
  --surface: #FFFFFF; --raised: #F5F5F3; --line: #E4E4E4;
  --accent: #9B2C2C; --accent-2: #7E2222; --on-accent: #FFFFFF; --link: #24509E;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 1.125rem/1.7 var(--read);
  font-synthesis-weight: none;
}

img { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }

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

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

.shell { max-width: var(--shell); margin-inline: auto; padding-inline: var(--gut); }
.narrow { max-width: 46rem; }

.skip { position: absolute; left: -9999px; background: var(--ink); color: var(--surface); padding: .7rem 1.1rem; z-index: 99; border-radius: var(--r); }
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- labels: a modern grotesque, not a typewriter ---------- */
.folio {
  font: 500 .8125rem/1.4 var(--ui);
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.masthead__in {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 4.5rem;
  max-width: var(--shell); margin-inline: auto; padding-inline: var(--gut);
}
.brand {
  font: 700 1.0625rem/1.15 var(--ui);
  letter-spacing: -.01em; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand span {
  display: block; margin-top: .15rem;
  font: 500 .75rem/1 var(--ui); letter-spacing: .04em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.nav { margin-left: auto; }
.nav ul { display: flex; gap: .35rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a {
  display: block;
  font: 500 .9375rem/1 var(--ui);
  color: var(--ink-2); text-decoration: none;
  padding: .55rem .7rem; border-radius: var(--r);
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--raised); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }

.nav-toggle {
  margin-left: auto; display: none;
  background: none; border: 1px solid var(--line); border-radius: var(--r);
  font: 500 .875rem/1 var(--ui); color: var(--ink); padding: .6rem .85rem; cursor: pointer;
}

@media (max-width: 58rem) {
  .nav-toggle { display: block; }
  .nav {
    display: none; margin-left: 0;
    position: absolute; inset: 4.5rem 0 auto; background: var(--surface);
    border-bottom: 1px solid var(--line); padding: .75rem var(--gut) 1.25rem;
  }
  .nav[data-open="true"] { display: block; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav a { padding: .8rem .5rem; border-radius: var(--r); }
}

/* ---------- hero ---------- */
.hero { padding-block: clamp(3.5rem, 9vw, 7rem) clamp(2.5rem, 6vw, 4.5rem); }
.hero__grid { display: grid; gap: clamp(2rem, 5vw, 4rem); grid-template-columns: minmax(0,1fr); align-items: end; }
@media (min-width: 54rem) { .hero__grid { grid-template-columns: minmax(0,1fr) 17rem; } }

/* The display voice stays a serif. Everything structural around it is the
   grotesque — the page reads as an institution, not a product. */
.hero__name {
  font: 700 clamp(2.75rem, 8.5vw, 6rem)/0.98 var(--display);
  letter-spacing: -.02em;
  margin: .75rem 0 0;
  text-wrap: balance;
}
.hero__name em { font-style: normal; display: block; }
.hero__role {
  margin: 1.75rem 0 0; max-width: 34rem;
  font-size: 1.25rem; line-height: 1.6; color: var(--ink-2);
}

.hero__portrait {
  border-radius: var(--r); overflow: hidden;
  background: var(--raised); border: 1px solid var(--line);
}
.hero__portrait img { filter: grayscale(1) contrast(1.05); width: 100%; }
.hero__portrait figcaption { padding: .7rem .85rem; }

/* the lifeline */
.lifeline { margin-top: 3.5rem; padding-bottom: 2rem; }
.lifeline__track { display: flex; align-items: center; gap: 1rem; color: var(--muted); }
.lifeline__bar { flex: 1; height: 2px; background: var(--line); border-radius: 2px; position: relative; }
.lifeline__mark {
  position: absolute; top: -5px; left: var(--at);
  width: 3px; height: 12px; border-radius: 2px; background: var(--accent);
}
.lifeline__note {
  position: absolute; top: 15px; left: var(--at); transform: translateX(-50%);
  white-space: nowrap; color: var(--accent); font-weight: 600;
}
@media (max-width: 42rem) { .lifeline__note { transform: none; left: 0; } }

/* ---------- sections ---------- */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }
.section__head { margin-bottom: 2.5rem; }
.section h2 {
  font: 700 clamp(1.75rem, 3.4vw, 2.5rem)/1.15 var(--display);
  letter-spacing: -.012em; margin: .6rem 0 0;
}
.section h3 { font: 700 1.375rem/1.3 var(--display); letter-spacing: -.008em; margin: 2.5rem 0 .75rem; }

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.35rem; }
.prose p:last-child { margin-bottom: 0; }
.prose blockquote {
  margin: 2rem 0; padding: 1.25rem 1.5rem;
  background: var(--raised); border-left: 3px solid var(--accent);
  border-radius: 0 var(--r) var(--r) 0; color: var(--ink-2);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.lede { font-size: 1.3125rem; line-height: 1.55; color: var(--ink-2); }

/* ---------- the page spine ---------- */
.spine { margin: 0; padding: 0; list-style: none; }
.spine__row {
  display: grid;
  grid-template-columns: 3.25rem minmax(0,1fr);
  gap: 0 1rem; align-items: start;
  border-radius: var(--r);
  transition: background .15s ease;
}
.spine__row + .spine__row { border-top: 1px solid var(--line); }
.spine__row:hover { background: var(--raised); }
@media (min-width: 34rem) { .spine__row { grid-template-columns: 3.5rem 6.5rem minmax(0,1fr); gap: 0 1.5rem; } }
@media (min-width: 54rem) { .spine__row { grid-template-columns: 3.75rem 7rem 9rem minmax(0,1fr); } }

.spine__thumb {
  display: block; align-self: center;
  border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
  background: var(--raised); margin: 1.25rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
  transition: transform .18s ease, box-shadow .18s ease;
}
.spine__thumb img { width: 100%; display: block; }
a.spine__thumb:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.spine__thumb--none {
  aspect-ratio: 300/412; box-shadow: none;
  background: repeating-linear-gradient(-45deg, var(--line) 0 1px, transparent 1px 6px);
  opacity: .7;
}

.spine__pages { padding: 1.25rem 0; white-space: nowrap; font: 500 .8125rem/1.4 var(--ui); color: var(--muted); font-variant-numeric: tabular-nums; }
.spine__bar { display: none; align-self: center; height: 6px; margin: 1.25rem 0; background: var(--ink); border-radius: 3px; }
@media (min-width: 54rem) { .spine__bar { display: block; } }
.spine__body { padding: 1.25rem 0; min-width: 0; }
.spine__title { font: 600 1.0625rem/1.35 var(--ui); letter-spacing: -.01em; margin: 0; }
.spine__title a { color: var(--ink); text-decoration: none; }
.spine__title a:hover { color: var(--accent); text-decoration: underline; }
.spine__meta { margin: .3rem 0 0; }

.spine__row--gap .spine__bar { background: repeating-linear-gradient(-45deg, var(--line) 0 3px, transparent 3px 7px); }
.spine__row--gap .spine__title { font-weight: 400; color: var(--muted); }
.spine__row--front .spine__bar { background: var(--muted); }

@media (max-width: 33.99rem) {
  .spine__thumb { grid-row: 1 / span 2; align-self: start; }
  .spine__pages { grid-column: 2; grid-row: 1; padding: 1.25rem 0 0; }
  .spine__body { grid-column: 2; grid-row: 2; padding-top: .2rem; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font: 600 .9375rem/1 var(--ui);
  padding: .9rem 1.35rem; border-radius: var(--r);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none;
  background: var(--surface);
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.btn:hover { background: var(--raised); border-color: var(--muted); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn--seal { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--seal:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

/* ---------- language tabs ---------- */
.tabs {
  display: flex; flex-wrap: wrap; gap: .3rem;
  padding: .3rem; margin-bottom: 2.5rem;
  background: var(--raised); border-radius: 9px;
  width: fit-content; max-width: 100%;
}
.tabs a {
  font: 500 .9375rem/1 var(--ui);
  padding: .7rem 1.1rem; border-radius: 6px;
  color: var(--muted); text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="true"] {
  color: var(--ink); background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.09);
}
.panel[hidden] { display: none; }

[dir="rtl"] { font-family: var(--hebrew); text-align: right; }
[dir="rtl"] .prose { margin-left: auto; margin-right: 0; }
[dir="rtl"] blockquote { border-left: 0; border-right: 3px solid var(--accent); border-radius: var(--r) 0 0 var(--r); }

/* ---------- figures ---------- */
.plate {
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  background: var(--raised);
}
.plate img { width: 100%; }
.plate figcaption { padding: .8rem 1rem; }

.duo { display: grid; gap: clamp(1.5rem, 4vw, 3rem); grid-template-columns: minmax(0,1fr); }
@media (min-width: 50rem) { .duo { grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; } }
@media (min-width: 50rem) { .duo--letter { grid-template-columns: 25rem minmax(0,1fr); } }

/* ---------- bibliography ---------- */
.biblio { margin: 0; padding: 0; list-style: none; }
.biblio li {
  display: grid; gap: .2rem 1.75rem; grid-template-columns: minmax(0,1fr);
  padding: 1.35rem 0; border-top: 1px solid var(--line);
}
.biblio li:first-child { border-top: 0; }
@media (min-width: 42rem) { .biblio li { grid-template-columns: 5rem minmax(0,1fr); } }
.biblio__year { font: 600 .9375rem/1.7 var(--ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.biblio__title { font-weight: 600; }
.biblio__where { color: var(--muted); font-size: 1rem; }

/* ---------- link list ---------- */
.links { margin: 0; padding: 0; list-style: none; }
.links li { border-top: 1px solid var(--line); }
.links li:first-child { border-top: 0; }
.links a {
  display: block; padding: 1.35rem .75rem; margin-inline: -.75rem;
  border-radius: var(--r);
  font: 600 1.0625rem/1.4 var(--ui); color: var(--ink); text-decoration: none;
  transition: background .15s ease;
}
.links a:hover { background: var(--raised); color: var(--accent); }
.links a::after { content: " →"; color: var(--muted); }
.links a:hover::after { color: var(--accent); }
.links .folio { display: block; margin-top: .25rem; font-weight: 400; }

/* ---------- form ---------- */
.field { margin-bottom: 1.5rem; max-width: 34rem; }
.field label { display: block; margin-bottom: .45rem; font: 600 .9375rem/1.4 var(--ui); }
.field input, .field textarea {
  width: 100%; font: 400 1rem/1.6 var(--read);
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem;
}
.field input:focus, .field textarea:focus {
  border-color: var(--link); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 20%, transparent);
}
.field textarea { min-height: 10rem; resize: vertical; }
.hp { position: absolute; left: -9999px; }
button.btn { cursor: pointer; font-family: var(--ui); }

/* ---------- document viewer ---------- */
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.zoom img { width: 100%; }
.lightbox {
  border: 1px solid var(--line); border-radius: 10px; padding: 0;
  max-width: min(94vw, 58rem); max-height: 94vh;
  background: var(--raised); color: var(--ink);
  box-shadow: 0 2rem 5rem rgba(0,0,0,.5);
}
.lightbox::backdrop { background: rgba(8, 10, 14, .8); backdrop-filter: blur(3px); }
.lightbox img { display: block; max-height: 80vh; width: auto; max-width: 100%; margin-inline: auto; }
.lightbox__bar { display: flex; gap: 1.5rem; align-items: baseline; justify-content: space-between; padding: 1rem 1.15rem; border-top: 1px solid var(--line); }
.lightbox__close {
  font: 600 .875rem/1 var(--ui); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); padding: .55rem .9rem; cursor: pointer; white-space: nowrap;
}
.lightbox__close:hover { border-color: var(--muted); }

/* ---------- page-load sequence ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rise > * { opacity: 0; animation: rise .55s cubic-bezier(.2,.7,.3,1) forwards; }
  .rise > *:nth-child(1) { animation-delay: .04s; }
  .rise > *:nth-child(2) { animation-delay: .12s; }
  .rise > *:nth-child(3) { animation-delay: .20s; }
  .rise > *:nth-child(4) { animation-delay: .28s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); padding-block: 3.5rem 4.5rem; color: var(--muted); font-size: 1rem; }
.foot__grid { display: grid; gap: 2.5rem; grid-template-columns: minmax(0,1fr); }
@media (min-width: 46rem) { .foot__grid { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); } }
.foot a { color: var(--ink-2); }
.foot a:hover { color: var(--accent); }
.foot ul { list-style: none; margin: .6rem 0 0; padding: 0; }
.foot li { margin-bottom: .5rem; }
