/* razkevich.com — clean senior-engineer blog aesthetic
   Inspired by matklad / seangoedecke / jvns (structure & restraint, not assets) */

:root {
  color-scheme: light dark;
  --bg: #fafaf9;
  --fg: #1c1917;
  --muted: #78716c;
  --accent: #0f766e;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --border: #e7e5e4;
  --code-bg: #f5f5f4;
  --pre-bg: #1c1917;
  --pre-fg: #f5f5f4;
  --max: 40rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --ease: 150ms ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --fg: #f5f5f4;
    --muted: #a8a29e;
    --accent: #2dd4bf;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --border: #292524;
    --code-bg: #1c1917;
    --pre-bg: #1c1917;
    --pre-fg: #e7e5e4;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
  transition: color var(--ease), text-decoration-thickness var(--ease);
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.35rem 4.5rem;
}

/* —— Header —— */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 2.75rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border);
}

.site-brand { margin: 0; min-width: 0; }

.site-title {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.3;
}
.site-title a {
  color: inherit;
  text-decoration: none;
}
.site-title a:hover { color: var(--accent); }

.site-tag {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover { color: var(--accent); text-decoration: underline; }

/* —— Typography —— */
h1, h2, h3 {
  font-family: var(--sans);
  letter-spacing: -0.03em;
  line-height: 1.25;
  font-weight: 700;
  color: var(--fg);
}

.page-title {
  font-size: clamp(1.55rem, 4vw, 1.85rem);
  margin: 0 0 0.45rem;
  font-weight: 700;
  text-wrap: balance;
}

.meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 1.75rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

/* —— Feed (homepage) —— */
.feed {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feed li {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.15rem 1.25rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.feed li:first-child { padding-top: 0; }
.feed li:last-child { border-bottom: 0; }

.feed .date {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.3rem;
  white-space: nowrap;
}

.feed .title {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.35;
}
.feed .title a {
  color: inherit;
  text-decoration: none;
}
.feed .title a:hover { color: var(--accent); }

.feed .excerpt {
  grid-column: 2;
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 560px) {
  .feed li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
  .feed .date { padding-top: 0; }
  .feed .excerpt { grid-column: 1; }
}

/* —— Post chrome —— */
.back {
  font-size: 0.82rem;
  margin: 0 0 1.5rem;
}
.back a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.back a:hover { color: var(--accent); text-decoration: underline; }

/* —— Prose —— */
.prose {
  max-width: 65ch;
  font-size: 1.02rem;
  line-height: 1.75;
}

.prose > *:first-child { margin-top: 0; }

.prose p { margin: 0 0 1.15rem; }

.prose h2 {
  font-size: 1.28rem;
  margin: 2.25rem 0 0.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.prose h3 {
  font-size: 1.08rem;
  margin: 1.75rem 0 0.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.prose ul, .prose ol {
  margin: 0 0 1.15rem;
  padding-left: 1.4rem;
}
.prose li { margin: 0.3rem 0; }
.prose li > ul, .prose li > ol { margin-bottom: 0.2rem; }

.prose blockquote {
  margin: 0 0 1.15rem;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose blockquote p { margin-bottom: 0.5rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose code, code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.12em 0.38em;
  border-radius: 4px;
  word-break: break-word;
}

.prose pre {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  background: var(--pre-bg);
  color: var(--pre-fg);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 1.25rem;
  -webkit-overflow-scrolling: touch;
}
.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
  color: inherit;
  word-break: normal;
}

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

.prose .caption, .prose p.caption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: -0.65rem;
  margin-bottom: 1.15rem;
  line-height: 1.45;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}

.prose strong { font-weight: 650; }
.prose a { font-weight: 500; }

/* —— Footer —— */
.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: space-between;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--accent); }

/* —— 404 —— */
.not-found {
  text-align: left;
  padding: 1rem 0 2rem;
}
.not-found .page-title { margin-bottom: 0.75rem; }
.not-found p {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 1.02rem;
}
.not-found .home-link {
  display: inline-block;
  font-weight: 550;
  text-decoration: none;
  color: var(--accent);
  padding: 0.45rem 0.9rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 6px;
  background: var(--accent-soft);
}
.not-found .home-link:hover {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

@media (max-width: 560px) {
  .wrap { padding: 1.75rem 1.1rem 3.5rem; }
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 2rem;
  }
  html { font-size: 17px; }
}
