/* Post Page Specific Styles */

.post-article {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: visible;
}

.post-header {
  margin-bottom: var(--g-6);
  padding-bottom: var(--g-4);
  border-bottom: var(--border);
  text-align: center;
  overflow: visible;
}

.post-categories-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--g-2);
  align-items: center;
  justify-content: center;
  margin: 0 0 var(--g-4);
  overflow: visible;
  padding-top: var(--g-2);
  padding-bottom: 2px;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--g-4);
  margin-bottom: var(--g-4);
}

.post-meta--author {
  justify-content: center;
  margin-top: var(--g-3);
  margin-bottom: var(--g-4);
  gap: var(--g-2);
}

.post-categories-group .post-category,
.post-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #0b0b0c;
  color: #ffffff;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
  border: 1px solid #0b0b0c;
  text-decoration: none;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.post-categories-group .post-category:hover,
.post-categories-group .post-category:focus,
.post-meta-pill:hover,
.post-meta-pill:focus {
  text-decoration: none;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(11, 11, 12, 0.15);
}

/* Dark theme post category labels */
html.dark-theme .post-categories-group .post-category,
html.dark-theme .post-meta-pill {
  background: #ffffff !important;
  color: #0b0b0c !important;
  border: 1px solid #ffffff !important;
}

html.dark-theme .post-categories-group .post-category:hover,
html.dark-theme .post-categories-group .post-category:focus,
html.dark-theme .post-meta-pill:hover,
html.dark-theme .post-meta-pill:focus {
  /* Same hover as light: keep pill colors, only lift with shadow */
  background: #ffffff !important;
  color: #0b0b0c !important;
  border-color: #ffffff !important;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.35);
}

@media (max-width: 640px) {
  .post-meta--author {
    flex-direction: row;
    align-items: center;
    gap: var(--g-2);
  }
}

.post-author {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  /* "Written by" and the author name read as one sentence — only the &nbsp; separates them */
  gap: 0;
  line-height: 1;
}

.post-meta--author .post-author {
  margin: 0;
}

.post-meta--author .post-date {
  margin: 0;
}

.post-author strong {
  color: #0b0b0c;
  font-weight: 600;
  display: inline;
  line-height: 1.3;
  vertical-align: middle;
}

.post-author .site-name-link,
.post-author .site-name-link:visited,
.post-author .site-name-link:active {
  color: inherit;
  text-decoration: none;
  display: inline;
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.post-author .site-name-link:hover,
.post-author .site-name-link:focus-visible {
  color: inherit;
  text-decoration: none;
  background-size: 100% 2px;
}

/* "|" between "Written by {author}" and the date */
.post-meta-sep {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.post-date {
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
}

.post-title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  color: #0b0b0c;
  text-align: center;
}

.post-subscribe--card {
  margin: var(--g-8) 0;
  padding: var(--g-6);
  box-sizing: border-box;
  background: #F0F1F5;
  border: 1px solid #d4d4d4;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  transition: transform var(--duration-fast) ease, background var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.post-subscribe--card:hover {
  transform: translateY(-1px);
  background: #e8eaef;
  box-shadow: var(--shadow-soft);
}

.post-subscribe-inner {
  max-width: 460px;
  margin-inline: auto;
  text-align: center;
}

.post-subscribe--card .post-subscribe-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--g-2);
  margin: 0 0 var(--g-3);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  color: #0b0b0c;
}

.post-subscribe-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.post-subscribe-cta {
  margin: 0 0 var(--g-4);
  padding-bottom: var(--g-4);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-dim);
  border-bottom: 1px solid #d4d4d4;
}

.post-subscribe--card .maxsan-subscribe-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--g-2);
  width: 100%;
  padding-top: var(--g-1);
  box-sizing: border-box;
}

.post-subscribe--card .maxsan-subscribe-input {
  flex: 1 1 200px;
  min-width: 0;
  max-width: 300px;
  margin: 0;
  padding: 13px 16px;
  font-size: 15px;
  text-align: left;
  background: #F0F1F5;
  border: 1px solid #d4d4d4;
  border-radius: 10px;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.post-subscribe--card .maxsan-subscribe-input:focus {
  border-color: #0b0b0c;
  box-shadow: 0 0 0 3px rgba(11, 11, 12, 0.08);
  outline: none;
}

.post-subscribe--card .maxsan-subscribe-submit {
  flex: 0 0 auto;
  width: auto;
  margin-top: 0;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  background: #0b0b0c;
  color: #ffffff;
  border: 1px solid #0b0b0c;
  transition: transform var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
}

.post-subscribe--card .maxsan-subscribe-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(11, 11, 12, 0.18);
}

