/* Generic Resource Factory text-cards viewer */

.text-cards-page {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background: linear-gradient(165deg, #f8f6f0 0%, #ebe8df 50%, #e4e0d6 100%);
  color: #1a1820;
  --tc-accent: #5c4a2a;
  --tc-accent-soft: #e8d9b0;
  --tc-hero-from: #2a3548;
  --tc-hero-to: #1a2230;
  --tc-verse-bg: #fffef8;
  --tc-card-border: #c4b8a8;
}

.tc-hero {
  padding: 1.75rem 1.25rem 1.5rem;
  text-align: center;
  background: radial-gradient(ellipse 120% 80% at 50% 0%, var(--tc-hero-from) 0%, var(--tc-hero-to) 55%, #121820 100%);
  color: #f7f3ea;
  border-bottom: 4px solid var(--tc-accent-soft);
}

.tc-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.tc-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 600;
}

.tc-subtitle {
  margin: 0 auto 1rem;
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.45;
  opacity: 0.92;
}

.tc-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  justify-content: center;
  font-size: 0.95rem;
}

.tc-hero-links a {
  color: var(--tc-accent-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tc-hero-links a:hover,
.tc-hero-links a:focus {
  color: #fff;
}

.tc-hero-links__sep {
  opacity: 0.5;
}

.tc-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.tc-loading,
.tc-error {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 1.05rem;
}

.tc-error {
  color: #7a1e1e;
}

.tc-error a {
  color: #3d2f5c;
}

.tc-selector h2 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.tc-selector-lead {
  margin: 0 0 1rem;
  color: #3a3048;
  max-width: 40rem;
}

.tc-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.tc-selector-card {
  display: block;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--tc-card-border);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tc-selector-card:hover,
.tc-selector-card:focus {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.tc-selector-card__id {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.tc-selector-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.tc-selector-card__meta {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.8;
}

.tc-resource-header {
  margin-bottom: 1.25rem;
  padding: 1.25rem 1.35rem;
}

.tc-resource-header__id {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.75;
}

.tc-resource-header h2 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.tc-meta-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.tc-meta-dl dt {
  font-weight: 600;
  opacity: 0.75;
}

.tc-meta-dl dd {
  margin: 0;
}

.tc-subheading {
  margin: 1rem 0 0.35rem;
  font-size: 0.95rem;
}

.tc-viewer-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
}

.tc-viewer-path {
  opacity: 0.65;
  font-size: 0.82rem;
}

.tc-controls {
  margin-bottom: 1.25rem;
}

.tc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.tc-search-label {
  flex: 1 1 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.tc-search {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--tc-card-border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fffef9;
  font-family: inherit;
}

.tc-search:focus {
  outline: 2px solid var(--tc-accent);
  outline-offset: 1px;
}

.tc-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tc-btn {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  background: transparent;
  color: inherit;
}

.tc-btn--accent {
  background: var(--tc-accent);
  color: #fffef8;
  border-color: var(--tc-accent);
}

.tc-btn--accent:hover,
.tc-btn--accent:focus {
  filter: brightness(1.08);
}

.tc-btn--ghost {
  border-color: var(--tc-card-border);
  background: #fffef9;
}

.tc-btn--small {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
}

.tc-count {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  opacity: 0.85;
}

.tc-count-note {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #4a4338;
  opacity: 0.88;
}

.tc-sort-hint {
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.55rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #3a342c;
  background: rgba(255, 254, 248, 0.85);
  border: 1px solid rgba(196, 184, 168, 0.55);
  border-radius: 8px;
}

.tc-display-order-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tc-sort-select {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--tc-card-border);
  background: #fffef9;
  color: inherit;
  max-width: 100%;
}

.tc-filter-group {
  margin-bottom: 0.75rem;
}

.tc-filter-heading {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

.tc-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tc-chip {
  cursor: pointer;
  border: 1px solid var(--tc-card-border);
  background: #fffef9;
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
}

.tc-chip--active {
  background: var(--tc-accent);
  color: #fffef8;
  border-color: var(--tc-accent);
}

.tc-audio-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

.tc-empty {
  text-align: center;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.tc-empty .tc-btn {
  margin: 0.35rem 0.25rem;
}

.tc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}

.tc-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--tc-card-border);
  background: #fffef9;
}

.tc-card--modal {
  border: none;
  padding: 0;
  background: transparent;
}

.tc-badge {
  display: inline-block;
  margin: 0 0.25rem 0.35rem 0;
  font-size: 0.72rem;
}

.tc-badge--type {
  font-weight: 600;
}

.tc-card__title {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.1rem;
  line-height: 1.3;
}

.tc-card__subtitle,
.tc-card__ref {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  opacity: 0.85;
}

.tc-badges {
  margin-bottom: 0.5rem;
}

.tc-verse {
  margin: 0.5rem 0 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--tc-verse-bg);
  border-left: 3px solid var(--tc-accent);
  border-radius: 0 8px 8px 0;
  font-size: 1.05rem;
  line-height: 1.55;
}

.tc-verse__translit {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  opacity: 0.88;
  font-style: italic;
}

.tc-block {
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.tc-block__label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 0.2rem;
}

.tc-block__body {
  line-height: 1.5;
}

.tc-callout {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
}

.tc-card__meta {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  opacity: 0.7;
  line-height: 1.4;
}

.tc-dynamic-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tc-filter-group--dynamic {
  margin-bottom: 0;
}

.tc-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.35rem;
  margin-top: 0.65rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(196, 184, 168, 0.65);
}

