/* ==========================================================================
   ATHAR — أثر
   Light, editorial, Arabic-first. Logical properties throughout so the same
   sheet serves RTL and LTR.
   ========================================================================== */

:root {
  --paper: #f7f3ec;
  --surface: #fffdf9;
  --wash: #efe7d8;
  --ink: #1c1a17;
  --ink-2: #4b4439;
  --muted: #7c7263;
  --line: #e4dbc9;
  --line-2: #d3c6ae;
  --bronze: #9a6f3a;
  --bronze-deep: #7a5528;
  --bronze-wash: #f3e9d8;

  --font-display: "Amiri", "Noto Naskh Arabic", serif;
  --font-ui: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, sans-serif;
  --font-latin-serif: "IBM Plex Serif", Georgia, serif;

  --container: 1160px;
  --radius: 3px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --header-h: 62px;
}

@media (min-width: 900px) {
  :root { --header-h: 78px; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; }

::selection { background: var(--bronze-wash); color: var(--bronze-deep); }

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

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  z-index: 100;
  border-radius: var(--radius);
}
.skip-link:focus { inset-inline-start: 12px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(18px, 5vw, 40px);
}

/* ---------- header ------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-block-end: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.is-scrolled {
  border-block-end-color: var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  min-height: 44px;
  align-items: center;
}
.brand-mark {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  padding-block-start: 4px;
}
.brand-latin {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
}

.nav-link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding-block: 6px;
  border-block-end: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav-link:hover { color: var(--ink); border-block-end-color: var(--line-2); }

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 7px 12px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.lang-switch:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.lang-switch .globe { opacity: 0.65; }

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

.hero {
  padding-block: clamp(40px, 6.5vw, 76px) clamp(30px, 4.6vw, 52px);
  border-block-end: 1px solid var(--line);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(58% 62% at 50% 0%, rgba(154, 111, 58, 0.075), transparent 72%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset-block: clamp(14px, 2vw, 24px);
  inset-inline: clamp(10px, 2.6vw, 28px);
  border: 1px solid var(--line);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-ornament {
  width: clamp(26px, 3.4vw, 34px);
  height: clamp(26px, 3.4vw, 34px);
  color: var(--bronze);
  opacity: 0.9;
  margin-block-end: clamp(12px, 2.2vw, 20px);
}

.eyebrow {
  margin: 0 0 30px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}
html[dir="rtl"] .eyebrow { letter-spacing: 0.04em; font-size: 12.5px; }

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(78px, 13.6vw, 152px);
  line-height: 1;
  margin: 0;
  padding-block-start: 0.1em;
  letter-spacing: 0;
  color: var(--ink);
}
html[lang="en"] .wordmark {
  font-family: var(--font-latin-serif);
  font-weight: 600;
  font-size: clamp(56px, 10.5vw, 108px);
  letter-spacing: 0.06em;
  text-indent: 0.06em;
  line-height: 0.95;
}

.hero-latin {
  margin: clamp(16px, 2.2vw, 24px) 0 0;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.62em;
  text-indent: 0.62em;
  text-transform: uppercase;
  color: var(--bronze);
  direction: ltr;
  unicode-bidi: isolate;
}

.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: clamp(18px, 2.8vw, 26px) auto clamp(16px, 2.4vw, 22px);
  width: min(420px, 88%);
}
.rule span {
  height: 1px;
  background: var(--line-2);
  flex: 1;
}
.rule i {
  width: 7px;
  height: 7px;
  border: 1px solid var(--bronze);
  transform: rotate(45deg);
  display: block;
}

.hero-desc {
  margin: 0 auto;
  max-width: 54ch;
  color: var(--ink-2);
  font-size: clamp(15px, 2vw, 17.5px);
  line-height: 1.9;
}
.hero-desc span { display: block; }
.hero-desc span + span { color: var(--muted); }

/* ---------- search + filters --------------------------------------------- */

