:root {
  --bg: #000000;
  --fg: #ffffff;
  --dim: #8a8a8a;
  --line: #2a2a2a;
  --line2: #444;
  --accent: #ffffff;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Space Grotesk', system-ui, sans-serif;
  --rtl: 'Vazirmatn', 'Noto Naskh Arabic', Tahoma, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

/* RTL languages use Vazirmatn */
[lang="fa"], [lang="ckb"] { font-family: var(--rtl); }

.app-shell {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
  padding: 2.4rem 1.4rem 4rem;
  min-height: 100vh;
}

/* subtle grain / vignette for atmosphere without color */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(100% 60% at 50% 110%, rgba(255,255,255,0.03), transparent 60%);
  z-index: 0;
}
.app-shell > * { position: relative; z-index: 1; }

.corner {
  position: fixed;
  top: 1rem;
  font-size: 1.2rem;
  opacity: 0.6;
  z-index: 2;
  animation: pulse 4s ease-in-out infinite;
}
.corner.tl { inset-inline-start: 1rem; }
@keyframes pulse { 0%,100%{opacity:.4;transform:scale(1)} 50%{opacity:.85;transform:scale(1.1)} }

/* Header */
.site-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.4rem;
  margin-bottom: 1.6rem;
}
.brand {
  font-family: var(--serif);
  font-weight: 200;
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.5rem;
}
[lang="fa"] .brand, [lang="ckb"] .brand { font-family: var(--rtl); font-weight: 200; }

.date-line {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1.2rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.streak { color: var(--fg); opacity: 0.55; }

/* Language switcher */
.lang-switch {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.lang-btn {
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 0.32rem 0.9rem;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.lang-btn[lang="fa"], .lang-btn[lang="ckb"] { font-family: var(--rtl); }
.lang-btn:hover { color: var(--fg); border-color: var(--fg); }
.lang-btn.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
  font-weight: 500;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.ctrl {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line2);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.18s ease;
  flex: 1 1 auto;
  min-width: fit-content;
}
[dir="rtl"] .ctrl { font-family: var(--rtl); }
.ctrl:hover { background: var(--fg); color: var(--bg); }
.ctrl.today { flex: 0 0 auto; }

/* Daily countdown banner (replaces the old "New Topic" button) */
.controls { justify-content: center; }
.next-topic {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px dashed var(--line2);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  animation: fadein 0.6s ease both;
}
[dir="rtl"] .next-topic { font-family: var(--rtl); letter-spacing: 0; }

/* Reading area */
.reading { animation: fadein 0.5s ease both; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.field-badge {
  border: 1px solid var(--line2);
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
}
[lang="fa"] .field-badge, [lang="ckb"] .field-badge { letter-spacing: 0; }

.topic-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin-bottom: 0.7rem;
}
[lang="fa"] .topic-title, [lang="ckb"] .topic-title {
  font-family: var(--rtl);
  font-weight: 500;
  line-height: 1.4;
}

.sociologist {
  font-size: 0.9rem;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.4rem;
  margin-bottom: 1.6rem;
}
.socio-name { color: var(--fg); font-weight: 500; }

/* Essay */
.essay p {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.16rem;
  line-height: 1.75;
  margin-bottom: 1.4rem;
  animation: slideup 0.6s ease both;
}
[lang="fa"] .essay p, [lang="ckb"] .essay p {
  font-family: var(--rtl);
  font-weight: 400;
  font-size: 1.08rem;
  line-height: 2.1;
}
@keyframes slideup { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* Questions */
.questions {
  border-top: 1px solid var(--line);
  margin-top: 2.2rem;
  padding-top: 1.6rem;
}
.questions h3 {
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1rem;
}
[dir="rtl"] .questions h3 { letter-spacing: 0; }
.questions ul { list-style: none; }
.questions li {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
  padding: 0.7rem 0 0.7rem 1.4rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  animation: slideup 0.6s ease both;
}
[dir="rtl"] .questions li {
  padding: 0.7rem 1.4rem 0.7rem 0;
  font-family: var(--rtl);
}
.questions li::before {
  content: "—";
  position: absolute;
  inset-inline-start: 0;
  color: var(--dim);
}
.questions li:last-child { border-bottom: none; }

/* Actions */
.actions { margin-top: 1.8rem; }
.ctrl.copy { flex: 0 0 auto; }

/* Archive */
.archive-wrap {
  margin-top: 2.6rem;
  border-top: 1px solid var(--line);
  padding-top: 1.4rem;
}
.archive-toggle {
  background: none;
  border: none;
  color: var(--dim);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.3rem 0;
}
[dir="rtl"] .archive-toggle { font-family: var(--rtl); letter-spacing: 0; }
.archive-toggle:hover { color: var(--fg); }
.archive-list { list-style: none; margin-top: 1rem; }
.archive-item {
  width: 100%;
  text-align: start;
  background: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--fg);
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: all 0.18s ease;
  font-family: inherit;
}
[dir="rtl"] .archive-item { font-family: var(--rtl); }
.archive-item:hover { border-color: var(--fg); transform: translateX(2px); }
[dir="rtl"] .archive-item:hover { transform: translateX(-2px); }
.archive-item.current { border-color: var(--fg); background: rgba(255,255,255,0.05); }
.ai-field { font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.ai-title { font-family: var(--serif); font-size: 1.05rem; }
[dir="rtl"] .ai-title { font-family: var(--rtl); }
.ai-socio { font-size: 0.78rem; color: var(--dim); }

/* Footer */
.site-footer {
  margin-top: 3rem;
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
  text-align: center;
}
.footer-tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--dim);
  margin-bottom: 0.8rem;
}
[dir="rtl"] .footer-tag { font-family: var(--rtl); font-style: normal; }
.footer-links a {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--line2);
  padding-bottom: 2px;
  transition: border-color 0.2s;
}
.footer-links a:hover { border-color: var(--fg); }

/* Mobile tweaks */
@media (max-width: 520px) {
  .controls .ctrl { flex: 1 1 45%; font-size: 0.76rem; padding: 0.5rem 0.5rem; }
  .app-shell { padding: 1.8rem 1.1rem 3rem; }
}