:root {
  --sermon-muted: #6b7280;
  --sermon-line: #d8d8d8;
  --sermon-soft: #f7f7f7;
  --sermon-accent: #005cc5;
}

* {
  box-sizing: border-box;
}

button,
input {
  font: inherit;
}

.sermons-shell {
  margin-top: 2rem;
}

.sermons-page-title {
  margin-bottom: 1.5rem;
}

.sermons-page-title p {
  margin: 0.35rem 0 0;
  color: var(--sermon-muted);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.intro {
  padding: 0 0 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--sermon-line);
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
  margin: 1.5rem 0 0.75rem;
}

.search-box,
.book-filter {
  display: grid;
  gap: 0.35rem;
  color: var(--sermon-muted);
  font-size: 0.95rem;
}

.search-box input,
.book-toggle {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--sermon-line);
  border-radius: 3px;
  background: #fff;
  color: inherit;
  outline: none;
}

.search-box input:focus,
.book-toggle:focus-visible,
.book-toggle.is-active {
  border-color: var(--sermon-accent);
}

.book-filter {
  position: relative;
}

.book-filter-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.book-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  max-width: 18rem;
  color: inherit;
  cursor: pointer;
}

.book-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  z-index: 10;
  width: min(100%, 46rem);
  padding: 1rem;
  border: 1px solid var(--sermon-line);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.book-options {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
}

.book-group h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  color: inherit;
}

.book-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.book-option {
  border: 1px solid var(--sermon-line);
  border-radius: 3px;
  background: var(--sermon-soft);
  color: inherit;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
  font-size: 0.86rem;
}

.book-option:hover,
.book-option:focus-visible,
.book-option.is-active {
  border-color: var(--sermon-accent);
  color: var(--sermon-accent);
  outline: none;
}

.tag-panel {
  display: grid;
  gap: 0.5rem;
}

.tag-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--sermon-muted);
  font-size: 0.95rem;
}

.text-button,
.back-button {
  color: var(--sermon-accent);
}

.text-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.tag-cloud,
.reader-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag-button,
.tag-pill {
  border: 1px solid var(--sermon-line);
  border-radius: 3px;
  background: #fff;
  color: inherit;
  font-size: 0.88rem;
}

.tag-button {
  cursor: pointer;
  padding: 0.22rem 0.5rem;
}

.tag-button.is-active {
  border-color: var(--sermon-accent);
  color: var(--sermon-accent);
}

.tag-pill {
  padding: 0.12rem 0.42rem;
  color: var(--sermon-muted);
}

.tag-more {
  justify-self: start;
}

.result-bar {
  min-height: 1.6rem;
  color: var(--sermon-muted);
  font-size: 0.92rem;
}

.result-bar p {
  margin: 0;
}

.sermon-list {
  display: grid;
  gap: 0.75rem;
}

.sermon-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--sermon-line);
  border-radius: 3px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  padding: 1rem;
}

.sermon-card:hover,
.sermon-card:focus-visible {
  border-color: var(--sermon-accent);
  outline: none;
}

.sermon-card h2 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.35;
}

.sermon-card time,
.reader-date {
  color: var(--sermon-muted);
  font-size: 0.88rem;
}

.sermon-card p {
  margin: 0 0 0.65rem;
  color: var(--sermon-muted);
}

.reader-view {
  max-width: 48rem;
  margin: 0 auto;
}

.back-button {
  margin: 0 0 1rem;
  border: 1px solid var(--sermon-line);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  padding: 0.4rem 0.65rem;
}

.reader-paper {
  background: #fff;
}

.reader-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--sermon-line);
  margin-bottom: 1.5rem;
}

.reader-date {
  margin: 0 0 0.4rem;
}

.reader-header h2 {
  margin: 0 0 0.7rem;
  font-size: 1.8rem;
  line-height: 1.25;
}

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

.prose > :last-child {
  margin-bottom: 0;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.3;
  margin: 1.35em 0 0.45em;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 0 0 1em;
}

.prose blockquote {
  border-left: 3px solid var(--sermon-line);
  background: var(--sermon-soft);
  padding: 0.8rem 1rem;
}

.prose pre {
  overflow: auto;
  border-radius: 3px;
  padding: 1rem;
}

.empty-state {
  border: 1px dashed var(--sermon-line);
  border-radius: 3px;
  padding: 1.25rem;
  background: var(--sermon-soft);
}

.empty-state h2 {
  margin: 0 0 0.25rem;
}

.empty-state p {
  margin: 0;
  color: var(--sermon-muted);
}

.related-sermons,
.resource-recommendations {
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--sermon-line);
}

.related-sermons {
  border-top-color: #8bb59b;
}

.resource-recommendations {
  border-top-color: #b9a46b;
}

.related-sermons h3,
.resource-recommendations h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.related-sermons h3 {
  color: #2f6f4e;
}

.resource-recommendations h3 {
  color: #7a5f1a;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.related-card {
  display: grid;
  align-content: start;
  gap: 0.35rem;
  min-height: 8.5rem;
  padding: 0.85rem;
  border: 1px solid var(--sermon-line);
  border-radius: 3px;
  background: #fbfcfb;
  color: inherit;
  text-decoration: none;
}

.content .related-card:hover,
.content .related-card:focus-visible {
  border-color: var(--sermon-accent);
  background-image: none;
  color: inherit;
  outline: none;
}

.related-card time,
.related-card span {
  color: var(--sermon-muted);
  font-size: 0.88rem;
}

.related-card strong {
  color: inherit;
  font-size: 1rem;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .reader-header h2 {
    font-size: 1.45rem;
  }

  .related-list {
    grid-template-columns: 1fr;
  }

  .related-card {
    min-height: 0;
  }

  .book-options {
    grid-template-columns: 1fr;
  }

  .book-toggle {
    max-width: none;
  }
}

body.theme-dark .book-toggle,
body.theme-dark .book-panel,
body.theme-dark .book-option,
body.theme-dark .related-card {
  border-color: #4b5563;
  background: #111827;
  color: #e5e7eb;
}

body.theme-dark .book-panel {
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34);
}

body.theme-dark .book-option:hover,
body.theme-dark .book-option:focus-visible,
body.theme-dark .book-option.is-active {
  border-color: #9ae6b4;
  color: #9ae6b4;
}

body.theme-dark .content .related-card:hover,
body.theme-dark .content .related-card:focus-visible {
  border-color: #9ae6b4;
  background-image: none;
  color: #e5e7eb;
}

body.theme-dark .related-card time,
body.theme-dark .related-card span {
  color: #b7c0cc;
}

body.theme-dark .related-card strong {
  color: #f3f4f6;
}

body.theme-dark .related-sermons {
  border-top-color: #4f8f67;
}

body.theme-dark .resource-recommendations {
  border-top-color: #a68a3d;
}

body.theme-dark .related-sermons h3 {
  color: #9ae6b4;
}

body.theme-dark .resource-recommendations h3 {
  color: #f2d17b;
}
