@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@300;400;500;600&family=Instrument+Serif:ital@0;1&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,500;0,8..60,600;1,8..60,300;1,8..60,400&display=swap');

:root {
  --bg: #0a0a0c;
  --surface: #111114;
  --surface2: #18181c;
  --border: #252530;
  --text: #c8c8d0;
  --text-dim: #65657a;
  --accent: #7b6fde;
  --accent-glow: rgba(123, 111, 222, 0.15);
  --green: #5ae0a0;
  --green-dim: rgba(90, 224, 160, 0.1);
  --red: #e05a6f;
  --amber: #e0b45a;
  --cyan: #5ab8e0;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Serif 4', 'Georgia', serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Grain overlay ── */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Site header / nav ── */
.site-header {
  padding: 2rem 2rem 1.5rem;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-header a {
  text-decoration: none;
  color: inherit;
}

.site-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: #eeeef4;
  letter-spacing: -0.01em;
}

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

.site-nav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

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

.site-divider {
  max-width: 720px;
  margin: 0 auto;
  border: none;
  border-top: 1px solid var(--border);
}

/* ── Page container ── */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

/* ── Typography ── */
h1 {
  font-family: 'Instrument Serif', serif;
  font-size: 2.2rem;
  font-weight: 400;
  color: #eeeef4;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.4rem;
  font-weight: 400;
  color: #dddde4;
  margin: 2rem 0 0.75rem;
}

.meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  margin-bottom: 2rem;
}

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

p, .prose {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text);
  margin-bottom: 1.25rem;
  font-weight: 300;
}

strong {
  color: #dddde4;
  font-weight: 500;
}

code {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--surface2);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.82em;
  color: var(--green);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(123, 111, 222, 0.3);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.2s;
}

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

.site-header a,
.site-nav a,
.post-item a {
  text-decoration: none;
}

/* ── Post abstract ── */
.abstract {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  font-style: italic;
}

.abstract strong {
  font-style: normal;
}

/* ── Post list (index page) ── */
.post-list {
  list-style: none;
}

.post-item {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}

.post-item:first-child {
  padding-top: 0;
}

.post-item a {
  text-decoration: none;
  display: block;
}

.post-item-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.25rem;
  font-weight: 400;
  color: #eeeef4;
  margin-bottom: 0.35rem;
  transition: color 0.15s;
}

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

.post-item-date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.post-item-summary {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.6;
  font-weight: 300;
}

/* ── About page ── */
.about-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.about-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--surface2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--accent);
  flex-shrink: 0;
}

.about-name {
  font-family: 'Instrument Serif', serif;
  font-size: 1.6rem;
  color: #eeeef4;
  font-weight: 400;
}

.about-tagline {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
  font-style: italic;
}

.about-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.about-links a {
  font-size: 0.7rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.about-links a:hover {
  text-decoration: underline;
}

/* ── Footer ── */
.site-footer {
  font-family: 'IBM Plex Mono', monospace;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.65rem;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ── Sidenotes ── */
.sidenote {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text-dim);
  border-left: 2px solid var(--border);
  padding-left: 1rem;
  margin: 1rem 0 1rem 1.5rem;
}

.sidenote strong {
  color: var(--text);
  font-size: 0.75rem;
}

@media (min-width: 1200px) {
  .page {
    display: grid;
    grid-template-columns: minmax(0, 720px) 260px;
    gap: 0 2rem;
    max-width: 1020px;
  }

  .page > * {
    grid-column: 1;
  }

  .sidenote {
    grid-column: 2;
    margin: 0;
    width: auto;
    align-self: start;
  }
}

/* ── Light mode ── */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafaf8;
    --surface: #f0f0ec;
    --surface2: #e8e8e4;
    --border: #d4d4cc;
    --text: #3a3a42;
    --text-dim: #8a8a96;
    --accent: #5b4fc7;
    --accent-glow: rgba(91, 79, 199, 0.1);
    --green: #1a8a50;
    --green-dim: rgba(26, 138, 80, 0.08);
    --red: #c0394a;
    --amber: #b08a30;
    --cyan: #2a7fa0;
  }

  h1, h2, .post-item-title, .about-name, .site-title {
    color: #1a1a20;
  }

  strong {
    color: #2a2a32;
  }

  code {
    background: var(--surface2);
    color: var(--green);
  }

  a {
    text-decoration-color: rgba(91, 79, 199, 0.3);
  }

  .grain {
    opacity: 0.015;
  }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  h1 { font-size: 1.6rem; }
  .site-header { flex-direction: column; gap: 0.75rem; }
  .about-header { flex-direction: column; text-align: center; }
}
