/* ==========================================================================
   Telugu Gospel Lyrics — UX POLISH LAYER (Phase 10.5, v3.2.1)

   ADDITIVE ONLY. This file does not redefine brand tokens, does not change
   typography families, and does not restyle existing components beyond
   spacing / touch-target / focus refinements. It loads last so its rules win
   without needing !important.

   Sections:
     1. Hero (search-first)
     2. Alphabet grid
     3. Category cards
     4. Song summary card
     5. Discovery + linking rails
     6. Sidebar
     7. Footer discovery mesh
     8. Search page
     9. Skeletons + empty states
    10. Accessibility + motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HERO — search first
   -------------------------------------------------------------------------- */
.tgl-hero--search .tgl-hero__inner {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 16px clamp(28px, 5vw, 56px);
  text-align: center;
}
.tgl-hero--search .tgl-hero__title {
  font-size: clamp(1.75rem, 4.6vw, 3rem);
  line-height: 1.15;
  margin: 6px 0 10px;
  text-wrap: balance;
}
.tgl-hero--search .tgl-hero__sub {
  font-size: clamp(0.98rem, 1.6vw, 1.12rem);
  line-height: 1.6;
  max-width: 62ch;
  margin: 0 auto 22px;
  opacity: 0.92;
}
.tgl-hero__searchwrap {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}
/* The Search Engine combobox, sized up for the hero. */
.tgl-hero__searchwrap .tgl-searchform {
  display: flex;
  gap: 8px;
  position: relative;
}
.tgl-hero__searchwrap .tgl-searchform__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 56px;
  padding: 0 18px;
  font-size: 1.05rem;
  border-radius: 12px;
}
.tgl-hero__searchwrap .tgl-searchform__submit {
  flex: 0 0 auto;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
/* Suggestion list — absolutely positioned so opening it causes no shift. */
.tgl-searchform__suggestions {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
  text-align: left;
}
.tgl-searchform__suggestions[hidden] { display: none; }
.tgl-searchform__suggestions li {
  margin: 0;
  padding: 0;
}
.tgl-searchform__suggestions a,
.tgl-searchform__suggestions .tgl-suggest__item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.tgl-searchform__suggestions li[aria-selected="true"] > *,
.tgl-searchform__suggestions a:hover,
.tgl-searchform__suggestions a:focus-visible {
  background: rgba(0, 0, 0, 0.06);
}
.tgl-suggest__type {
  margin-left: auto;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.6;
  flex: 0 0 auto;
}
.tgl-suggest__label { min-width: 0; overflow-wrap: anywhere; }

.tgl-hero__quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}
.tgl-hero__chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tgl-hero__chip:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); }
.tgl-hero__chip-icon { font-size: 0.95em; line-height: 1; }

.tgl-hero__stats {
  margin: 16px 0 0;
  font-size: 0.9rem;
  opacity: 0.85;
}
.tgl-hero__stat + .tgl-hero__stat::before {
  content: "·";
  margin: 0 8px;
  opacity: 0.6;
}

/* --------------------------------------------------------------------------
   2. ALPHABET — bigger targets, clearer grouping
   -------------------------------------------------------------------------- */
.tgl-alphabet { padding-block: clamp(24px, 4vw, 44px); }
.tgl-alphabet__group + .tgl-alphabet__group { margin-top: 24px; }
.tgl-alphabet__group > h3 {
  font-size: 1rem;
  margin: 0 0 10px;
  opacity: 0.85;
}
.tgl-alphabet__grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
}
.tgl-alphabet__grid > a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;              /* WCAG 2.2 target size, comfortably met */
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  line-height: 1.1;
  transition: background 0.15s ease, transform 0.15s ease;
}
.tgl-alphabet__grid > a:hover { transform: translateY(-1px); background: rgba(0, 0, 0, 0.05); }
.tgl-alphabet__grid > a.is-active {
  border-color: currentColor;
  background: rgba(0, 0, 0, 0.07);
}
.tgl-alpha__count {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.65;
}
.tgl-alphabet__grid > a.is-empty { opacity: 0.4; pointer-events: none; }

/* --------------------------------------------------------------------------
   3. CATEGORY CARDS
   -------------------------------------------------------------------------- */
.tgl-ts-catgrid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.tgl-ts-catcard {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  color: inherit;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.tgl-ts-catcard:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.2);
}
.tgl-ts-catcard__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.06);
  font-size: 1.15rem;
  line-height: 1;
}
.tgl-ts-catcard__text { min-width: 0; }
.tgl-ts-catcard__name {
  display: block;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.tgl-ts-catcard__count {
  display: block;
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   4. SONG SUMMARY CARD
   -------------------------------------------------------------------------- */
.tgl-summary {
  margin: 18px 0 22px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.025);
}
.tgl-summary__title {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 12px;
  opacity: 0.75;
}
.tgl-summary__grid {
  display: grid;
  gap: 10px 20px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: 0;
}
.tgl-summary__cell { min-width: 0; }
.tgl-summary__label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.62;
  margin: 0 0 2px;
}
.tgl-summary__value {
  margin: 0;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.tgl-summary__value a { text-decoration: none; }
.tgl-summary__value a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   5. DISCOVERY + LINKING RAILS — consistent cards, never ad-interrupted
   -------------------------------------------------------------------------- */
.tgl-discovery { margin: 26px 0; }
.tgl-discovery__title {
  font-size: 1.15rem;
  margin: 0 0 12px;
}
.tgl-discovery__title a { text-decoration: none; color: inherit; }
.tgl-discovery__title a:hover { text-decoration: underline; }
.tgl-discovery__list {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}
.tgl-discovery__item { margin: 0; }
.tgl-discovery__link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.09);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tgl-discovery__link:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1); }
.tgl-discovery__thumb {
  flex: 0 0 auto;
  width: 60px;
  height: 40px;          /* fixed box = zero CLS while thumbs decode */
  object-fit: cover;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}
