/* ============================================================
   Biblical Language Learner — style.css
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f5f2ec;
  --surface:   #fffdf9;
  --border:    #d9d0bb;
  --accent:    #7b3f00;      /* warm brown – ink / manuscript feel */
  --accent2:   #3a6b35;      /* deep green for secondary actions */
  --text:      #2a2218;
  --muted:     #7a6f5e;
  --hebrew-font: 'Noto Serif Hebrew', 'SBL Hebrew', serif;
  --greek-font:  'Noto Serif', 'GFS Didot', serif;
  --ui-font:     'Noto Sans', system-ui, sans-serif;
  --radius:    8px;
  --shadow:    0 2px 12px rgba(0,0,0,0.08);
}

html { font-size: 16px; }
body {
  font-family: var(--ui-font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Header ---------- */
.app-header {
  width: 100%;
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 1.4rem 1rem 1.2rem;
}
.app-header h1 {
  font-family: var(--ui-font);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.app-header .subtitle {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ---------- Main wrapper ---------- */
.app-main {
  width: 100%;
  max-width: 960px;
  padding: 1.5rem 1rem 3rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ---------- Language nav ---------- */
.lang-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.55rem 1.1rem 0.45rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.lang-btn .corpus-label {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
}
.lang-btn:hover:not(.disabled) {
  border-color: var(--accent);
  background: #fdf6ee;
}
.lang-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.lang-btn.active .corpus-label { color: rgba(255,255,255,0.8); }
.lang-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Verse card ---------- */
.verse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 2rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---------- Loading ---------- */
.verse-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Verse text ---------- */
.verse-display { display: flex; flex-direction: column; gap: 0.75rem; }

.verse-text {
  font-size: 2.4rem;
  line-height: 2.2;
  text-align: center;
  color: var(--text);
  word-spacing: 0.3em;
  min-height: 5rem;
}
/* Hebrew-specific */
.verse-text[lang="he"] {
  font-family: var(--hebrew-font);
  direction: rtl;
  font-size: 2.6rem;
  line-height: 2.4;
  font-weight: 400;
}
/* Greek (NT and LXX) */
.verse-text[lang="el"] {
  font-family: var(--greek-font);
  direction: ltr;
  font-size: 2.2rem;
  line-height: 2.0;
}
/* Aramaic (same font as Hebrew, RTL) */
.verse-text[lang="arc"] {
  font-family: var(--hebrew-font);
  direction: rtl;
  font-size: 2.6rem;
  line-height: 2.4;
  font-weight: 400;
}
/* Latin */
.verse-text[lang="la"] {
  font-family: var(--greek-font);
  direction: ltr;
  font-size: 2.0rem;
  line-height: 1.9;
}
/* Coptic */
.verse-text[lang="cop"] {
  font-family: 'Noto Sans Coptic', sans-serif;
  direction: ltr;
  font-size: 2.0rem;
  line-height: 2.2;
}
/* Egyptian (Latin transliteration with diacritics) */
.verse-text[lang="egy"] {
  font-family: var(--greek-font);
  direction: ltr;
  font-size: 1.8rem;
  line-height: 2.0;
  letter-spacing: 0.03em;
}

/* German (standard Latin script) */
.verse-text[lang="de"] {
  font-family: var(--greek-font);
  direction: ltr;
  font-size: 1.9rem;
  line-height: 1.9;
}

.verse-hint {
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  padding: 0.6rem 1.6rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--ui-font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #5c2e00; border-color: #5c2e00; }

.btn-secondary {
  background: var(--surface);
  color: var(--accent2);
  border-color: var(--accent2);
}
.btn-secondary:hover { background: #edf5ec; }
.btn-secondary.answer-shown {
  background: var(--accent2);
  color: #fff;
  border-color: var(--accent2);
}
.btn-secondary.answer-shown:hover { background: #2c5128; }

/* ---------- Answer panel ---------- */
.answer-panel {
  border-top: 2px solid var(--border);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.answer-ref {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* Parse table */
.answer-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.parse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.parse-table th {
  background: #f0e8d8;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.parse-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #ede5d4;
  vertical-align: top;
}
.parse-table tbody tr:last-child td { border-bottom: none; }
.parse-table tbody tr:hover { background: #faf6ef; }

/* Word column - original script */
.cell-word {
  font-size: 1.5rem;
  line-height: 2;
  white-space: nowrap;
}
.cell-word.heb { font-family: var(--hebrew-font); direction: rtl; }
.cell-word.arc { font-family: var(--hebrew-font); direction: rtl; }
.cell-word.grk { font-family: var(--greek-font); }
.cell-word.lat { font-family: var(--greek-font); }
.cell-word.cop { font-family: 'Noto Sans Coptic', sans-serif; }
.cell-word.egy { font-family: var(--greek-font); letter-spacing: 0.02em; }
.cell-word.deu { font-family: var(--greek-font); }

/* Lemma column */
.cell-lemma {
  font-size: 1.2rem;
  white-space: nowrap;
}
.cell-lemma.heb { font-family: var(--hebrew-font); direction: rtl; }
.cell-lemma.arc { font-family: var(--hebrew-font); direction: rtl; }
.cell-lemma.grk { font-family: var(--greek-font); }
.cell-lemma.lat { font-family: var(--greek-font); }
.cell-lemma.cop { font-family: 'Noto Sans Coptic', sans-serif; }
.cell-lemma.egy { font-family: var(--greek-font); letter-spacing: 0.02em; }
.cell-lemma.deu { font-family: var(--greek-font); }

/* Morph column */
.cell-morph { color: var(--muted); font-size: 0.82rem; max-width: 320px; }
.morph-part { display: block; }
.morph-part + .morph-part { margin-top: 0.3rem; }
.morph-attr { font-weight: 600; color: var(--text); }

/* Gloss column */
.cell-gloss { font-style: italic; }

/* KJV translation */
.answer-translation {
  background: #f7f2e8;
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.translation-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
#answer-translation-text {
  font-family: var(--greek-font);
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--text);
}

/* ---------- Footer ---------- */
.attribution {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
.attribution a { color: var(--accent); }

/* ---------- Utility ---------- */
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .verse-text[lang="he"] { font-size: 2rem; line-height: 2.4; }
  .verse-text[lang="el"] { font-size: 1.7rem; }
  .verse-card { padding: 1.25rem 1rem; }
  .parse-table { font-size: 0.82rem; }
  .cell-word { font-size: 1.2rem; }
  .cell-lemma { font-size: 1rem; }
}
