/* ==========================================================================
   Writrex Blog: blog-only layer.
   Loaded after https://writrex.com/assets/css/styles.css and uses its tokens.
   Nothing here restyles an existing site component; it only adds post cards,
   the article layout, post visuals and editor (Gutenberg) content.
   ========================================================================== */

/* WordPress admin bar: keep the sticky header below it */
.admin-bar .site-header { top: 32px; }
.admin-bar .docs-toc { top: 120px; }
@media (max-width: 782px) { .admin-bar .site-header { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-header { top: 0; } }

/* ---------- Post visuals ----------
   Same markup whether the visual is an inline SVG, a self-contained SVG image,
   a sandboxed HTML visual, the featured image fallback, or the placeholder. */
.wbv { margin: 0; }
.wbv__frame {
  position: relative;
  aspect-ratio: var(--wbv-ratio, 16 / 9);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(15, 24, 41, 0.9), rgba(11, 19, 34, 0.9));
}
.wbv__frame::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(136, 153, 170, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(136, 153, 170, 0.06) 1px, transparent 1px);
  background-size: 24px 24px;
}
.wbv .wbv__stage { position: absolute; inset: 0; display: grid; place-items: center; padding: 5%; }
.wbv--html .wbv__stage, .wbv--photo .wbv__stage { padding: 0; }
.wbv .wbv__stage > svg,
.wbv .wbv__stage > img { width: 100%; height: 100%; max-width: 100%; object-fit: contain; display: block; }
.wbv .wbv__stage > svg { overflow: visible; }
.wbv--photo .wbv__stage > img { object-fit: cover; }
.wbv .wbv__stage > iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.wbv--card .wbv__stage > iframe { pointer-events: none; }
/* The site's .fig class is used only as a drawing scope here, not as a second frame */
.wbv .wbv__stage.fig { border: 0; border-radius: 0; background: none; overflow: visible; }
.wbv .wbv__stage.fig::before { display: none; }
.wbv--hero { max-width: min(100%, calc(72vh * var(--wbv-ar, 1.7778))); margin-inline: auto; }
.wbv--hero .wbv__frame { border-top-color: var(--mint); box-shadow: 0 40px 100px -40px rgba(0, 229, 160, 0.16); }
.wbv__cap { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; }
.wbv--placeholder .wbv__stage { padding: 8% 10%; }

/* ---------- Listing head, topics and search ---------- */
.blog-head { padding-bottom: clamp(24px, 3vw, 40px); }
.blog-head .h-page { max-width: 920px; margin-inline: auto; text-wrap: balance; }
.blog-head .lede p + p { margin-top: 10px; }

.blog-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding-bottom: 8px; }
.blog-topics { display: flex; flex-wrap: wrap; gap: 8px; }
.blog-topics a { font-size: 13.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; transition: color 0.2s, border-color 0.2s, background 0.2s; }
.blog-topics a:hover { color: var(--text); border-color: var(--line-2); }
.blog-topics a[aria-current="page"] { color: var(--mint); border-color: var(--mint-line); background: var(--mint-soft); }

.blog-search { position: relative; display: flex; align-items: center; min-width: min(100%, 260px); }
.blog-search svg { position: absolute; left: 13px; color: var(--dim); pointer-events: none; }
.blog-search input { width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 9px 16px 9px 38px; font: inherit; font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
.blog-search input::placeholder { color: var(--dim); }
.blog-search input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); outline: none; }
.blog-search input::-webkit-search-cancel-button { filter: invert(0.6); }

.blog-list { padding-top: clamp(28px, 4vw, 44px); }

