/* Hebrew Learning App — Encyclopedia Stylesheet */

/* ── Page layout ── */
.encyclopedia-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--nav-height);
}

/* ── Search bar ── */
.search-bar-wrap {
  padding: 12px 16px;
  background: var(--ink-2);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: var(--ink-3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 10px 14px 10px 38px;
  color: var(--paper);
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235a5248' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
.search-input:focus {
  border-color: var(--gold);
}
.search-input::placeholder { color: var(--muted); }

/* ── Alphabet grid ── */
.alphabet-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.set-section {
  margin-bottom: 28px;
}
.set-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(200,168,75,0.2);
}

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
}

.letter-tile {
  background: var(--ink-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}
.tile-speak-btn {
  position: absolute;
  top: 5px;
  right: 6px;
  background: none;
  border: none;
  font-size: 0.72rem;
  opacity: 0.45;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  line-height: 1;
  transition: opacity 0.15s;
  z-index: 2;
}
.letter-tile:hover .tile-speak-btn,
.tile-speak-btn:focus { opacity: 1; }
.tile-speak-btn.speaking { opacity: 1; background: rgba(200,168,75,0.18); }
.letter-tile:hover {
  border-color: var(--gold);
  background: rgba(200,168,75,0.06);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.letter-tile.mastered {
  border-color: rgba(45, 158, 95, 0.4);
  background: rgba(45, 158, 95, 0.05);
}
.letter-tile.hidden { display: none; }

.tile-symbol {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  line-height: 1;
}

.tile-name {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-light);
  text-align: center;
  font-weight: 500;
}

.tile-mastered-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  display: none;
}
.letter-tile.mastered .tile-mastered-dot { display: block; }

/* ── Detail panel overlay ── */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.detail-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 480px);
  background: var(--ink-2);
  overflow-y: auto;
  padding-bottom: calc(var(--nav-height) + 16px);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 101;
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
}
.detail-panel.open {
  transform: translateX(0);
}

/* ── Panel header ── */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  background: var(--ink-2);
  z-index: 1;
}

.panel-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink-3);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted-light);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.panel-close:hover {
  color: var(--paper);
  border-color: rgba(255,255,255,0.25);
}

/* ── Panel body ── */
.panel-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Hero section ── */
.panel-hero {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.panel-symbol-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.panel-symbol-main {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: clamp(3.5rem, 14vw, 6rem);
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  line-height: 1;
  box-shadow: var(--shadow-sm);
}

.panel-symbol-sofit {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  line-height: 1;
  opacity: 0.85;
}

.panel-symbol-labels {
  display: flex;
  gap: 8px;
  align-items: center;
}
.panel-symbol-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-light);
  text-align: center;
}

.panel-hero-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.panel-letter-name {
  font-size: clamp(1.4rem, 5vw, 1.8rem);
  font-weight: 700;
  color: var(--paper);
  line-height: 1.1;
}

.panel-letter-position {
  font-size: 0.75rem;
  color: var(--muted-light);
}

.panel-gematria {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(200,168,75,0.1);
  border: 1px solid rgba(200,168,75,0.25);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 600;
  width: fit-content;
  margin-top: 2px;
}

.panel-audio-btn {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(27,79,138,0.2);
  border: 1px solid rgba(27,79,138,0.4);
  border-radius: var(--radius);
  color: var(--accent-light);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: fit-content;
}
.panel-audio-btn:hover {
  background: rgba(27,79,138,0.35);
}

/* ── Info sections ── */
.panel-section {
  background: var(--ink-3);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  font-weight: 600;
  border-bottom: 1px solid rgba(200,168,75,0.2);
  padding-bottom: 8px;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.info-row-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-light);
}
.info-row-value {
  font-size: 0.92rem;
  color: var(--paper);
  line-height: 1.4;
}

/* ── Torah examples ── */
.torah-example {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.05);
}

.torah-word {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold);
  direction: rtl;
  line-height: 1;
  min-width: 48px;
  text-align: center;
}

.torah-info { flex: 1; }
.torah-transliteration { font-size: 0.9rem; color: var(--paper); font-weight: 500; }
.torah-meaning { font-size: 0.8rem; color: var(--muted-light); }
.torah-reference { font-size: 0.72rem; color: var(--accent-light); margin-top: 2px; }

/* ── Related roots ── */
.root-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.root-item:last-child { border-bottom: none; }

.root-symbol {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 1.2rem;
  color: var(--gold);
  direction: rtl;
  min-width: 48px;
  font-weight: 600;
}
.root-info { flex: 1; }
.root-transliteration { font-size: 0.85rem; color: var(--paper); font-weight: 500; }
.root-meaning { font-size: 0.78rem; color: var(--muted-light); }

/* ── Spiritual note ── */
.spiritual-note {
  font-size: 0.88rem;
  color: var(--muted-light);
  line-height: 1.6;
  font-style: italic;
  border-left: 2px solid var(--gold);
  padding-left: 12px;
}

/* ── No results ── */
.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted-light);
  display: none;
}
.no-results.visible { display: block; }
