/* ─── Tokens ─────────────────────────────────────────────── */

:root {
  --bg:          oklch(97%   0.008 85);
  --bg-subtle:   oklch(93.5% 0.010 85);
  --ink:         oklch(18%   0.008 85);
  --ink-muted:   oklch(52%   0.008 85);
  --ink-faint:   oklch(80%   0.006 85);
  --divider:     oklch(88%   0.007 85);

  --accent:       oklch(35% 0.10 165);
  --accent-hover: oklch(27% 0.10 165);
  --accent-ghost: oklch(84% 0.045 165);

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body:    'Source Sans 3', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  --sp-xs:  0.375rem;
  --sp-sm:  0.75rem;
  --sp-md:  1.25rem;
  --sp-lg:  2.5rem;
  --sp-xl:  4rem;
  --sp-2xl: 6.5rem;
}

/* ─── Reset ──────────────────────────────────────────────── */

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

html {
  font-size: 16px;
  height: 100%;
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Push footer to bottom on short pages */
.page-body,
.wrap:not(.site-header):not(.site-footer):not(.site-nav) {
  flex: 1 0 auto;
}

.site-footer {
  flex-shrink: 0;
}

a { color: inherit; text-decoration: none; }

/* ─── Layout ─────────────────────────────────────────────── */

.wrap {
  max-width: 1020px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.page-body.wrap {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: start;
}

.page-single {
  padding-block: clamp(var(--sp-lg), 4vw, var(--sp-xl));
}

/* ─── Site header ────────────────────────────────────────── */

.site-header {
  padding-top: clamp(2.75rem, 7vw, 5rem);
  padding-bottom: var(--sp-lg);
}

.site-name {
  display: block;
}

.site-logo {
  display: block;
  height: clamp(2.5rem, 6vw, 4.5rem);
  width: auto;
  max-width: 100%;
  border-radius: 8px;
}

.site-tagline {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* ─── Navigation ─────────────────────────────────────────── */

.site-nav-rail {
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  margin-bottom: var(--sp-lg);
}

.site-nav {
  display: flex;
  align-items: baseline;
  gap: var(--sp-md);
  padding-block: 0.625rem;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.025em;
  color: var(--ink-muted);
  transition: color 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-link:hover  { color: var(--ink); }

.nav-link.active {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

/* ─── Site intro ─────────────────────────────────────────── */

.site-intro {
  font-size: 1.0625rem;
  color: var(--ink-muted);
  line-height: 1.65;
  max-width: 52ch;
  margin-bottom: clamp(var(--sp-xl), 9vw, var(--sp-2xl));
}

/* ─── Year groups ────────────────────────────────────────── */

.year-group {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.year-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4rem, 11vw, 7.5rem);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--accent-ghost);
  margin-bottom: clamp(0.75rem, 1.5vw, 1.25rem);
  pointer-events: none;
  user-select: none;
}

/* ─── Post entries ───────────────────────────────────────── */

.post-entry {
  display: grid;
  grid-template-columns: 5.75rem 1fr;
  column-gap: var(--sp-md);
  padding-block: clamp(0.875rem, 1.75vw, 1.25rem);
  border-bottom: 1px solid var(--divider);
}

.year-posts .post-entry:first-child {
  border-top: 1px solid var(--divider);
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  padding-top: 0.2rem;
  white-space: nowrap;
}

.post-body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.post-title {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  transition: color 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.post-excerpt {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.55;
  max-width: 60ch;
}

/* ─── Post header (single post page) ────────────────────── */

.post-header {
  padding-bottom: clamp(var(--sp-lg), 4vw, var(--sp-xl));
  border-bottom: 1px solid var(--divider);
  margin-bottom: clamp(var(--sp-lg), 4vw, var(--sp-xl));
}

.post-back {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.775rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  margin-bottom: var(--sp-md);
  transition: color 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.article-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.875rem, 5.5vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: var(--sp-md);
  max-width: 22ch;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}

/* ─── Article body ───────────────────────────────────────── */

.article-body {
  max-width: 72ch;
}

.article-body p {
  font-size: 1.0625rem;
  line-height: 1.78;
  margin-bottom: 1.625rem;
}

.article-body p:last-child { margin-bottom: 0; }

.article-body h2,
.article-body h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.1;
}

.article-body h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
.article-body h3 { font-size: clamp(1.25rem, 2.5vw, 1.625rem); }

.article-body pre {
  background: var(--bg-subtle);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 2rem 0;
}

.article-body pre code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--ink);
  background: none;
  padding: 0;
  border-radius: 0;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.article-body blockquote {
  border-left: 3px solid var(--accent-ghost);
  padding-left: var(--sp-md);
  color: var(--ink-muted);
  font-style: italic;
  margin: 1.5rem 0;
}

.article-body ul,
.article-body ol {
  padding-left: var(--sp-lg);
  margin-bottom: 1.625rem;
}

.article-body li {
  font-size: 1.0625rem;
  line-height: 1.78;
  margin-bottom: 0.3rem;
}

/* ─── Sidebar ────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 2.5rem;
}

.sidebar-message {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink-muted);
}

.sidebar-message strong {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

/* ─── Footer ─────────────────────────────────────────────── */

.site-footer {
  display: flex;
  align-items: center;
  padding-block: clamp(var(--sp-lg), 5vw, var(--sp-xl));
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--ink-faint);
}

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 660px) {
  .page-body.wrap {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    border-top: 1px solid var(--divider);
    padding-top: var(--sp-lg);
    margin-top: var(--sp-sm);
  }
}

@media (max-width: 500px) {
  .post-entry {
    grid-template-columns: 1fr;
    row-gap: var(--sp-xs);
  }

  .post-date { font-size: 0.6875rem; }
}

/* ─── Reduced motion ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
