/* Telegram feed: the home section, /telegram and /telegram/submit. Loaded only on those pages,
   after site.css, whose tokens it uses. Logical properties only (RTL-first). */

.tg-section {
  gap: 20px;
}

.tg-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.6;
}

.tg-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (min-width: 900px) {
  .tg-columns {
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  }

  .tg-columns-empty {
    grid-template-columns: minmax(0, 420px);
  }
}

.tg-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
}

.tg-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tg-updated,
.tg-note,
.tg-empty {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.tg-list,
.tg-ranks {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tg-item + .tg-item,
.tg-rank + .tg-rank {
  border-block-start: 1px solid var(--border);
}

.tg-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-block: 12px;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tg-link:hover .tg-excerpt {
  color: var(--accent);
}

.tg-excerpt {
  font-size: 13px;
  line-height: 1.9;
  color: var(--text);
}

.tg-label {
  display: inline-block;
  padding: 0 8px;
  border-radius: var(--pill);
  background: var(--lilac);
  color: var(--accent-hover);
  font-weight: 700;
}

.tg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
}

.tg-channel {
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.tg-username {
  font-size: 13px;
  color: var(--muted);
}

.tg-when {
  margin-inline-start: auto;
  font-size: 13px;
  color: var(--muted);
}

.tg-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block-start: 12px;
  border-block-start: 1px solid var(--border);
}

.tg-all {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--tap);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
}

/* rankings ------------------------------------------------------------------------------ */

.tg-rankings-title {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.6;
}

.tg-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-block-end: 4px;
  border-radius: var(--pill);
  background: var(--lilac);
}

.tg-tabs[hidden] {
  display: none;
}

.tg-tab {
  flex: 1 1 0;
  min-block-size: var(--tap);
  padding-inline: 6px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  font-weight: 700;
  cursor: pointer;
}

.tg-tab[aria-selected="true"] {
  background: var(--white);
  color: var(--heading);
  box-shadow: 0 1px 4px rgba(38, 1, 100, 0.12);
}

.tg-panel-title {
  margin: 12px 0 0;
  font-size: 15px;
  color: var(--heading);
}

/* With JavaScript the tabs replace the panel headings (telegram.js adds .is-tabbed). */
.is-tabbed .tg-panel-title {
  display: none;
}

.tg-rank-link {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
}

.tg-rank-number {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 28px;
  block-size: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
}

.tg-rank-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-inline-size: 0;
}

.tg-rank-meta {
  font-size: 13px;
  color: var(--muted);
}

.tg-empty {
  padding-block: 12px;
}

/* Brainium's own channel: Telegram blue with white text. White on #0088CC is 3.9:1, so every
   text on it is large and bold (>= 18.66px bold counts as large text: 3:1 is enough). */

.tg-brainium {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius-card);
  background: #0088cc;
  color: var(--white);
  text-decoration: none;
}

.tg-brainium:hover {
  color: var(--white);
  background: #0077b3;
}

.tg-brainium-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 48px;
  block-size: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.tg-brainium-text {
  display: flex;
  flex-direction: column;
  min-inline-size: 0;
  line-height: 1.5;
}

.tg-brainium-title {
  font-size: 19px;
  font-weight: 800;
}

.tg-brainium-user {
  font-size: 19px;
  font-weight: 700;
  text-align: end;
}

.tg-brainium-join {
  flex: none;
  margin-inline-start: auto;
  padding: 6px 18px;
  border-radius: var(--pill);
  background: var(--white);
  color: #0077b3;
  font-size: 15px;
  font-weight: 800;
}

/* submission ---------------------------------------------------------------------------- */

.tg-submit {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.tg-submit-text {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--heading);
}

.tg-note-input {
  min-block-size: 96px;
  padding-block: 10px;
  font-size: 16px;
}

.tg-honeypot {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .tg-card {
    padding: 16px;
  }

  .tg-when {
    margin-inline-start: 0;
    flex-basis: 100%;
  }
}
