/* blog — extends styles.css */

/* body is a flex column; without this, wide tables set main's min-content
   width and the whole page overflows the viewport on mobile */
main {
  min-width: 0;
}

.nav {
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  justify-content: space-between;
}

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

.nav-blog-link {
  font: 500 13px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sub);
}

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

/* ---------- index ---------- */

.blog-head {
  padding: 64px 0 40px;
  max-width: 720px;
}

.blog-head h1 {
  font-size: clamp(32px, 4vw, 44px);
  margin-bottom: 14px;
}

.blog-head .lede {
  margin-bottom: 0;
}

.post-list {
  display: grid;
  gap: 0;
  padding-bottom: 88px;
  max-width: 780px;
}

.post-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--line);
  padding: 26px 0 28px;
}

.card-body {
  flex: 1;
  min-width: 0;
  display: block;
}

.card-thumb {
  flex: none;
  width: 156px;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 18, 0.06);
}

@media (max-width: 600px) {
  .card-thumb {
    width: 96px;
    aspect-ratio: 1;
  }
}

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

.post-card .post-meta {
  margin-bottom: 8px;
}

.post-card h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 8px;
  transition: color 0.15s ease;
}

.post-card p {
  color: var(--sub);
  font-size: 15px;
  max-width: 60ch;
}

/* ---------- article ---------- */

.post {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 0 32px;
}

.post-meta {
  font: 500 12px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sub);
}

.post-meta .sep {
  margin: 0 8px;
  opacity: 0.5;
}

.post h1 {
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.12;
  margin: 12px 0 18px;
}

.post .lede {
  font-size: 18px;
  max-width: none;
  margin-bottom: 0;
}

.byline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--sub);
}

.byline .avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  position: relative;
}

.byline .avatar::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 3.5px solid #fff;
  border-radius: 50%;
}

.byline strong {
  color: var(--ink);
  font-weight: 600;
}

.post-hero {
  max-width: 820px;
  margin: 44px auto 0;
}

.post-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 20px 44px -28px rgba(16, 40, 26, 0.35);
}

.post-hero + .post-body {
  padding-top: 44px;
}

.post-body {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 40px;
}

.post-body > * + * {
  margin-top: 18px;
}

.post-body h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 44px;
}

.post-body h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-top: 32px;
}

.post-body p,
.post-body li {
  font-size: 16.5px;
  line-height: 1.65;
  color: #2c362f;
}

.post-body a {
  color: var(--accent-dark);
  text-underline-offset: 3px;
}

.post-body ul,
.post-body ol {
  padding-left: 24px;
}

.post-body li + li {
  margin-top: 8px;
}

.post-body strong {
  color: var(--ink);
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}

/* let tables breathe wider than the prose column on large screens */
@media (min-width: 1000px) {
  .post-body .table-wrap {
    width: calc(100% + 140px);
    margin-left: -70px;
  }
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 15px;
  line-height: 1.55;
}

@media (min-width: 701px) {
  .post-body table {
    min-width: 640px;
  }
}

.post-body th {
  font: 600 12px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sub);
  text-align: left;
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}

.post-body td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.post-body tbody tr:nth-child(even) td {
  background: rgba(14, 122, 65, 0.03);
}

.post-body tr:last-child td {
  border-bottom: none;
}

.post-body td:first-child {
  font-weight: 600;
  min-width: 150px;
}

.post-body td:last-child {
  min-width: 220px;
}

/* stack table rows into labeled cards on small screens */
@media (max-width: 700px) {
  .post-body table,
  .post-body tbody,
  .post-body tr,
  .post-body td {
    display: block;
  }

  .post-body thead {
    display: none;
  }

  .post-body tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }

  .post-body tr:last-child {
    border-bottom: none;
  }

  .post-body td,
  .post-body td:first-child,
  .post-body td:last-child {
    padding: 0;
    border-bottom: none;
    min-width: 0;
  }

  .post-body td + td {
    margin-top: 10px;
  }

  .post-body tbody tr:nth-child(even) td {
    background: none;
  }

  .post-body tbody tr:nth-child(even) {
    background: rgba(14, 122, 65, 0.03);
  }

  .post-body td::before {
    content: attr(data-label);
    display: block;
    font: 600 11px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sub);
    margin-bottom: 3px;
  }

  .post-body td:first-child::before {
    content: none;
  }

  .post-body td:first-child {
    font-size: 16px;
    letter-spacing: -0.01em;
  }
}

.callout {
  background: var(--accent-soft);
  border: 1.5px solid #cfe3d5;
  border-radius: 14px;
  padding: 18px 20px;
}

.callout p {
  font-size: 15.5px;
}

.post-cta {
  margin-top: 52px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 12px 32px -18px rgba(16, 40, 26, 0.12);
}

.post-cta h2 {
  font-size: 21px;
  margin: 0 0 8px;
}

.post-cta p {
  color: var(--sub);
  font-size: 15px;
  margin-bottom: 18px;
}

.post-cta .cta-btn {
  display: inline-block;
  font: 600 15px var(--sans);
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 55%), var(--accent);
  border-radius: 10px;
  padding: 12px 22px;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 1px 2px rgba(11, 99, 52, 0.3);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.post-cta .cta-btn:hover {
  background-color: var(--accent-dark);
  transform: translateY(-1px);
}

.related {
  max-width: 680px;
  margin: 0 auto;
  padding-bottom: 72px;
}

.related h2 {
  font: 500 12px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--sub);
  margin-bottom: 6px;
}

.related a {
  display: block;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 15.5px;
}

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

@media (max-width: 600px) {
  .post {
    padding-top: 36px;
  }
}
