:root {
  --paper: #f8f7f2;
  --paper-deep: #efede5;
  --ink: #1f2933;
  --muted: #626b74;
  --accent: #17324d;
  --accent-warm: #a66a2c;
  --rule: #d6d3ca;
  --reading-measure: 68ch;
  --article-font-size: clamp(1.05rem, .45vw + .95rem, 1.22rem);
  --font-serif: 'Literata', Georgia, serif;
  --font-sans: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
}

a { color: inherit; }

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  background: var(--accent);
  color: white;
  padding: .5rem .75rem;
}

.skip-link:focus { top: 1rem; }

.site-header,
.masthead,
.essay-list,
.site-footer {
  width: min(100% - 2rem, 72rem);
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

nav { display: flex; flex-wrap: wrap; gap: 1rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover, nav a:focus, .read-link:hover, .read-link:focus { color: var(--accent); }

.masthead { padding: 5rem 0 3rem; max-width: var(--reading-measure); }
.eyebrow, .essay-meta { color: var(--muted); font-size: .875rem; letter-spacing: .06em; text-transform: uppercase; }
h1, h2 { color: var(--accent); font-family: var(--font-serif); line-height: 1.15; }
h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); margin: .25rem 0 1rem; }
.masthead > p:last-child { font-family: var(--font-serif); font-size: 1.25rem; }

.essay-list { padding-bottom: 5rem; }
.essay-card { border-top: 1px solid var(--rule); max-width: var(--reading-measure); padding: 2rem 0; }
.essay-card h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin: .5rem 0 1rem; }
.essay-card h2 a { text-decoration: none; }
.essay-deck { font-family: var(--font-serif); font-size: 1.2rem; max-width: 58ch; }
.read-link { color: var(--accent); font-weight: 600; }
.edition-links { align-items: baseline; display: flex; flex-wrap: wrap; gap: .65rem; }

.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: .875rem; padding: 1.5rem 0; }

.essay {
  width: min(100% - 2rem, 82rem);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) 0 5rem;
}

.article-header,
.mobile-toc,
.footnotes,
#notes-and-sources {
  max-width: var(--reading-measure);
}

.article-header { margin-bottom: 2.5rem; }
.article-header h1 { font-size: clamp(2.4rem, 5vw, 4.35rem); }

.translation-status {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 0 2.5rem;
  max-width: var(--reading-measure);
  padding: 1rem 1.25rem;
}

.translation-status p { margin: 0; }
.translation-status p + p { margin-top: .5rem; }

.article-utility {
  align-items: baseline;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.article-utility .eyebrow,
.language-switch { margin: 0 0 .65rem; }

.language-switch {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .9rem;
}

.language-switch a,
.hebrew-edition-link {
  color: var(--accent);
  text-underline-offset: .18em;
}

.article-deck {
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 1vw + .85rem, 1.45rem);
  line-height: 1.5;
  margin: 0 0 1.25rem;
}

.article-layout {
  display: grid;
  font-family: var(--font-serif);
  font-size: var(--article-font-size);
  grid-template-columns: var(--reading-measure) minmax(13rem, 17rem);
  gap: clamp(3rem, 7vw, 7rem);
  align-items: start;
}

.essay-body {
  font-family: inherit;
  inline-size: 100%;
  max-inline-size: var(--reading-measure);
  font-size: inherit;
  line-height: 1.78;
  grid-column: 1;
  min-width: 0;
}

.essay-body > :first-child { margin-top: 0; }
.essay-body p,
.footnotes p { margin: 0 0 1.35em; }

.essay-body h2,
.essay-body h3 {
  scroll-margin-top: 2rem;
}

.essay-body h2 {
  font-size: clamp(1.75rem, 2vw + 1rem, 2.55rem);
  margin: 3.25rem 0 1rem;
}

.essay-body h3 {
  font-size: clamp(1.3rem, 1vw + 1rem, 1.65rem);
  margin: 2.4rem 0 .85rem;
}

.essay-body ul,
.essay-body ol { padding-left: 1.35em; }
.essay-body li + li { margin-top: .55em; }

.article-toc,
.mobile-toc {
  font-family: var(--font-sans);
}

.article-toc {
  color: var(--muted);
  font-size: .9rem;
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  position: sticky;
  top: 6rem;
}

.article-toc nav,
.mobile-toc nav { display: block; }
.article-toc p { color: var(--accent); font-weight: 700; margin: 0 0 .75rem; }
.article-toc ol,
.mobile-toc ol { margin: 0; padding-left: 1.25rem; }
.article-toc li + li,
.mobile-toc li + li { margin-top: .6rem; }
.article-toc a { text-decoration-color: var(--rule); text-underline-offset: .18em; }
.article-toc a:hover,
.article-toc a:focus { color: var(--accent); }

