:root {
  color-scheme: light;
  --background: #fff;
  --text: #111;
  --muted: #666a70;
  --line: #dedfe1;
  --soft: #f6f6f7;
  --page-x: clamp(1.25rem, 4.4vw, 4.5rem);
  --max-width: 1440px;
  --prose: 42rem;
  --ease: cubic-bezier(0.2, 0.75, 0.25, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text);
  font-family: "Manrope", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

.page {
  width: min(100%, var(--max-width));
  min-height: 100svh;
  margin: 0 auto;
  padding: 0 var(--page-x);
  display: flex;
  flex-direction: column;
}

.header {
  height: clamp(4.25rem, 7vw, 5.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

.nav a {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
}

main {
  flex: 1;
}

.footer {
  margin-top: clamp(3.5rem, 8vw, 7rem);
  padding: 1.5rem 0 2rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

/* Index */

.blog-hero {
  margin: clamp(3rem, 7vw, 6rem) 0 clamp(2rem, 4vw, 3.5rem);
}

.blog-hero h1 {
  max-width: 10ch;
  margin: 0 0 1rem;
  font-size: clamp(3.5rem, 8.5vw, 8rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.075em;
}

.blog-hero p {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.5;
}

.posts {
  border-top: 1px solid var(--line);
}

.post-card {
  display: grid;
  grid-template-columns: clamp(5.5rem, 9vw, 7.5rem) 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: clamp(7rem, 10vw, 9rem);
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  isolation: isolate;
  position: relative;
}

.post-card::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--page-x) * -1);
  z-index: -1;
  background: var(--soft);
  opacity: 0;
  transform: scaleY(0.78);
  transition:
    opacity 0.32s var(--ease),
    transform 0.38s var(--ease);
}

.post-card:hover::before,
.post-card:focus-visible::before {
  opacity: 1;
  transform: scaleY(1);
}

.post-card:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.post-card__meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.post-card__title {
  display: block;
  margin-bottom: 0.35rem;
  font-size: clamp(1.2rem, 2.2vw, 1.85rem);
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.post-card__excerpt {
  display: block;
  max-width: 48rem;
  color: var(--muted);
  font-size: clamp(0.88rem, 1.3vw, 1.05rem);
  line-height: 1.45;
}

.post-card__arrow {
  width: clamp(1.4rem, 2.3vw, 2.05rem);
  height: clamp(1.4rem, 2.3vw, 2.05rem);
  margin-left: 1rem;
  transition: transform 0.36s var(--ease);
}

.post-card:hover .post-card__arrow,
.post-card:focus-visible .post-card__arrow {
  transform: translate(0.3rem, -0.3rem);
}

/* Article */

.article-top {
  margin: clamp(2.5rem, 6vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
  max-width: var(--prose);
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.crumb a {
  text-decoration: none;
}

.crumb a:hover {
  color: var(--text);
}

.article-top h1 {
  margin: 0 0 1.1rem;
  font-size: clamp(2rem, 4.8vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.article-lead {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  line-height: 1.55;
}

.article-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.prose {
  max-width: var(--prose);
  padding-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.7;
}

.prose > * + * {
  margin-top: 1.15em;
}

.prose h2 {
  margin-top: 2.6em;
  margin-bottom: 0.7em;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.prose h3 {
  margin-top: 2em;
  margin-bottom: 0.55em;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.prose p,
.prose li {
  color: #222;
}

.prose strong {
  color: var(--text);
  font-weight: 700;
}

.prose ul,
.prose ol {
  padding-left: 1.2em;
}

.prose li + li {
  margin-top: 0.4em;
}

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

.prose blockquote {
  margin: 1.6em 0;
  padding: 1.15rem 1.25rem;
  border-left: 3px solid var(--text);
  background: var(--soft);
}

.prose blockquote p {
  margin: 0;
}

.prose blockquote p + p {
  margin-top: 0.7em;
}

.table-wrap {
  width: calc(100% + 0.5rem);
  margin-left: -0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.prose table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
}

.prose th,
.prose td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose thead th {
  background: var(--soft);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.prose tbody th {
  font-weight: 700;
  white-space: nowrap;
}

.questions {
  margin-top: 2.5em;
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--line);
  background: var(--soft);
}

.questions ol {
  margin: 0.9em 0 0;
}

@media (max-width: 720px) {
  .post-card {
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
  }

  .post-card__meta {
    grid-column: 1 / -1;
  }

  .post-card__arrow {
    margin-left: 0.35rem;
  }
}

@media (max-width: 640px) {
  .blog-hero h1 {
    margin-top: 0.5rem;
    font-size: clamp(3.25rem, 17vw, 5.2rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