.toolbar {
  margin-block-start: clamp(24px, 3.4vw, 34px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  justify-items: center;
  width: 100%;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  width: 100%;
  min-width: 0;
  max-width: 560px;
}
.search:focus-within {
  border-color: var(--bronze);
  box-shadow: 0 0 0 4px rgba(154, 111, 58, 0.1);
}
.search .icon {
  position: absolute;
  inset-inline-start: 16px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 15.5px;
  color: var(--ink);
  padding: 16px 16px;
  padding-inline-start: 46px;
  padding-inline-end: 52px;
  min-width: 0;
}
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button { display: none; }

.search-clear {
  position: absolute;
  inset-inline-end: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 2px;
}
.search-clear:hover { color: var(--ink); background: var(--wash); }

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

@media (max-width: 719px) {
  .chips {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    width: 100%;
    padding-block-end: 2px;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
}

.chip {
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 15px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
  white-space: nowrap;
}
.chip:hover { border-color: var(--ink-2); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip .n {
  font-size: 11px;
  opacity: 0.6;
  margin-inline-start: 6px;
  font-variant-numeric: tabular-nums;
}

/* ---------- results ------------------------------------------------------ */

.results {
  padding-block: clamp(28px, 4vw, 44px) clamp(48px, 7vw, 88px);
}

.results-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-block-end: 18px;
  border-block-end: 1px solid var(--line);
  margin-block-end: clamp(22px, 3vw, 34px);
}
.results-count {
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.results-count b { color: var(--ink); font-weight: 600; }
.results-hint {
  font-size: 12px;
  color: var(--muted);
  display: none;
}
@media (min-width: 720px) { .results-hint { display: block; } }

.grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(16px, 2.4vw, 26px);
}
.grid > .card {
  /* two cards across on desktop: a lone card never stretches wider than the
     rest of the row, and a small database still reads as a calm two-up list */
  flex: 1 1 420px;
  max-width: 560px;
  min-width: 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: 0 14px 34px -18px rgba(28, 26, 23, 0.32);
}
.card[hidden] { display: none; }

.card-link { display: block; height: 100%; }

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--wash);
  overflow: hidden;
}
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease);
}
.card:hover .card-media img { transform: scale(1.035); }

.card-media.is-empty {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(154, 111, 58, 0.06) 0 1px, transparent 1px 11px),
    var(--wash);
}
.card-media.is-empty span {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--bronze-deep);
  opacity: 0.5;
}

.card-body { padding: 16px 18px 20px; }

.card-section {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bronze);
  margin-block-end: 9px;
}
html[dir="rtl"] .card-section { letter-spacing: 0.02em; font-size: 11.5px; }

.card-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.35;
  color: var(--ink);
}
html[lang="en"] .card-title { font-family: var(--font-latin-serif); font-size: 1.22rem; font-weight: 600; }

.card-date {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}
.card-loc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* rights badge, shared */
.rights {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  padding: 3px 7px;
  backdrop-filter: blur(4px);
}
.rights::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bronze);
  opacity: 0.85;
}

.badge-demo {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--bronze-deep);
  background: var(--bronze-wash);
  border: 1px solid #e0cda8;
  border-radius: 2px;
  padding: 3px 8px;
}

.card-media .rights {
  position: absolute;
  inset-block-end: 10px;
  inset-inline-start: 10px;
}
.card-media .badge-demo {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
}

/* ---------- empty states ------------------------------------------------- */

