@font-face {
  font-family: 'Vazirmatn';
  src: url('/public/fonts/Vazirmatn-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
}

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

html { min-height: 100vh; }

body {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 16px;
  color: #222222;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: #8B1A1A;
  padding: 1rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.header-inner figure {
  margin: 0;
  padding: 0.5rem;
}

.header-inner img {
  height: 150px;
  width: auto;
  display: block;
}

.header-text {
  text-align: center;
  color: #ffffff;
  font-size: 2.875rem;
  line-height: 1.2;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

.nav-bar {
  display: flex;
  align-items: center;
  padding: 0;
  flex-wrap: nowrap;
}

.nav-left {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
  width: 100%;
  align-items: center;
}

.nav-right {
  display: flex;
  align-items: center;
  margin-right: 2rem;
}

nav a {
  display: inline-block;
  padding: 0.75rem 1rem;
  color: #8B1A1A;
  text-decoration: none;
  font-size: 1.1rem;
}

nav a:hover {
  background: #8B1A1A;
  color: #ffffff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.75rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #8B1A1A;
}

/* Main */
main { padding: 1.15rem 0; flex: 1; }

/* Homepage grid - RTL flipped */
.home-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 2.5rem;
  margin: 2rem 0;
}

/* .home-grid .sidebar { order: 2; }
.home-grid .featured { order: 1; } */

.featured article img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.featured article a {
  display: block;
  font-size: 1.5rem;
  font-weight: 500;
  margin-top: 0.75rem;
  text-decoration: none;
  line-height: 1.25;
}

.featured article a:hover { text-decoration: underline; }

/* Sidebar */
.sidebar h3 {
  font-size: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #8B1A1A;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.4rem;
  margin: 1.5rem 0 0.75rem;
}

.sidebar h3:first-child { margin-top: 0; }

.sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  line-height: 1.3;
}

.sidebar ul li { padding-bottom: 6px; }

.sidebar ul li a {
  font-size: 1rem;
  text-decoration: none;
}

.sidebar ul li a:hover { text-decoration: underline; }

/* Campaign banner */
.campaign-banner {
  background: #faeeda;
  border: 1px solid #ef9f27;
  border-radius: 6px;
  padding: 1rem 1.5rem;
  margin: 2rem 0 2.15rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.campaign-banner p { font-size: 1.25rem; }

.campaign-banner a {
  background: #8B1A1A;
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.campaign-banner a:hover { opacity: 0.85; }

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 2.5rem;
  margin: 2rem 0;
}

.post-grid .sidebar { order: 2; }
.post-grid .post-content { order: 1; }

.post-content img {
  width: 100%;
  height: auto;
  display: block;
  margin: 1.25rem 0;
}

/* Post typography */
.post-date {
  font-size: 0.75rem;
  color: #666;
}

.post-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #222;
  margin: 0 0 1.75rem 0;
  padding: 0;
  line-height: 1.25;
}

.post-content h2, h3, h4, h5, h6 {
  font-size: 1.1875rem;
  font-weight: 600;
  color: #222;
  margin: 1.50rem 0 1.50rem;
}

.post-content p {
  margin-bottom: 1.25rem;
  line-height: 1.8;
  font-size: 1.1875rem;
  font-weight: 400;
}

.post-content ul, .post-content ol {
  margin: 0 0 1.25rem 0;
  margin-inline-start: 1.5rem;
  line-height: 1.3;
}

.post-content li { margin-bottom: 0.4rem; }

.post-content blockquote {
  border-right: 3px solid #8B1A1A;
  border-left: none;
  margin: 1.5rem 0;
  padding: 0.5rem 1.25rem;
  color: #444;
  font-style: italic;
  background: #faf5f5;
}

.post-content a { text-decoration: underline; }

.post-content figure img { margin-bottom: 0; }

.image-caption {
  font-size: 0.875rem;
  color: #666;
  text-align: right;
  margin-top: 4px;
  margin-bottom: 1.25rem;
  display: block;
}

/* Post meta */
.post-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin: 0.5rem 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ddd;
}

.post-meta-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reading-time {
  font-size: 0.875rem;
  color: #666;
}

