/* Urdu Nastaliq, self-hosted. This is Apple's cut of Noto Nastaliq Urdu
   (version 20, extracted from /System/Library/Fonts/NotoNastaliq.ttc and
   subsetted to the Arabic block) so every visitor sees the same shaping we get
   on macOS — not the slightly different Google Fonts v23 cut. The unicode-range
   pins it to the Arabic block, so the browser uses it only for Urdu/Arabic
   characters and leaves all Latin text to the normal stack — which lets us list
   it first in --serif/--sans below and have Urdu render in Nastaliq anywhere
   (header, prose) with no extra markup. */
@font-face {
  font-family: "Noto Nastaliq Urdu";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/static/fonts/noto-nastaliq-urdu-arabic-v20.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+08A0-08FF, U+200C-200E, U+2010-2011, U+FB50-FDFF, U+FE70-FEFC;
}

:root {
  /* BurgundyNeon: the single, always-on night palette (direct terminal colors).
     color-scheme: dark tells the browser to render form controls, scrollbars
     and the like in dark too, regardless of the visitor's OS setting. */
  color-scheme: dark;
  --paper: #250911;   /* terminal background */
  --surface: #1c080d; /* terminal black */
  --ink: #e8dbdb;     /* terminal white */
  --muted: #9a7075;
  --faint: #5a2a30;
  --rule: #3a1c20;    /* terminal bright-black */
  --accent: #03d8ff;  /* terminal text/cursor: neon cyan */
  --accent-2: #03d8ff; /* categories/quotes on the neon cyan */
  --accent-soft: #051e28;
  --serif: "Noto Nastaliq Urdu", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Noto Nastaliq Urdu", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --measure: 38rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: 64rem; margin: 0 auto; padding: 0 1.5rem; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 2px; }

/* ---- header ---- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.header-inner {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
  flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.2; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand-line { display: flex; align-items: baseline; gap: 0.55rem; flex-wrap: wrap; }
.brand-name { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); letter-spacing: 0.01em; }
/* Nastaliq needs vertical room or its descenders clip; give it a touch more
   line-height and lead with a hairline separator from the Latin name. */
.brand-sep { color: var(--faint); }
.brand-urdu { font-family: "Noto Nastaliq Urdu", var(--serif); font-size: 0.72rem; line-height: 1.9; color: var(--accent); }
.brand-tag { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.14em; margin-top: 0.2rem; }
.site-nav { display: flex; gap: 1.25rem; font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }
.site-nav a { color: var(--muted); }
.site-nav a:hover { color: var(--accent); }
.search input {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  width: 11rem;
  max-width: 40vw;
}

/* ---- layout ---- */
main.wrap { padding-top: 2.5rem; padding-bottom: 4rem; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 3rem; align-items: start; }

/* ---- cards (hairline-separated, catalog style) ---- */
.feed { min-width: 0; }
.card { padding: 1.6rem 0; border-bottom: 1px solid var(--rule); }
.card:first-child { padding-top: 0; }
.meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin: 0 0 0.5rem;
  display: flex;
  gap: 0.9rem;
  align-items: center;
}
.meta .topic { color: var(--accent-2); }
.card-title { font-family: var(--serif); font-size: 1.55rem; line-height: 1.2; margin: 0 0 0.5rem; font-weight: 600; }
.card-title a { color: var(--ink); }
.card-title a:hover { color: var(--accent); text-decoration: none; }
.card-summary { margin: 0 0 0.9rem; color: var(--muted); max-width: var(--measure); }
.card-foot { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin: 0; }
.readmore { font-family: var(--mono); font-size: 0.78rem; }

/* ---- tags ---- */
.tags { display: inline-flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--accent-soft);
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
}
.tag:hover { color: var(--accent); text-decoration: none; }

/* ---- sidebar ---- */
.sidebar { position: sticky; top: 1.5rem; font-size: 0.95rem; }
.sidebar section { margin-bottom: 2rem; }
.side-head { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); margin: 0 0 0.7rem; font-weight: 500; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { display: flex; justify-content: space-between; align-items: baseline; padding: 0.18rem 0; border-bottom: 1px solid var(--rule); }
.side-list li:last-child { border-bottom: 0; }
.count { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.tagcloud { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; }

/* ---- page headers ---- */
.page-head { margin: 0 0 1.8rem; padding-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 2rem; margin: 0; }
.page-sub { font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); margin: 0.4rem 0 0; }
.empty { color: var(--muted); padding: 2rem 0; }

/* ---- index lists (topics/tags pages) ---- */
.index-list { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.index-list li { display: flex; justify-content: space-between; align-items: baseline; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.index-list a { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); }
.index-list a:hover { color: var(--accent); }
.tagcloud.big { gap: 0.6rem; }
.tagcloud.big .tag { font-size: 0.85rem; padding: 0.3rem 0.8rem; }
.tagcloud.big .count { margin-left: 0.35rem; }

/* ---- single post ---- */
.post { max-width: var(--measure); margin: 0 auto; }
.breadcrumb { font-family: var(--mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); margin-bottom: 1.2rem; }
.breadcrumb a { color: var(--muted); }
.post-title { font-family: var(--serif); font-weight: 600; font-size: 2.3rem; line-height: 1.15; margin: 0 0 0.6rem; }
.post-meta { margin-bottom: 2rem; }
.post-meta .topic { color: var(--accent-2); }
.prose { font-size: 1.08rem; line-height: 1.75; }
.prose h2 { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; margin: 2.2rem 0 0.6rem; }
.prose h3 { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; margin: 1.8rem 0 0.5rem; }
.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.prose li { margin: 0.3rem 0; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote { margin: 1.4rem 0; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 3px solid var(--accent-2); color: var(--muted); font-style: italic; }
.prose code { font-family: var(--mono); font-size: 0.9em; background: var(--accent-soft); padding: 0.1rem 0.35rem; border-radius: 4px; }
.prose pre { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }

/* ---- microblog (title-less) cards ---- */
.card-note .note-body { font-size: 1.02rem; line-height: 1.7; max-width: var(--measure); margin: 0 0 0.7rem; }
.card-note .note-body > :first-child { margin-top: 0; }
.card-note .note-body > :last-child { margin-bottom: 0; }
.source-link { font-family: var(--mono); font-size: 0.78rem; margin: 1.6rem 0 0; }
.post-tags { margin: 2rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.related { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

/* ---- pagination ---- */
.pager { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 0.78rem; }
.pager .pager-status { color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.pager .disabled { color: var(--rule); }

/* ---- footer ---- */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0; font-family: var(--mono); font-size: 0.74rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- responsive ---- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; gap: 2.5rem; }
  .sidebar { position: static; border-top: 1px solid var(--rule); padding-top: 1.5rem; }
  .header-inner { gap: 1rem; }
  .search input { width: 100%; max-width: none; }
  .search { width: 100%; order: 3; }
}