.empty {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(36px, 6vw, 64px) clamp(20px, 4vw, 44px);
  text-align: center;
  max-width: 620px;
  margin-inline: auto;
}
.empty-mark {
  font-family: var(--font-display);
  font-size: 40px;
  color: var(--bronze);
  opacity: 0.5;
  line-height: 1;
  margin-block-end: 14px;
}
.empty h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  margin: 0 0 10px;
}
.empty p {
  margin: 0 auto;
  max-width: 46ch;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.85;
}
.empty .btn { margin-block-start: 22px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover { background: transparent; color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- article ------------------------------------------------------ */

.article { padding-block: clamp(22px, 3vw, 34px) clamp(56px, 8vw, 96px); }

.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-block-end: clamp(22px, 4vw, 34px);
}
.crumb a { color: var(--muted); transition: color 0.2s var(--ease); }
.crumb a:hover { color: var(--bronze-deep); }
.crumb .sep { opacity: 0.5; }

.article-head { max-width: 780px; }

.article-head h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.25;
  margin: 0 0 18px;
  color: var(--ink);
}
html[lang="en"] .article-head h1 {
  font-family: var(--font-latin-serif);
  font-weight: 600;
  font-size: clamp(30px, 4.6vw, 44px);
  line-height: 1.2;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  font-size: 13px;
  color: var(--ink-2);
  padding-block-end: 22px;
  border-block-end: 1px solid var(--line);
  margin-block-end: 26px;
}
.article-meta .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-2);
}
.article-meta .meta-label { color: var(--muted); }

.summary {
  font-family: var(--font-display);
  font-size: clamp(17px, 2.4vw, 20px);
  line-height: 1.95;
  color: var(--ink-2);
  margin: 0;
  padding-inline-start: 18px;
  border-inline-start: 2px solid var(--bronze);
}
html[lang="en"] .summary { font-family: var(--font-latin-serif); font-size: 1.05rem; line-height: 1.8; }

.demo-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-block-start: 24px;
  padding: 14px 16px;
  background: var(--bronze-wash);
  border: 1px dashed #dcc7a1;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.8;
  color: var(--bronze-deep);
}
.demo-notice .badge-demo { flex: none; background: var(--surface); }

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(32px, 5vw, 56px);
  margin-block-start: clamp(32px, 5vw, 52px);
}
@media (min-width: 980px) {
  .article-grid { grid-template-columns: minmax(0, 1fr) 252px; }
}

/* toc */
.toc-desktop { display: none; }

.toc-mobile {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  margin-block-end: 28px;
}
.toc-mobile > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile > summary .plus {
  width: 12px;
  height: 12px;
  position: relative;
  flex: none;
}
.toc-mobile > summary .plus::before,
.toc-mobile > summary .plus::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 0;
  width: 100%;
  height: 1px;
  background: var(--bronze);
  transition: transform 0.25s var(--ease);
}
.toc-mobile > summary .plus::after { transform: rotate(90deg); }
.toc-mobile[open] > summary .plus::after { transform: rotate(0deg); }
.toc-mobile .toc-body { padding: 0 16px 14px; }

@media (min-width: 980px) {
  .toc-mobile { display: none; }
  .toc-desktop {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow: auto;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px 20px;
  }
}

.toc-title {
  margin: 0 0 12px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
html[dir="rtl"] .toc-title { letter-spacing: 0.03em; font-size: 12px; }

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-inline-start: 1px solid var(--line);
}
.toc li { margin: 0; }
.toc a {
  display: block;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
  padding: 6px 0;
  padding-inline-start: 13px;
  margin-inline-start: -1px;
  border-inline-start: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.toc a:hover { color: var(--ink); }
.toc a.is-active {
  color: var(--ink);
  font-weight: 500;
  border-inline-start-color: var(--bronze);
}
.toc .lvl-3 a { padding-inline-start: 26px; font-size: 12.5px; }
.toc .lvl-4 a { padding-inline-start: 38px; font-size: 12px; }

/* prose */
.prose {
  max-width: 100%;
  color: var(--ink);
}

.prose > :first-child { margin-block-start: 0; }

.prose p {
  font-family: var(--font-display);
  font-size: clamp(19px, 2.5vw, 21.5px);
  line-height: 2.05;
  margin: 0 0 1.1em;
  color: var(--ink);
}

.prose .lead {
  font-size: clamp(21px, 2.9vw, 24px);
  line-height: 1.95;
  color: var(--ink);
}
.prose .lead::first-letter { color: var(--bronze-deep); }

html[lang="en"] .prose p {
  font-family: var(--font-latin-serif);
  font-size: 1.06rem;
  line-height: 1.85;
  margin-bottom: 1.15em;
}
html[lang="en"] .prose .lead { font-size: 1.2rem; line-height: 1.75; }

.prose h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 30px);
  line-height: 1.4;
  margin: 2.4em 0 0.75em;
  padding-block-start: 1.1em;
  border-block-start: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 24px);
  position: relative;
}
.prose h2::before {
  content: "";
  position: absolute;
  inset-block-start: -1px;
  inset-inline-start: 0;
  width: 46px;
  height: 1px;
  background: var(--bronze);
}
html[lang="en"] .prose h2 { font-family: var(--font-latin-serif); font-weight: 600; font-size: 1.5rem; }

