@font-face {
  font-family: 'Ezra SIL';
  src: url('/static/fonts/EzraSIL.ttf') format('truetype');
  font-display: swap;
  font-weight: 400;
}

:root {
  --color-accent: #2b3f6b;
  --color-text: #1a1a1a;
  --color-muted: #666;
  --color-bg: #fdfdfb;
  --color-footer-bg: #111111;
  --color-footer-text: #cfcfcf;
  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  padding: 2rem 2rem 0.85rem;
  text-align: center;
}

.site-title {
  display: inline-block;
  margin-bottom: 1rem;
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  text-decoration: none;
}

.site-header nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  border-top: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  padding: 0.85rem 0;
}

.site-header nav a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-header nav a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.avatar-link {
  display: inline-flex;
  border-bottom: none !important;
}

.avatar-bg {
  fill: var(--color-accent);
  transition: fill 0.15s ease;
}

.avatar-link:hover .avatar-bg {
  fill: #17223e;
}

.avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.15s ease;
}

.avatar-link:hover .avatar-initials {
  background: #17223e;
}

main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  flex: 1;
}

main h1 {
  font-family: var(--font-serif);
  color: var(--color-accent);
}

.welcome-heading {
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
}

.welcome-subtitle {
  font-size: 1.15rem;
  text-align: center;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2.5rem;
}

.card {
  position: relative;
  display: block;
  padding: 2rem;
  background: #f4f8fb;
  color: var(--color-text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 26px 26px;
  border-color: transparent transparent var(--color-accent) transparent;
  filter: drop-shadow(-1px -1px 2px rgba(0, 0, 0, 0.3));
  transition: border-color 0.15s ease;
}

.card:hover::after {
  border-color: transparent transparent #17223e transparent;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--color-accent);
}

.card p {
  margin: 0;
  font-size: 1rem;
  color: var(--color-muted);
}

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

.site-footer {
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  padding: 1.5rem 2rem;
}

.site-footer p {
  max-width: 1200px;
  margin: 0 auto;
  text-align: left;
  font-size: 1rem;
}

.site-footer-note {
  max-width: 1200px;
  margin: 0.35rem auto 0;
  text-align: left;
  font-size: 0.8rem;
  opacity: 0.7;
}

.site-footer-note a {
  color: #fff;
}

/* Read page */

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

.read-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.read-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.read-select {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: var(--color-text);
}

.read-select-narrow {
  min-width: 4.5rem;
}

.read-nav-arrows {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}

.read-nav-btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  background: #fff;
  color: var(--color-accent);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.read-nav-btn:hover:not(:disabled) {
  background: var(--color-accent);
  color: #fff;
}

.read-nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.font-heb {
  font-family: "SBL Hebrew", "Ezra SIL", serif;
  font-weight: 400;
  font-synthesis: none;
}

.read-text {
  font-size: 1.6rem;
  line-height: 2.2;
  text-align: right;
}

.read-text p {
  margin: 0 0 0.75rem;
}

.verse-num {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-muted);
  vertical-align: super;
  margin-inline-end: 0.4rem;
  unicode-bidi: isolate;
}

.read-gated-message {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  text-align: left;
  color: var(--color-muted);
}

.read-gated-message a {
  color: var(--color-accent);
}

.read-dev-note {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  font-style: italic;
}

/* Account pages (register/login/account) */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 26rem;
  margin-top: 1.5rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-field input {
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: var(--color-text);
  font-weight: normal;
}

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.form-checkbox input {
  margin-top: 0.2rem;
}

.auth-submit {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 1.4rem;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.auth-submit:hover {
  background: #17223e;
}

.form-error {
  color: #a02020;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-links {
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.form-links-disabled {
  color: var(--color-muted);
}

/* Search page */

.search-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-bottom: 2px solid var(--color-accent);
  margin-bottom: 1.5rem;
}

.search-tab {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  color: var(--color-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.search-tab:hover {
  color: var(--color-accent);
}

.search-tab.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.search-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-panel[hidden] {
  display: none;
}

.search-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.search-field label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.search-field-row {
  display: flex;
  gap: 0.6rem;
}

.search-field input[type="text"] {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  flex: 1;
  min-width: 0;
}

.search-field input.font-heb {
  font-family: "SBL Hebrew", "Ezra SIL", serif;
  font-size: 1.35rem;
}

.search-select {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  color: var(--color-text);
}

.search-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
}

.search-radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.search-radio-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.search-coming-soon {
  color: var(--color-muted);
  font-style: italic;
}

.search-subheading {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  margin: 1rem 0 0.4rem;
}
.search-subheading:first-of-type {
  margin-top: 0.6rem;
}

.search-submit {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: 4px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-submit:hover {
  background: #17223e;
}

#search-results {
  margin-top: 2rem;
  border-top: 1px solid #ddd;
  padding-top: 1.5rem;
}

#search-status {
  font-family: var(--font-sans);
  color: var(--color-muted);
}

#search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#search-results-header[hidden] {
  display: none;
}