.mobile-toc {
  border-block: 1px solid var(--rule);
  margin: 0 0 2.5rem;
  padding: 1rem 0;
}

.mobile-toc summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.mobile-toc nav { margin-top: 1rem; }

.article-table-wrap {
  margin: 2rem 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.article-table-wrap:focus-visible {
  outline: 3px solid var(--accent-warm);
  outline-offset: 4px;
}

.article-table {
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: .88em;
  line-height: 1.5;
  min-width: 44rem;
  width: 100%;
}

.article-table th,
.article-table td {
  border: 1px solid var(--rule);
  padding: .75rem;
  text-align: left;
  vertical-align: top;
}

.article-table th { background: var(--paper-deep); color: var(--accent); }

.source-figure,
.workflow-figure {
  margin: 2.4rem 0;
}

figcaption {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .84em;
  line-height: 1.55;
  margin-top: .8rem;
}

.workflow-scroll {
  border-block: 1px solid var(--rule);
  padding: 1.5rem 0;
}

.workflow-scroll:focus-visible {
  outline: 3px solid var(--accent-warm);
  outline-offset: 4px;
}

.evidence-flow {
  counter-reset: evidence-step;
  display: grid;
  gap: .85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.evidence-flow li {
  background: var(--paper-deep);
  border-left: .24rem solid var(--accent);
  counter-increment: evidence-step;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: .8rem 1rem;
}

.evidence-flow li::before {
  color: var(--accent-warm);
  content: counter(evidence-step, decimal-leading-zero);
  font-family: var(--font-sans);
  font-size: .78em;
  font-weight: 700;
  letter-spacing: .05em;
  padding-top: .15rem;
}

.evidence-flow strong,
.evidence-flow span {
  grid-column: 2;
}

.evidence-flow strong {
  color: var(--accent);
  font-family: var(--font-sans);
}

.evidence-flow span {
  color: var(--muted);
  font-size: .9em;
}

.workflow-return {
  border-left: .24rem solid var(--accent-warm);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .9em;
  margin: 1rem 0 0;
  padding: .2rem 0 .2rem 1rem;
}

.footnotes {
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: .92rem;
  line-height: 1.6;
  margin-top: 3.5rem;
  overflow-wrap: anywhere;
  padding-top: 1.5rem;
}

.footnotes ol { padding-left: 1.35rem; }
.footnotes li { padding-left: .35rem; }
.footnote-ref { color: var(--accent); font-family: var(--font-sans); font-weight: 700; text-decoration: none; }
.footnote-back { color: var(--accent); margin-left: .25rem; }
.essay-body a,
.footnotes a { overflow-wrap: anywhere; }

html[lang="he"] {
  --font-serif: 'Noto Serif Hebrew', Georgia, serif;
  --font-sans: 'Noto Sans Hebrew', 'Helvetica Neue', sans-serif;
}

html[dir="rtl"] body { text-align: right; }

html[dir="rtl"] .article-layout {
  direction: ltr;
  grid-template-columns: minmax(13rem, 17rem) var(--reading-measure);
}

html[dir="rtl"] .article-toc {
  direction: rtl;
  grid-column: 1;
  text-align: right;
}

html[dir="rtl"] .essay-body {
  direction: rtl;
  grid-column: 2;
  text-align: right;
}

html[dir="rtl"] .essay-body ul,
html[dir="rtl"] .essay-body ol,
html[dir="rtl"] .footnotes ol {
  padding-left: 0;
  padding-right: 1.35em;
}

html[dir="rtl"] .article-table th,
html[dir="rtl"] .article-table td { text-align: right; }

html[dir="rtl"] .evidence-flow li {
  border-left: 0;
  border-right: .24rem solid var(--accent);
  grid-template-columns: minmax(0, 1fr) 2rem;
}

html[dir="rtl"] .evidence-flow li::before { grid-column: 2; }
html[dir="rtl"] .evidence-flow strong,
html[dir="rtl"] .evidence-flow span { grid-column: 1; }

html[dir="rtl"] .workflow-return {
  border-left: 0;
  border-right: .24rem solid var(--accent-warm);
  padding: .2rem 1rem .2rem 0;
}

@media (min-width: 1100px) {
  .mobile-toc { display: none; }
}

@media (max-width: 1099px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .article-toc { display: none; }
  .essay-body { grid-column: 1; }
  html[dir="rtl"] .article-layout { grid-template-columns: minmax(0, 1fr); }
  html[dir="rtl"] .essay-body { grid-column: 1; }
}

@media (max-width: 38rem) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .article-utility { align-items: flex-start; flex-direction: column; gap: 0; }
  .masthead { padding-top: 3rem; }
  .essay { padding-top: 3rem; }
  .article-table { min-width: 38rem; }
  .article-table th,
  .article-table td { padding: .6rem; }
  .evidence-flow li { grid-template-columns: 1.8rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
