/* ─── Base ─── */
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Theme transitions ─── */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease !important;
}

/* ─── Autocomplete dropdown ─── */
.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 0.25rem;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background-color: #fff;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  backdrop-filter: blur(4px);
  max-height: 320px;
  overflow-y: auto;
}
.dark .suggestions {
  border-color: #374151;
  background-color: rgba(31,41,55,0.95);
  backdrop-filter: blur(4px);
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: background-color 0.15s, color 0.15s;
  border-bottom: 1px solid #f3f4f6;
}
.dark .suggestion-item {
  border-color: rgba(55,65,81,0.5);
}
.suggestion-item:last-child { border-bottom: 0; }
.suggestion-item:hover,
.suggestion-item.active { background-color: #eef2ff; }
.dark .suggestion-item:hover,
.dark .suggestion-item.active { background-color: rgba(49,46,129,0.3); }

.suggestion-hindi {
  font-weight: 600;
  color: #111827;
}
.dark .suggestion-hindi { color: #f3f4f6; }

.suggestion-roman {
  font-size: 0.75rem;
  line-height: 1rem;
  color: #6b7280;
}
.dark .suggestion-roman { color: #9ca3af; }

/* ─── Custom scrollbar ─── */
.suggestions::-webkit-scrollbar { width: 6px; }
.suggestions::-webkit-scrollbar-track { background: transparent; }
.suggestions::-webkit-scrollbar-thumb { border-radius: 9999px; background-color: #d1d5db; }
.dark .suggestions::-webkit-scrollbar-thumb { background-color: #4b5563; }

/* ─── Entry Card ─── */
.entry-card {
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  background-color: #fff;
  padding: 1.25rem;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  transition: box-shadow 0.2s;
}
.entry-card:hover { box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1); }
@media (min-width: 640px) { .entry-card { padding: 1.5rem; } }

.entry-card-full { }
.entry-card-full:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); }

.entry-card + .entry-card { margin-top: 1rem; }

.entry-toxic {
  border-left: 4px solid #f87171;
}
.dark .entry-toxic {
  border-left-color: #ef4444;
}

/* ─── Headword ─── */
.entry-head { margin-bottom: 0.75rem; }

.entry-link { text-decoration: none; }

.entry-hindi {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 700;
  color: #111827;
}
.dark .entry-hindi { color: #f9fafb; }

.word-page .entry-hindi {
  font-size: 2.25rem;
}
@media (min-width: 640px) { .word-page .entry-hindi { font-size: 3rem; } }
@media (min-width: 1024px) { .word-page .entry-hindi { font-size: 3.75rem; } }

.entry-roman {
  font-size: 1rem;
  line-height: 1.5rem;
  color: #4b5563;
  letter-spacing: 0.01em;
}
.dark .entry-roman { color: #d1d5db; }

.word-page .entry-roman {
  font-size: 1.25rem;
  color: #6b7280;
  letter-spacing: 0.02em;
}
.dark .word-page .entry-roman { color: #9ca3af; }
@media (min-width: 640px) { .word-page .entry-roman { font-size: 1.5rem; } }
@media (min-width: 1024px) { .word-page .entry-roman { font-size: 1.875rem; } }

/* ─── Meta line (POS + source + toxic) ─── */
.entry-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.pos-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 0.375rem;
  background-color: #e0e7ff;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: #4338ca;
  letter-spacing: 0.02em;
}
.dark .pos-badge {
  background-color: rgba(49,46,129,0.5);
  color: #a5b4fc;
}

.source-label {
  font-size: 0.75rem;
  line-height: 1rem;
  color: #9ca3af;
}
.dark .source-label { color: #6b7280; }

.toxicity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 0.375rem;
  background-color: #fef2f2;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: #dc2626;
}
.dark .toxicity-badge {
  background-color: rgba(127,29,29,0.3);
  color: #f87171;
}

/* ─── Body ─── */
.entry-body > * + * { margin-top: 0.75rem; }

/* ─── Field labels ─── */
.field-label {
  display: block;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}
.dark .field-label { color: #6b7280; }

/* ─── Definition ─── */
.entry-def {
  font-size: 1rem;
  line-height: 1.625;
  color: #1f2937;
}
.dark .entry-def { color: #e5e7eb; }

/* ─── Example / Quote ─── */
.entry-example {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background-color: rgba(249,250,251,0.8);
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-style: italic;
  line-height: 1.625;
  color: #4b5563;
}
.dark .entry-example {
  border-color: #374151;
  background-color: rgba(31,41,55,0.5);
  color: #d1d5db;
}

.entry-example svg {
  margin-top: 0.125rem;
  flex-shrink: 0;
  opacity: 0.4;
}
.dark .entry-example svg { opacity: 0.5; }

/* ─── Word chips (synonyms/antonyms) ─── */
.entry-word-list { padding-top: 0.25rem; }

.word-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #fff;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #4f46e5;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.dark .word-chip {
  border-color: #4b5563;
  background-color: rgba(31,41,55,0.5);
  color: #818cf8;
}

.word-chip-antonym {
  color: #e11d48;
  border-color: #fecdd3;
}
.dark .word-chip-antonym {
  color: #fb7185;
  border-color: rgba(136,19,55,0.5);
  background-color: rgba(136,19,55,0.1);
}

/* ─── Related words ─── */
.related-group {
  margin-top: 1.25rem;
  border-top: 1px solid #f3f4f6;
  padding-top: 1.25rem;
}
.dark .related-group { border-color: #1f2937; }

.related-group h3 {
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}
.dark .related-group h3 { color: #6b7280; }

.related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.related-word {
  display: inline-flex;
  align-items: center;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #4f46e5;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  transition: all 0.15s;
  text-decoration: none;
}
.related-word:hover {
  border-color: #a5b4fc;
  background-color: #eef2ff;
  color: #4338ca;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}
.dark .related-word {
  border-color: #374151;
  background-color: rgba(31,41,55,0.6);
  color: #a5b4fc;
}
.dark .related-word:hover {
  border-color: #4f46e5;
  background-color: #374151;
  color: #c7d2fe;
}
.related-word:active { transform: scale(0.95); }

/* ─── Feature cards (home page) ─── */
.feature-card {
  border-radius: 1rem;
  border: 1px solid #e5e7eb;
  background-color: #fff;
  padding: 1.5rem;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  transition: all 0.2s;
}
.feature-card:hover {
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  transform: translateY(-0.125rem);
}
.dark .feature-card {
  border-color: rgba(55,65,81,0.5);
  background-color: rgba(31,41,55,0.8);
}

/* ─── Example chips (hero quick links) ─── */
.example-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  background-color: rgba(255,255,255,0.9);
  padding: 0.375rem 1rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: #4b5563;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  backdrop-filter: blur(4px);
  transition: all 0.2s;
  text-decoration: none;
}
.example-chip:hover {
  background-color: #f3f4f6;
  color: #111827;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}
.dark .example-chip {
  border-color: rgba(255,255,255,0.2);
  background-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.9);
}
.dark .example-chip:hover {
  background-color: rgba(255,255,255,0.2);
  color: #fff;
}

/* ─── Keyboard hint ─── */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  border: 1px solid #d1d5db;
  background-color: #f3f4f6;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #9ca3af;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}
.dark .kbd {
  border-color: rgba(165,180,252,0.3);
  background-color: rgba(49,46,129,0.3);
  color: rgba(165,180,252,0.8);
}

/* ─── Hero section ─── */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #fcf6f0 0%, #f5efe8 30%, #f0e8df 60%, #faf5f0 100%);
}
.dark .hero {
  background: linear-gradient(135deg, #1c1917 0%, #292524 30%, #1a1a1a 60%, #0f0f0f 100%);
}

.hero-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.03'%3E%3Cpath d='M36 34v2H24v-2h12zM36 24v2H24v-2h12z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.dark .hero-pattern {
  opacity: 0.2;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v2H24v-2h12zM36 24v2H24v-2h12z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ─── Staggered fade-in animations ─── */
.stagger-fade-in > * {
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}
.stagger-fade-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-fade-in > *:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