#search-count {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-muted);
}

#search-group-row[hidden] {
  display: none;
}

.search-view-toggle {
  display: flex;
  gap: 0.4rem;
}

.search-view-btn {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  background: #fff;
  color: var(--color-accent);
  cursor: pointer;
}

.search-view-btn.active {
  background: var(--color-accent);
  color: #fff;
}

.search-results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.search-results-table tr {
  border-bottom: 1px solid #eee;
}

.search-results-table td {
  padding: 0.6rem 0.5rem;
  vertical-align: middle;
}

.search-result-word {
  font-size: 1.6rem;
  text-align: right;
  width: 15%;
  white-space: nowrap;
}

.search-result-ref {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: left;
  white-space: normal;
  overflow-wrap: break-word;
}

.search-verse-context {
  font-size: 1.6rem;
  line-height: 2;
  margin: 0 0 1rem;
}

.search-verse-context .search-result-ref {
  display: block;
  margin-bottom: 0.25rem;
}

.search-poetic-line {
  display: block;
  margin-bottom: 0.3rem;
}

.search-match-highlight {
  background: #fff2a8;
  border-radius: 2px;
}

#search-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

#search-pagination[hidden] {
  display: none;
}

#search-pagination button {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--color-accent);
  border-radius: 4px;
  background: #fff;
  color: var(--color-accent);
  cursor: pointer;
}

.study-layout {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

.study-nav {
  display: flex;
  flex-direction: column;
  flex: 0 0 220px;
  gap: 0.15rem;
  border-right: 2px solid var(--color-accent);
  padding-right: 1.5rem;
}

.study-nav a,
.study-nav-disabled {
  display: block;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 4px;
}

.study-nav a {
  color: var(--color-text);
  transition: background 0.15s ease, color 0.15s ease;
}

.study-nav a:hover {
  background: #f4f8fb;
  color: var(--color-accent);
}

.study-nav a.active {
  background: var(--color-accent);
  color: #fff;
  font-weight: 600;
}

.study-nav-disabled {
  color: var(--color-muted);
  cursor: default;
}

.study-content {
  flex: 1;
  min-width: 0;
}

#search-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Syntax Viewer (Study section) */

.hidden {
  display: none;
}

.sv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.sv-btn {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
}

.sv-btn-primary {
  border: 1px solid var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.sv-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sv-mode-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.sv-mode-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.sv-mode-row label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.sv-verse-box {
  background: #fff;
  border: 1px solid #e3ddcf;
  border-radius: 6px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.75rem;
  min-height: 4rem;
}

.sv-verse-box #sv-verse-text {
  font-size: 1.5rem;
  line-height: 2.2;
}

.sv-placeholder {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--color-muted);
}

.sv-hint {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--color-muted);
  margin: 0 0 0.75rem;
}

.sv-accent-panel {
  margin-bottom: 1.5rem;
}

.sv-loading,
.sv-muted {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-muted);
}

.poetic-line {
  display: block;
  margin-bottom: 0.3rem;
}

.sv-w {
  cursor: pointer;
  border-radius: 3px;
  padding: 0.05rem 0;
}

.sv-w:hover {
  background: #e7edf6;
}

.sv-w.selected {
  background: #cddaf0;
}

/* Sentence / Clause / Phrase / Group tree */

.sentence-block {
  border: 1px solid #ecdfb8;
  border-left: 4px solid #b8860b;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fdf8ec;
}

.sentence-header {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  margin-bottom: 0.6rem;
}

.sentence-header .sc-ref {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  margin-left: 0.4rem;
}

.sentence-text {
  font-size: 1.4rem;
  color: #4b4638;
  margin-bottom: 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ecdfb8;
}

