/* ---------------------------------------------------------------------------
   sarmadgulzar.com — warm, quiet, typographic.
   Newsreader for prose, IBM Plex Mono for the small stuff. No JavaScript.
--------------------------------------------------------------------------- */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/plexmono-400.woff2") format("woff2");
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/plexmono-500.woff2") format("woff2");
}

/* ------------------------------------------------------------------ tokens */

:root {
  --bg: #fbfaf7;
  --ink: #211d18;
  --muted: #766f63;
  --faint: #e3ded3;
  --accent: #b0522b;
  --accent-soft: #b0522b59;
  --code-inline-bg: #f0ede4;
  --code-bg: #f4f1e7;
  --selection: #b0522b2e;

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171411;
    --ink: #e9e4da;
    --muted: #989082;
    --faint: #35302a;
    --accent: #e08b5e;
    --accent-soft: #e08b5e59;
    --code-inline-bg: #241f1a;
    --code-bg: #201c17;
    --selection: #e08b5e38;
  }
}

/* ------------------------------------------------------------------- base */

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  color-scheme: light dark;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  font-optical-sizing: auto;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  max-width: 42rem;
  margin-inline: auto;
  padding: 0 1.375rem;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

main {
  flex: 1;
}

::selection {
  background: var(--selection);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

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

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

/* the small stuff: dates, labels, nav */
.meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----------------------------------------------------------------- header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  row-gap: 0.875rem;
  padding: 2.75rem 0 4.5rem;
}

.site-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.125rem;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------------- home */

.intro {
  margin-bottom: 5rem;
}

.intro p {
  font-size: 1.5rem;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: -0.005em;
  margin-bottom: 1.25rem;
}

.intro p + p {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--muted);
}

.intro em {
  font-style: normal;
  color: var(--accent);
}

.intro-links {
  display: flex;
  gap: 1.5rem;
  margin-top: 2.25rem;
}

.intro-links a {
  text-decoration: none;
  color: var(--muted);
}

.intro-links a:hover {
  color: var(--accent);
}

.recent {
  margin-bottom: 4rem;
}

.section-label {
  margin-bottom: 1.25rem;
}

.all-posts {
  margin-top: 1.5rem;
}

.all-posts a {
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--muted);
}

.all-posts a:hover {
  color: var(--accent);
}

/* -------------------------------------------------------------- post list */

.page-title {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 2.75rem;
}

.year-group {
  margin-bottom: 2.75rem;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
  padding: 0.4rem 0;
}

.post-list a {
  text-decoration: none;
  font-size: 1.125rem;
}

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

.post-list .leader {
  flex: 1;
  min-width: 2rem;
  border-bottom: 1px dotted var(--faint);
  transform: translateY(-0.2em);
}

.post-list time {
  white-space: nowrap;
}

/* ------------------------------------------------------------------ posts */

.post-header {
  margin-bottom: 3rem;
}

.post-title {
  font-size: 2.125rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.post-meta .sep {
  margin: 0 0.375rem;
}

.post-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
}

.post-footer a {
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--muted);
}

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

/* ------------------------------------------------------------------ prose */

.prose p,
.section-intro p {
  margin-bottom: 1.375rem;
}

.prose h2 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 3rem 0 1rem;
}

.prose h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 2.5rem 0 0.875rem;
}

.prose ul,
.prose ol {
  padding-left: 1.375rem;
  margin-bottom: 1.375rem;
}

.prose li {
  margin-bottom: 0.375rem;
}

.prose li::marker {
  color: var(--muted);
}

.prose blockquote {
  border-left: 2px solid var(--accent-soft);
  padding-left: 1.375rem;
  margin: 2rem 0;
  color: var(--muted);
}

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

.prose hr {
  border: 0;
  text-align: center;
  margin: 3rem 0;
}

.prose hr::before {
  content: "\2042"; /* asterism ⁂ */
  color: var(--muted);
  font-size: 1.125rem;
  letter-spacing: 0.25em;
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 2rem 0;
}

