:root {
  --bg-deep: #0e0a08;
  --bg: #15100c;
  --surface: #1c1510;
  --surface2: #231a14;
  --border: rgba(201, 162, 39, 0.12);
  --border-strong: #3d3026;
  --text: #f3ebe4;
  --text-muted: #9a8b80;
  --accent: #e4bc5c;
  --accent-dim: #a68b3a;
  --accent-glow: rgba(228, 188, 92, 0.12);
  --danger: #f0a090;
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Vazirmatn', system-ui, sans-serif;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  background: var(--bg-deep);
  position: relative;
}

.bg-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 1.75rem 1.15rem 2.5rem;
}

/* ——— Top bar ——— */
.topbar {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-strong);
  background: linear-gradient(135deg, rgba(228, 188, 92, 0.06) 0%, transparent 50%);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar__nav {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  transition:
    color 0.15s,
    background 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav-link--current {
  color: var(--accent);
  background: var(--accent-glow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand__mark {
  font-size: 2.25rem;
  line-height: 1;
  filter: drop-shadow(0 2px 12px rgba(228, 188, 92, 0.25));
}

.brand__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__tagline {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.pill--live {
  background: rgba(80, 180, 120, 0.15);
  color: #8fd4a8;
  border: 1px solid rgba(80, 180, 120, 0.35);
}

.pill--live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6ecf8f;
  box-shadow: 0 0 8px #6ecf8f;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ——— Stats ——— */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card--accent {
  border-color: rgba(228, 188, 92, 0.35);
  background: linear-gradient(145deg, var(--surface2) 0%, var(--surface) 100%);
  box-shadow: var(--shadow), 0 0 0 1px var(--accent-glow);
}

.stat-card--wide {
  grid-column: 1 / -1;
}

@media (min-width: 640px) {
  .stat-card--wide {
    grid-column: span 1;
  }
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card__icon {
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0.9;
}

.stat-card__body {
  min-width: 0;
  flex: 1;
}

.stat-card__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-card__value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-card__path {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  line-height: 1.45;
  word-break: break-all;
  color: var(--text-muted);
  direction: ltr;
  text-align: left;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
}

/* ——— Sources collapsible ——— */
.sources-block {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.sources-block__summary {
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sources-block__summary::-webkit-details-marker {
  display: none;
}

.sources-block__summary::before {
  content: '▸';
  display: inline-block;
  transition: transform 0.2s;
  color: var(--accent-dim);
}

details[open] .sources-block__summary::before {
  transform: rotate(-90deg);
}

.sources-block__content {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border-strong);
}

.chip-list {
  margin: 0;
  padding: 0.75rem 1rem 0 0;
  list-style: disc;
}

.chip-list li {
  margin-bottom: 0.55rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.chip-list li:last-child {
  margin-bottom: 0;
}

.chip {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.chip--rss {
  background: rgba(100, 180, 120, 0.18);
  color: #9fd4a8;
}

.chip--html {
  background: rgba(120, 160, 220, 0.18);
  color: #a8c4f0;
}

.chip--mix {
  background: var(--accent-glow);
  color: var(--accent);
}

.chip--pup {
  background: rgba(200, 120, 160, 0.18);
  color: #e8a8c8;
}

/* ——— Feed section ——— */
.feed-section {
  margin-bottom: 1.5rem;
}

.feed-head {
  margin-bottom: 0.75rem;
}

.feed-head__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.feed-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 160px;
}

.field--narrow {
  flex: 0 0 auto;
  min-width: 5rem;
}

.field__label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field__input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field__input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.feed-meta {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ——— Buttons ——— */
.btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  min-height: 2.35rem;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent-dim);
  background: var(--surface);
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn--primary {
  background: linear-gradient(180deg, rgba(228, 188, 92, 0.2) 0%, rgba(228, 188, 92, 0.08) 100%);
  border-color: rgba(228, 188, 92, 0.45);
  color: var(--accent);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(228, 188, 92, 0.3) 0%, rgba(228, 188, 92, 0.12) 100%);
}

.btn__spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(228, 188, 92, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ——— Feed cards ——— */
.feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feed-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}

.feed-card:hover {
  border-color: rgba(228, 188, 92, 0.25);
}

.feed-card__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.feed-card__id {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.feed-card__time {
  font-size: 0.78rem;
  color: var(--text-muted);
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

.feed-card__pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(120, 160, 220, 0.15);
  color: #a8c4f0;
}

.feed-card__pill--muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.feed-card__title {
  margin: 0 0 0.65rem;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.feed-card__empty {
  color: var(--text-muted);
  font-weight: 400;
}

.feed-card__footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 560px) {
  .feed-card__footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.feed-card__source {
  font-size: 0.82rem;
  color: var(--accent-dim);
}

.feed-card__source--muted {
  color: var(--text-muted);
  font-style: italic;
}

.feed-card__link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
  text-decoration: none;
  color: #d4b87a;
  font-size: 0.78rem;
  font-weight: 600;
}

.feed-card__link:hover {
  color: var(--accent);
}

.feed-card__url {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  max-width: 100%;
  word-break: break-all;
  text-align: left;
}

.feed-empty,
.feed-error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
}

.feed-error {
  color: var(--danger);
  border-style: solid;
}

/* ——— Skeleton ——— */
.skeleton--feed {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.skeleton__line {
  height: 0.85rem;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--surface2) 0%,
    rgba(228, 188, 92, 0.08) 50%,
    var(--surface2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
  margin-bottom: 0.65rem;
}

.skeleton__line--short {
  width: 55%;
}

.skeleton__line:last-child {
  margin-bottom: 0;
}

@keyframes shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

/* ——— Footer ——— */
.site-footer {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.site-footer strong {
  color: var(--text);
  font-weight: 600;
}

.site-footer code {
  font-size: 0.78em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  direction: ltr;
}

.site-footer__sub {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  opacity: 0.85;
}

/* ——— Blog single article ——— */
.blog-article {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.35rem 1.25rem;
  margin-top: 1rem;
}

.blog-article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.blog-article__title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.blog-body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.blog-prose {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
}

.blog-prose__label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.feed-card__title-link {
  color: inherit;
  text-decoration: none;
}

.feed-card__title-link:hover {
  color: var(--accent);
}

/* ——— Article (professional reading view) ——— */
.article {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  margin-top: 1rem;
  overflow: hidden;
}

.article__cover {
  margin: 0;
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border-strong);
}

.article__cover img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

.article__head {
  padding: 1.6rem 1.6rem 0;
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.9rem;
}

.article__source {
  color: var(--accent-dim);
  font-weight: 600;
}

.article__date {
  direction: rtl;
  font-variant-numeric: tabular-nums;
}

.article__title {
  margin: 0 0 1.1rem;
  font-size: clamp(1.5rem, 1.1rem + 2vw, 2.05rem);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* ——— Prose (parsed Gemini translation) ——— */
.article__body {
  padding: 0 1.6rem 1.6rem;
}

.prose {
  font-size: 1.04rem;
  line-height: 1.95;
  color: #e8ded4;
}

.prose__p {
  margin: 0 0 1.1rem;
  text-align: justify;
  text-justify: inter-word;
}

.prose__h3 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 1.9rem 0 0.85rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.prose__h3:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.prose__h4 {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  margin: 1.3rem 0 0.6rem;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.45;
  color: #f0e6db;
}

.prose__num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 0.4rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid rgba(228, 188, 92, 0.25);
  transform: translateY(-0.05em);
}

.prose__num--main {
  color: var(--bg-deep);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dim) 100%);
  border-color: transparent;
}

/* ——— Article footer + original link ——— */
.article__footer {
  padding: 0 1.6rem 1.6rem;
}

.article__orig {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(228, 188, 92, 0.35);
  background: var(--accent-glow);
  transition: background 0.15s, border-color 0.15s;
}

.article__orig:hover {
  background: rgba(228, 188, 92, 0.18);
  border-color: var(--accent-dim);
}

/* ——— Collapsible English source ——— */
.article__en {
  margin: 0 1.6rem 1.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}

.article__en > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article__en > summary::-webkit-details-marker {
  display: none;
}

.article__en > summary::before {
  content: '▸';
  color: var(--accent-dim);
  transition: transform 0.2s;
}

.article__en[open] > summary::before {
  transform: rotate(-90deg);
}

.article__en-body {
  margin: 0;
  padding: 0.4rem 1rem 1.1rem;
  direction: ltr;
  text-align: left;
  font-family: var(--font);
  font-size: 0.88rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .article__head,
  .article__body,
  .article__footer {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
  .article__en {
    margin-left: 1.1rem;
    margin-right: 1.1rem;
  }
  .prose {
    font-size: 1rem;
  }
}