.clause-block {
  border: 1px solid #d6dceb;
  border-left: 3px solid var(--color-accent);
  border-radius: 4px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.6rem;
  background: #f5f7fb;
}

.clause-block:last-child {
  margin-bottom: 0;
}

.clause-header {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  margin-bottom: 0.15rem;
}

.clause-text {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.clause-gap {
  color: #9ca3af;
}

.sc-block {
  padding: 0.75rem 1rem;
  border: 1px solid #e3ddcf;
  border-radius: 6px;
  background: #fafaf7;
}

.sc-block.phrase-card {
  background: #f1f8f3;
  border-color: #bfe0cb;
}

.sc-block-label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-muted);
  margin-bottom: 0.15rem;
}

.sc-heb {
  font-family: "SBL Hebrew", "Ezra SIL", serif;
  font-size: 1.4rem;
  font-weight: 400;
  font-synthesis: none;
  margin-bottom: 0.4rem;
}

.sc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.sc-tag {
  display: inline-flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  background: #e4e9f4;
  color: var(--color-accent);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  line-height: 1.35;
}

.sc-tag-code {
  font-weight: 700;
}

.phrase-card .sc-tag {
  background: #dcefe1;
  color: #2f6b45;
}

/* Border moved from bottom back to top (2026-09-01, both Clause and
   Phrase now reordered the same way -- tags before Mother, see
   renderClause() in this file and app/syntax_card.py's
   phrase_html_by_id()) -- Mother now comes AFTER the type/domain/kind
   (or function/type/determination) tags in both cards, right before the
   Show Phrases/Groups button (which already supplies its own
   margin-top regardless of what's directly above it), so the dashed
   separator needs to divide Mother from what PRECEDES it (the tags)
   rather than what follows it. A short-lived .phrase-card-only override
   existed between the 2026-08-29 and 2026-09-01 reorders, when only
   Phrase had flipped back to tags-first and Clause still had
   Mother-first -- gone now that both cards agree, folded back into this
   one shared rule. */
.sc-mother {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #d1cdc0;
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

/* relation on its own line (2026-08-29 fix) -- a long mother Hebrew
   text (sometimes a whole clause) wrapping onto multiple lines was
   breaking the relation tag's alignment when both shared one line.
   Mother line first, relation below it (2026-08-29 follow-up) -- the
   gap now sits above relation as a small margin-top, not below it. */
.sc-relation-row {
  margin-top: 0.15rem;
}

.sc-relation-row:empty {
  display: none;
}

.sc-mother-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9a6a1f;
}

.sc-mother .sc-heb {
  display: inline;
  font-size: 1.15rem;
  margin: 0 0.3rem;
}

.sc-ref {
  color: var(--color-muted);
  font-size: 0.75rem;
}

.sc-error {
  color: #b3261e;
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

.phrase-cards {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.show-clauses-btn,
.show-phrases-btn,
.show-groups-btn {
  font-family: var(--font-sans);
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
}

.show-clauses-btn {
  color: #9a6a1f;
  background: #fbeecb;
  border: 1px solid #e8cf8e;
}

.show-clauses-btn:hover {
  background: #f6e2ac;
}

/* Green, not the site accent color (2026-09-02) -- this button reveals
   Phrase cards, so its color should point at what it opens rather than
   blend into the Clause card it sits on, same reasoning applied to
   .show-groups-btn right below. Exact values matched to .show-groups-btn
   and .sc-block.phrase-card's own border-color. */
.show-phrases-btn {
  color: #2f6b45;
  background: #dcefe1;
  border: 1px solid #bfe0cb;
}

.show-phrases-btn:hover {
  background: #c9e6d1;
}

.show-groups-btn {
  margin-top: 0.6rem;
  margin-bottom: 0;
  color: #2f6b45;
  background: #dcefe1;
  border: 1px solid #bfe0cb;
}

.show-groups-btn:hover {
  background: #c9e6d1;
}

.groups-container {
  margin-top: 0.5rem;
}

.groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.group-row {
  padding: 0.4rem 0.6rem;
  background: #ffffff;
  border: 1px solid #d1e9d8;
  border-radius: 4px;
}

.group-header {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #2f6b45;
  margin-bottom: 0.25rem;
}

.group-content {
  font-family: "SBL Hebrew", "Ezra SIL", serif;
  font-size: 1.3rem;
  font-weight: 400;
  font-synthesis: none;
}
