/* =================================================================
   adeebyousaf.com — site stylesheet
   Locked design system shared by Article (essay/note variants),
   Project hubs, Projects index, and Writing archive.
   Tokens identical to Homepage.html / Article — Jarvis (Build log).html.
   ================================================================= */

:root {
  --bg: #FAF8F4;
  --bg-2: #F2EEE6;
  --ink: #1A1814;
  --ink-2: #3B362E;
  --muted: #8A8073;
  --muted-2: #A89E8E;
  --rule: #E4DDD0;
  --accent: #8C2A2A;
  --serif: "EB Garamond", "Source Serif Pro", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
html.dark {
  --bg: #14130F;
  --bg-2: #1B1A15;
  --ink: #ECE6D9;
  --ink-2: #C9C2B2;
  --muted: #7A7264;
  --muted-2: #5E574B;
  --rule: #2A2620;
  --accent: #C97A6A;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--serif);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  transition: background-color .35s ease, color .35s ease;
}
::selection { background: var(--accent); color: var(--bg); }
a { color: inherit; text-decoration: none; }

.page { max-width: 1200px; margin: 0 auto; padding: 0 56px; }
@media (max-width: 720px) { .page { padding: 0 24px; } }

/* ---------- HEADER (sticky, frosted) ---------- */
header.site {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 22px 56px 20px;
  margin: 0 -56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
@media (max-width: 720px) {
  header.site { padding: 18px 24px 16px; margin: 0 -24px; }
}
.wordmark {
  font-family: var(--serif);
  font-size: 19px; font-weight: 500;
  letter-spacing: .005em;
  color: var(--ink);
}
.wordmark .dot { color: var(--accent); margin: 0 .15em; }
nav.primary {
  display: flex; gap: 36px; justify-self: center;
  font-family: var(--sans);
  font-size: 13.5px; font-weight: 450; letter-spacing: .01em;
}
nav.primary a {
  color: var(--ink-2); position: relative; padding: 4px 0;
  transition: color .2s ease;
}
nav.primary a:hover { color: var(--accent); }
nav.primary a[aria-current="page"] { color: var(--ink); }
nav.primary a[aria-current="page"]::after {
  content: ""; position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px; background: var(--accent);
}
.header-right { justify-self: end; display: flex; align-items: center; gap: 18px; }
.theme-toggle {
  appearance: none; background: transparent;
  border: 1px solid var(--rule); border-radius: 999px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-2);
  transition: border-color .2s ease, color .2s ease;
}
.theme-toggle:hover { border-color: var(--ink-2); color: var(--ink); }
.theme-toggle svg { width: 14px; height: 14px; display: block; }
html:not(.dark) .theme-toggle .moon { display: block; }
html:not(.dark) .theme-toggle .sun { display: none; }
html.dark .theme-toggle .moon { display: none; }
html.dark .theme-toggle .sun { display: block; }

/* ---------- SECTION HEADER (homepage rhythm) ---------- */
.sec-head {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: baseline;
  gap: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  margin-bottom: 40px;
}
.sec-head .label {
  font-family: var(--sans);
  font-size: 11.5px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
}
.sec-head .label .num {
  color: var(--ink-2); margin-right: 14px;
  font-variant-numeric: tabular-nums;
}
.sec-head .meta {
  font-family: var(--sans);
  font-size: 12px; color: var(--muted);
  justify-self: end;
}
@media (max-width: 720px) {
  .sec-head { grid-template-columns: 1fr; gap: 8px; }
  .sec-head .meta { justify-self: start; }
}

/* ---------- READING LIST ---------- */
.reading-list { list-style: none; margin: 0; padding: 0; }
.reading-list li { border-top: 1px solid var(--rule); }
.reading-list li:last-child { border-bottom: 1px solid var(--rule); }
.reading-list a.row {
  display: grid;
  grid-template-columns: 110px 110px 1fr 1.05fr;
  column-gap: 32px;
  align-items: baseline;
  padding: 22px 4px;
  transition: background-color .2s ease, padding .2s ease;
  position: relative;
}
.reading-list a.row:hover {
  background: var(--bg-2);
  padding-left: 16px; padding-right: 16px;
}
.reading-list a.row::before {
  content: ""; position: absolute;
  left: 0; top: 50%;
  width: 0; height: 1px;
  background: var(--accent);
  transform: translateY(-.5px);
  transition: width .25s ease;
}
.reading-list a.row:hover::before { width: 8px; }
.r-date {
  font-family: var(--sans); font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted); letter-spacing: .02em;
}
.r-tag {
  font-family: var(--sans); font-size: 11px;
  font-weight: 500; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.r-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--dot, var(--muted-2));
}
.r-tag.essay     { --dot: #6B5B43; }
.r-tag.buildlog  { --dot: var(--accent); }
.r-tag.note      { --dot: #5A6B4E; }
html.dark .r-tag.essay { --dot: #B89B73; }
html.dark .r-tag.note  { --dot: #98AC85; }
.r-title {
  font-family: var(--serif); font-size: 22px;
  font-weight: 500; line-height: 1.32;
  color: var(--ink); letter-spacing: -0.005em;
  text-wrap: balance;
}
.reading-list a.row:hover .r-title { color: var(--accent); }
.r-desc {
  font-family: var(--serif); font-style: italic;
  font-size: 16px; line-height: 1.45;
  color: var(--muted); text-wrap: pretty;
}
@media (max-width: 900px) {
  .reading-list a.row {
    grid-template-columns: 90px 1fr;
    grid-template-areas:
      "date tag"
      "title title"
      "desc desc";
    row-gap: 8px;
    padding: 20px 0;
  }
  .reading-list a.row:hover { padding-left: 0; padding-right: 0; }
  .r-date { grid-area: date; }
  .r-tag { grid-area: tag; justify-self: start; }
  .r-title { grid-area: title; font-size: 20px; }
  .r-desc { grid-area: desc; }
}

/* ---------- RETURN LINK ---------- */
.return-link {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 36px;
  font-family: var(--sans);
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  transition: color .2s ease;
}
.return-link:hover { color: var(--accent); }
.return-link .arrow { font-size: 14px; transform: translateY(-1px); }

/* ---------- ARTICLE — shared chrome (header, dek, prose, body grid) ---------- */
article.piece { padding-bottom: 80px; }
.piece-header { padding: 64px 0 56px; max-width: 880px; }
.piece-eyebrow {
  font-family: var(--sans);
  font-size: 12px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 32px;
}
.piece-eyebrow::before {
  content: ""; display: inline-block;
  width: 28px; height: 1px; background: var(--muted-2);
}
.piece-eyebrow .tag {
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 8px;
}
.piece-eyebrow .tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--dot, var(--accent));
}
.piece-eyebrow .tag.essay     { --dot: #6B5B43; }
.piece-eyebrow .tag.buildlog  { --dot: var(--accent); }
.piece-eyebrow .tag.note      { --dot: #5A6B4E; }
html.dark .piece-eyebrow .tag.essay { --dot: #B89B73; }
html.dark .piece-eyebrow .tag.note  { --dot: #98AC85; }
.piece-eyebrow .sep { color: var(--muted-2); }

.piece-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6.4vw, 72px);
  line-height: 1.1;
  letter-spacing: -0.018em;
  margin: 0 0 28px;
  color: var(--ink);
  text-wrap: balance;
}
.piece-title em { font-style: italic; }

/* note variant — smaller header */
.piece.note-variant .piece-title {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.piece-dek {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(20px, 2.1vw, 26px);
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0; max-width: 720px;
  text-wrap: pretty;
}

/* body grid: 3 col, prose centred in col 2 */
.piece-body {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    min(660px, 100%)
    minmax(0, 1fr);
  column-gap: 0;
  border-top: 1px solid var(--rule);
  padding-top: 48px;
}

/* essay/note: collapse to single centred column */
.piece-body.no-sidebar { grid-template-columns: minmax(0, 1fr) min(660px, 100%) minmax(0, 1fr); }
.piece-body.no-sidebar .piece-prose { grid-column: 2; }

.piece-prose {
  grid-column: 2;
  max-width: 660px;
  font-family: var(--serif);
  font-size: 19px; line-height: 1.62;
  color: var(--ink-2);
  text-wrap: pretty;
}
.piece-prose p { margin: 0 0 24px; }
.piece-prose p:last-child { margin-bottom: 0; }
.piece-prose > p.first::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 64px; line-height: .9;
  padding: 6px 12px 0 0;
  color: var(--ink); font-weight: 500;
}
.piece-prose a {
  color: var(--ink);
  border-bottom: 1px solid var(--muted-2);
  transition: color .2s ease, border-color .2s ease;
}
.piece-prose a:hover { color: var(--accent); border-color: var(--accent); }

.piece-prose h2 {
  font-family: var(--sans);
  font-size: 11.5px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted);
  margin: 56px 0 4px; padding-top: 28px;
  border-top: 1px solid var(--rule);
  display: flex; align-items: baseline; gap: 16px;
}
.piece-prose h2 .num {
  color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.piece-prose h2 + .h2-title {
  font-family: var(--serif);
  font-size: 30px; font-weight: 400;
  line-height: 1.25; letter-spacing: -0.008em;
  color: var(--ink);
  margin: 0 0 28px;
  text-wrap: balance;
}
.piece-prose h3 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  margin: 36px 0 14px;
  letter-spacing: -0.005em;
}

.piece-prose ul, .piece-prose ol { margin: 0 0 24px; padding-left: 24px; }
.piece-prose li { margin-bottom: 8px; }
.piece-prose li::marker { color: var(--muted-2); }

.piece-prose code {
  font-family: var(--mono);
  font-size: .82em;
  background: var(--bg-2);
  padding: 2px 6px; border-radius: 3px;
  color: var(--ink); letter-spacing: 0;
}
.piece-prose pre {
  font-family: var(--mono);
  font-size: 13px; line-height: 1.6;
  background: var(--bg-2); color: var(--ink-2);
  padding: 22px 24px; margin: 8px 0 32px;
  overflow-x: auto;
  border-left: 2px solid var(--rule);
  border-radius: 0;
}
.piece-prose pre code { background: transparent; padding: 0; font-size: inherit; }

.piece-prose blockquote {
  margin: 32px 0;
  padding: 4px 0 4px 28px;
  border-left: 2px solid var(--accent);
  font-style: italic;
  font-size: 22px; line-height: 1.5;
  color: var(--ink); text-wrap: balance;
}
.piece-prose blockquote p { margin: 0 0 12px; }
.piece-prose blockquote cite {
  display: block; font-style: normal;
  font-family: var(--sans);
  font-size: 11.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  margin-top: 12px;
}

.piece-prose figure { margin: 36px 0; }
.piece-prose figure .frame {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  padding: 32px;
  font-family: var(--mono);
  font-size: 12.5px; line-height: 1.7;
  color: var(--ink-2);
  white-space: pre; overflow-x: auto;
}
.piece-prose figcaption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px; line-height: 1.5;
  color: var(--muted);
  margin-top: 12px;
  text-wrap: pretty;
}
.piece-prose figcaption .num {
  font-family: var(--sans); font-style: normal;
  font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted-2);
  margin-right: 10px;
}

.piece-prose figure.image .ph {
  background:
    repeating-linear-gradient(45deg,
      transparent, transparent 9px,
      var(--rule) 9px, var(--rule) 10px),
    var(--bg-2);
  border: 1px solid var(--rule);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11.5px; letter-spacing: .04em;
}
.piece-prose figure.image .ph::before {
  content: attr(data-label);
  position: absolute; top: 12px; left: 14px;
  font-family: var(--sans);
  font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted-2);
  background: var(--bg);
  padding: 3px 8px; border: 1px solid var(--rule);
}
.piece-prose figure.image.inline .ph { aspect-ratio: 16 / 9; }
.piece-prose figure.image.pair .pair-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 14px;
}
.piece-prose figure.image.pair .pair-item .ph { aspect-ratio: 4 / 3; }
.piece-prose figure.image.pair .pair-item .sub {
  display: block;
  font-family: var(--sans);
  font-size: 10.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted-2);
  margin-top: 8px;
}
.piece-prose figure.image.breakout {
  margin-left: -120px; margin-right: -120px;
  margin-top: 44px; margin-bottom: 44px;
}
.piece-prose figure.image.breakout .ph { aspect-ratio: 21 / 9; }

