/* ===========================================================
   ismaelkhan.com — pure CSS, no framework, no build pipeline.
   Aesthetic: "the Notebook" — cream paper, Source Serif 4,
   wiki-blue links, oldstyle numerals, comfortable measure.
   =========================================================== */

/* ---------- Reset (minimal) ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: #ffffff;
  color: #1a1612;
  font-family: 'Source Serif 4', 'Source Serif Pro', Charter, 'Iowan Old Style',
    'Apple Garamond', Baskerville, Georgia, 'Times New Roman', serif;
  font-size: 14px;
  line-height: 1.2;
  font-feature-settings: 'onum';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---------- Page shell ----------
 * Desktop: fixed left sidebar (220px) + fluid content column.
 * Mobile (<960px): sidebar drops below the content.
 */
.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 32px 80px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding-right: 4px;
  font-size: 14.5px;
  line-height: 1.5;
  color: #4a443c;
}

.content {
  min-width: 0;
  max-width: 720px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 40px 22px 64px;
    font-size: 16px;
  }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid #d8cfbe;
  }
  .content { max-width: none; }
}

/* ---------- Sidebar ---------- */
.sb-section {
  margin: 0 0 28px;
}

.sb-heading {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a7f70;
  font-weight: 600;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #d8cfbe;
}

.sb-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sb-list li {
  margin: 0 0 4px;
  line-height: 1.4;
}

.sb-count {
  color: #8a7f70;
  font-size: 12px;
  font-variant-numeric: oldstyle-nums tabular-nums;
}

.sb-muted {
  margin: 0;
  color: #8a7f70;
  font-style: italic;
  font-size: 13.5px;
}

.sb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.sb-tags li {
  margin: 0;
}

/* ---------- Sidebar search ---------- */
.sb-search-form {
  margin: 0;
  position: relative;
}

.sb-search-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #c7bba0;
  border-radius: 2px;
  background: #faf6ec;
  color: #1a1612;
}

.sb-search-input:focus {
  outline: none;
  border-color: #8a7f70;
  background: #fff;
}

.sb-search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px 0;
  background: #faf6ec;
  border: 1px solid #d8cfbe;
  border-radius: 2px;
  font-size: 13.5px;
  max-height: 280px;
  overflow-y: auto;
}

.sb-search-results li { margin: 0; }

.sb-search-results a {
  display: block;
  padding: 6px 10px;
  text-decoration: none;
  border-bottom: 1px solid #ece4d2;
  color: #0645ad;
}

.sb-search-results li:last-child a { border-bottom: 0; }

.sb-search-results a:hover { background: #e7dfcb; }

.sb-search-title { display: block; line-height: 1.3; }

.sb-search-date {
  display: block;
  color: #8a7f70;
  font-size: 12px;
  font-variant-numeric: oldstyle-nums tabular-nums;
  margin-top: 2px;
}

.sb-search-empty {
  padding: 8px 10px;
  color: #8a7f70;
  font-style: italic;
}

/* ---------- Site header (now lives inside sidebar) ---------- */
.site-header {
  margin: 0 0 24px;
}

.site-name {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.1px;
  margin: 0;
  line-height: 1.2;
}

.site-name a {
  color: #1a1612;
  text-decoration: none;
  background: none;
}

.site-name a:hover {
  background: none;
  text-decoration: none;
  color: #1a1612;
}

.site-tagline {
  font-size: 14px;
  color: #6b6356;
  font-style: italic;
  margin: 4px 0 0;
  font-weight: 400;
  line-height: 1.45;
}

.site-nav {
  margin: 0 0 28px;
  font-size: 13.5px;
  color: #6b6356;
}

.site-nav .sep {
  margin: 0 6px;
  color: #bcb3a1;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 64px;
  font-size: 13px;
  color: #8a7f70;
}

/* ---------- Rules ---------- */
.rule {
  border: 0;
  border-top: 1px solid #d8cfbe;
  margin: 40px 0;
}

.rule-minor {
  border: 0;
  border-top: 1px solid #e2d9c6;
  margin: 48px auto;
  width: 120px;
}

/* ---------- Links (wiki-blue, underlined) ---------- */
a {
  color: #0645ad;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:visited {
  color: #553d8b;
}

a:hover {
  background: #e7dfcb;
}

::selection {
  background: #d6c79a;
}

/* ---------- About blurb (homepage) ---------- */
.about {
  margin: 0 0 0;
}

.about p {
  margin: 0;
  text-wrap: pretty;
}

/* ---------- Featured posts on homepage ---------- */
.post {
  margin: 0;
}

.post-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.2px;
  margin: 0 0 6px;
  line-height: 1.2;
  color: #1a1612;
}

.post-title a {
  color: inherit;
  text-decoration: none;
}

.post-title a:hover {
  background: #e7dfcb;
}

.post-date {
  color: #8a7f70;
  font-size: 14px;
  display: block;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.post-permalink {
  font-size: 14px;
  color: #8a7f70;
  margin: 14px 0 0;
}

/* ---------- Post body prose ---------- */
.post-body p,
.post-body ul,
.post-body ol,
.post-body blockquote,
.post-body pre,
.post-body figure,
.post-body table {
  margin: 0 0 16px;
  text-wrap: pretty;
}

.post-body > :last-child {
  margin-bottom: 0;
}

.post-body h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.1px;
  margin: 32px 0 12px;
  line-height: 1.3;
}

.post-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 10px;
}

.post-body ul,
.post-body ol {
  padding-left: 1.4em;
}

.post-body li {
  margin: 0 0 6px;
}

.post-body blockquote {
  border-left: 3px solid #d8cfbe;
  padding-left: 16px;
  color: #4a443c;
  font-style: italic;
}

.post-body code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.92em;
  background: #e7dfcb;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.post-body pre {
  font-family: 'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.88em;
  background: #ece4d2;
  border: 1px solid #d8cfbe;
  padding: 12px 14px;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
}

.post-body pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border: 1px solid #d8cfbe;
}

.post-body hr {
  border: 0;
  border-top: 1px solid #d8cfbe;
  margin: 32px 0;
}

.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid #d8cfbe;
}

.post-body th {
  font-weight: 600;
}

/* KaTeX math integration */
.post-body .katex { font-size: 1.05em; }
.post-body .katex-display {
  margin: 16px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ---------- Older-posts log (homepage) ---------- */
.section-label {
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a7f70;
  font-weight: 600;
  margin: 0 0 22px;
}

.log {
  width: 100%;
  border-collapse: collapse;
  font-size: 17px;
}

.log td {
  padding: 7px 0;
  vertical-align: baseline;
}

.log-date {
  color: #8a7f70;
  font-size: 14px;
  font-variant-numeric: oldstyle-nums tabular-nums;
  width: 160px;
  white-space: nowrap;
}

.archive-link {
  margin: 28px 0 0;
  font-size: 15px;
}

@media (max-width: 480px) {
  .log-date {
    width: 120px;
    font-size: 13px;
  }
}

/* ---------- Archive page ---------- */
.page-title {
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
}

.page-intro {
  color: #6b6356;
  margin: 0 0 36px;
}

.archive-year {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.1px;
  margin: 32px 0 8px;
  color: #4a443c;
}

.archive-year:first-child {
  margin-top: 0;
}

/* ---------- Post pagination ---------- */
.post-pagination {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid #d8cfbe;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 15px;
  color: #6b6356;
}

.post-pagination a {
  text-decoration: none;
  border-bottom: 1px solid #c7bba0;
}

.post-pagination a:hover {
  background: #e7dfcb;
}

.post-pagination .nav-dir {
  color: #8a7f70;
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

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