@font-face {
  font-family: "Gofteh";
  src: url("../fonts/GoftehWeb-Heavy.woff2") format("woff2"),
       url("../fonts/GoftehWeb-Heavy.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f3ee;
  --stone: #ebe6dc;
  --ink: #171512;
  --muted: #6a645c;
  --line: #ddd4c6;
  --accent: #8a7348;
  --sage: #3f5244;
  --card: #fbfaf7;
  --font-display: "Gofteh", "Vazirmatn", Tahoma, sans-serif;
  --font-body: "Vazirmatn", Tahoma, sans-serif;
  --radius: 2px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(138, 115, 72, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 40% at 0% 100%, rgba(63, 82, 68, 0.06), transparent 50%),
    var(--paper);
  line-height: 1.85;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--sage); text-underline-offset: 4px; }
a:hover { color: var(--ink); }
img { max-width: 100%; display: block; }
.wrap { width: min(100% - 2rem, 56rem); margin-inline: auto; }
.wrap-wide { width: min(100% - 2rem, 64rem); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.nav { display: flex; flex-wrap: wrap; gap: 0.9rem 1.1rem; font-size: 0.92rem; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }

main { flex: 1; }

.hero {
  padding: 4rem 0 3.2rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.hero-kicker {
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
  animation: fadeIn 0.8s ease both;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  line-height: 1.05;
  margin: 0;
  color: var(--ink);
  animation: rise 0.7s ease both;
}
.hero-line {
  width: 3.5rem;
  height: 1px;
  background: var(--accent);
  margin: 1.25rem 0 1rem;
  opacity: 0.7;
}
.hero p {
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.08rem;
  margin: 0;
  animation: rise 0.85s ease 0.08s both;
}

.section { padding: 2.5rem 0 3.5rem; }
.section h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  margin: 0 0 0.35rem;
}
.section-lead { color: var(--muted); margin: 0 0 1.75rem; font-size: 0.95rem; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  border-top: 1px solid var(--line);
  animation: rise 0.6s ease both;
}
.post-list a {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  text-decoration: none;
  color: inherit;
}
@media (min-width: 640px) {
  .post-list a { grid-template-columns: 9.5rem 1fr; gap: 1.35rem; }
}
.post-thumb {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--stone);
}
.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.post-list a:hover .post-thumb img { transform: scale(1.03); }
.post-cat { color: var(--accent); font-size: 0.78rem; margin: 0 0 0.25rem; }
.post-list h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0;
  line-height: 1.35;
  color: var(--ink);
}
.post-list a:hover h3 { color: var(--sage); }
.post-excerpt {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 2.5rem 0 0.75rem;
  line-height: 1.2;
}
.page-lead { color: var(--muted); max-width: 36rem; }

.article-meta { color: var(--accent); font-size: 0.9rem; margin-top: 2.2rem; }
.article-meta a { color: inherit; text-decoration: none; }
.article-title {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4.5vw, 2.75rem);
  line-height: 1.25;
  margin: 0.6rem 0 0.8rem;
}
.article-excerpt { color: var(--muted); font-size: 1.08rem; max-width: 40rem; }
.article-cover {
  margin: 2rem auto;
  aspect-ratio: 21/9;
  overflow: hidden;
  background: var(--stone);
  max-width: 56rem;
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; }

.article-grid {
  display: grid;
  gap: 2rem;
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}
@media (min-width: 960px) {
  .article-grid { grid-template-columns: 1fr 13rem; }
}
.prose { max-width: 40rem; font-size: 1.05rem; color: color-mix(in srgb, var(--ink) 92%, transparent); }
.prose h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin: 2.2rem 0 0.8rem;
  scroll-margin-top: 5rem;
}
.prose h3 { font-family: var(--font-display); font-size: 1.2rem; margin: 1.6rem 0 0.6rem; }
.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { padding-right: 1.25rem; margin: 0 0 1.1rem; }
.prose li { margin: 0.35rem 0; }
.prose a { color: var(--sage); }
.toc { position: sticky; top: 5rem; }
.toc-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
  font-weight: 600;
}
.toc nav { display: grid; gap: 0.45rem; font-size: 0.86rem; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.related { border-top: 1px solid var(--line); margin: 2rem auto 3rem; padding-top: 1.5rem; max-width: 40rem; }
.related h2 { font-family: var(--font-display); font-size: 1.4rem; }
.related ul { padding: 0; list-style: none; }
.related li { margin: 0.5rem 0; }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.6rem 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Admin */
.admin-wrap { width: min(100% - 2rem, 52rem); margin: 2rem auto 3rem; }
.admin-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 1.5rem;
}
.admin-card h1 { font-family: var(--font-display); margin-top: 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 1.25rem; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius);
}
.btn:hover { color: var(--paper); opacity: 0.9; }
.btn-outline {
  background: transparent;
  color: var(--ink);
}
.btn-outline:hover { background: var(--stone); color: var(--ink); }
.btn-danger { background: #8b2e22; border-color: #8b2e22; }
.field { margin-bottom: 1rem; }
.field label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; font-weight: 500; }
.field input, .field textarea, .field select {
  width: 100%;
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--radius);
}
.field textarea { min-height: 16rem; line-height: 1.7; }
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  background: var(--stone);
}
.badge-on { background: color-mix(in srgb, var(--sage) 18%, white); border-color: var(--sage); }
.admin-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}
.admin-row h3 { margin: 0.25rem 0; font-size: 1rem; font-family: var(--font-body); font-weight: 600; }
.msg-error { color: #8b2e22; font-size: 0.9rem; }
.grid-2 { display: grid; gap: 1rem; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

@media (max-width: 639px) {
  .nav-hide-sm { display: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
