/* AramSho blog (/blog/) — builds on site.css tokens; no extra fonts or scripts. */

.blog-hero {
  padding-block: clamp(24px, 4vw, 56px) clamp(24px, 4vw, 40px);
}

.blog-hero-inner {
  max-width: 860px;
}

.blog-hero h1 {
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.6rem);
}

.blog-section {
  padding-block: clamp(24px, 4vw, 48px);
}

.blog-section h2 {
  font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem);
}

/* ---------- Search & topics ---------- */

.blog-search {
  margin-top: 24px;
  max-width: 620px;
}

.blog-search label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.blog-search-row {
  display: flex;
  gap: 8px;
}

.blog-search input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.blog-search input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.blog-search input:focus-visible {
  border-color: var(--accent);
}

.blog-search .button {
  min-height: 48px;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.topic-list ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.topic-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
  text-decoration: none;
}

.topic-list a:hover,
.topic-list a[aria-current="page"] {
  border-color: var(--accent);
  background: rgb(var(--ring) / 0.14);
}

/* ---------- Cards ---------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 20px;
}

@media (min-width: 1000px) {
  .post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  transition: border-color 0.2s, transform 0.2s;
}

.post-card:hover,
.post-card:focus-within {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.post-card-media {
  aspect-ratio: 16 / 9;
  background:
    repeating-radial-gradient(circle at 70% 60%, rgb(var(--ring) / 0.18) 0 1px, transparent 2px 26px),
    var(--band);
}

.post-card-media.is-empty {
  display: flex;
  align-items: flex-end;
  padding: 16px 20px;
}

.post-card-media.is-empty span {
  color: var(--dawn);
  font-size: 1.05rem;
  font-weight: 700;
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px 20px;
}

.post-card-category {
  margin: 0;
  color: var(--dawn);
  font-size: 0.88rem;
  font-weight: 700;
}

.post-card-title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
}

/* The whole card is clickable through the title link. */
.post-card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
}

.post-card-title a:focus-visible {
  outline: none;
}

.post-card:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.post-card-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: auto 0 0;
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Pagination & empty states ---------- */

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

.pagination a,
.pagination span {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.pagination a:hover {
  border-color: var(--accent);
}

.pagination [aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.pagination .pagination-gap {
  border-color: transparent;
}

.blog-empty {
  max-width: 44em;
  color: var(--muted);
}

/* ---------- Article ---------- */

.post-header {
  max-width: 860px;
  padding-top: clamp(20px, 3vw, 40px);
}

.post-header h1 {
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem);
}

.post-header .eyebrow a {
  color: inherit;
  text-decoration: none;
}

.post-byline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-byline p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin: 0;
}

.byline-avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.post-byline strong,
.post-byline a {
  font-weight: 700;
}

.post-cover {
  max-width: 860px;
  margin-block: 8px 32px;
}

.post-cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 24px;
  background: var(--surface);
}

.post-shell {
  max-width: 860px;
  padding-bottom: clamp(32px, 5vw, 64px);
}

.post-layout {
  min-width: 0;
}

.post-aside {
  display: none;
}

/* Reading progress: pure CSS, only where scroll-driven animations exist. */
.read-progress {
  display: none;
}

@supports (animation-timeline: scroll()) {
  .read-progress {
    position: fixed;
    inset-inline: 0;
    top: 0;
    z-index: 60;
    display: block;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right center;
    animation: read-progress linear both;
    animation-timeline: scroll(root);
  }

  @keyframes read-progress {
    to {
      transform: scaleX(1);
    }
  }
}

.post-body,
.post-sources,
.post-note,
.post-tags,
.post-cta,
.author-box,
.toc {
  max-width: 44rem;
}

.post-body {
  font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.12rem);
  line-height: 2.05;
  overflow-wrap: anywhere;
}

.post-body > * {
  margin-block: 0 1.1em;
}

.post-body h2 {
  margin-top: 1.8em;
  font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
}

.post-body h3 {
  margin-top: 1.5em;
  font-size: 1.18rem;
}

.post-body h4 {
  margin-top: 1.3em;
  font-size: 1.05rem;
}

.post-body :is(h2, h3, h4) {
  scroll-margin-top: 88px;
}

.post-body ul,
.post-body ol {
  padding-inline-start: 1.4em;
}

.post-body li + li {
  margin-top: 0.4em;
}

.post-body blockquote {
  margin-inline: 0;
  padding: 12px 20px;
  border-inline-start: 4px solid var(--accent);
  border-radius: 12px;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  background: var(--surface);
  color: var(--text);
}

.post-body blockquote p:last-child {
  margin-bottom: 0;
}

.post-body img {
  border-radius: 16px;
}

.post-body figure {
  margin-inline: 0;
}

.post-body figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.post-body hr {
  margin-block: 2em;
  border: 0;
  border-top: 1px solid var(--border);
}

