/* joeosterfeld.com: one stylesheet, light + dark via prefers-color-scheme. */

:root {
  --bg: #ffffff;
  --fg: #111318;
  --muted: #5b616e;
  --subtle: #f6f7f9;
  --line: #e6e8eb;
  --accent: #4f46e5;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0f;
    --fg: #ededf0;
    --muted: #9ba1ad;
    --subtle: #15161b;
    --line: #26282f;
    --accent: #a5b4fc;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1;
}

.wrap {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

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

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

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--fg);
  color: var(--bg);
  border-radius: 8px;
  z-index: 1;
}

.skip:focus {
  top: 1rem;
}

.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  transition: transform 0.15s ease;
}

.meta {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* Header + footer */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.brand {
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

.site-header nav a,
.site-footer a {
  color: var(--muted);
  font-size: 0.9375rem;
  transition: color 0.15s ease;
}

.site-header nav a:hover,
.site-header nav a[aria-current],
.site-footer a:hover {
  color: var(--fg);
}

.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  padding-block: 2rem;
}

.site-footer nav a {
  font-size: 0.875rem;
}

/* Home */

.home {
  padding-top: clamp(4rem, 12vh, 8rem);
}

.hero {
  margin-bottom: 3rem;
}

.avatar {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line), 0 8px 24px -12px rgb(0 0 0 / 0.25);
  margin-bottom: 2rem;
}

.hero h1,
.page-head h1,
.post-head h1 {
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.tagline,
.lede {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 1.1875rem;
  text-wrap: pretty;
}

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.link-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.25rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.0625rem;
  font-weight: 500;
  transition: color 0.15s ease, padding 0.15s ease;
}

.link-list .icon {
  color: var(--muted);
}

.link-list a:hover {
  color: var(--accent);
  padding-inline: 0.5rem 0;
}

.link-list a:hover .icon {
  color: var(--accent);
  transform: translateX(2px);
}

/* Page headings */

.page-head,
.post-head {
  padding-top: clamp(3rem, 8vh, 5rem);
  margin-bottom: 3rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.eyebrow:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-head .meta {
  margin: 1rem 0 0;
}

/* Blog landing cards */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--subtle);
}

.card h2 {
  margin: 0 0 0.375rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.more,
.button {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 500;
}

.card:hover .icon,
.button:hover .icon {
  transform: translateX(2px);
}

/* Post lists */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

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

.post-list h2 {
  margin: 0.25rem 0 0.375rem;
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.post-list p {
  margin: 0;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

/* Long-form content */

.prose {
  font-size: 1.0625rem;
  line-height: 1.75;
}

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

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.25rem;
}

.prose li + li {
  margin-top: 0.375rem;
}

.prose h1,
.prose h2,
.prose h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.prose h2 {
  margin: 3rem 0 1rem;
  font-size: 1.5rem;
}

.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.1875rem;
}

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

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

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prose code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.125rem 0.375rem;
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

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

/* Resume: the markdown starts with its own h1 and contact line. */

.resume {
  padding-top: clamp(3rem, 8vh, 5rem);
}

.resume h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.resume h1 + p {
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

.resume h2 {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.resume h3 + p {
  margin-top: -0.25rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Prev / next */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pager a[rel='next'] {
  grid-column: 2;
  text-align: right;
}

.pager a:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--subtle);
}

@media (max-width: 600px) {
  .wrap {
    padding-inline: 1.25rem;
  }

  .site-header nav {
    gap: 1.25rem;
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager a[rel='next'] {
    grid-column: 1;
    text-align: left;
  }

  .site-footer .wrap {
    flex-direction: column;
  }
}

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