/* henrykernot.com — Swiss/Grotesk, blue accent */

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --accent: #2563eb;
  --code-bg: #f5f5f5;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 45.6rem;
}

[data-theme="light"] {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --accent: #2563eb;
  --code-bg: #f5f5f5;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #f0f0f0;
  --muted: #909090;
  --line: #262626;
  --accent: #60a5fa;
  --code-bg: #171717;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a;
    --fg: #f0f0f0;
    --muted: #909090;
    --line: #262626;
    --accent: #60a5fa;
    --code-bg: #171717;
  }
}

* { box-sizing: border-box; }

html {
  font-feature-settings: "cv11", "ss01", "ss03";
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 120ms ease, color 120ms ease;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.site-header {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 1.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.site-header .brand {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--fg);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  font-size: 0.875rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--fg); }

#theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 4px;
  width: 1.75rem;
  height: 1.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}

#theme-toggle:hover { color: var(--fg); border-color: var(--muted); }

h1, h2, h3, h4 {
  font-family: var(--font);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 1.25rem;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  margin: 0 0 1.25rem;
  object-fit: cover;
}

.avatar-lg {
  width: 120px;
  height: 120px;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3.5rem 0 1.5rem;
}

h3 {
  font-size: 1.0625rem;
  margin: 2rem 0 0.75rem;
}

p { margin: 0 0 1rem; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

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

strong { font-weight: 600; color: var(--fg); }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}

code, pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; }
pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; line-height: 1.5; position: relative; white-space: pre-wrap; overflow-wrap: break-word; }
pre code { background: transparent; padding: 0; font-size: 0.8125rem; }

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: var(--font);
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}

pre:hover .copy-btn,
.copy-btn:focus,
.copy-btn.copied { opacity: 1; }

.copy-btn:hover { color: var(--fg); border-color: var(--muted); }
.copy-btn.copied { color: var(--accent); border-color: var(--accent); }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

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

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

.post-list li {
  display: block;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.post-list li:has(.post-date) {
  display: grid;
  grid-template-columns: 6rem 1fr;
  column-gap: 1rem;
  row-gap: 0.125rem;
}

.post-list li:last-child { border-bottom: 1px solid var(--line); }

.post-list .post-date {
  grid-column: 1;
  grid-row: 1 / span 2;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.post-list .post-title {
  grid-column: 2;
  grid-row: 1;
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.005em;
}

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

.post-list .post-desc {
  grid-column: 2;
  grid-row: 2;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Card-style post list (homepage): hero image on top, text below */
.post-list-cards li,
.post-list-cards li:has(.post-date) {
  display: block;
  padding: 1.5rem 0;
}
.post-list-cards .post-hero {
  display: block;
  margin-bottom: 0.75rem;
  overflow: hidden;
  border-radius: 4px;
}
.post-list-cards .post-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.post-list-cards .post-date {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
  margin-bottom: 0.25rem;
}
.post-list-cards .post-title {
  display: block;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: -0.005em;
  text-decoration: none;
  color: var(--fg);
  margin-bottom: 0.25rem;
}
.post-list-cards .post-title:hover { color: var(--accent); }
.post-list-cards .post-desc {
  display: block;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--fg); }

@media (max-width: 540px) {
  main { padding: 2rem 1.25rem 3rem; }
  h1 { font-size: 1.5rem; }
  .post-list li {
    grid-template-columns: 1fr;
    row-gap: 0.25rem;
  }
  .post-list .post-date {
    grid-column: 1;
    grid-row: 1;
    padding-top: 0;
  }
  .post-list .post-title { grid-column: 1; grid-row: 2; }
  .post-list .post-desc { grid-column: 1; grid-row: 3; }
}

.post-header { margin-bottom: 2rem; }
.post-header h1 { margin: 0.25rem 0 0; }
.post-header .post-date { font-size: 0.8125rem; }

.post-body {
  max-width: 48rem;
  line-height: 1.6;
}
.post-body p { margin: 0 0 1em; }
.post-body h2 {
  font-size: 1.375rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 2.5em 0 0.5em;
  line-height: 1.25;
}
.post-body h3 {
  font-size: 1.125rem;
  margin: 2em 0 0.5em;
  line-height: 1.25;
}
.post-body img, main img { max-width: 100%; height: auto; display: block; margin: 1.5em auto; border-radius: 4px; }
.post-body figure { margin: 1.5em 0; }
.post-body figure figcaption { font-size: 0.8125rem; color: var(--muted); text-align: center; margin-top: 0.5em; }
.post-body p > img + em {
  display: block;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.4rem;
  font-style: italic;
}
.post-body a { color: var(--fg); }
.post-body blockquote {
  margin: 1.5em 0;
  padding-left: 1em;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.post-body pre, .post-body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.post-body pre { background: var(--line); padding: 0.75em 1em; border-radius: 4px; overflow-x: auto; }

.post-subscribe {
  margin-top: 3rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.9375rem;
}
.post-subscribe p { margin: 0; }
