@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Noto+Serif:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  /* Backgrounds — warm parchment from ochre/sienna range */
  --cream:       #f5efe2;
  --parchment:   #ede3cc;
  --parchment-d: #e0d4b8;

  /* Ink — indigo-dark (from B) not brown-black */
  --ink:         #1e2235;
  --ink-mid:     #3a3d50;
  --ink-light:   #6a6878;

  /* Sand / muted golds */
  --sand:        #b89a60;
  --sand-l:      #d0bc90;

  /* Accent — burnt sienna (from A) */
  --rust:        #8b4513;
  --rust-mid:    #a85520;
  --rust-light:  #c4712e;

  /* Labels — havana ochre (from A) */
  --gold:        #b8861a;

  /* Links — ancient green earth (from A) */
  --teal:        #3d6b5c;
  --teal-l:      #5a8f7a;

  /* Borders */
  --border:      #c8b890;
  --border-l:    #ddd0b0;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; }
body { background: var(--cream); color: var(--ink); min-height: 100vh; }
body.ltr { font-family: 'Noto Serif', serif; direction: ltr; }
body.rtl { font-family: 'Noto Naskh Arabic', serif; direction: rtl; font-size: 1.08em; }

nav.site-nav {
  background: var(--ink);
  display: flex;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 2px solid var(--rust);
  min-height: 52px;
}

/* Logo — left in LTR, right in RTL */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 1.6rem;
  text-decoration: none;
  border-right: 1px solid rgba(200,180,138,0.15);
  flex-shrink: 0;
}
.nav-logo-img {
  height: 36px;
  width: 36px;
  object-fit: contain;
}
.nav-logo-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.nav-logo-en {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--parchment);
  line-height: 1;
}
.nav-logo-ar {
  font-family: 'Noto Naskh Arabic', serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--parchment);
  line-height: 1;
}
.nav-logo-sub {
  font-size: 0.8rem;
  color: var(--sand);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: 'Noto Serif', serif;
  font-style: normal;
  margin-top: 0.15rem;
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: stretch;
  list-style: none;
  flex: 1;
  padding: 0 0.5rem;
}
.nav-links li { display: flex; }
.nav-links a {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  color: rgba(196,173,130,0.75);
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: 0.01em;
  transition: color 0.18s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--cream); border-bottom-color: rgba(172,78,40,0.5); }
.nav-links a.active { color: var(--cream); border-bottom-color: var(--rust); }

/* Language switcher — pushed to the far end */
.nav-lang {
  display: flex;
  align-items: center;
  padding: 0 1.4rem;
  margin-left: auto;
  border-left: 1px solid rgba(200,180,138,0.15);
  flex-shrink: 0;
}
[dir="rtl"] .nav-lang { margin-left: 0; margin-right: auto; border-left: none; border-right: 1px solid rgba(200,180,138,0.15); }
.nav-lang a {
  font-size: 0.9rem;
  color: var(--sand);
  text-decoration: none;
  border: 1px solid rgba(200,180,138,0.25);
  padding: 0.2rem 0.65rem;
  transition: all 0.18s;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
}
.nav-lang a:hover { border-color: var(--sand); color: var(--cream); }

/* RTL nav — logo on right, links flow right-to-left */
[dir="rtl"] .nav-logo { border-right: none; border-left: 1px solid rgba(200,180,138,0.15); }
[dir="rtl"] .nav-links { flex-direction: row-reverse; }

.page-header { background: var(--parchment); border-bottom: 1px solid var(--border); padding: 2rem 5rem; }
.page-header h1 { font-size: 2rem; font-weight: 700; color: var(--ink); }
.page-header .subtitle { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1.1rem; color: var(--ink-light); margin-top: 0.25rem; }

.filter-bar { background: var(--cream); border-bottom: 1px solid var(--border-l); padding: 0.8rem 5rem; display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap; }
.filter-label { font-size: 0.9rem; font-weight: 600; color: var(--gold); margin: 0 0.3rem; }
.filter-btn { background: none; border: 1px solid var(--border); color: var(--ink-mid); font-size: 0.9rem; padding: 0.26rem 0.82rem; cursor: pointer; transition: all 0.15s; border-radius: 1px; }
.filter-btn:hover { border-color: var(--rust-mid); color: var(--rust); }
.filter-btn.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.search-wrap { margin-right: auto; position: relative; }
.search-input { font-size: 1rem; padding: 0.32rem 0.9rem 0.32rem 2rem; border: 1px solid var(--border); background: var(--parchment); color: var(--ink); width: 210px; outline: none; }
.search-input:focus { border-color: var(--teal); }
.search-icon { position: absolute; left: 0.55rem; top: 50%; transform: translateY(-50%); color: var(--sand); font-size: 1rem; }

