/* Non-critical styles — loaded without blocking render. */

/* ---- Cards / archive ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: var(--sp);
  padding-block: var(--sp);
}

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
@media (prefers-reduced-motion: no-preference) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgb(0 0 0 / .08); }
}
.card__media {
  aspect-ratio: 16 / 9;
  background: var(--c-line);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .4rem; }
.card__title { font-size: var(--t-lg); margin: 0; line-height: 1.35; }
.card__title a { color: inherit; text-decoration: none; }
.card__title a:hover { color: var(--c-brand); }
.card__meta { color: var(--c-muted); font-size: var(--t-sm); margin: 0; }

.card__tag {
  align-self: flex-start;
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--c-brand); background: var(--c-accent-sf);
  padding: .2rem .5rem; border-radius: 999px;
  text-decoration: none;
}

/* ---- Long-form content ---- */
.entry__content h2 {
  margin-top: 2em;
  padding-bottom: .25em;
  border-bottom: 1px solid var(--c-line);
}
.entry__content h3 { margin-top: 1.6em; }

.entry__content ul, .entry__content ol { padding-inline-start: 1.4em; margin: 0 0 1.3em; }
.entry__content li { margin-bottom: .45em; }

.entry__content blockquote {
  margin: 1.6rem 0;
  padding: .8rem 1.2rem;
  border-inline-start: 4px solid var(--c-brand);
  background: var(--c-surface);
  border-radius: var(--radius);
  color: var(--c-muted);
  font-style: normal;
}

.entry__content table {
  width: 100%; border-collapse: collapse;
  margin: 1.5rem 0; font-size: var(--t-sm);
}
.entry__content :is(th, td) {
  border: 1px solid var(--c-line);
  padding: .55rem .7rem; text-align: start;
}
.entry__content th { background: var(--c-accent-sf); font-weight: 700; }

/* Wide content scrolls inside itself; the page never scrolls sideways */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Sanskrit / transliteration helper — aids AI entity disambiguation */
.iast { font-style: italic; color: var(--c-muted); }
.deva { font-family: var(--font-hi); }

/* ---- Web Story strip ---- */
.story-strip {
  display: flex; gap: .9rem;
  overflow-x: auto; padding-block: .5rem 1.25rem;
  scroll-snap-type: x mandatory;
}
.story-strip__item {
  flex: 0 0 8.5rem; scroll-snap-align: start;
  text-decoration: none; color: inherit;
}
.story-strip__thumb {
  aspect-ratio: 9 / 16; border-radius: var(--radius);
  overflow: hidden; background: var(--c-line);
  border: 2px solid var(--c-accent);
}
.story-strip__thumb img { width: 100%; height: 100%; object-fit: cover; }
.story-strip__label {
  font-size: var(--t-sm); font-weight: 600;
  margin: .4rem 0 0; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Pagination ---- */
.pagination { display: flex; gap: .4rem; flex-wrap: wrap; padding-block: var(--sp); }
.pagination .page-numbers {
  padding: .45rem .8rem; border: 1px solid var(--c-line);
  border-radius: var(--radius); text-decoration: none;
  color: var(--c-text); font-size: var(--t-sm);
}
.pagination .page-numbers.current { background: var(--c-brand); color: #fff; border-color: var(--c-brand); }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--c-line);
  background: var(--c-surface);
  margin-top: calc(var(--sp) * 2);
  padding-block: var(--sp);
  color: var(--c-muted);
  font-size: var(--t-sm);
}
.site-footer a { color: var(--c-muted); }
.site-footer__cols {
  display: grid; gap: var(--sp);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .3rem; }

/* ---- Utilities ---- */
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap;
}
:where(a, button, input, summary):focus-visible {
  outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 4px;
}

@media print {
  .site-header, .site-footer, .story-strip { display: none; }
}

/* ===== Engagement ===== */

/* Reading progress */
.progress {
  position: fixed; inset-block-start: 0; inset-inline: 0;
  height: 3px; z-index: 60; background: transparent; pointer-events: none;
}
.progress__bar {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--c-brand), var(--c-accent));
  transition: width .1s linear;
}