/* ---------- Post cards ---------- */
.post-card.card { padding: 10px; display: flex; flex-direction: column; }
.post-card .wbv__frame { border-radius: 8px; }
.post-card__body { display: flex; flex-direction: column; flex: 1; padding: 16px 12px 10px; }
.post-card__cap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.post-card__cap .tag { margin: 0; }
.post-card__read { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--dim); white-space: nowrap; }
.post-card__title { font-size: 19px; line-height: 1.3; letter-spacing: -0.015em; margin-top: 12px; }
.post-card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.post-card__link:focus-visible { outline: none; }
.post-card:has(.post-card__link:focus-visible) { outline: 2px solid var(--mint); outline-offset: 3px; }
.post-card .post-card__excerpt { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .post-card__date { margin-top: auto; padding-top: 16px; font-family: var(--font-mono); font-size: 12px; color: var(--dim); }

/* Lead card: the newest post on each page, visual left and text right */
.post-card--lead.card { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: center; margin-bottom: 20px; }
.post-card--lead .post-card__body { padding: 16px clamp(8px, 2vw, 28px) 16px 0; }
.post-card--lead .post-card__title { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.12; margin-top: 16px; }
.post-card--lead .post-card__excerpt { font-size: 16px; margin-top: 14px; -webkit-line-clamp: 4; }
@media (max-width: 900px) {
  .post-card--lead.card { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .post-card--lead .post-card__body { padding: 16px 12px 10px; }
}

/* ---------- Pagination ---------- */
.blog-pages { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: clamp(36px, 5vw, 56px); }
.blog-pages .page-numbers, .post-pages a, .post-pages > span { min-width: 42px; height: 42px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: 14px; transition: color 0.2s, border-color 0.2s; }
.blog-pages a.page-numbers:hover, .post-pages a:hover { color: var(--text); border-color: var(--mint-line); }
.blog-pages .page-numbers.current { color: var(--mint-ink); background: var(--mint); border-color: var(--mint); font-weight: 700; }
.blog-pages .page-numbers.dots { border-color: transparent; }

/* ---------- Single post ---------- */
.post-head { padding-bottom: clamp(32px, 4vw, 48px); }
.post-head .h-page { max-width: 940px; margin-inline: auto; text-wrap: balance; }
.post-card__title { text-wrap: pretty; }
.post-head__cat { display: inline-block; margin-bottom: 18px; }
.post-head__cat:hover { text-decoration: underline; text-underline-offset: 4px; }
.post-head .lede { margin-top: 20px; }
.post-meta { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 26px; font-size: 14px; color: var(--muted); row-gap: 8px; }
.post-meta > span { padding-inline: 14px; }
.post-meta > span + span { border-left: 1px solid var(--line-2); }
.post-meta a { color: var(--text); }
.post-meta a:hover { color: var(--mint); }

.post-hero { margin-bottom: clamp(44px, 6vw, 80px); }

.post-layout { display: grid; grid-template-columns: minmax(0, 720px); justify-content: center; column-gap: 64px; }
.post-layout.has-toc { grid-template-columns: minmax(0, 720px) 220px; }
.post-layout > .post-body, .post-layout > .post-foot { grid-column: 1; }
.post-layout > .post-toc { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
@media (max-width: 1180px) { .post-layout.has-toc { grid-template-columns: minmax(0, 720px); } }

/* ---------- Article content (Gutenberg output inside the site's .prose) ---------- */
.post-body { font-size: 17px; line-height: 1.75; }
.post-body > :first-child { margin-top: 0; }
.prose h2:first-child { margin-top: 0; }
.prose h4 { font-size: 16px; margin: 26px 0 8px; }
.prose img { border-radius: var(--radius); height: auto; }
.prose figure { margin: 30px 0; }
.prose figcaption, .prose .wp-element-caption { margin-top: 10px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--dim); text-align: center; }
.prose blockquote, .prose .wp-block-quote { margin: 32px 0; border-left: 2px solid var(--mint); padding: 4px 0 4px 24px; font-size: clamp(18px, 2.2vw, 21px); line-height: 1.5; color: var(--text); }
.prose blockquote p { color: inherit; margin: 0; }
.prose blockquote p + p { margin-top: 12px; }
.prose blockquote cite { display: block; margin-top: 12px; font-size: 13px; font-style: normal; color: var(--muted); }
.prose .wp-block-pullquote { border: 0; padding: 0; text-align: left; }
.prose hr, .prose .wp-block-separator { border: 0; height: 1px; margin: 48px 0; background: repeating-linear-gradient(90deg, var(--line-2) 0 4px, transparent 4px 8px); }
.prose mark { background: var(--mint-soft); color: var(--mint); padding: 0 3px; border-radius: 3px; }
.prose kbd { font-size: 0.85em; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface); }
.prose .wp-block-table { margin: 24px 0; overflow-x: auto; }
.prose .wp-block-table .table-wrap { border: 0; border-radius: 0; margin: 0; }
.prose .wp-block-table table { border-collapse: collapse; }
.prose .wp-block-table td, .prose .wp-block-table th { border: 0; border-bottom: 1px solid var(--line); }
.prose .wp-block-buttons { margin: 28px 0; display: flex; flex-wrap: wrap; gap: 12px; }
.prose .wp-block-button__link { display: inline-flex; align-items: center; padding: 13px 26px; border-radius: var(--radius); background: var(--mint); color: var(--mint-ink); font-weight: 700; font-size: 15px; border: 0; }
.prose .wp-block-button__link:hover { color: var(--mint-ink); transform: translateY(-2px); box-shadow: 0 10px 30px -10px var(--mint-line); }
.prose .is-style-outline .wp-block-button__link { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.prose .wp-block-embed { margin: 30px 0; }
.prose .wp-block-embed iframe { width: 100%; border-radius: var(--radius); }
.prose .wp-block-image.alignleft, .prose .alignleft { float: left; margin: 6px 24px 16px 0; max-width: 50%; }
.prose .wp-block-image.alignright, .prose .alignright { float: right; margin: 6px 0 16px 24px; max-width: 50%; }
.prose .aligncenter { margin-inline: auto; text-align: center; }
.prose::after { content: ""; display: table; clear: both; }
.prose .wp-block-details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 20px; margin: 16px 0; }
.prose .wp-block-details summary { cursor: pointer; font-weight: 600; color: var(--text); }
@media (max-width: 640px) {
  .post-body { font-size: 16px; }
  .prose .alignleft, .prose .alignright { float: none; margin: 24px 0; max-width: 100%; }
}

/* ---------- Article footer ---------- */
.post-foot { padding-top: 48px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.post-tags a { display: inline-block; font-family: var(--font-mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; }
.post-tags a:hover { color: var(--mint); border-color: var(--mint-line); }

.post-author { display: flex; gap: 20px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 24px; }
.post-author__img { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--line-2); flex: none; }
.post-author__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.post-author__name { font-size: 18px; font-weight: 700; margin-top: 4px; }
.post-author__name a:hover { color: var(--mint); }
.post-author__bio { color: var(--muted); font-size: 15px; margin-top: 8px; }
.post-foot .pager { margin-top: 32px; }
@media (max-width: 520px) { .post-author { flex-direction: column; } .post-foot .pager { grid-template-columns: 1fr; } .post-foot .pager a:last-child { text-align: left; } }

/* ---------- Related, empty state, 404 ---------- */
.blog-related { margin-top: clamp(56px, 8vw, 96px); }
.blog-empty { max-width: 760px; margin-inline: auto; padding: 44px 32px; }
.blog-empty .h-section { font-size: clamp(24px, 3vw, 30px); }
.blog-empty p { max-width: 520px; margin: 14px auto 0; }
.blog-empty .btn-row { margin-top: 26px; }
.blog-empty__search .blog-search { max-width: 360px; margin: 22px auto 0; }
.blog-404 { margin-top: 32px; }
.blog-404 .blog-search { max-width: 420px; margin: 0 auto 24px; }
