/* Şejere – Türkmen heritage design */
:root {
  --color-green: #006847;
  --color-green-dark: #004d35;
  --color-gold: #c9a227;
  --color-gold-light: #e5c84a;
  --color-cream: #f8f6f1;
  --color-cream-dark: #ebe7df;
  --color-text: #2c2c2c;
  --color-text-muted: #5a5a5a;
  --font-sans: "Noto Sans", system-ui, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 6px;
  --radius-lg: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* Header */
.header {
  background: linear-gradient(135deg, var(--color-green) 0%, var(--color-green-dark) 100%);
  color: white;
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.02) 20px,
    rgba(255, 255, 255, 0.02) 21px
  );
  pointer-events: none;
}

.header-inner {
  position: relative;
  z-index: 1;
}

.logo {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: 0.02em;
}

.subtitle {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  opacity: 0.95;
}

.author {
  font-size: 0.9rem;
  opacity: 0.85;
  margin: 0;
}

/* Main */
.main {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* Search */
.search-section {
  margin-bottom: 1.5rem;
}

.search-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid var(--color-cream-dark);
  border-radius: var(--radius-lg);
  background: white;
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder {
  color: var(--color-text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.2);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  opacity: 0.5;
}

.search-hint {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Alphabet nav */
.alphabet-nav {
  margin-bottom: 1.5rem;
}

.alphabet-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}

.alphabet-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  border: 1px solid var(--color-cream-dark);
  border-radius: var(--radius);
  background: white;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.alphabet-btn:hover {
  background: var(--color-cream-dark);
  border-color: var(--color-gold);
  color: var(--color-green);
}

.alphabet-btn.active {
  background: var(--color-green);
  border-color: var(--color-green);
  color: white;
}

.alphabet-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Results layout */
.results-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 700px) {
  .results-section {
    grid-template-columns: 1fr;
  }
}

/* Results list */
.results-list {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-cream-dark);
  max-height: 70vh;
  overflow-y: auto;
  position: sticky;
  top: 1rem;
}

@media (max-width: 700px) {
  .results-list {
    max-height: 200px;
    position: static;
  }
}

.result-item {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 1px solid var(--color-cream-dark);
  transition: background 0.15s;
  cursor: pointer;
}

.result-item:last-child {
  border-bottom: none;
}

.result-item:hover {
  background: var(--color-cream);
}

.result-item.active {
  background: rgba(0, 104, 71, 0.08);
  color: var(--color-green);
  font-weight: 500;
}

.result-item {
  pointer-events: auto;
}

.result-item span,
.result-item .result-item-names {
  pointer-events: none;
}

.result-item-names {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.15rem;
}

/* Entry detail */
.entry-detail {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-cream-dark);
  padding: 2rem;
  min-height: 300px;
}

.entry-placeholder {
  color: var(--color-text-muted);
  text-align: center;
  padding: 3rem 2rem;
}

.entry-placeholder p {
  margin: 0;
  font-size: 1rem;
}

.entry-content.hidden {
  display: none;
}

.entry-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.entry-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-green);
  margin: 0;
  flex: 1 1 auto;
}

.entry-actions {
  flex-shrink: 0;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--color-green);
  background: rgba(0, 104, 71, 0.08);
  border: 1px solid rgba(0, 104, 71, 0.25);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.share-btn:hover {
  background: rgba(0, 104, 71, 0.12);
  border-color: var(--color-green);
}

.share-btn-icon {
  font-size: 1rem;
  opacity: 0.9;
}

.share-btn.copied {
  color: var(--color-green-dark);
  background: rgba(201, 162, 39, 0.15);
  border-color: var(--color-gold);
}

.entry-names {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-cream-dark);
}

.entry-body {
  font-size: 1rem;
  line-height: 1.75;
  white-space: pre-wrap;
}

.entry-body p {
  margin: 0 0 1rem;
}

/* Footer */
.footer {
  background: var(--color-cream-dark);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer p {
  margin: 0;
}

.footer p + p {
  margin-top: 0.5rem;
}

.footer-dev {
  font-size: 0.8rem;
  opacity: 0.9;
}

.footer-dev a {
  color: inherit;
  text-decoration: underline;
}

.footer-dev a:hover {
  opacity: 0.85;
}

.footer-version {
  font-size: 0.75rem;
  opacity: 0.8;
}

.footer-version a {
  color: inherit;
  text-decoration: none;
}

.footer-version a:hover {
  text-decoration: underline;
}

/* Changelog page */
.changelog-page {
  max-width: 640px;
  margin: 0 auto;
}

.changelog-nav {
  margin-bottom: 1.5rem;
}

.back-link {
  color: var(--color-green);
  text-decoration: none;
  font-size: 0.95rem;
}

.back-link:hover {
  text-decoration: underline;
}

.changelog-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-green);
  margin: 0 0 1.5rem;
}

.changelog-version {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-cream-dark);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.version-badge {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-green);
  margin: 0 0 0.25rem;
}

.version-date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 1rem;
}

.changelog-list {
  margin: 0;
  padding-left: 1.25rem;
  line-height: 1.7;
}

.changelog-list li {
  margin-bottom: 0.35rem;
}

.logo-link {
  color: inherit;
  text-decoration: none;
}

.logo-link:hover .logo {
  opacity: 0.95;
}

/* Scrollbar */
.results-list::-webkit-scrollbar {
  width: 6px;
}

.results-list::-webkit-scrollbar-track {
  background: var(--color-cream);
}

.results-list::-webkit-scrollbar-thumb {
  background: var(--color-cream-dark);
  border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