.post-subscribe--card .maxsan-subscribe-msg {
  flex: 1 1 100%;
  margin: var(--g-1) 0 0;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* Author + date stay on one line on small screens */
@media (max-width: 640px) {
  .post-meta--author {
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .post-meta--author .post-author,
  .post-meta--author .post-date {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }
}

.post-content {
  margin-bottom: 0;
}

.post-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text-dim); /* matches card description/meta */
}

.post-body h2 {
  margin: var(--g-8) 0 var(--g-4);
  font-size: 24px;
  font-weight: 600;
  color: #0b0b0c;
}

.post-body h3 {
  margin: var(--g-6) 0 var(--g-3);
  font-size: 20px;
  font-weight: 600;
  color: #0b0b0c;
}

.post-body p {
  margin: 0 0 var(--g-4);
}

/* No trailing margin after the last block — keeps the footer gap equal to the header gap */
.post-body > :last-child {
  margin-bottom: 0;
}

.post-body ul, .post-body ol {
  margin: 0 0 var(--g-4);
  padding-left: var(--g-6);
}

.post-body li {
  margin-bottom: var(--g-2);
}

.post-body strong {
  font-weight: 600;
  color: #0b0b0c;
}

.post-body figure,
.post-content figure,
.post-body .wp-block-image,
.post-content .wp-block-image,
.post-body p:has(> img:only-child),
.post-content p:has(> img:only-child) {
  border: 1px solid #d4d4d4;
  border-radius: 16px;
  overflow: hidden;
  margin: 0 auto var(--g-6);
  max-width: 100%;
  box-sizing: border-box;
  padding: 0;
  text-align: center;
}

/* Images in post content — keep natural size, never force crop */
.post-body img,
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  margin: 0 auto;
  display: block;
  box-sizing: border-box;
  border: none !important;
}