.main-container { padding: 2.5rem 5rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 1rem; }
thead { background: var(--ink); color: var(--parchment); position: sticky; top: 56px; }
thead th { padding: 0.85rem 0.9rem; text-align: right; font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
thead th.ltr-col { text-align: left; direction: ltr; font-family: 'Cormorant Garamond', serif; font-style: italic; }
tbody tr { border-bottom: 1px solid var(--border-l); transition: background 0.15s; }
tbody tr:hover { background: var(--parchment); }
tbody td { padding: 0.8rem 0.9rem; vertical-align: top; line-height: 1.6; color: var(--ink-mid); }
.name-cell { font-weight: 600; color: var(--ink); font-size: 1rem; min-width: 140px; }
.notes-cell { font-size: 0.9rem; color: var(--ink-light); max-width: 240px; }
.link-cell a { color: var(--teal); text-decoration: none; font-size: 0.9rem; direction: ltr; display: inline-block; }
.link-cell a:hover { text-decoration: underline; }
.expand-btn { background: none; border: none; color: var(--teal); cursor: pointer; font-size: 0.9rem; padding: 0; }
.expand-row { display: none; background: var(--parchment); }
.expand-row td { padding: 0.9rem; font-size: 0.9rem; line-height: 1.9; color: var(--ink-mid); border-top: 1px solid var(--border-l); }
.expand-row.open { display: table-row; }
.expand-label { font-weight: 600; color: var(--rust); margin-left: 0.4rem; }

.badge { display: inline-block; padding: 0.14rem 0.48rem; font-size: 0.8rem; font-weight: 600; border-radius: 1px; white-space: nowrap; }
.badge-open { background: #d4edda; color: #155724; }
.badge-partial { background: #fff3cd; color: #856404; }
.badge-physical { background: #f8d7da; color: #721c24; }
.badge-research { background: #e8e0f0; color: #4a2080; }

.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 1.1rem; }
.inst-card { background: var(--parchment); border: 1px solid var(--border); padding: 1.4rem; transition: all 0.2s; position: relative; overflow: hidden; }
.inst-card::after { content:''; position:absolute; bottom:0; right:0; left:0; height:2px; background:var(--rust); transform:scaleX(0); transition:transform 0.3s; }
.inst-card:hover { border-color: var(--rust); box-shadow: 0 4px 16px rgba(26,22,16,0.08); }
.inst-card:hover::after { transform: scaleX(1); }
.inst-country { font-size: 0.8rem; font-weight: 600; color: var(--teal); letter-spacing: 0.1em; text-transform: uppercase; font-family: 'Noto Serif', serif; direction: ltr; margin-bottom: 0.4rem; }
.inst-name { font-size: 1.05rem; font-weight: 600; color: var(--ink); margin-bottom: 0.3rem; line-height: 1.4; }
.inst-holdings { font-size: 0.9rem; color: var(--ink-light); margin-bottom: 0.8rem; line-height: 1.7; }
.inst-footer { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.inst-terms { font-size: 0.8rem; color: var(--gold); font-style: italic; font-family: 'Noto Serif', serif; direction: ltr; }
.inst-link a { font-size: 0.9rem; color: var(--teal); text-decoration: none; direction: ltr; }
.inst-link a:hover { text-decoration: underline; }
.category-label { grid-column: 1/-1; font-size: 0.9rem; font-weight: 700; color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-family: 'Noto Serif', serif; direction: ltr; padding-top: 0.5rem; border-top: 1px solid var(--border-l); margin-top: 1rem; }

.section-divider { display: flex; align-items: center; gap: 1rem; margin: 2.5rem 0 1.2rem; }
.section-divider h2 { font-size: 1.1rem; font-weight: 700; color: var(--rust); white-space: nowrap; }
.section-divider .label2 { font-family: 'Cormorant Garamond', serif; font-size: 1rem; font-style: italic; color: var(--sand); direction: ltr; }
.divider-line { flex: 1; height: 1px; background: var(--border); }

.result-count { font-size: 0.9rem; color: var(--ink-light); margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-l); }

.suggest-strip { background: var(--parchment); border: 1px dashed var(--border); padding: 1.1rem 2rem; text-align: center; margin-top: 2.5rem; }
.suggest-strip p { font-size: 1rem; color: var(--ink-light); }
.suggest-strip a { color: var(--rust); text-decoration: none; border-bottom: 1px solid var(--rust); }

footer.site-footer { background: var(--ink); color: var(--sand); text-align: center; padding: 1.5rem; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 1rem; direction: ltr; margin-top: 3rem; }

.leaflet-container { background: #e8dfc8 !important; }
.leaflet-popup-content-wrapper { background: var(--ink) !important; color: var(--cream); border-radius: 0 !important; border-top: 3px solid var(--rust); box-shadow: 0 6px 24px rgba(26,22,16,0.35) !important; }
.leaflet-popup-tip { background: var(--ink) !important; }
.leaflet-popup-content { margin: 1rem 1.2rem !important; min-width: 230px; }
.popup-name { font-size: 1.05rem; font-weight: 700; color: #f0e8d0; margin-bottom: 0.6rem; }
.popup-stat { font-size: 0.9rem; color: #c0b090; margin-bottom: 0.2rem; direction: ltr; font-family: 'Noto Serif', serif; }
.popup-names { font-size: 0.85rem; color: #9a8060; font-style: italic; font-family: 'Noto Serif', serif; direction: ltr; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid rgba(200,180,138,0.2); line-height: 1.7; }
.popup-link { display: inline-block; margin-top: 0.7rem; font-size: 0.9rem; color: var(--rust-light); text-decoration: none; direction: ltr; font-family: 'Noto Serif', serif; }
.popup-link:hover { text-decoration: underline; }
.alfalaj-tooltip { background: var(--ink) !important; color: var(--parchment) !important; border: none !important; border-top: 2px solid var(--rust) !important; border-radius: 0 !important; padding: 0.45rem 0.75rem !important; font-size: 1rem !important; box-shadow: 0 3px 12px rgba(26,22,16,0.25) !important; }
.alfalaj-tooltip::before { display: none !important; }

.orient-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px,1fr)); gap: 1rem; }
.orient-card { background: var(--parchment); border: 1px solid var(--border); padding: 1.25rem; transition: all 0.2s; }
.orient-card:hover { border-color: var(--teal-l); box-shadow: 0 3px 12px rgba(26,22,16,0.07); }
.orient-name { font-size: 1.05rem; font-weight: 600; color: var(--ink); margin-bottom: 0.2rem; }
.orient-meta { font-size: 0.9rem; color: var(--teal); font-family: 'Cormorant Garamond', serif; font-style: italic; direction: ltr; text-align: left; margin-bottom: 0.5rem; }
.orient-regions { font-size: 0.9rem; color: var(--ink-light); margin-bottom: 0.4rem; }
.orient-notes { font-size: 0.9rem; color: var(--ink-light); line-height: 1.7; border-top: 1px solid var(--border-l); padding-top: 0.5rem; margin-top: 0.5rem; }
.visual-tag { font-size: 0.8rem; padding: 0.13rem 0.45rem; background: #e8f4f0; color: #1a5c30; border: 1px solid #b8d8cc; display: inline-block; margin-bottom: 0.4rem; }
.gap-tag { font-size: 0.8rem; padding: 0.13rem 0.45rem; background: #fff3e0; color: #7a4400; border: 1px solid #f0c070; display: inline-block; margin-bottom: 0.4rem; }

.hidden { display: none !important; }

@media (max-width: 900px) {
  .page-header, .filter-bar, .main-container { padding-left: 1.5rem; padding-right: 1.5rem; }
  .nav-links a { padding: 0 0.8rem; font-size: 0.9rem; }
  .inst-grid { grid-template-columns: 1fr; }
}

/* ── LOGO SVG ── */
.logo-svg { display: inline-block; vertical-align: middle; }

/* ── PEOPLE / PHOTOGRAPHERS PAGE ── */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.person-card { background: var(--parchment); border: 1px solid var(--border); transition: all 0.2s; position: relative; overflow: hidden; }
.person-card::after { content:''; position:absolute; bottom:0; right:0; left:0; height:2px; background:var(--rust); transform:scaleX(0); transition:transform 0.3s; }
.person-card:hover { border-color: var(--rust); box-shadow: 0 4px 16px rgba(26,22,16,0.08); }
.person-card:hover::after { transform: scaleX(1); }
.person-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.8rem; padding: 1rem 1rem 0.6rem; border-bottom: 1px solid var(--border-l); }
.person-name { font-size: 1.05rem; font-weight: 700; color: var(--ink); margin-bottom: 0.15rem; }
.person-meta { font-size: 0.9rem; color: var(--ink-light); font-family: 'Noto Serif', serif; font-style: italic; direction: ltr; line-height: 1.5; }
.person-body { padding: 0.7rem 1rem 0.9rem; }
.person-row { display: flex; gap: 0.5rem; font-size: 0.9rem; color: var(--ink-mid); margin-bottom: 0.28rem; line-height: 1.5; }
.person-lbl { font-weight: 600; color: var(--gold); min-width: 72px; flex-shrink: 0; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.05rem; }
.person-notes { font-size: 0.95rem; color: var(--ink-light); line-height: 1.75; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px dashed var(--border-l); font-style: italic; }
.person-link-wrap { margin-top: 0.5rem; }
.person-link { font-size: 0.9rem; color: var(--teal); text-decoration: none; direction: ltr; display: inline-block; }
.person-link:hover { text-decoration: underline; }

.section-block { margin-bottom: 2.5rem; }
.section-count { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; color: var(--sand); background: var(--parchment); border: 1px solid var(--border-l); padding: 0.1rem 0.6rem; flex-shrink: 0; }

/* ── CONTACT PAGE ── */
.contact-wrap { max-width: 680px; margin: 0 auto; padding: 4rem 2rem; }
.contact-intro { font-family: 'Cormorant Garamond', serif; font-size: 1.45rem; font-style: italic; color: var(--ink-light); line-height: 1.8; margin-bottom: 2.5rem; }
.contact-reasons { list-style: none; margin-bottom: 2.5rem; }
.contact-reasons li { padding: 0.7rem 0; border-bottom: 1px dashed var(--border-l); font-size: 1rem; color: var(--ink-mid); display: flex; gap: 0.8rem; align-items: flex-start; line-height: 1.7; }
.contact-reasons li::before { content: '→'; color: var(--rust); font-size: 0.9rem; flex-shrink: 0; margin-top: 0.15rem; }
.contact-email-block { background: var(--ink); padding: 2rem 2.5rem; text-align: center; margin-bottom: 2rem; }
.contact-email-label { font-size: 0.9rem; font-weight: 700; color: var(--sand); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 0.6rem; font-family: 'Noto Serif', serif; }
.contact-email-addr { font-family: 'Cormorant Garamond', serif; font-size: 1.65rem; color: var(--parchment); direction: ltr; }
.contact-email-addr a { color: var(--parchment); text-decoration: none; border-bottom: 1px solid rgba(196,173,130,0.4); transition: border-color 0.2s; }
.contact-email-addr a:hover { border-color: var(--rust-light); color: var(--rust-light); }
.contact-note { font-size: 0.9rem; color: var(--ink-light); font-style: italic; font-family: 'Cormorant Garamond', serif; text-align: center; }

/* RTL person-lbl */
[dir="rtl"] .person-lbl { min-width: 80px; }
[dir="rtl"] .person-meta { direction: rtl; font-family: 'Noto Naskh Arabic', serif; font-style: normal; }
[dir="rtl"] .contact-reasons li::before { content: '←'; }

/* hide elements for search */
.person-card.hidden, .section-block.all-hidden { display: none; }


.footer-note {
  background: var(--parchment-d);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 0.9rem 2rem;
  font-size: 0.9rem;
  color: var(--ink-light);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
}
.footer-note a { color: var(--rust); text-decoration: none; border-bottom: 1px solid rgba(139,58,28,0.3); }
.footer-note a:hover { border-bottom-color: var(--rust); }
/* ═══════════════════════════════════════════
   MOBILE — full responsive overhaul
   Breakpoints: 600px (phone), 900px (tablet)
   ═══════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 1.2rem;
  cursor: pointer;
  background: none;
  border: none;
  margin-left: auto;
  flex-shrink: 0;
}
[dir="rtl"] .nav-hamburger { margin-left: 0; margin-right: auto; }
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--sand);
  transition: all 0.2s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {

  /* ── Base ── */
  html { font-size: 17px; }

  /* ── Nav ── */
  nav.site-nav { flex-wrap: nowrap; min-height: 52px; position: relative; }
  .nav-hamburger { display: flex; }
  .nav-lang { display: none; } /* moved into mobile menu */

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--ink);
    border-top: 1px solid rgba(200,180,138,0.15);
    border-bottom: 2px solid var(--rust);
    z-index: 300;
    padding: 0.5rem 0;
  }
  .nav-links.open { display: flex; }
  .nav-links li { display: block; }
  .nav-links a {
    padding: 0.75rem 1.4rem;
    font-size: 1rem;
    border-bottom: none;
    border-top: 1px solid rgba(200,180,138,0.08);
    margin-bottom: 0;
    white-space: normal;
  }
  .nav-links a:hover, .nav-links a.active { background: rgba(200,180,138,0.07); }

  /* Language link inside mobile menu */
  .nav-links::after {
    content: attr(data-lang-label);
    display: block;
    padding: 0.75rem 1.4rem;
    font-size: 0.9rem;
    color: var(--sand);
    border-top: 1px solid rgba(200,180,138,0.15);
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
  }

  /* ── Page header ── */
  .page-header { padding: 1.4rem 1.2rem; }
  .page-header h1 { font-size: 1.6rem; }
  .page-header .subtitle { font-size: 0.95rem; }

  /* ── Filter bar ── */
  .filter-bar {
    padding: 0.7rem 1.2rem;
    gap: 0.4rem;
    overflow-x: auto;
    flex-wrap: wrap;
  }
  .filter-btn { font-size: 0.8rem; padding: 0.3rem 0.6rem; }
  .filter-label { font-size: 0.8rem; }
  .search-wrap { width: 100%; margin-top: 0.3rem; }
  .search-input { width: 100%; }

  /* ── Main container ── */
  .main-container { padding: 1.5rem 1.2rem; }

  /* ── Institution cards ── */
  .inst-grid { grid-template-columns: 1fr; gap: 1rem; }
  .inst-card { padding: 1rem; }
  .inst-name { font-size: 1rem; }
  .inst-holdings { font-size: 0.85rem; }
  .inst-footer { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

  /* ── People/photographers grid ── */
  .people-grid { grid-template-columns: 1fr; gap: 0.8rem; }
  .person-name { font-size: 1rem; }
  .person-row { font-size: 0.85rem; }

  /* ── Books / manuscripts / orient grid ── */
  .orient-grid { grid-template-columns: 1fr; }

  /* ── Tables ── */
  .table-wrap { font-size: 0.8rem; }
  thead th { padding: 0.6rem 0.5rem; font-size: 0.75rem; }
  tbody td { padding: 0.6rem 0.5rem; font-size: 0.8rem; }

  /* ── Section dividers ── */
  .section-divider h2 { font-size: 1rem; }

  /* ── Contact page ── */
  .contact-wrap { padding: 2rem 1.2rem; }
  .contact-intro { font-size: 1.2rem; }
  .contact-email-addr { font-size: 1.3rem; }
  .contact-email-block { padding: 1.5rem 1.2rem; }

  /* ── Footer ── */
  footer.site-footer { font-size: 0.85rem; padding: 1.2rem; }
  .footer-note { font-size: 0.8rem; padding: 0.7rem 1.2rem; }

  /* ── Suggest strip ── */
  .suggest-strip { padding: 1rem 1.2rem; }
  .suggest-strip p { font-size: 0.9rem; }
}

@media (max-width: 600px) {
  html { font-size: 16px; }
  .page-header h1 { font-size: 1.4rem; }
  .nav-logo-en, .nav-logo-ar { font-size: 1.2rem; }
  .nav-logo-sub { display: none; }
}
