/* GALex Digital - static site styles */

:root {
  --bg: #fafaf7;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6a6a6a;
  --accent: #7c2d12;
  --accent-soft: #fef3ec;
  --border: #e5e5e0;
  --gr-color: #1e40af;
  --ar-color: #166534;
  --num-color: #7c2d12;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Gentium Plus", "Brill", "Charis SIL", "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.55;
}

/* Layout: header + sidebar + main + footer */
body {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header header"
    "sidebar main"
    "footer footer";
  min-height: 100vh;
}

header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--accent);
}
.brand .subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.search {
  display: flex;
  gap: 8px;
  flex: 1;
  max-width: 640px;
}
.search input[type="search"] {
  flex: 1;
  padding: 8px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-family: inherit;
}
.search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search select {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
}

nav#sidebar {
  grid-area: sidebar;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 110px);
}

.tabbar {
  display: flex;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
.tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

#list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
#list li {
  padding: 6px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
#list li:hover {
  background: var(--accent-soft);
}
#list li.selected {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
#list .l-ar {
  font-size: 15px;
  color: var(--ar-color);
  direction: rtl;
}
#list .l-tr {
  flex: 1;
  font-style: italic;
  color: var(--ink);
}
#list .l-gr {
  font-size: 16px;
  color: var(--gr-color);
  font-family: "Gentium Plus", "Brill", serif;
}
#list .root-divider {
  padding: 6px 16px 2px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
  cursor: default;
  border-left: none;
}

main {
  grid-area: main;
  padding: 24px 40px;
  overflow-y: auto;
  max-height: calc(100vh - 110px);
}

article#entry {
  max-width: 880px;
  margin: 0 auto;
}

.welcome {
  background: var(--panel);
  padding: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.welcome h2 {
  color: var(--accent);
  margin-top: 0;
}
.welcome .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 24px;
}

