/* ==========================================================================
   Theme: Sans
   Instrument Sans + JetBrains Mono on cool neutrals, with a cobalt accent
   and a sticky sidebar on wide screens.
   Everything visual lives in this folder; content/ never has to change.
   ========================================================================== */

:root {
  --bg:       #fbfbfa;
  --ink:      #17171a;
  --ink-soft: #3f3f46;
  --muted:    #75757e;
  --rule:     #e6e6e3;
  --hover:    #f1f1ee;
  --accent:   #2e4fdc;
  --code-bg:  #f3f3f1;

  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar: 13rem;
  --measure: 38rem;
  --gutter:  1.5rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0e0e10;
    --ink:      #ececee;
    --ink-soft: #c2c2c8;
    --muted:    #8a8a93;
    --rule:     #232327;
    --hover:    #18181b;
    --accent:   #8fa3ff;
    --code-bg:  #16161a;
  }
}

/* --- Base ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

::selection { background: var(--accent); color: var(--bg); }

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* --- Layout: sidebar + column -------------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, var(--measure));
  justify-content: center;
  gap: 0 5rem;
  padding: 0 var(--gutter);
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  padding: 4.5rem 0 2rem;
}

.name {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.tagline { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 2.5rem;
  font-size: 0.95rem;
}

.sidebar nav a {
  position: relative;
  width: fit-content;
  padding: 0.15rem 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar nav a:hover { color: var(--ink); }
.sidebar nav a[aria-current="page"] { color: var(--ink); font-weight: 500; }

.sidebar nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -0.9rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
}

main { padding: 4.5rem 0 2rem; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin-top: 5rem;
  padding: 1.5rem 0 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font: 0.75rem/1.5 var(--mono);
}

.site-footer .links { display: flex; gap: 1.25rem; }
.site-footer a { text-decoration: none; transition: color 0.15s; }
.site-footer a:hover { color: var(--accent); }

/* --- Page headers -------------------------------------------------------- */

.page-header h1,
.post-header h1 {
  margin: 0 0 2rem;
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.5rem);
  letter-spacing: -0.035em;
}

.post-meta {
  margin: -1.1rem 0 2.75rem;
  color: var(--muted);
  font: 0.78rem/1.5 var(--mono);
}

/* --- Prose (rendered Markdown) ------------------------------------------- */

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

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table,
.prose figure { margin: 0 0 1.25em; }

.prose p { text-wrap: pretty; }

.prose h2 { margin: 2.5em 0 0.6em; font-size: 1.3rem; letter-spacing: -0.02em; }
.prose h3 { margin: 2em 0 0.5em; font-size: 1.05rem; letter-spacing: -0.01em; }

.prose a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: text-decoration-color 0.15s;
}

.prose a:hover { text-decoration-color: currentColor; }

.prose strong { font-weight: 600; }

.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin: 0.3em 0; padding-left: 0.2em; }
.prose li::marker { color: var(--muted); }
.prose ol > li::marker { font: 0.85em var(--mono); }

.prose blockquote {
  margin-left: 0;
  padding: 0.1em 0 0.1em 1.1em;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr { height: 1px; margin: 3rem 0; border: 0; background: var(--rule); }

.prose img { display: block; max-width: 100%; height: auto; border-radius: 8px; }

.prose code {
  padding: 0.15em 0.35em;
  border-radius: 5px;
  background: var(--code-bg);
  font: 0.84em var(--mono);
  font-variant-ligatures: none; /* keep -> and != as typed */
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--code-bg);
  font: 0.8rem/1.65 var(--mono);
  font-variant-ligatures: none;
}

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

.prose table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.prose th, .prose td { padding: 0.5em 0.75em 0.5em 0; border-bottom: 1px solid var(--rule); text-align: left; }
.prose th { font-weight: 600; }

/* --- Home ---------------------------------------------------------------- */

.home .prose h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.1rem, 1.5rem + 2.4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.home .prose h1 em { color: var(--accent); font-style: normal; }

.home .prose h1 + p {
  color: var(--ink-soft);
  font-size: 1.2rem;
  line-height: 1.55;
}

.label {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.recent { margin-top: 4.5rem; }
.recent .summary { display: none; }

.more {
  display: inline-block;
  margin-top: 1rem;
  color: var(--muted);
  font: 0.78rem var(--mono);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* --- Post lists ---------------------------------------------------------- */

.post-list { margin: 0 -0.75rem; padding: 0; list-style: none; }

.post-list a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.15rem 1.5rem;
  padding: 0.8rem 0.75rem;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.15s;
}

.post-list a:hover { background: var(--hover); }

.post-list .title { font-weight: 500; letter-spacing: -0.01em; }

.post-list time {
  color: var(--muted);
  font: 0.75rem var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.post-list .summary { grid-column: 1 / -1; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }

/* --- Blog ---------------------------------------------------------------- */

.blog .intro { margin-bottom: 2.5rem; color: var(--ink-soft); }

.post-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font: 0.8rem var(--mono);
}

.post-footer a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.post-footer a:hover { color: var(--accent); }

/* --- Projects -------------------------------------------------------------
   In projects.md, "## Section" headings group projects. Each project is a
   "### Name", then a one-line paragraph of metadata (dates · status), then
   the description. */

.page-projects .prose > p:first-child { color: var(--ink-soft); }

.page-projects .prose h2 {
  margin: 4.5rem 0 0;
  color: var(--muted);
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-projects .prose > p:first-child + h2 { margin-top: 3rem; }
.page-projects .prose h2 + ul { margin-top: 1.25rem; }

.page-projects .prose h3 {
  margin: 2.25rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: 1.2rem;
  letter-spacing: -0.015em;
}

.page-projects .prose h2 + h3 { margin-top: 1.25rem; }

.page-projects .prose h3 + p {
  margin: 0.2rem 0 0.75rem;
  color: var(--muted);
  font: 0.75rem/1.6 var(--mono);
  font-variant-ligatures: none;
}

/* --- Narrow screens: sidebar becomes a header ---------------------------- */

@media (max-width: 54rem) {
  .shell { grid-template-columns: minmax(0, var(--measure)); }
  .sidebar { position: static; padding-top: 2.25rem; }
  .sidebar nav { flex-direction: row; gap: 1.5rem; margin-top: 1.25rem; }

  .sidebar nav a[aria-current="page"]::before {
    top: auto;
    bottom: -0.15rem;
    left: 50%;
    transform: translateX(-50%);
  }

  main { padding-top: 3rem; }
}

@media (max-width: 34rem) {
  :root { --gutter: 1.25rem; }
  body { font-size: 1rem; }
}
