/* حفظ و نشر آثار — Notebook design */
@font-face { font-family: Sahel; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/Sahel-FD.woff2) format("woff2"); }
@font-face { font-family: Sahel; font-weight: 600; font-style: normal; font-display: swap; src: url(/fonts/Sahel-SemiBold-FD.woff2) format("woff2"); }
@font-face { font-family: Sahel; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/Sahel-Bold-FD.woff2) format("woff2"); }
/* Latin digits, for the short link */
@font-face { font-family: "Sahel Latin"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/Sahel.woff2) format("woff2"); }

:root {
  --bg: #e9e7e1; --fg: #22252b; --muted: #6a6e77; --ink: #776b5c; --accent: #f4c430; --on-accent: #3a332b; --rule: #d1cec6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #16181c; --fg: #e2e1dc; --muted: #979aa2; --ink: #f4c430; --accent: #f4c430; --on-accent: #221c13; --rule: #2d3036; color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #16181c; --fg: #e2e1dc; --muted: #979aa2; --ink: #f4c430; --accent: #f4c430; --on-accent: #221c13; --rule: #2d3036; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: Sahel, sans-serif; font-size: 16.5px; line-height: 2.05;
  background: var(--bg); color: var(--fg);
}
a { color: inherit; }
h1, h2 { text-wrap: balance; margin: 0; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }

.wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding-inline: max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-left)); padding-block: 14px 20px; }
.col { width: 100%; max-width: 36rem; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }

header.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; }
.brand { text-decoration: none; font-weight: 600; font-size: 1.2rem; line-height: 1.7; }
.switch { position: relative; flex: none; width: 52px; height: 28px; border-radius: 999px; border: 1px solid var(--rule); background: var(--bg); cursor: pointer; padding: 0; color: var(--muted); }
.switch svg { position: absolute; top: 6px; width: 14px; height: 14px; }
.switch .sun { right: 7px; } .switch .moon { left: 7px; }
.switch .knob { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); transition: right .2s ease; }
.switch[aria-checked="true"] .knob { right: 27px; }
@media (prefers-reduced-motion: reduce) { .switch .knob { transition: none; } }

.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.pills a { text-decoration: none; font-size: .84rem; line-height: 1.9; padding: 0 11px; border-radius: 9px; border: 1px solid var(--rule); color: var(--fg); }
@media (max-width: 480px) { .pills { gap: 5px; } .pills a { font-size: .78rem; padding: 0 8px; } }
.pills a:hover { border-color: var(--accent); }
.pills a.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { text-decoration: none; font-size: .74rem; line-height: 1.8; padding: 0 8px; border-radius: 7px; border: 1px solid var(--rule); color: var(--ink); }
.tag:hover { border-color: var(--accent); }
.ibtn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid var(--rule); background: transparent; color: var(--ink); cursor: pointer; padding: 0; text-decoration: none; }
.ibtn:hover { border-color: var(--accent); }
.ibtn svg { width: 18px; height: 18px; }
.ibtn.off { opacity: .35; cursor: default; }
.ibtn.off:hover { border-color: var(--rule); }

.list { list-style: none; padding: 0; margin: 6px 0 0; }
.list li { padding: 14px 0; border-bottom: 1px dashed var(--rule); }
.list li:last-child { border-bottom: 0; }
.list h2 { font-size: 1.04rem; font-weight: 600; }
.list h2 a { text-decoration: none; }
.list h2 a:hover { color: var(--ink); }
.list p { margin: 0 0 2px; color: var(--muted); font-size: .94rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.meta { font-size: .82rem; color: var(--muted); }
.empty { margin-top: 26px; text-align: center; color: var(--muted); }
.more { margin-top: 18px; display: flex; justify-content: center; gap: 10px; }
.catHead { margin-top: 26px; text-align: center; }
.catHead h1 { font-size: 1.2rem; font-weight: 600; }

article { margin-top: 30px; }
article > header h1 { font-size: 1.3rem; font-weight: 600; line-height: 1.7; }
article > header h2 { font-size: .98rem; font-weight: 400; color: var(--muted); margin-top: 2px; }
.body { margin-top: 22px; }
.poem { white-space: pre-line; line-height: 2.25; }
.prose p { text-align: justify; margin: 0 0 1em; }
.prose .ln { display: block; white-space: nowrap; text-align: justify; text-align-last: justify; }
.prose .ln.end { text-align: start; text-align-last: auto; }
.postfoot { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 26px; padding-top: 14px; border-top: 1px dashed var(--rule); font-size: .82rem; color: var(--muted); }
.postfoot .row { align-self: stretch; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.copy { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: .8rem; color: var(--fg); background: transparent; border: 1px solid var(--rule); border-radius: 9px; padding: 2px 6px 2px 12px; cursor: pointer; }
.copy:hover { border-color: var(--accent); }
.copy svg { width: 15px; height: 15px; color: var(--ink); }
.copy .u { direction: ltr; letter-spacing: .02em; font-family: "Sahel Latin", Sahel, sans-serif; }
.copy .ok { color: var(--ink); font-family: Sahel, sans-serif; letter-spacing: 0; }
.pn { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }

.about { margin-top: 30px; text-align: center; }
.about h1 { font-size: 1.2rem; font-weight: 600; }
.about p { color: var(--muted); }

footer.foot { margin-top: auto; padding-top: 40px; font-size: .8rem; color: var(--muted); text-align: center; }
footer.foot span { display: block; border-top: 1px solid var(--rule); padding-top: 12px; }

/* desktop: a wider column and slightly larger type; phones keep the sizes above */
@media (min-width: 1000px) {
  body { font-size: 17.5px; }
  .col { max-width: 42rem; }
}
@media (min-width: 1400px) {
  body { font-size: 18.5px; }
  .col { max-width: 46rem; }
}
