/* Self-hosted Vazirmatn variable font (SIL Open Font License 1.1). */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/vazirmatn-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --page: #f9f9f7;
  --surface: #ffffff;
  --ink: #000101;
  --muted: #686d67;
  --line: #e4e6e1;
  --accent: #3a4631;
  --accent-hover: #263321;
  --soft: #eff0eb;
  --code: #eff0eb;
  --hero-ink: #f9f9f7;
  --hero-muted: #d5d9d1;
  --content-width: 1060px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { color: var(--accent-hover); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.site-shell { width: min(var(--content-width), calc(100% - 56px)); margin: 0 auto; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 26px 0; margin-bottom: 34px; border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 13px; background: var(--accent); color: #fff;
  font-size: 23px; font-weight: 700;
}
.brand-name { font-size: 1.13rem; font-weight: 800; letter-spacing: -.035em; }
.site-description { margin: 4px 0 0; color: var(--muted); font-size: .78rem; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 24px; }
.site-nav a { color: var(--muted); font-size: .88rem; text-decoration: none; transition: color .15s ease; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }
.site-main { min-height: 55vh; }
.home-intro {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 0 0 44px; padding: clamp(30px, 5vw, 58px);
  border-radius: 22px; background: var(--accent); color: var(--hero-ink);
}
.home-intro::before {
  content: ""; position: absolute; z-index: -1; width: 310px; height: 310px;
  left: -105px; top: -155px; border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 50%; box-shadow: 0 0 0 32px rgb(255 255 255 / 4%), 0 0 0 66px rgb(255 255 255 / 3%);
}
.home-eyebrow { margin: 0 0 14px; color: #d9dfd4; font-size: .78rem; font-weight: 700; letter-spacing: .04em; }
.page-heading { margin: 0 0 12px; font-size: clamp(1.9rem, 5vw, 3.4rem); line-height: 1.45; letter-spacing: -.045em; font-weight: 800; }
.home-intro .page-heading { max-width: 760px; color: var(--hero-ink); }
.page-intro { max-width: 700px; margin: 0; color: var(--muted); }
.home-intro .page-intro { color: var(--hero-muted); font-size: 1.02rem; line-height: 2; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 8px; }
.section-heading h2 { margin: 0; font-size: 1.15rem; font-weight: 800; }
.section-heading span { color: var(--muted); font-size: .8rem; }
.post-list { margin-top: 20px; }
.post-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 8px 24px;
  padding: 25px 0 27px; border-bottom: 1px solid var(--line);
}
.post-card:first-child { padding-top: 10px; }
.post-card-main { min-width: 0; }
.post-title { margin: 0 0 7px; font-size: clamp(1.13rem, 2.3vw, 1.42rem); line-height: 1.65; letter-spacing: -.025em; }
.post-title a { color: var(--ink); text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: .79rem; line-height: 1.8; }
.post-meta .meta-separator { margin-inline: -7px; }
.short-post-url { margin: 30px 0 30px; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.short-post-url a { direction: ltr; unicode-bidi: plaintext; }
.post-summary { max-width: 790px; margin: 10px 0 0; color: var(--muted); font-size: .91rem; line-height: 1.95; }
.post-number { color: #a4a89f; font-size: .78rem; font-variant-numeric: tabular-nums; padding-top: 7px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.tag-chip { display: inline-block; padding: 2px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: .75rem; text-decoration: none; }
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.article-header { margin-bottom: 34px; padding-bottom: 27px; border-bottom: 1px solid var(--line); }
.article-title { margin: 0 0 16px; font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.55; letter-spacing: -.045em; font-weight: 800; }
.article-content { max-width: 820px; margin-inline: auto; font-size: 1.02rem; line-height: 2.1; overflow-wrap: anywhere; }
.article-content > * { margin-top: 0; margin-bottom: 1.45em; }
.article-content h2 { margin-top: 2.1em; font-size: 1.55rem; line-height: 1.65; letter-spacing: -.025em; }
.article-content h3 { margin-top: 1.8em; font-size: 1.25rem; line-height: 1.7; }
.article-content h4 { font-size: 1.08rem; }
.article-content img, .article-content video { display: block; max-width: 100%; height: auto; margin: 1.8em auto; border-radius: 10px; }
.article-content figure { margin: 2em 0; }
.article-content figcaption { color: var(--muted); text-align: center; font-size: .82rem; }
.article-content blockquote { margin-right: 0; padding: 4px 18px 4px 0; border-right: 3px solid var(--accent); color: var(--muted); }
.article-content ul, .article-content ol { padding-right: 1.4em; }
.article-content li { margin: .35em 0; }
.article-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .9rem; }
.article-content th, .article-content td { padding: 9px 12px; border: 1px solid var(--line); text-align: right; }
.article-content th { background: var(--soft); }
.article-content pre { direction: ltr; text-align: left; overflow-x: auto; padding: 16px; border-radius: 9px; background: var(--code); font-size: .85rem; line-height: 1.7; }
.article-content code { direction: ltr; unicode-bidi: plaintext; padding: .12em .35em; border-radius: 4px; background: var(--code); font-size: .88em; }
.article-content pre code { padding: 0; background: transparent; }
.article-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.breadcrumbs { margin-bottom: 18px; color: var(--muted); font-size: .83rem; }
.breadcrumbs a { color: var(--muted); }
.pagination { display: flex; justify-content: space-between; gap: 16px; margin: 34px 0; }
.pagination a { text-decoration: none; }
.site-footer { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 76px; padding: 24px 0 34px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.site-footer a { color: inherit; }
.empty-state { padding: 30px 0; color: var(--muted); }
@media (max-width: 700px) {
  .site-shell { width: min(var(--content-width), calc(100% - 30px)); }
  .site-header { display: block; padding: 20px 0; margin-bottom: 24px; }
  .site-nav { margin-top: 18px; gap: 8px 17px; }
  .home-intro { padding: 28px 22px; margin-bottom: 34px; border-radius: 16px; }
  .home-intro::before { width: 220px; height: 220px; left: -90px; top: -100px; }
  .page-heading { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .post-card { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 21px 0 23px; }
  .post-number { display: none; }
  .article-content { font-size: 1rem; }
  .article-content blockquote { padding-right: 13px; }
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #171a17; --surface: #202420; --ink: #f0f0eb; --muted: #afb4aa;
    --line: #363d35; --accent: #69785f; --accent-hover: #84937a;
    --soft: #262c25; --code: #232823; --hero-ink: #f8f9f5; --hero-muted: #d8ded3;
  }
  .brand-mark { background: #69785f; color: #fff; }
  .home-eyebrow { color: #e2e8dd; }
  .post-number { color: #828b7d; }
}
@media print {
  :root { --page: #fff; --ink: #000; --muted: #555; --line: #ddd; }
  .site-nav, .site-footer, .tag-row, .home-intro::before { display: none; }
  .site-shell { width: 100%; }
  .home-intro { background: #fff; color: #000; padding: 0; }
  .home-intro .page-heading, .home-intro .page-intro { color: #000; }
  .article-content { font-size: 11pt; }
}

.search-page { max-width: 820px; margin-inline: auto; }
.search-page > .page-heading { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.search-form { margin-top: 28px; }
.search-label { display: block; margin-bottom: 8px; font-size: .88rem; font-weight: 700; }
.search-controls { display: flex; gap: 10px; }
.search-input {
  flex: 1; min-width: 0; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem; outline-offset: 3px;
}
.search-input:focus { border-color: var(--accent); outline: 2px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.search-button {
  padding: 10px 22px; border: 0; border-radius: 8px; background: var(--accent);
  color: #fff; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer;
}
.search-button:hover { background: var(--accent-hover); }
.search-button:disabled, .search-input:disabled { opacity: .6; cursor: not-allowed; }
.search-status { margin: 18px 0 8px; color: var(--muted); font-size: .85rem; }
.search-results { margin-top: 18px; }
.search-result { padding: 22px 0; border-bottom: 1px solid var(--line); }
.search-result-title { margin: 0 0 8px; font-size: 1.15rem; line-height: 1.7; }
.search-result-title a { color: var(--ink); text-decoration: none; }
.search-result-title a:hover { color: var(--accent); }
@media (max-width: 480px) {
  .search-controls { flex-direction: column; }
  .search-button { width: 100%; }
}


/* CHATGPT: show the four random homepage recommendations in two columns. */
.random-post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 36px;
}
.random-post-list .post-card {
  min-width: 0;
  align-content: start;
}
.random-posts-heading { margin-top: 42px; }
@media (max-width: 700px) {
  .random-post-list { grid-template-columns: minmax(0, 1fr); }
}


/* CHATGPT: clamp history summaries to two lines only in the default view. */
.history-default-view .post-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