.tgl-discovery__label {
  min-width: 0;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
/* Sidebar + continue-reading variants stay single column. */
.tgl-sidebar .tgl-discovery__list,
.tgl-continue .tgl-discovery__list { grid-template-columns: minmax(0, 1fr); }

.tgl-continue { margin: 26px 0; }

/* --------------------------------------------------------------------------
   6. SIDEBAR — simplified, sticky unit respects the footer
   -------------------------------------------------------------------------- */
.tgl-sidebar .tgl-widget { margin-bottom: 22px; }
.tgl-sidebar .tgl-widget-title {
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.72;
  margin: 0 0 10px;
}
.tgl-sidebar .tgl-searchform { display: flex; gap: 6px; position: relative; }
.tgl-sidebar .tgl-searchform__input { flex: 1 1 auto; min-width: 0; min-height: 44px; }
.tgl-sidebar .tgl-searchform__submit { min-height: 44px; }

/* The sticky rail: `position:sticky` inside a normal-flow column already
   stops at the end of the column, which sits above the footer — so the unit
   can never overlap the footer and never needs JS to release it. */
@media (min-width: 1024px) {
  .tgl-sidebar__sticky {
    position: sticky;
    top: calc(var(--tgl-header-height, 64px) + 16px);
  }
}
@media (max-width: 1023px) {
  .tgl-sidebar__sticky { position: static; }
}

/* --------------------------------------------------------------------------
   7. FOOTER DISCOVERY MESH
   -------------------------------------------------------------------------- */
.tgl-footer-discovery {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
.tgl-footer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tgl-footer-chips li { margin: 0; }
.tgl-footer-chips a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.85rem;
  text-decoration: none;
}
.tgl-footer-chips a:hover { background: rgba(255, 255, 255, 0.12); }

/* --------------------------------------------------------------------------
   8. SEARCH PAGE
   -------------------------------------------------------------------------- */
.tgl-search-head { margin-bottom: 18px; }
.tgl-search-head .tgl-searchform { display: flex; gap: 8px; position: relative; max-width: 640px; }
.tgl-search-head .tgl-searchform__input { flex: 1 1 auto; min-width: 0; min-height: 52px; font-size: 1.02rem; }
.tgl-search-head .tgl-searchform__submit { min-height: 52px; padding: 0 20px; }
.tgl-search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 4px;
}
.tgl-search-filters select,
.tgl-search-filters input { min-height: 44px; }

/* --------------------------------------------------------------------------
   9. SKELETONS + EMPTY STATES
   -------------------------------------------------------------------------- */
.tgl-skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.11) 37%, rgba(0,0,0,.06) 63%);
  background-size: 400% 100%;
  animation: tgl-shimmer 1.3s ease infinite;
}
.tgl-skeleton--line { height: 14px; margin-bottom: 8px; }
.tgl-skeleton--card { height: 56px; margin-bottom: 10px; }
@keyframes tgl-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.tgl-empty {
  padding: 26px 20px;
  border-radius: 14px;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  text-align: center;
}
.tgl-empty__title { margin: 0 0 6px; font-size: 1.1rem; }
.tgl-empty__text { margin: 0 0 14px; opacity: 0.78; }

/* --------------------------------------------------------------------------
   10. ACCESSIBILITY + MOTION
   -------------------------------------------------------------------------- */
.tgl-hero__chip:focus-visible,
.tgl-alphabet__grid > a:focus-visible,
.tgl-ts-catcard:focus-visible,
.tgl-discovery__link:focus-visible,
.tgl-footer-chips a:focus-visible,
.tgl-searchform__input:focus-visible,
.tgl-searchform__submit:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .tgl-hero__chip,
  .tgl-ts-catcard,
  .tgl-discovery__link,
  .tgl-alphabet__grid > a { transition: none; }
  .tgl-hero__chip:hover,
  .tgl-ts-catcard:hover,
  .tgl-discovery__link:hover,
  .tgl-alphabet__grid > a:hover { transform: none; }
  .tgl-skeleton { animation: none; }
}

/* Mobile density: tighten the rails, keep targets big. */
@media (max-width: 600px) {
  .tgl-discovery__list { grid-template-columns: minmax(0, 1fr); }
  .tgl-ts-catgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tgl-alphabet__grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .tgl-summary { padding: 14px; }
  .tgl-hero--search .tgl-hero__inner { padding-top: 26px; }
}