/* When real <img> sits inside .ph, drop the placeholder pattern + label. */
.piece-prose figure.image .ph:has(img) {
  background: var(--bg-2);
  padding: 0;
}
.piece-prose figure.image .ph:has(img)::before { display: none; }
.piece-prose figure.image .ph img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
}

.piece-prose hr {
  border: 0; margin: 48px auto;
  text-align: center; width: 100%;
}
.piece-prose hr::after {
  content: "§";
  font-family: var(--serif);
  font-size: 18px; color: var(--muted-2);
  letter-spacing: .4em;
}

.piece-end {
  margin-top: 64px; padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 12px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 14px;
}
.piece-end::before {
  content: ""; width: 28px; height: 1px;
  background: var(--muted-2);
}

/* sidebar (build log only) */
.piece-meta {
  grid-column: 1;
  justify-self: end;
  width: 200px;
  margin-right: 48px;
  align-self: start;
  font-family: var(--sans);
}
.piece-meta dl {
  margin: 0; display: grid; grid-template-columns: 1fr; gap: 18px;
}
.piece-meta dt {
  font-size: 10.5px; font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}
.piece-meta dd {
  margin: 0;
  font-size: 13px; line-height: 1.5;
  color: var(--ink-2); letter-spacing: .005em;
}
.piece-meta dd a {
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color .2s ease, border-color .2s ease;
}
.piece-meta dd a:hover { color: var(--accent); border-color: var(--accent); }
.piece-meta dd .ext {
  width: 8px; height: 8px;
  margin-left: 4px; opacity: .55;
  display: inline-block; vertical-align: 1px;
}
.piece-meta .status { display: inline-flex; align-items: center; gap: 8px; }
.piece-meta .status::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: #6B8C5A;
  box-shadow: 0 0 0 3px color-mix(in srgb, #6B8C5A 18%, transparent);
}
html.dark .piece-meta .status::before {
  background: #98AC85;
  box-shadow: 0 0 0 3px color-mix(in srgb, #98AC85 18%, transparent);
}
.piece-meta .part-of {
  margin-top: 22px;
  font-size: 12px;
  color: var(--ink-2);
  display: inline-flex; gap: 6px; align-items: center;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.piece-meta .part-of:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 900px) {
  .piece-body { grid-template-columns: 1fr; column-gap: 0; row-gap: 40px; }
  .piece-prose { grid-column: auto; }
  .piece-meta {
    grid-column: auto; justify-self: stretch;
    width: auto; margin-right: 0;
    padding-bottom: 8px; border-bottom: 1px solid var(--rule);
    order: -1;
  }
  .piece-meta dl { grid-template-columns: 1fr 1fr; gap: 20px 32px; }
  .piece-prose figure.image.breakout { margin-left: 0; margin-right: 0; }
  .piece-prose figure.image.pair .pair-grid { grid-template-columns: 1fr; gap: 18px; }
}
@media (max-width: 560px) {
  .piece-meta dl { grid-template-columns: 1fr; }
  .piece-prose { font-size: 18px; }
  .piece-prose pre { font-size: 12px; padding: 16px 18px; }
  .piece-prose blockquote { font-size: 19px; padding-left: 20px; }
}

/* ---------- CONTINUE READING ---------- */
section.continue { padding: 80px 0 60px; }

/* ---------- FILTER CHIPS (writing archive) ---------- */
.filter-row {
  display: flex; flex-wrap: wrap;
  gap: 28px;
  font-family: var(--sans);
  font-size: 12.5px; letter-spacing: .14em;
  text-transform: uppercase;
  margin: 0 0 36px;
  padding-bottom: 4px;
}
.filter-row button {
  appearance: none; background: transparent; border: 0;
  padding: 4px 0;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: var(--muted);
  cursor: pointer;
  position: relative;
  transition: color .2s ease;
}
.filter-row button:hover { color: var(--ink-2); }
.filter-row button[aria-pressed="true"] { color: var(--ink); }
.filter-row button[aria-pressed="true"]::after {
  content: ""; position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px; background: var(--accent);
}
.filter-count {
  margin-left: auto;
  text-transform: none;
  letter-spacing: .02em;
  font-size: 12px;
  color: var(--muted);
  align-self: center;
}

/* ---------- PROJECTS INDEX rows ---------- */
.project-list { list-style: none; margin: 0; padding: 0; }
.project-list li { border-top: 1px solid var(--rule); }
.project-list li:last-child { border-bottom: 1px solid var(--rule); }
.project-list a.row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  column-gap: 32px;
  align-items: baseline;
  padding: 22px 4px;
  position: relative;
  transition: background-color .2s ease, padding .2s ease;
}
.project-list a.row:hover {
  background: var(--bg-2);
  padding-left: 16px; padding-right: 16px;
}
.project-list a.row::before {
  content: ""; position: absolute;
  left: 0; top: 50%;
  width: 0; height: 1px;
  background: var(--accent);
  transform: translateY(-.5px);
  transition: width .25s ease;
}
.project-list a.row:hover::before { width: 8px; }
.p-name {
  font-family: var(--serif); font-size: 22px;
  font-weight: 500; line-height: 1.3;
  color: var(--ink); letter-spacing: -0.005em;
}
.project-list a.row:hover .p-name { color: var(--accent); }
.p-desc {
  font-family: var(--serif); font-style: italic;
  font-size: 16px; line-height: 1.45;
  color: var(--muted);
}
.p-status {
  font-family: var(--sans); font-size: 12px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.p-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--dot, var(--muted-2));
}
.p-status.active   { --dot: #6B8C5A; }
.p-status.dormant  { --dot: #B68A3A; }
.p-status.archived { --dot: var(--muted-2); }
html.dark .p-status.active   { --dot: #98AC85; }
html.dark .p-status.dormant  { --dot: #D4A85A; }

@media (max-width: 720px) {
  .project-list a.row {
    grid-template-columns: 1fr;
    grid-template-areas:
      "name"
      "desc"
      "status";
    row-gap: 6px;
    padding: 20px 0;
  }
  .project-list a.row:hover { padding-left: 0; padding-right: 0; }
  .p-name { grid-area: name; }
  .p-desc { grid-area: desc; }
  .p-status { grid-area: status; }
}

/* ---------- PROJECT HUB framing ---------- */
.hub-frame {
  font-family: var(--serif);
  font-size: 19px; line-height: 1.62;
  color: var(--ink-2);
  max-width: 660px;
  margin: 0 0 48px;
  text-wrap: pretty;
}
.hub-frame a {
  color: var(--ink);
  border-bottom: 1px solid var(--muted-2);
  transition: color .2s ease, border-color .2s ease;
}
.hub-frame a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- FOOTER ---------- */
footer.site {
  padding: 60px 0 56px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 12.5px; color: var(--muted);
  display: flex; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  letter-spacing: .02em;
}
footer.site .right {
  color: var(--muted-2);
  font-style: italic;
  font-family: var(--serif);
  font-size: 14px;
}
.top-link { color: var(--muted); transition: color .2s ease; }
.top-link:hover { color: var(--accent); }

/* ---------- ENTRANCE ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.return-link, .piece-eyebrow, .piece-title, .piece-dek {
  animation: rise .9s ease both;
}
.return-link  { animation-delay: 0s; }
.piece-eyebrow { animation-delay: .08s; }
.piece-title  { animation-delay: .18s; }
.piece-dek    { animation-delay: .32s; }