.prose h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.7;
  margin: 2em 0 0.6em;
  color: var(--ink);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
html[lang="en"] .prose h3 { font-size: 1.05rem; }

.prose h4 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 1.75em 0 0.5em;
  color: var(--bronze-deep);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
html[lang="en"] .prose h4 { font-size: 0.97rem; }

.prose ul,
.prose ol {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.4vw, 20.5px);
  line-height: 1.95;
  padding-inline-start: 1.3em;
  margin: 0 0 1.2em;
}
html[lang="en"] .prose ul,
html[lang="en"] .prose ol { font-family: var(--font-latin-serif); font-size: 1.02rem; }

.prose a:not(.cite) {
  color: var(--bronze-deep);
  border-block-end: 1px solid rgba(154, 111, 58, 0.4);
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.prose a:not(.cite):hover { border-block-end-color: var(--bronze-deep); }

sup.c { font-size: 0; line-height: 0; }

.cite {
  display: inline-block;
  position: relative;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--bronze-deep);
  background: var(--bronze-wash);
  border: 1px solid var(--bronze);
  border-radius: 3px;
  padding: 1px 7px;
  margin-inline: 4px;
  vertical-align: super;
  text-decoration: none;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 0 rgba(122, 85, 40, 0.12);
}
/* 44px touch target without changing the visual size */
.cite::after {
  content: "";
  position: absolute;
  inset: -12px -15px;
}
.cite:hover,
.cite:focus-visible {
  background: var(--bronze-deep);
  border-color: var(--bronze-deep);
  color: var(--paper);
}
@media (max-width: 719px) {
  .cite { font-size: 13.5px; padding: 2px 8px; margin-inline: 5px; }
  .cite::after { inset: -11px -16px; }
}

.prose blockquote {
  margin: 0 0 1.3em;
  padding-inline-start: 18px;
  border-inline-start: 2px solid var(--line-2);
  color: var(--ink-2);
}
.prose figure { margin: 2em 0; }
.prose figcaption {
  font-size: 12.5px;
  color: var(--muted);
  margin-block-start: 8px;
}

/* gallery */
.section-block { margin-block-start: clamp(40px, 6vw, 64px); }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-block-end: 14px;
  border-block-end: 1px solid var(--line);
  margin-block-end: 24px;
}
.block-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 26px);
}
html[lang="en"] .block-head h2 { font-family: var(--font-latin-serif); font-weight: 600; font-size: 1.35rem; }
.block-head .count {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(16px, 2.4vw, 22px);
}
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(2, 1fr); } }

