@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-serif-roman.woff2) format('woff2');
}
@font-face {
  font-family: 'Source Serif 4';
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url(../fonts/source-serif-italic.woff2) format('woff2');
}

:root {
  --bg: #ffffff;
  --rule: #cccccc;
  --rule-light: #e0e0e0;
  --overlay: rgba(0,0,0,0.45);
  --font-body: 'Source Serif 4', 'Georgia', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 400; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: #000;
  min-height: 100vh;
  font-size: 16px;
  font-optical-sizing: none;
  font-variation-settings: 'opsz' 20;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* -- Sidebar -- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 290px;
  overflow-y: auto;
  background: var(--bg);
  border-right: 1px solid var(--rule);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 100;
}

.sidebar-title {
  font-size: 1.4rem;
  margin-bottom: -20px;
}

.sidebar-subtitle {
  font-size: 2.8rem;
  font-style: italic;
  letter-spacing: -0.03em;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* -- Mobile header bar -- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  z-index: 101;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-header span {
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* -- Sidebar toggle (hamburger) -- */
.sidebar-toggle {
  display: none;
  padding: 4px 6px;
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}

/* -- Sidebar backdrop (mobile) -- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--overlay);
  z-index: 99;
}

.sidebar-backdrop.open { display: block; }

select, input {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 3px 6px;
  border: none;
  border-bottom: 1px solid var(--rule-light);
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  appearance: auto;
}

select:focus, input:focus {
  outline: none;
  border-bottom-color: #000;
}

button {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 2px 10px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

button:hover { text-decoration: underline; text-underline-offset: 2px; }

.filter-summary {
  font-size: 0.88rem;
  font-style: italic;
}

.sidebar-footer {
  font-size: 0.88rem;
  display: flex;
  gap: 16px;
}

#random-btn {
  text-align: left;
  padding-left: 0;
  font-style: italic;
  font-size: 0.85rem;
}

.sidebar-section > label,
.translator-section h2 {
  font-size: 0.88rem;
  font-feature-settings: 'smcp' 1;
}

.sort-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.sort-group select { flex: 1; }

.reverse-btn {
  font-size: 0.88rem;
  padding: 0 4px;
  user-select: none;
  line-height: 1;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkbox-group label {
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.checkbox-group label.indent-1 { padding-left: 16px; }
.checkbox-group label.indent-2 { padding-left: 32px; }

/* -- Grid -- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  margin-left: 290px;
}

/* -- Mobile -- */
@media (max-width: 899px) {
  .mobile-header { display: flex; }
  .sidebar-toggle { display: block; }
  .sidebar {
    width: 280px;
    top: 48px;
    transform: translateX(-100%);
    transition: transform 0.25s;
  }
  .sidebar-title { display: none; }
  .sidebar-subtitle { display: none; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { top: 48px; }
  .grid { margin-left: 0; padding: 0; padding-top: 48px; }
}

/* -- Card -- */
.card {
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  padding: 18px 20px 22px;
  cursor: grab;
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 300px;
}

.card:hover { background: #f5f5f5; }

.card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}

.card.drag-over {
  box-shadow: inset 0 0 0 1.5px #888;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}

.card-header .translator-name {
  font-size: 1.15rem;
  line-height: 1.25;
  cursor: pointer;
}

.card-header .translator-name:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-header .meta {
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 2px;
}

.feature-dots {
  display: grid;
  grid-template-columns: repeat(4, 7px);
  grid-template-rows: repeat(3, 7px);
  gap: 2px;
}

.feature-dot {
  width: 7px;
  height: 7px;
  cursor: default;
  flex-shrink: 0;
}
.feature-dot.lg { width: 10px; height: 10px; }
.feature-dot.on { background: #000; }
.feature-dot.off { background: transparent; border: 1px solid #aaa; }

.card-body {
  font-size: 0.92rem;
  line-height: 1.5;
  cursor: text;
}

.card-body.verse .verse-line {
  padding-left: 2em;
  text-indent: -2em;
  text-wrap: pretty;
}

.card-body.verse .verse-line.blank {
  height: 0.8em;
}

.card-body.prose {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.card-body.no-passage {
  font-style: italic;
  text-align: center;
  padding: 24px 0;
  font-size: 0.85rem;
}

/* -- About page -- */
.about-page {
  max-width: 640px;
  margin: 48px auto;
  padding: 0 28px 48px;
  margin-left: max(290px, calc(50% - 320px));
  font-size: 0.92rem;
  line-height: 1.5;
}
.about-page p { margin: 0 0 1em; }
.about-page a { word-break: break-all; }
.about-page h2 { font-size: 1.15rem; margin: 2em 0 0.8em; }
.about-page h2:first-child { margin-top: 0; }

@media (max-width: 899px) {
  .about-page { margin-left: auto; margin-top: 60px; }
}

.stats-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.stat .stat-label {
  font-size: 0.88rem;
  font-style: italic;
}

.links-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.links-row a {
  font-size: 0.92rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 12px;
}

.feature-grid-item {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.feature-grid-item.off {
  font-style: italic;
  text-decoration: line-through;
}

@media (max-width: 899px) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .feature-grid-item {
    white-space: normal;
  }
}

@media (max-width: 500px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.loading {
  text-align: center;
  padding: 48px;
  font-style: italic;
  font-size: 0.92rem;
  grid-column: 1 / -1;
}

/* -- Sidebar excerpt links -- */
.sidebar-excerpt-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-excerpt-link {
  font-size: 0.92rem;
  line-height: 1.4;
  padding: 2px 0;
}

.sidebar-excerpt-link.active {
  font-weight: 600;
}