.prose strong {
  font-weight: 600;
}

/* ------------------------------------------------------------------- code */

code {
  font-family: var(--mono);
  font-size: 0.8125em;
}

p code,
li code,
h2 code,
h3 code {
  background: var(--code-inline-bg);
  padding: 0.125em 0.375em;
  border-radius: 4px;
}

pre {
  /* giallo sets gruvbox backgrounds inline; ours blends better with the page */
  background: var(--code-bg) !important;
  padding: 1.125rem 1.375rem;
  border-radius: 8px;
  border: 1px solid var(--faint);
  overflow-x: auto;
  margin: 2rem 0;
  line-height: 1.4;
}

pre code {
  font-size: 0.8125rem;
  background: none;
  padding: 0;
}

/* --------------------------------------------------------------- projects */

.project-list {
  list-style: none;
  padding: 0;
}

.project-list li {
  margin-bottom: 2rem;
}

.project-head {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
}

.project-head a {
  font-family: var(--mono);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.project-head a:hover {
  color: var(--accent);
}

.project-head .leader {
  flex: 1;
  min-width: 2rem;
  border-bottom: 1px dotted var(--faint);
  transform: translateY(-0.2em);
}

.project-head .meta {
  white-space: nowrap;
}

.project-desc {
  color: var(--muted);
  font-size: 1rem;
  margin-top: 0.375rem;
  max-width: 36rem;
}

/* ----------------------------------------------------------------- series */

.series-crumb {
  margin-bottom: 0.875rem;
}

.series-crumb a {
  color: var(--accent);
  text-decoration: none;
}

.series-crumb a:hover {
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 0.2em;
}

.series-about {
  margin-bottom: 2.5rem;
}

.parts-list {
  list-style: none;
  padding: 0;
  counter-reset: part;
}

.parts-list li {
  display: flex;
  align-items: baseline;
  gap: 0.875rem;
  padding: 0.4rem 0;
}

.parts-list .part-num {
  color: var(--accent);
}

.parts-list a {
  text-decoration: none;
  font-size: 1.125rem;
}

.parts-list a:hover {
  color: var(--accent);
}

.parts-list .leader {
  flex: 1;
  min-width: 2rem;
  border-bottom: 1px dotted var(--faint);
  transform: translateY(-0.2em);
}

.parts-list time {
  white-space: nowrap;
}

.part-nav {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--faint);
}

.part-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  text-decoration: none;
  max-width: 46%;
}

.part-nav .part-next {
  margin-left: auto;
  text-align: right;
}

.part-nav .part-nav-title {
  font-size: 1rem;
  line-height: 1.4;
}

.part-nav a:hover .part-nav-title {
  color: var(--accent);
}

/* -------------------------------------------------- companion video link */

.watch {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: -1rem 0 3rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--faint);
  border-bottom: 1px solid var(--faint);
}

.watch a {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

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

.watch .leader {
  flex: 1;
  min-width: 2rem;
  border-bottom: 1px dotted var(--faint);
  transform: translateY(-0.2em);
}

.watch .meta {
  white-space: nowrap;
}

/* ----------------------------------------------------------------- tables */

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
}

.prose th {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 1px solid var(--faint);
}

.prose td {
  padding: 0.5rem 1rem 0.5rem 0;
  border-bottom: 1px solid var(--faint);
}

/* ----------------------------------------------------------------- footer */

.site-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--faint);
  margin-top: 6rem;
  padding: 1.5rem 0 2.5rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

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

/* -------------------------------------------------------------------- 404 */

.fourohfour p {
  margin-bottom: 1.375rem;
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 34rem) {
  body {
    font-size: 1.0625rem;
  }

  .site-header {
    padding: 2rem 0 3.25rem;
  }

  .intro p {
    font-size: 1.3125rem;
  }

  .post-title,
  .page-title {
    font-size: 1.75rem;
  }

  .post-list li {
    gap: 0.625rem;
  }
}