.tc-badge--meta {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.12rem 0.38rem;
  border-radius: 4px;
  color: #6b6358;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  opacity: 1;
}

.tc-card__subtitle,
.tc-card__ref {
  color: #4a4540;
}

.tc-section--primary .tc-section__body {
  font-size: 1.05rem;
  line-height: 1.55;
}

.tc-dev-warn {
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 6px;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffc107;
}

.tc-scroll-footer {
  text-align: center;
  margin-top: 1rem;
  padding-bottom: 2rem;
}

.tc-scroll-status {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  opacity: 0.8;
}

.tc-scroll-sentinel {
  width: 100%;
  height: 1px;
  margin: 0;
  pointer-events: none;
  visibility: hidden;
}

.tc-show-more-fallback {
  margin-top: 0.5rem;
}

.tc-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.tc-modal[hidden] {
  display: none !important;
}

.tc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 28, 0.55);
}

.tc-modal__panel {
  position: relative;
  max-width: 36rem;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  background: #fffef9;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--tc-card-border);
}

.tc-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--tc-card-border);
}

.tc-modal__head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.tc-modal__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.tc-modal__body {
  padding: 1rem 1.15rem 1.25rem;
}

/* Resource-specific tones */
.resource-gita {
  --tc-accent: #1e4a7a;
  --tc-accent-soft: #d4af37;
  --tc-hero-from: #1e3a5f;
  --tc-hero-to: #0f2438;
  --tc-verse-bg: #fffef5;
}

.resource-kabir {
  --tc-accent: #3d2f5c;
  --tc-accent-soft: #e8d9b0;
  --tc-hero-from: #3d2f5c;
  --tc-hero-to: #1a1424;
  --tc-verse-bg: #f7f3ea;
}

.resource-patanjali {
  --tc-accent: #1a6b6b;
  --tc-accent-soft: #c8d4e8;
  --tc-hero-from: #1a4a52;
  --tc-hero-to: #142838;
  --tc-verse-bg: #f5f8f6;
}

.resource-rcm {
  --tc-accent: #b45309;
  --tc-accent-soft: #fcd34d;
  --tc-hero-from: #7c2d12;
  --tc-hero-to: #431407;
  --tc-verse-bg: #fffbeb;
}

.resource-upanishads {
  --tc-accent: #5c6b4a;
  --tc-accent-soft: #e8dcc0;
  --tc-hero-from: #3d4a32;
  --tc-hero-to: #252e1f;
  --tc-verse-bg: #f8f6f0;
}

@media (max-width: 520px) {
  .tc-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Reader layout: filter zone + scrollable content ─── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tc-main:has(#tc-app:not([hidden])) {
  max-width: min(100%, 92rem);
}

.tc-app-shell {
  display: grid;
  gap: 1rem 1.25rem;
  align-items: start;
}

.tc-controls--filters {
  margin-bottom: 0;
}

.tc-toolbar--filters {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0;
}

.tc-search-label--block {
  flex: none;
  width: 100%;
}

.tc-filter-zone__title {
  margin: 0;
  font-size: 1.05rem;
}

.tc-filter-zone__close {
  padding: 0.35rem 0.65rem;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--tc-card-border);
  background: #fffef9;
  cursor: pointer;
}