.figure {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.figure-media { position: relative; background: var(--wash); aspect-ratio: 4 / 3; }
.figure-media img { width: 100%; height: 100%; object-fit: cover; }
/* page scans are documents, not photographs: show the whole page, never crop it */
.figure--page .figure-media { aspect-ratio: 3 / 4; background: #fff; }
.figure--page .figure-media img { object-fit: contain; }
/* photographs: a normal photo crop, and the whole frame opens the lightbox */
.figure-zoom {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.figure-zoom:focus-visible { outline: 2px solid var(--bronze); outline-offset: -2px; }
.figure--photo .figure-media .rights { display: none; }
.figure--photo .src a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }
.figure--photo .src a:hover { color: var(--ink); }
.figure-media .rights { position: absolute; inset-block-end: 10px; inset-inline-start: 10px; }
.figure figcaption { padding: 13px 15px 15px; }
.figure .cap {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
}
html[lang="en"] .figure .cap { font-family: var(--font-latin-serif); font-size: 0.95rem; }
.figure .src {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* references */
.refs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-block-start: 1px solid var(--line);
}
.ref {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 16px;
  padding-block: 22px;
  border-block-end: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.ref:target { background: color-mix(in srgb, var(--bronze-wash) 55%, transparent); }

.ref-num {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--bronze-deep);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

.ref-cite {
  margin: 0 0 8px;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--ink);
}
.ref-cite .author { font-weight: 600; }
.ref-cite cite { font-style: italic; color: var(--ink); }
.ref-cite .page { color: var(--muted); unicode-bidi: isolate; }
.ref-cite .year { color: var(--muted); font-variant-numeric: tabular-nums; }

.ref-quote {
  margin: 0 0 12px;
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--bronze);
  font-family: var(--font-display);
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--ink-2);
}
html[lang="en"] .ref-quote { font-family: var(--font-latin-serif); font-size: 0.98rem; }

.ref-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.ref-actions .rights { background: transparent; }

.ref-empty {
  margin: 0;
  padding: 24px 0;
  color: var(--muted);
  font-size: 14px;
  border-block-end: 1px solid var(--line);
}

/* review badge */
.review {
  margin-block-start: clamp(40px, 6vw, 60px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 22px;
  max-width: 560px;
}
.review-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-block-end: 12px;
}
.review-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
html[dir="rtl"] .review-label { letter-spacing: 0.03em; font-size: 12px; }
.review-count {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.review-bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.review-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--bronze), var(--bronze-deep));
  transition: width 0.9s var(--ease);
}
html[dir="rtl"] .review-bar span { background: linear-gradient(270deg, var(--bronze), var(--bronze-deep)); }
.review-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.8;
}
.review-note .sep { margin-inline: 8px; color: var(--line-2); }

/* ---------- footer ------------------------------------------------------- */

.site-footer {
  border-block-start: 1px solid var(--line);
  padding-block: clamp(34px, 5vw, 54px) clamp(28px, 4vw, 40px);
  background: var(--surface);
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 40px;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand .brand-mark { font-size: 26px; }
.footer-tag {
  margin: 8px 0 0;
  max-width: 38ch;
  font-size: 13px;
  line-height: 1.85;
  color: var(--muted);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 13px;
  color: var(--ink-2);
}
.footer-links a { transition: color 0.2s var(--ease); }
.footer-links a:hover { color: var(--bronze-deep); }

.footer-bottom {
  margin-block-start: clamp(26px, 4vw, 38px);
  padding-block-start: 18px;
  border-block-start: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.footer-bottom .sig { direction: ltr; unicode-bidi: isolate; }

/* ---------- lightbox ----------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(24, 21, 17, 0.82);
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 44px);
  backdrop-filter: blur(3px);
}
.lightbox[hidden] { display: none; }
.lightbox-inner {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 720px;
  width: 100%;
  max-height: 100%;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}
.lightbox-inner img {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
  margin: 0 auto;
  background: var(--paper);
}
.lightbox-cap {
  padding: 14px 18px 18px;
  border-block-start: 1px solid var(--line);
}
.lightbox-cap p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.8; }
.lightbox-cap .rights { margin-block-start: 10px; }
.lightbox-close {
  position: absolute;
  inset-block-start: 10px;
  inset-inline-end: 10px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-radius: 2px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  color: var(--ink);
}
.lightbox-close:hover { background: var(--ink); color: var(--paper); }

/* ---------- reveal ------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0ms);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .card, .card-media img, .review-bar span { transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- print -------------------------------------------------------- */

@media print {
  .site-header, .toc, .lightbox, .site-footer .footer-links, .ref-actions { display: none; }
  body { background: #fff; }
  .article-grid { grid-template-columns: 1fr; }
  .prose p { font-size: 11pt; line-height: 1.6; }
}