.share-buttons {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.share-buttons a {
  color: #8B1A1A;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.share-buttons a:hover { opacity: 0.7; }

/* Footer */
footer {
  background: #8B1A1A;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-social {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

footer a {
  color: #f5c4c4;
  text-decoration: none;
  font-size: 1.1rem;
}

footer a:hover { color: #ffffff; }

/* Category list */
.category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  padding: 0;
}

.category-list li {
  border-bottom: 1px solid #ddd;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.category-list li a {
  font-size: 1.25rem;
  line-height: 1.5rem;
  padding-bottom: 4px;
  font-weight: 500;
  text-decoration: none;
}

.category-list li a:hover { text-decoration: underline; }

.post-content .category-list { margin: 0; padding: 0; }

/* Article meta */
.article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  overflow: hidden;
}

.article-meta .author-photo {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin: 0;
}

.article-meta div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.article-meta p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.2;
}

.article-image {
  width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
}

/* Article card */
.article-card {
  border-bottom: 1px solid #ddd;
  padding-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.article-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.article-card-top .author-photo-small {
  width: 50px;
  height: 50px;
  min-width: 50px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin: 0;
}

.article-card-title {
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.4;
}

.article-card-title:hover { text-decoration: underline; }

.article-card-meta {
  font-size: 0.875rem;
  color: #666;
  padding-inline-end: calc(50px + 0.75rem);
}

/* Post header row */
.post-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.5rem 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ddd;
}

.post-header-row .post-meta {
  margin: 0;
  padding: 0;
  border: none;
}

/* Author bio */
.post-content .author-bio {
  display: flex;
  align-items: flex-start;
  margin: 1.5rem 0 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #ddd;
  font-size: 0.875rem;
  color: #444;
  line-height: 1.5;
}

/* Campaigns */
.campaign-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #222222;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
}

.campaign-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.campaign-card {
  flex: 1 1 250px;
  max-width: 100%;
}

.campaign-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
}

.campaign-card h3 {
  font-size: 1rem;
  margin: 0.75rem 0 0.4rem;
}

.campaign-card h3 a { text-decoration: none; }
.campaign-card h3 a:hover { text-decoration: underline; }

.campaign-card p {
  font-size: 0.875rem;
  color: #444;
  margin-bottom: 0.75rem;
}

.campaign-card.past { opacity: 0.7; }

.cta-button {
  display: inline-block;
  background: #8B1A1A;
  color: #ffffff;
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.cta-button:hover { opacity: 0.85; color: #ffffff; }

.campaign-description {
  font-size: 1rem;
  margin: 1rem 0;
  color: #444;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #ddd;
  font-size: 1rem;
}

.pagination a {
  color: #8B1A1A;
  text-decoration: none;
  font-weight: 500;
}

.pagination a:hover { text-decoration: underline; }

.pagination span {
  color: #666;
  font-size: 0.875rem;
}

/* Search */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-right: auto;
  padding: 0.4rem 0.5rem;
}

#search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #8B1A1A;
  padding: 0.25rem;
  display: flex;
  align-items: center;
}

#search-input {
  width: 0;
  opacity: 0;
  border: none;
  border-bottom: 1.5px solid #8B1A1A;
  outline: none;
  font-size: 0.9rem;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  color: #222;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  transition: width 0.3s ease, opacity 0.3s ease;
  background: transparent;
}

#search-input.expanded { width: 180px; opacity: 1; }

#search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 280px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 100;
  display: none;
}

#search-results.open { display: block; }

.search-result-item {
  display: block;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: #222;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover { background: #f5f5f3; color: #8B1A1A; }

.search-no-results {
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  color: #666;
}

/* Links */
a { color: #8B1A1A; }

/* 404 */
.error-page {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem 1rem;
}

.error-page h1 {
  font-size: 2rem;
  color: #8B1A1A;
  margin-bottom: 1rem;
}

.error-page p {
  font-size: 1.1rem;
  color: #444;
  margin-bottom: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-direction: row; }
  .header-inner img { height: 80px; }
  .header-text { font-size: 1.75rem; }
  nav { flex-wrap: wrap; }
  nav a { padding: 0.2rem 0.6rem; font-size: 1rem; }
  .home-grid { grid-template-columns: 1fr; }
  .post-grid { grid-template-columns: 1fr; }
  .campaign-banner { flex-direction: column; gap: 1rem; text-align: center; }
  .campaign-card { flex: 1 1 100%; }
  .nav-toggle { display: flex; }
  .nav-bar { justify-content: space-between; }
  .nav-links { display: none; width: 100%; }
  .nav-links.open { display: flex; }
  .nav-right { flex-direction: column; align-items: flex-start; width: 100%; }
  .featured article a { font-size: 1.375rem; }
  footer a { font-size: 1rem; }
  main { padding: 0; }
}
