/* Blog-only additions on top of the website's global styles.css (served next to
   this file as /assets/blog/styles.css). Palette, fonts, header, footer and
   buttons all come from there; this file adds the reading column, the post list
   and article typography. Code token colours come from /blog/highlight.css. */

/* Same shell contract as app-root in styles.css: a flex column at least one
   viewport tall so the footer sits at the bottom of short pages. */
.blog-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.blog-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--color-base-100);
}

/* Reading column. Mirrors .content-wrapper (max 800px, header offset). */
.blog-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: calc(var(--header-height) + 48px) 20px 80px;
  box-sizing: border-box;
}

.blog-eyebrow {
  font-family: var(--font-family-accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-info);
  margin: 0 0 0.5rem;
}

.blog-title {
  font-size: 2.25rem;
  line-height: 1.15;
  text-wrap: balance;
}

.blog-intro {
  font-size: 1.1rem;
  opacity: 0.8;
  max-width: 62ch;
  margin: 0.5rem 0 0;
}

/* ---- Index ---- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.post-card {
  background: #ffffff;
  border: 1px solid var(--color-base-300);
  padding: 1.25rem 1.5rem;
  /* The site's cut-corner signature (see .btn-cut in styles.css). */
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  transition: border-color 0.2s;
}

.post-card:hover {
  border-color: var(--color-primary);
}

.post-card h2 {
  font-size: 1.4rem;
  margin: 0.25rem 0 0.5rem;
}

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

.post-card p {
  margin: 0;
  opacity: 0.85;
}

.post-card .post-tags {
  margin-top: 0.75rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  font-family: var(--font-family-accent);
  font-size: 0.8rem;
  color: var(--color-info);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.post-tag {
  background: var(--color-base-200);
  color: var(--color-base-content);
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-field);
}

.post-empty {
  margin-top: 2.5rem;
  opacity: 0.75;
}

/* ---- Article ---- */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-base-300);
}

.post-header .post-meta {
  margin-top: 1rem;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.7;
}

.post-body > * + * {
  margin-top: 1.1em;
}

.post-body h2 {
  font-size: 1.6rem;
  margin-top: 2.4em;
  line-height: 1.25;
}

.post-body h3 {
  font-size: 1.25rem;
  margin-top: 2em;
}

.post-body h2 + *, .post-body h3 + * {
  margin-top: 0.6em;
}

.post-body a {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-color: rgba(27, 153, 139, 0.35);
  text-underline-offset: 2px;
}

.post-body a:hover {
  color: var(--color-primary-content);
  text-decoration-color: var(--color-primary);
}

.post-body ul, .post-body ol {
  padding-left: 1.4em;
}

.post-body li + li {
  margin-top: 0.35em;
}

.post-body blockquote {
  margin: 1.5em 0;
  padding: 0.25em 1.25em;
  border-left: 4px solid var(--color-primary);
  background: var(--color-base-200);
}

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  display: block;
  overflow-x: auto;
  font-size: 0.95rem;
}

.post-body th, .post-body td {
  text-align: left;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--color-base-300);
}

.post-body :not(pre) > code {
  background: var(--color-base-200);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Code blocks sit on the site's slate, like the landing hero. Pygments supplies
   the token colours (/blog/highlight.css); only the frame is styled here. */
.post-body .highlight {
  background-color: var(--color-base-content);
  border-radius: var(--radius-field);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.post-body .highlight pre {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  color: var(--color-base-100);
  font-size: 0.88rem;
  line-height: 1.55;
  background: none;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--color-base-300);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-family-header);
  font-weight: 600;
}

.post-footer a:hover {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .blog-container {
    /* The header grows on mobile (see styles.css .content-wrapper rule). */
    padding-top: 120px;
  }

  .blog-title {
    font-size: 1.75rem;
  }
}

/* ---- Figures ---- */
/* Posts wrap images in <figure> (raw HTML is allowed in posts) so a caption can
   say what the reader is looking at. Screenshots get the site's thin border. */
.post-body figure {
  margin: 2em 0;
}

.post-body figure img {
  border: 1px solid var(--color-base-300);
  border-radius: var(--radius-field);
}

.post-body figcaption {
  margin-top: 0.6em;
  font-family: var(--font-family-accent);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--color-info);
}

/* Lead block: the wordmark on the site's slate, cut corners like the code blocks. */
.post-body .post-hero {
  margin: 0 0 2em;
  padding: 3rem 2rem;
  background-color: var(--color-base-content);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  display: flex;
  justify-content: center;
}

.post-body .post-hero img {
  width: min(420px, 80%);
  border: 0;
  border-radius: 0;
}

/* Author card: portrait beside the bio, stacked on narrow screens. */
.post-body .post-author {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin: 1.5em 0;
}

.post-body .post-author img {
  flex: 0 0 200px;
  width: 200px;
  border: 0;
  border-radius: var(--radius-field);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.post-body .post-author p {
  margin: 0;
}

.post-body .post-author p + p {
  margin-top: 1em;
}

@media (max-width: 600px) {
  .post-body .post-author {
    flex-direction: column;
  }

  .post-body .post-author img {
    width: 100%;
    max-width: 320px;
  }
}