.tc-filter-zone__close:focus-visible {
  outline: 2px solid var(--tc-accent);
  outline-offset: 2px;
}

.tc-chip-bar--multiline {
  gap: 0.35rem;
}

.tc-chip--filtered-out {
  display: none !important;
}

.tc-chip:focus-visible {
  outline: 2px solid var(--tc-accent);
  outline-offset: 2px;
}

.tc-filter-hint {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
  opacity: 0.62;
  line-height: 1.35;
}

.tc-filter-heading--minor {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
}

.tc-filter-collapsible {
  border: 1px solid var(--tc-card-border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.55rem;
  background: rgba(255, 255, 255, 0.4);
}

.tc-filter-collapsible__summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.2rem 0.15rem;
}

.tc-filter-collapsible__summary::-webkit-details-marker {
  display: none;
}

.tc-filter-collapsible__hint {
  font-weight: 400;
  opacity: 0.62;
  font-size: 0.76rem;
  white-space: nowrap;
}

.tc-filter-group-search {
  width: 100%;
  margin: 0.35rem 0 0.45rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.88rem;
  border-radius: 6px;
  border: 1px solid var(--tc-card-border);
  font-family: inherit;
  box-sizing: border-box;
}

.tc-filter-group-search:focus {
  outline: 2px solid var(--tc-accent);
  outline-offset: 1px;
}

.tc-active-filters-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px dashed var(--tc-card-border);
  background: rgba(255, 254, 249, 0.72);
}

.tc-active-filters__label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.68;
  flex: 0 0 100%;
}

.tc-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1 1 auto;
  align-items: center;
}

.tc-active-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.45rem;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid var(--tc-card-border);
  border-radius: 999px;
  background: #fffef9;
  font-family: inherit;
  color: inherit;
}

.tc-active-pill:focus-visible {
  outline: 2px solid var(--tc-accent);
  outline-offset: 2px;
}

.tc-active-pill--static {
  cursor: default;
  opacity: 0.88;
}

.tc-active-pill__x {
  font-weight: 700;
  opacity: 0.75;
}

.tc-active-filters__clear {
  flex-shrink: 0;
  align-self: center;
}

.tc-content-zone {
  min-width: 0;
}

@media (min-width: 900px) {
  .tc-app-shell {
    grid-template-columns: minmax(264px, 328px) minmax(0, 1fr);
  }

  .tc-filter-zone {
    position: sticky;
    top: 0.75rem;
    align-self: start;
    max-height: calc(100vh - 1.5rem);
    overflow-y: auto;
    padding: 0.85rem 1rem;
    border: 1px solid var(--tc-card-border);
    border-radius: 10px;
    background: rgba(255, 254, 249, 0.94);
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
  }

  .tc-filter-zone__header {
    margin-bottom: 0.5rem;
  }

  .tc-filter-backdrop {
    display: none !important;
  }

  .tc-filters-toggle {
    display: none !important;
  }

  .tc-filter-zone__close {
    display: none !important;
  }
}

@media (max-width: 899px) {
  .tc-app-shell {
    grid-template-columns: 1fr;
  }

  .tc-filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    padding: 0.48rem 0.88rem;
    font-family: inherit;
    font-size: 0.92rem;
    border-radius: 8px;
    border: 1px solid var(--tc-card-border);
    background: #fffef9;
    cursor: pointer;
    font-weight: 600;
  }

  .tc-filters-toggle:focus-visible {
    outline: 2px solid var(--tc-accent);
    outline-offset: 2px;
  }

  .tc-filter-zone {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(22rem, 92vw);
    background: #faf8f3;
    border-right: 1px solid var(--tc-card-border);
    box-shadow: 6px 0 28px rgba(0, 0, 0, 0.14);
    transform: translateX(-108%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    padding: 0;
    border-radius: 0;
    max-height: none;
  }

  .tc-filter-zone--open {
    transform: translateX(0);
  }

  .tc-filter-zone__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--tc-card-border);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
  }

  .tc-controls--filters {
    padding: 0.65rem 0.85rem 1.1rem;
  }

  .tc-filter-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(20, 18, 24, 0.38);
    cursor: pointer;
  }

  .tc-filter-backdrop[hidden] {
    display: none !important;
  }
}