.post-body code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.92em;
}

.post-body pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 12px;
  background: var(--surface);
  direction: ltr;
  text-align: left;
}

/* «Video or HTML» blocks: lazy 16:9 player frame, native video controls. */
.post-embed {
  margin-block: 1.6em;
}

.post-embed > * {
  margin-block: 0 1em;
}

.post-embed > :last-child {
  margin-bottom: 0;
}

.embed-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
}

.embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.post-embed video,
.post-embed audio {
  display: block;
  width: 100%;
  border-radius: 16px;
}

.post-embed video {
  background: #000;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

.table-scroll table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.8;
}

.table-scroll caption {
  padding: 10px 14px;
  color: var(--muted);
  text-align: start;
}

.table-scroll th,
.table-scroll td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: start;
  vertical-align: top;
}

.table-scroll th {
  background: var(--surface);
}

.table-scroll tr:last-child td {
  border-bottom: 0;
}

.table-scroll :is(th, td) p {
  margin: 0;
}

/* ---------- Table of contents ---------- */

.toc {
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}

.toc summary {
  padding: 14px 20px;
  font-weight: 700;
  cursor: pointer;
}

.toc ol {
  margin: 0;
  padding: 0 20px 16px;
  padding-inline-start: 2.4em;
}

.toc li + li {
  margin-top: 4px;
}

.toc .toc-level-3 {
  margin-inline-start: 1.2em;
  list-style: circle;
  font-size: 0.95rem;
}

.toc a {
  color: var(--text);
}

.toc a:hover {
  color: var(--accent-strong);
}

.toc-title {
  margin: 0;
  padding: 16px 20px 8px;
  font-weight: 700;
}

/* ---------- After the article ---------- */

.post-sources {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.post-sources h2,
.author-box h2 {
  font-size: 1.15rem;
}

.post-sources ol {
  padding-inline-start: 1.4em;
  color: var(--muted);
  font-size: 0.95rem;
}

.post-sources a {
  overflow-wrap: anywhere;
}

.post-note {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.post-tags a {
  display: inline-block;
  padding: 2px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.post-tags a:hover {
  border-color: var(--accent);
  color: var(--text);
}

.post-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
}

.post-share ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-share a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.post-share a:hover {
  border-color: var(--accent);
}

.back-to-top {
  margin: 28px 0 0;
  text-align: center;
}

.back-to-top a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.back-to-top a:hover {
  color: var(--text);
}

.post-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
}

.post-cta p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.post-cta p span {
  color: var(--muted);
  font-size: 0.95rem;
}

.post-cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.author-box {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-top: 32px;
  padding: 20px 24px;
  border-radius: 24px;
  background: var(--band);
}

.author-box-avatar {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.author-box p {
  margin-bottom: 0.5em;
  color: var(--muted);
}

.author-box strong {
  color: var(--text);
}

.related-posts {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

/* ---------- Author page & preview ---------- */

.author-intro {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.author-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

.author-role {
  color: var(--dawn);
  font-weight: 700;
}

.author-bio {
  max-width: 40em;
  color: var(--muted);
}

.author-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0;
  list-style: none;
}

.preview-banner {
  display: grid;
  gap: 2px;
  margin-top: 16px;
  padding: 12px 18px;
  border: 1px solid var(--dawn);
  border-radius: 14px;
  color: var(--text);
  font-size: 0.92rem;
}

/* Persian numerals for ordered lists (body, contents, sources). */
.post-body ol,
.toc ol,
.post-sources ol {
  list-style-type: persian;
}

/* ---------- Wide screens: contents beside the text ---------- */

@media (min-width: 1100px) {
  .post-shell.has-toc {
    display: grid;
    grid-template-columns: minmax(0, 44rem) 250px;
    gap: 48px;
    align-items: start;
    max-width: calc(44rem + 250px + 48px);
  }

  /* Title and cover line up with the two columns. */
  .post:has(.post-shell.has-toc) :is(.post-header, .post-cover) {
    max-width: calc(44rem + 250px + 48px);
  }

  .post-shell.has-toc .toc-inline {
    display: none;
  }

  .post-shell.has-toc .post-aside {
    position: sticky;
    top: 92px;
    display: block;
    max-height: calc(100vh - 120px);
    overflow: auto;
  }

  .toc-sticky {
    margin: 0;
    font-size: 0.92rem;
  }

  .toc-sticky ol {
    padding-inline-start: 2em;
  }
}

@media (max-width: 620px) {
  .author-box {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .read-progress {
    display: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .read-progress,
  .post-aside,
  .toc,
  .post-share,
  .post-cta,
  .back-to-top,
  .related-posts,
  .breadcrumbs,
  .skip-link {
    display: none !important;
  }

  .post-body a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }
}
