.single-post {
  --sd-post-image-width: 960px;
  --sd-post-link: #087a63;
  --sd-post-radius: 16px;
}

/* Article shell. Retain Astra's horizontal container and mobile side gutters. */
.single-post #primary {
  margin-block: clamp(28px, 4vw, 56px) clamp(56px, 7vw, 88px);
  padding-block: 0;
}
.single-post .ast-article-single {
  padding-block: 0;
}
.single-post .entry-header,
.single-post .entry-content {
  max-width: var(--sd-reading-width, 760px);
  margin-inline: auto;
}
.single-post .entry-header {
  margin-bottom: 32px;
  text-align: start;
}
.single-post .entry-title {
  margin: 0 0 15px;
  color: var(--sd-dark);
  font-family: var(--sd-font-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  overflow-wrap: break-word;
  /* Responsive title sizes remain under Astra Customizer control. */
}
.single-post .entry-meta {
  color: var(--sd-muted);
  font-family: var(--sd-font-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}
.single-post .entry-meta a {
  color: var(--sd-post-link);
  text-decoration: none;
}
.single-post .entry-meta a:hover {
  color: var(--sd-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Featured image: a dedicated wrapper avoids conflicts with Astra styles.
 * The PHP snippet renders the image at the start of the content, after the post header.
 * The image is centered and expands to 960px, with side gutters on small screens.
 */
.single-post .entry-content > .sd-post-featured {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(var(--sd-post-image-width), calc(100vw - 48px));
  max-width: none;
  margin: 0 0 36px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.single-post .entry-content > .sd-post-featured img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--sd-post-radius);
  box-shadow: none;
}

/* Body typography and paragraph spacing. */
.single-post .entry-content {
  min-width: 0;
  color: var(--sd-ink);
  font-family: var(--sd-font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.75;
  overflow-wrap: break-word;
}
.single-post .entry-content p {
  margin: 0 0 1.4em;
}
.single-post .entry-content :where(strong, b) {
  color: var(--sd-ink);
  font-weight: 600;
}
.single-post .entry-content > :first-child { margin-top: 0; }
.single-post .entry-content > :last-child { margin-bottom: 0; }

/* Headings: more space above than below. */
.single-post .entry-content :is(h2, h3, h4, h5, h6) {
  color: var(--sd-dark);
  font-family: var(--sd-font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.single-post .entry-content h2 {
  margin: 56px 0 20px;
  font-size: 32px;
  line-height: 1.25;
}
.single-post .entry-content h3 {
  margin: 40px 0 14px;
  font-size: 24px;
  line-height: 1.3;
}
.single-post .entry-content h4 {
  margin: 32px 0 12px;
  font-size: 20px;
  line-height: 1.35;
}
.single-post .entry-content h5 {
  margin: 28px 0 10px;
  font-size: 18px;
  line-height: 1.4;
}
.single-post .entry-content h6 {
  margin: 24px 0 10px;
  font-size: 16px;
  line-height: 1.4;
}
.single-post .entry-content h2 + h3 { margin-top: 28px; }
.single-post .entry-content h3 + h4 { margin-top: 24px; }

/* Links and visible focus for keyboard navigation. */
.single-post .entry-content a:not(.wp-block-button__link):not(.wp-element-button) {
  color: var(--sd-post-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.single-post .entry-content a:not(.wp-block-button__link):not(.wp-element-button):hover {
  color: var(--sd-dark);
}
.single-post :is(.entry-content, .entry-header) :is(a, button, summary):focus-visible {
  outline: 3px solid var(--sd-accent);
  outline-offset: 4px;
}

/* Lists, including nested Gutenberg lists. */
.single-post .entry-content :is(ul, ol) {
  margin: 0 0 28px;
  padding-inline-start: 1.5em;
}
.single-post .entry-content li { margin-bottom: 10px; }
.single-post .entry-content li:last-child { margin-bottom: 0; }
.single-post .entry-content ul > li::marker { color: var(--sd-green); }
.single-post .entry-content ol > li::marker {
  color: var(--sd-post-link);
  font-weight: 600;
}
.single-post .entry-content li > :is(ul, ol) { margin: 10px 0 12px; }

/* Quotes: support plain HTML and the native Gutenberg Quote block. */
.single-post .entry-content blockquote {
  margin: 36px 0;
  padding: 24px 28px;
  border: 0;
  border-inline-start: 4px solid var(--sd-green);
  border-radius: 0 12px 12px 0;
  background: var(--sd-soft);
  box-shadow: none;
  color: var(--sd-ink);
  font-size: 19px;
  font-style: normal;
  line-height: 1.7;
}
.single-post .entry-content blockquote p {
  font-size: inherit;
  line-height: inherit;
  margin-bottom: 14px;
}
.single-post .entry-content blockquote p:last-child { margin-bottom: 0; }
.single-post .entry-content blockquote cite {
  display: block;
  margin-top: 14px;
  color: var(--sd-muted);
  font-family: var(--sd-font-body);
  font-size: 14px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.5;
}

/* Content images: preserve each image's natural proportions and block width. */
.single-post .entry-content :is(.wp-block-image, .wp-block-gallery) {
  margin-block: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.single-post .entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--sd-post-radius);
  box-shadow: none;
}
.single-post .entry-content .wp-block-image img { display: block; }
.single-post .entry-content .wp-block-image figcaption {
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--sd-muted);
  font-family: var(--sd-font-body);
  font-size: 14px;
  line-height: 1.5;
  text-align: start;
}

/* Tables: the Gutenberg wrapper scrolls; plain HTML tables also scroll when needed. */
.single-post .entry-content .wp-block-table {
  max-width: 100%;
  margin: 36px 0;
  overflow-x: auto;
}
.single-post .entry-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 36px 0;
  overflow-x: auto;
  border: 0;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.6;
}
.single-post .entry-content .wp-block-table table {
  display: table;
  margin: 0;
}
.single-post .entry-content :is(th, td) {
  padding: 14px 16px;
  border: 1px solid var(--sd-line);
  text-align: start;
  vertical-align: top;
}
.single-post .entry-content th {
  background: var(--sd-soft);
  color: var(--sd-dark);
  font-family: var(--sd-font-heading);
  font-weight: 700;
}
.single-post .entry-content .wp-block-table figcaption {
  margin-top: 10px;
  color: var(--sd-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Inline code and horizontally scrolling code blocks. */
.single-post .entry-content code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--sd-soft);
  color: var(--sd-dark);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
}
.single-post .entry-content pre {
  max-width: 100%;
  margin: 36px 0;
  padding: 22px;
  overflow-x: auto;
  border: 0;
  border-radius: 12px;
  background: var(--sd-dark);
  color: var(--sd-white);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 15px;
  line-height: 1.65;
  white-space: pre;
  overflow-wrap: normal;
}
.single-post .entry-content pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  white-space: inherit;
  overflow-wrap: normal;
}
.single-post .entry-content hr {
  height: 0;
  margin: 48px auto;
  border: 0;
  border-top: 1px solid var(--sd-line);
  background: transparent;
  color: var(--sd-line);
}

/* Gutenberg buttons match global.css: a green primary button with dark text
 * and a white outline button.
 * Choose the Outline style in Gutenberg for secondary buttons.
 * Clear individual block color settings to use these default styles.
 */
.single-post .entry-content .wp-block-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-block: 32px;
}
.single-post .entry-content .wp-block-button { margin: 0; max-width: 100%; }
.single-post .entry-content .wp-block-button__link {
  display: inline-flex;
  box-sizing: border-box;
  min-height: 52px;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--sd-green);
  color: var(--sd-dark);
  box-shadow: none;
  font-family: var(--sd-font-heading);
  /* Equal sizes for both styles, including Gutenberg and Astra overrides. */
  font-size: 15px !important;
  font-weight: 700;
  line-height: 1.25 !important;
  text-align: center;
  text-decoration: none;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}
.single-post .entry-content .wp-block-button__link:hover {
  background: var(--sd-mint);
  color: var(--sd-dark);
  transform: translateY(-2px);
}
.single-post .entry-content .wp-block-button.is-style-outline > .wp-block-button__link,
.single-post .entry-content .wp-block-button__link.is-style-outline {
  border-color: #bcded7;
  background: var(--sd-white);
  color: var(--sd-dark);
}
.single-post .entry-content .wp-block-button.is-style-outline > .wp-block-button__link:hover,
.single-post .entry-content .wp-block-button__link.is-style-outline:hover {
  border-color: var(--sd-green);
  background: #effbf8;
  color: var(--sd-dark);
}

/* Mobile: retain readable body text and soften the heading sizes. */
@media (max-width: 767px) {
  .single-post #primary { margin-block: 28px 56px; }
  .single-post .entry-header { margin-bottom: 28px; }
  .single-post .entry-content { font-size: 17px; line-height: 1.7; }
  .single-post .entry-content p { margin-bottom: 1.35em; }
  .single-post .entry-content h2 { font-size: 28px; margin-block: 44px 18px; }
  .single-post .entry-content h3 { font-size: 22px; margin-block: 34px 14px; }
  .single-post .entry-content h4 { font-size: 19px; }
  .single-post .entry-content blockquote { margin-block: 30px; padding: 20px; font-size: 18px; }
  .single-post .entry-content :is(.wp-block-image, .wp-block-gallery) { margin-block: 32px; }
  .single-post .entry-content table { font-size: 14px; }
  .single-post .entry-content :is(th, td) { padding: 10px 12px; }
  .single-post .entry-content pre { padding: 18px; font-size: 14px; }
  .single-post .entry-content .wp-block-button__link { padding-inline: 20px; }
}
@media (max-width: 480px) {
  .single-post .entry-content :is(ul, ol) { padding-inline-start: 1.3em; }
  .single-post .entry-content :is(th, td) { padding: 9px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .single-post .entry-content .wp-block-button__link { transition: none; }
  .single-post .entry-content .wp-block-button__link:hover { transform: none; }
}