/* Table of contents */
.toc {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  margin: 0 0 1.75rem;
  font-size: var(--t-sm);
}
.toc summary {
  cursor: pointer; font-weight: 700; color: var(--c-brand);
  font-size: var(--t-base); list-style: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: " ▾"; }
.toc details[open] summary::after { content: " ▴"; }
.toc__list { margin: .7rem 0 0; padding-inline-start: 1.2rem; }
.toc__item { margin-bottom: .35rem; line-height: 1.5; }
.toc__item--h3 { margin-inline-start: .9rem; list-style: circle; }
.toc__item a { color: var(--c-text); text-decoration: none; }
.toc__item a:hover { color: var(--c-brand); text-decoration: underline; }
.toc__item.is-active > a { color: var(--c-brand); font-weight: 700; }

/* Related posts */
.related {
  max-width: var(--wrap);
  margin: calc(var(--sp) * 1.5) auto 0;
  border-top: 1px solid var(--c-line);
  padding-top: var(--sp);
}
.related__title {
  font-size: var(--t-h2); margin-bottom: .8rem;
  display: flex; align-items: center; gap: .55rem;
}
.related__title::before {
  content: ""; width: 5px; height: 1.1em;
  background: var(--c-accent); border-radius: 3px;
}
.card-grid--related { padding-block: .5rem 0; }

/* Read-next sticky card */
.readnext {
  position: fixed; inset-block-end: 1rem; inset-inline-end: 1rem;
  width: min(22rem, calc(100vw - 2rem));
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgb(0 0 0 / .16);
  z-index: 55;
  transform: translateY(140%);
  transition: transform .34s cubic-bezier(.22,1,.36,1);
}
.readnext.is-visible { transform: translateY(0); }
.readnext__link { display: flex; gap: .75rem; padding: .7rem; text-decoration: none; color: inherit; align-items: center; }
.readnext__thumb { flex: 0 0 4.5rem; }
.readnext__thumb img { width: 4.5rem; height: 4.5rem; object-fit: cover; border-radius: 8px; }
.readnext__body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.readnext__label {
  font-size: .68rem; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--c-accent);
}
.readnext__title {
  font-weight: 700; line-height: 1.35; font-size: var(--t-sm);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.readnext__close {
  position: absolute; inset-block-start: .25rem; inset-inline-end: .4rem;
  background: none; border: 0; font-size: 1.15rem; line-height: 1;
  color: var(--c-muted); cursor: pointer; padding: .2rem .35rem;
}
@media (prefers-reduced-motion: reduce) {
  .readnext { transition: none; }
}
@media print { .readnext, .progress { display: none; } }

/* ---- Sidebar widgets ---- */
.widget { margin-bottom: 1.6rem; }
.widget__title {
  font-size: var(--t-base); font-weight: 800;
  margin: 0 0 .7rem; padding-bottom: .4rem;
  border-bottom: 2px solid var(--c-accent);
  display: inline-block;
}











.taglist { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.taglist__tag {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 600;
  padding: .3rem .6rem; border-radius: 999px;
  background: var(--c-bg); border: 1px solid var(--c-line);
  color: var(--c-text); text-decoration: none;
}
.taglist__tag:hover { border-color: var(--c-accent); color: var(--c-brand); }
.taglist__tag.is-current { background: var(--c-accent-sf); border-color: var(--c-accent); color: var(--c-brand); }
.taglist__n { color: var(--c-muted); font-size: .7rem; font-weight: 500; }

.entry__hero img { border-radius: var(--radius); }

/* Related + read-next stay full-width below the two-column block */
.related { max-width: var(--wrap); }

/* ---- Inline related (text-only) ---- */
.inline-rel {
  margin: 1.4rem 0;
  padding: .65rem .9rem;
  border-inline-start: 3px solid var(--c-accent);
  background: var(--c-accent-sf);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--t-sm);
  line-height: 1.55;
}
.inline-rel__label {
  font-weight: 800;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .74rem;
  margin-inline-end: .3rem;
}
.inline-rel__link {
  font-weight: 700;
  color: var(--c-brand);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--c-brand) 35%, transparent);
}
.inline-rel__link:hover {
  color: var(--c-brand-ink);
  border-bottom-color: currentColor;
}
@media print { .inline-rel { display: none; } }