.entry-head {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.entry-head .root {
  display: inline-block;
  font-size: 14px;
  color: var(--muted);
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: 4px;
  margin-bottom: 8px;
}
.entry-head .arabic {
  font-size: 32px;
  direction: rtl;
  color: var(--ar-color);
  margin-right: 12px;
  font-family: "Amiri", "Scheherazade New", "Times New Roman", serif;
}
.entry-head .translit {
  font-size: 24px;
  font-style: italic;
  color: var(--ink);
}
.entry-head .grammar {
  font-size: 14px;
  color: var(--muted);
  margin-left: 8px;
}
.entry-head .pdf-page {
  float: right;
  font-size: 12px;
  color: var(--muted);
}

/* Entry body */
.para, .preamble {
  margin: 18px 0;
  padding: 0;
}
.preamble {
  padding: 8px 12px;
  background: var(--panel);
  border-left: 3px solid var(--border);
  border-radius: 0 4px 4px 0;
}
.para .num {
  font-weight: 700;
  color: var(--num-color);
  margin-right: 4px;
  font-size: 18px;
}
.para-num {
  margin-bottom: 6px;
}
.para-header {
  padding: 8px 12px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  margin-bottom: 10px;
  font-style: italic;
  color: var(--ink);
}
.belegstellen {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bs {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid #1e40af;
  border-radius: 6px;
  padding: 10px 14px;
}
.bs.continuation {
  border-left-color: #94a3b8;
  background: #fafafa;
}
.bs.ref-only {
  background: #fef9c3;
  border-left-color: #ca8a04;
  font-size: 14px;
}
.bs.highlighted {
  box-shadow: 0 0 0 3px #fbbf24, 0 4px 14px rgba(0,0,0,0.08);
  animation: bsHighlight 1.5s ease-out;
}
@keyframes bsHighlight {
  0% { background: #fef3c7; }
  100% { background: var(--panel); }
}
.bs-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.bs-label {
  font-weight: 700;
  color: var(--num-color);
  font-size: 13px;
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.bs-source {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}
.bs-source:hover {
  background: #f1f5f9;
  border-radius: 4px;
  padding: 2px 6px;
  margin: -2px -6px;
}
.source-view header { border-bottom: 2px solid var(--accent); padding-bottom: 14px; margin-bottom: 18px; }
.source-view h2 { color: var(--gr-color); margin: 4px 0; }
.source-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.source-meta { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.source-list { display: flex; flex-direction: column; gap: 8px; }
.source-item { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--gr-color); padding: 10px 14px; border-radius: 6px; }
.source-item-ref { color: var(--ink); text-decoration: none; }
.source-item-ref:hover { color: var(--accent); }
.source-item-section { color: var(--num-color); font-size: 12px; margin: 0 6px; }
.source-truncated { color: var(--muted); font-style: italic; }
.bs-author {
  color: var(--ink);
  font-weight: 600;
}
.bs-work {
  font-style: italic;
}
.bs-ref {
  color: var(--muted);
}
.bs-version {
  font-size: 11px;
  background: #1e40af;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bs-greek {
  color: var(--gr-color);
  font-family: "Gentium Plus", "Brill", "GFS Didot", serif;
  font-size: 17px;
  margin: 4px 0;
  line-height: 1.45;
}
.gr-link {
  color: var(--gr-color);
  text-decoration: none;
  border-bottom: 1px dotted var(--gr-color);
  cursor: pointer;
}
.gr-link:hover {
  background: #dbeafe;
  border-bottom-style: solid;
}
.ev-item .l-tr {
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
}
.bs-arabic {
  color: var(--ar-color);
  font-style: italic;
  margin: 4px 0;
  line-height: 1.45;
}
.bs-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.bs-aref {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 3px;
}
.bs-notes {
  font-style: italic;
}
.cite {
  display: inline;
}
.sep {
  display: inline-block;
  margin: 0 6px;
  color: var(--muted);
  vertical-align: -2px;
}

.gr {
  color: var(--gr-color);
  font-family: "Gentium Plus", "Brill", "GFS Didot", serif;
}
.ar {
  color: var(--ar-color);
  font-family: "Amiri", "Scheherazade New", "Times New Roman", serif;
  direction: rtl;
  unicode-bidi: embed;
}

/* Glossary entry view */
.glossary-entry .headword {
  font-size: 26px;
  color: var(--gr-color);
  font-family: "Gentium Plus", "Brill", serif;
  margin-bottom: 8px;
}
.glossary-entry .body {
  font-size: 15px;
  line-height: 1.6;
}

footer {
  grid-area: footer;
  padding: 8px 24px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--panel);
}

/* Responsive */
@media (max-width: 720px) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "header"
      "sidebar"
      "main"
      "footer";
  }
  nav#sidebar { max-height: 200px; }
  main { max-height: none; padding: 16px; }
}

/* Belegstelle sub-header (Arnzen B1 intro segments like '(a) al-muʾabbadu') */
.bs-intro {
  font-style: italic;
  color: var(--accent);
  font-size: 14px;
  padding: 2px 0 6px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 6px;
}

/* Canonical bibliography block in source view */
.source-biblio {
  margin-top: 10px;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
}
.source-biblio summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}
.source-biblio p { margin: 6px 0; line-height: 1.5; }
.bib-marker {
  display: inline-block;
  width: 18px;
  font-weight: 700;
  color: var(--gr-color);
}
.bib-secondary {
  color: var(--muted);
  font-size: 12px;
  padding-left: 18px;
}

/* Forms tab list rows */
#list li .l-tr em { font-style: italic; }

/* Quick wins: cite button, footer links, about page, search marks */
.cite-btn {
  margin-left: 10px;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
}
.cite-btn:hover { background: var(--accent-soft); }
footer { display: flex; justify-content: space-between; align-items: center; }
.footer-links a { color: var(--accent); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
mark {
  background: #fde68a;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.signs-table { border-collapse: collapse; margin: 8px 0; }
.signs-table td { border: 1px solid var(--border); padding: 4px 10px; font-size: 14px; }
.signs-table .sign-cell { font-size: 16px; text-align: center; width: 48px; color: var(--accent); }
.about-page h3 { color: var(--accent); margin-top: 22px; }

/* Parallel manuscript versions inside a Belegstelle */
.bs-versions { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bs-version-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
}
.bs-version-chip {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
}
.bs-version-text { font-size: 15px; font-style: italic; }

/* Knowledge graph */
.graph-svg {
  width: 100%;
  height: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
}
.graph-svg .gnode:hover circle { fill-opacity: 1; stroke: #fbbf24; }
.graph-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
.graph-legend i {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 50%;
  margin-right: 5px;
}
.graph-view .hint { color: var(--muted); font-size: 13px; }
.graph-view .hint a { color: var(--accent); }
