body.optex-article-grid .wp-block-query {
  display: block !important;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

body.optex-article-grid ul.wp-block-post-template {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
}

body.optex-article-grid ul.wp-block-post-template > li.wp-block-post {
  min-width: 0 !important;
  margin: 0 !important;
  width: auto !important;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #12151a;
  border: 1px solid rgba(18, 21, 26, 0.12);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(18, 21, 26, 0.06);
}

body.optex-article-grid li.wp-block-post .wp-block-group,
body.optex-article-grid li.wp-block-post .wp-block-group.has-global-padding {
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
}

body.optex-article-grid li.wp-block-post .optex-card-excerpt {
  margin: 0;
  padding: 0 16px;
  color: #5c6570;
  font-size: 0.92rem;
  line-height: 1.8;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.optex-article-grid li.wp-block-post .optex-card-more {
  display: inline-flex;
  width: fit-content;
  margin: 10px 16px 16px;
  font-weight: 700;
  color: #14607a;
  text-decoration: none;
}

body.optex-article-grid li.wp-block-post .wp-block-post-featured-image {
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f3f4f6;
}

body.optex-article-grid li.wp-block-post .wp-block-post-featured-image img {
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  object-fit: cover;
  display: block;
}

body.optex-article-grid li.wp-block-post .wp-block-post-title {
  font-size: 1.05rem !important;
  line-height: 1.75;
  font-weight: 700;
  margin: 0 !important;
  padding: 14px 16px 8px;
}

body.optex-article-grid li.wp-block-post .wp-block-post-title a {
  color: inherit;
  text-decoration: none;
}

body.optex-article-grid > .wp-site-blocks h1.wp-block-heading,
body.blog h1.wp-block-heading {
  text-align: center;
  margin: 28px 20px 8px;
}

html[data-theme="night"] body.optex-article-grid,
html[data-theme="night"] body.optex-article-grid .wp-site-blocks {
  background: #111111;
  color: #ffffff;
}

html[data-theme="night"] body.optex-article-grid ul.wp-block-post-template > li.wp-block-post {
  background: #1c1c1c;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

html[data-theme="night"] body.optex-article-grid li.wp-block-post .wp-block-post-featured-image {
  background: #111111;
}

html[data-theme="night"] body.optex-article-grid li.wp-block-post .optex-card-excerpt {
  color: #d0d4d8;
}

html[data-theme="night"] body.optex-article-grid li.wp-block-post .optex-card-more {
  color: #7ec8d8;
}

html[data-theme="night"] body.optex-article-grid h1,
html[data-theme="night"] body.optex-article-grid h2,
html[data-theme="night"] body.optex-article-grid .wp-block-post-title a {
  color: #ffffff;
}

@media (max-width: 1100px) {
  body.optex-article-grid ul.wp-block-post-template {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body.optex-article-grid ul.wp-block-post-template {
    grid-template-columns: 1fr;
  }
}

body.single-post {
  --optex-figure: min(1080px, calc(100vw - 48px));
}

body.single-post main,
body.single-post main .wp-block-group,
body.single-post .alignfull,
body.single-post .alignwide {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.single-post .alignfull,
body.single-post .alignwide,
body.single-post main .wp-block-post-title,
body.single-post main .wp-block-group:has(.wp-block-post-author-name),
body.single-post main .wp-block-post-featured-image,
body.single-post main .wp-block-post-content,
body.single-post main .wp-block-post-content > *,
body.single-post .optex-related {
  width: var(--optex-figure) !important;
  max-width: var(--optex-figure) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  left: auto !important;
  right: auto !important;
  float: none !important;
  transform: none !important;
}

body.single-post main .wp-block-post-title {
  margin-top: 12px;
  margin-bottom: 18px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  line-height: 1.45;
  font-weight: 800;
  text-align: right;
}

body.single-post main .wp-block-post-featured-image {
  margin-bottom: 22px;
  border-radius: 22px;
  overflow: hidden;
  background: #f3f4f6;
  box-shadow: 0 18px 40px rgba(18, 21, 26, 0.08);
}

body.single-post main .wp-block-post-featured-image img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

body.single-post main .wp-block-group:has(.wp-block-post-author-name) {
  margin-bottom: 22px !important;
  color: #5c6570;
  font-size: 0.92rem;
}

body.single-post .wp-block-post-content {
  font-size: 1.05rem;
  line-height: 2;
  color: #243038;
}

body.single-post .wp-block-post-content > h1:first-child {
  font-size: 1.35rem;
  line-height: 1.7;
  margin: 0 0 1rem;
}

body.single-post .wp-block-post-content h2,
body.single-post .wp-block-post-content h3 {
  line-height: 1.6;
  margin: 1.6em 0 0.6em;
}

body.single-post .wp-block-post-content h2 {
  font-size: 1.35rem;
  padding-right: 12px;
  border-right: 3px solid #14607a;
}

body.single-post .wp-block-post-content p,
body.single-post .wp-block-post-content li {
  margin-bottom: 0.9em;
}

body.single-post .wp-block-post-content a {
  color: #14607a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.single-post .wp-block-post-content img,
body.single-post .wp-block-post-content figure {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
}

body.single-post .optex-related {
  margin-top: 56px;
  margin-bottom: 48px;
}

body.single-post .optex-related h2 {
  margin: 0 0 18px;
  font-size: 1.4rem;
}

body.single-post .optex-related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

body.single-post .optex-related-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border: 1px solid rgba(18, 21, 26, 0.12);
  border-radius: 16px;
  overflow: hidden;
}

body.single-post .optex-related-hit {
  color: inherit;
  text-decoration: none;
}

body.single-post .optex-related-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

body.single-post .optex-related-card h3 {
  margin: 0;
  padding: 12px 12px 6px;
  font-size: 0.95rem;
  line-height: 1.7;
}

body.single-post .optex-related-card p {
  margin: 0;
  padding: 0 12px;
  color: #5c6570;
  font-size: 0.82rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.single-post .optex-related-card .optex-card-more {
  margin: 8px 12px 14px;
  padding: 0;
}

html[data-theme="night"] body.single-post,
html[data-theme="night"] body.single-post .wp-site-blocks {
  background: #111111;
  color: #ffffff;
}

html[data-theme="night"] body.single-post .wp-block-post-content,
html[data-theme="night"] body.single-post .wp-block-post-title,
html[data-theme="night"] body.single-post .optex-related h2,
html[data-theme="night"] body.single-post .optex-related-card h3 {
  color: #ffffff;
}

html[data-theme="night"] body.single-post .wp-block-post-content a,
html[data-theme="night"] body.single-post .optex-related-card .optex-card-more {
  color: #7ec8d8;
}

html[data-theme="night"] body.single-post .wp-block-post-content h2 {
  border-right-color: #7ec8d8;
}

html[data-theme="night"] body.single-post main .wp-block-group:has(.wp-block-post-author-name),
html[data-theme="night"] body.single-post .optex-related-card p {
  color: #d0d4d8;
}

html[data-theme="night"] body.single-post .optex-related-card {
  background: #1c1c1c;
  border-color: rgba(255, 255, 255, 0.16);
}

@media (max-width: 1100px) {
  body.single-post .optex-related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 782px) {
  body.single-post {
    --optex-figure: calc(100vw - 28px);
  }

  body.single-post .optex-related-grid {
    grid-template-columns: 1fr;
  }
}
