:root {
  --ink: #14221c;
  --ink-soft: #2a3d34;
  --paper: #d8e0da;
  --paper-deep: #c5d0c8;
  --panel: rgba(248, 251, 249, 0.78);
  --accent: #0b6b52;
  --accent-deep: #085240;
  --line: rgba(20, 34, 28, 0.14);
  --focus: rgba(11, 107, 82, 0.35);
  --shadow: 0 18px 50px rgba(20, 34, 28, 0.12);
  --display: "Tiro Devanagari Sanskrit", "Noto Serif Devanagari", serif;
  --sans: "Noto Sans Devanagari", "Noto Sans", sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(11, 107, 82, 0.18), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(20, 34, 28, 0.12), transparent 50%),
    linear-gradient(165deg, #e7eee9 0%, #d3ddd6 48%, #c7d2cb 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  pointer-events: none;
}

.shell {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0 0 4rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.home .hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0 3rem;
  transition: min-height 280ms ease, padding 280ms ease;
}

/* After a search, keep brand + field at the top so results are in view. */
.home.is-searching .hero {
  min-height: 0;
  justify-content: flex-start;
  padding: 1.25rem 0 1.5rem;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(4.5rem, 18vw, 8rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  color: var(--ink);
  cursor: pointer;
  width: fit-content;
  transition: font-size 280ms ease;
  animation: rise 700ms ease-out both;
}

.home.is-searching .brand {
  font-size: clamp(2.4rem, 10vw, 3.4rem);
}

.tagline {
  margin: 0.75rem 0 2rem;
  font-size: 1.15rem;
  color: var(--ink-soft);
  animation: rise 700ms 80ms ease-out both;
  transition: opacity 200ms ease, margin 280ms ease, max-height 280ms ease;
}

.home.is-searching .tagline {
  margin: 0.2rem 0 1rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

.search {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  animation: rise 700ms 140ms ease-out both;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--panel);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font: inherit;
  font-size: 1.2rem;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus), var(--shadow);
  transform: translateY(-1px);
}

.search button,
.more,
.back {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 0.35rem;
  cursor: pointer;
  background: var(--accent);
  color: #f4faf7;
  padding: 0.9rem 1.2rem;
  transition: background 160ms ease, transform 160ms ease;
}

.search button:hover,
.more:hover,
.back:hover {
  background: var(--accent-deep);
  transform: translateY(-1px);
}

.results {
  padding-bottom: 2rem;
  animation: rise 400ms ease-out both;
}

.results-heading {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
}

.results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.results-list li {
  border-top: 1px solid var(--line);
}

.results-list a {
  display: block;
  padding: 0.95rem 0.15rem;
  color: inherit;
  text-decoration: none;
  transition: color 150ms ease, padding-left 150ms ease;
}

.results-list a:hover {
  color: var(--accent-deep);
  padding-left: 0.35rem;
}

.results-list .hw {
  font-family: var(--display);
  font-size: 1.45rem;
  display: block;
}

.results-list .snip {
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.more {
  margin-top: 1.25rem;
  width: 100%;
}

.empty {
  color: var(--ink-soft);
}

.entry {
  padding-top: 1.5rem;
  animation: rise 420ms ease-out both;
}

.back {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--line);
  margin-bottom: 1.5rem;
  padding: 0.55rem 0.9rem;
}

.entry-headword {
  margin: 0 0 1.25rem;
  font-family: var(--display);
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  line-height: 1.1;
  font-weight: 400;
}

.def-block {
  padding: 1.1rem 0;
  border-top: 1px solid var(--line);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.65rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.meta strong {
  color: var(--accent-deep);
  font-weight: 600;
}

.sense {
  margin: 0.55rem 0;
  font-size: 1.12rem;
}

/* Quiet in-body links: read as prose; reveal affordance on sense/link hover. */
.sense a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  border-radius: 0.1em;
  transition: color 140ms ease, text-decoration-color 140ms ease, background 140ms ease;
}

.sense:hover a,
.sense:focus-within a {
  text-decoration: underline dotted;
  text-decoration-color: rgba(11, 107, 82, 0.4);
}

.sense a:hover,
.sense a:focus-visible {
  color: var(--accent);
  text-decoration: underline solid;
  text-decoration-color: var(--accent);
  background: rgba(11, 107, 82, 0.08);
  outline: none;
}

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

@media (max-width: 560px) {
  .search {
    flex-direction: column;
  }

  .search button {
    width: 100%;
  }
}