.post-body img.alignleft,
.post-body img.alignright,
.post-body img.aligncenter,
.post-content img.alignleft,
.post-content img.alignright,
.post-content img.aligncenter,
.post-body img[class*="align"],
.post-content img[class*="align"] {
  float: none !important;
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.post-body,
.post-content {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Tables — scroll sideways on small screens instead of getting clipped */
.post-body table,
.post-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0 0 var(--g-4);
}

.post-body th,
.post-body td,
.post-content th,
.post-content td {
  border: 1px solid #d4d4d4;
  padding: 8px 12px;
  text-align: left;
}

html.dark-theme .post-body th,
html.dark-theme .post-body td,
html.dark-theme .post-content th,
html.dark-theme .post-content td {
  border-color: rgba(255, 255, 255, 0.22);
}

/* Embeds (YouTube etc.) never overflow the content column */
.post-body iframe,
.post-content iframe,
.post-body video,
.post-content video {
  max-width: 100%;
}

/* Links inside post body — smooth underline like card titles */
.post-body a,
.post-content a {
  color: #0b0b0c;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.2s ease;
}

.post-body a:hover,
.post-body a:focus-visible,
.post-content a:hover,
.post-content a:focus-visible {
  text-decoration: none;
  background-size: 100% 2px;
}

.post-body a:has(img),
.post-content a:has(img) {
  background-image: none;
  background-size: 0;
  text-decoration: none;
}

/* Responsive adjustments for post page */
@media (max-width: 1024px) {
  .post-subscribe--card {
    padding: var(--g-6) var(--g-4);
  }
}

@media (max-width: 768px) {
  .post-title {
    font-size: 22px;
  }

  .post-subscribe--card {
    padding: var(--g-6) var(--g-4);
  }

  .post-subscribe-inner {
    max-width: 100%;
  }

  .post-subscribe--card .maxsan-subscribe-form {
    flex-direction: column;
    align-items: center;
    gap: var(--g-3);
  }

  .post-subscribe--card .maxsan-subscribe-input {
    flex: none;
    width: 100%;
    max-width: none;
    font-size: 16px;
  }

  .post-subscribe--card .maxsan-subscribe-submit {
    width: auto;
    min-width: 9rem;
    align-self: center;
  }
  
  .post-body {
    font-size: 15px;
  }
  
  .post-body h2 {
    font-size: 20px;
  }
  
  .post-body h3 {
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  .post-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--g-2);
  }
  
  .post-meta--author {
    justify-content: center;
    gap: var(--g-2);
  }
  
  .post-categories-group {
    gap: var(--g-1);
    justify-content: center;
  }
  
  .post-category {
    flex-shrink: 0;
    font-size: 9px;
    padding: 5px 9px;
  }
  
  .post-author,
  .post-meta-sep,
  .post-date {
    font-size: 12px;
    white-space: nowrap;
  }
  
  /* Smaller border radius for mobile */
  .post-body figure,
  .post-content figure,
  .post-body .wp-block-image,
  .post-content .wp-block-image,
  .post-body p:has(> img:only-child),
  .post-content p:has(> img:only-child) {
    border-radius: 8px;
    margin-bottom: var(--g-4);
  }

  .post-body img,
  .post-content img {
    margin-bottom: 0;
  }

  .post-subscribe--card {
    margin: var(--g-6) 0;
    padding: var(--g-4);
  }

  .post-subscribe--card .post-subscribe-title {
    font-size: 16px;
  }

  .post-subscribe--card .maxsan-subscribe-input {
    font-size: 16px;
  }

  .post-subscribe--card .maxsan-subscribe-submit {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .post-title {
    font-size: 20px;
  }
}

/* Dark Theme for Post Page — titles white, body text dim (matches homepage cards) */
html.dark-theme .post-article {
  color: #cccccc;
}

html.dark-theme .post-title,
html.dark-theme .post-subscribe--card .post-subscribe-title,
html.dark-theme .post-body h1,
html.dark-theme .post-body h2,
html.dark-theme .post-body h3,
html.dark-theme .post-body h4,
html.dark-theme .post-body h5,
html.dark-theme .post-body h6,
html.dark-theme .post-content h1,
html.dark-theme .post-content h2,
html.dark-theme .post-content h3,
html.dark-theme .post-content h4,
html.dark-theme .post-content h5,
html.dark-theme .post-content h6 {
  color: #ffffff !important;
}

html.dark-theme .post-body p,
html.dark-theme .post-body li,
html.dark-theme .post-body ul,
html.dark-theme .post-body ol,
html.dark-theme .post-body div,
html.dark-theme .post-body span,
html.dark-theme .post-content p,
html.dark-theme .post-content li,
html.dark-theme .post-content ul,
html.dark-theme .post-content ol,
html.dark-theme .post-content td,
html.dark-theme .post-content th,
html.dark-theme .post-content figcaption,
html.dark-theme .post-content blockquote,
html.dark-theme .post-author,
html.dark-theme .post-meta-sep,
html.dark-theme .post-date {
  color: #cccccc !important;
}

html.dark-theme .post-author strong,
html.dark-theme .post-body strong,
html.dark-theme .post-body b,
html.dark-theme .post-content strong,
html.dark-theme .post-content b {
  color: #ffffff !important;
}

html.dark-theme .post-author .site-name-link,
html.dark-theme .post-author .site-name-link:visited,
html.dark-theme .post-author .site-name-link:active {
  color: #ffffff !important;
  text-decoration: none;
}

html.dark-theme .post-author .site-name-link:hover,
html.dark-theme .post-author .site-name-link:focus-visible {
  color: #ffffff !important;
  text-decoration: none;
  background-size: 100% 2px;
}

/* Article links match static-page dark-mode link color (style.css) */
html.dark-theme .post-body a,
html.dark-theme .post-content a {
  color: #7fbfff;
  text-decoration: none;
  background-size: 0% 2px;
}

html.dark-theme .post-body a:hover,
html.dark-theme .post-body a:focus-visible,
html.dark-theme .post-content a:hover,
html.dark-theme .post-content a:focus-visible {
  color: #5aa8e6;
  text-decoration: none;
  background-size: 100% 2px;
}

html.dark-theme .post-header {
  border-color: rgba(255, 255, 255, 0.22);
}

html.dark-theme .post-subscribe--card {
  background: #213243;
  border-color: rgba(255, 255, 255, 0.22);
}

html.dark-theme .post-subscribe--card:hover {
  transform: translateY(-1px);
  background: #2a3d52;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

html.dark-theme .post-subscribe-cta {
  color: #9ca3af;
  border-bottom-color: rgba(255, 255, 255, 0.22);
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-input {
  background: #213243;
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-input::placeholder {
  color: #9ca3af;
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-submit,
html.dark-theme .post-subscribe--card .maxsan-subscribe-submit span {
  background: #ffffff !important;
  color: #0b0b0c !important;
  border-color: #ffffff !important;
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-submit:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-msg {
  color: #4ade80;
}

html.dark-theme .post-subscribe--card .maxsan-subscribe-msg.is-error {
  color: #f87171;
}

/* Body text inherits dim color; headings stay white via rules above */
html.dark-theme .post-content {
  color: #cccccc;
}

html.dark-theme .post-body figure,
html.dark-theme .post-content figure,
html.dark-theme .post-body .wp-block-image,
html.dark-theme .post-content .wp-block-image,
html.dark-theme .post-body p:has(> img:only-child),
html.dark-theme .post-content p:has(> img:only-child) {
  border-color: rgba(255, 255, 255, 0.22);
}

html.dark-theme .post-body img,
html.dark-theme .post-content img {
  border: none !important;
}

/* .post-pages styles live in style.css (shared with static pages) */
