/* Bearius News - blog parts on top of site.css (copy of bearius.org).
   Only tokens from site.css are used, so light and dark modes come for free. */

/* ---- WP CORE ---- */
.admin-bar .site-head { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-head { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-head { top: 0; } }

.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.screen-reader-text:focus { position: static; width: auto; height: auto; clip: auto; }

/* ---- BLOG BAR: categories + search ---- */
.blog-hero { border-bottom: 1px solid var(--line); }
.blog-bar { border-bottom: 1px solid var(--line); background: var(--bg); }
.blog-bar-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap; padding-block: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 11px;
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.02em;
  color: var(--muted); text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.search-form {
  display: flex; align-items: center; margin-left: auto;
  width: 260px; max-width: 100%; height: 34px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-form:focus-within { border-color: var(--accent-line); box-shadow: var(--glow); }
.search-input {
  flex: 1; min-width: 0; height: 100%; padding: 0 12px;
  font: inherit; font-family: var(--mono); font-size: 0.8rem; color: var(--text);
  background: transparent; border: 0; outline: none; -webkit-appearance: none; appearance: none;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus-visible { outline: none; }
.search-input::-webkit-search-decoration { -webkit-appearance: none; }
.search-btn {
  display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 100%; padding: 0;
  color: var(--muted); background: none; border: 0; border-left: 1px solid var(--line);
  border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer;
}
.search-btn:hover { color: var(--accent); }
@media (max-width: 560px) { .search-form { width: 100%; margin-left: 0; } }

/* ---- POST CARDS ----
   One component for the blog lists and for the latest posts block on bearius.org. */
.posts { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.post-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.post-card:hover, .post-card:focus-within { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--glow); }
.post-card-media {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.post-card-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post-card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 18px; }
.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.02em; color: var(--faint);
}
.post-meta-cat { color: var(--accent); }
.post-meta-cat::before { content: '/'; margin-right: 10px; color: var(--faint); opacity: var(--bracket); }
.post-card-title { font-size: 1.05rem; font-weight: 500; line-height: 1.32; letter-spacing: -0.008em; margin: 0; }
.post-card-title a { text-decoration: none; }
.post-card-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.post-card-title a:focus-visible { outline: none; }
.post-card:has(.post-card-title a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.post-card-excerpt {
  margin: 0; font-size: 0.88rem; color: var(--muted);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.post-card .more { margin-top: auto; padding-top: 6px; font-family: var(--mono); font-size: 0.75rem; color: var(--accent); }

/* terminal art for posts without a featured image */
.post-card-media .post-art { position: absolute; inset: 0; display: flex; flex-direction: column; border: 0; border-radius: 0; box-shadow: none; }
.post-card-media .post-art .pb-body { flex: 1; height: auto; min-height: 0; }
.post-art .pb-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-art .pb-code { min-width: 0; position: relative; z-index: 1; }
.post-art .pb-line { overflow: hidden; text-overflow: ellipsis; }

/* card across the whole row: first post, and the last one when it would stay alone */
.post-card--wide { grid-column: 1 / -1; }
@media (min-width: 640px) and (max-width: 759px) {
  .post-card--wide .post-card-media { aspect-ratio: 21 / 9; }
}
@media (min-width: 760px) {
  .post-card--wide { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); }
  .post-card--wide .post-card-media { aspect-ratio: auto; min-height: 280px; border-bottom: 0; border-right: 1px solid var(--line); }
  .post-card--wide .post-card-body { justify-content: center; padding: 26px 30px; gap: 10px; }
  .post-card--wide .post-card-title { font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.25; letter-spacing: -0.015em; }
  .post-card--wide .post-card-excerpt { font-size: 0.95rem; -webkit-line-clamp: 4; }
  .post-card--wide .more { margin-top: 6px; }
}

.empty { margin: 0; font-family: var(--mono); font-size: 0.9rem; color: var(--muted); }
.empty::before { content: '$ '; color: var(--accent); }

/* ---- PAGINATION ---- */
.pagination {
  display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 2.6rem; font-family: var(--mono); font-size: 0.8rem;
}
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 34px; height: 34px; padding: 0 11px;
  color: var(--muted); text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.pagination a.page-numbers:hover { color: var(--accent); border-color: var(--accent-line); }
.pagination .page-numbers.current { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.pagination .page-numbers.dots { background: none; border-color: transparent; min-width: 0; padding: 0 4px; }
@media (max-width: 560px) { .pagination .prev span, .pagination .next span { display: none; } }

/* ---- SINGLE POST ---- */
.post-head { padding-block: clamp(2.6rem, 6vw, 4.4rem) 0; }
.post-head .eyebrow a { text-decoration: none; }
.post-head .eyebrow a:hover { text-decoration: underline; text-decoration-color: var(--accent-line); }
.post-title { max-width: 24ch; font-size: clamp(1.9rem, 4.6vw, 2.9rem); }
.post-lede { max-width: 60ch; margin: 1.1rem 0 0; font-size: 1.08rem; }
.post-head .case-meta { margin-top: 1.6rem; }
.post-figure { margin: 2.2rem 0 0; }
.post-figure img {
  display: block; width: 100%; height: auto; max-height: 620px; object-fit: cover;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2);
}
.post-figure figcaption { margin-top: 0.6rem; font-size: 0.8rem; color: var(--faint); }
.post-body { padding-block: clamp(2.2rem, 5vw, 3.2rem) var(--step); border-bottom: 1px solid var(--line); }
.post-nav .pager a { max-width: 46%; }
@media (max-width: 560px) { .post-nav .pager a { max-width: 100%; } }

/* ---- ENTRY: long-form typography ---- */
/* the measure is in rem, not ch - ch would shrink code blocks set in the smaller mono font */
.entry { --measure: 42rem; font-size: 1.04rem; line-height: 1.75; color: var(--text); }
.entry > * { max-width: var(--measure); margin-top: 0; margin-bottom: 1.2rem; }
.entry > *:last-child { margin-bottom: 0; }
.entry > .alignwide, .entry > .alignfull { max-width: none; }
.entry h2 { font-size: clamp(1.3rem, 2.4vw, 1.5rem); margin: 2.6rem 0 0.9rem; }
.entry h3 { font-size: 1.15rem; margin: 2.1rem 0 0.7rem; }
.entry h4 { font-size: 1rem; font-weight: 500; margin: 1.8rem 0 0.6rem; }
.entry h2:first-child, .entry h3:first-child { margin-top: 0; }
.entry strong, .entry b { font-weight: 600; }
.entry a { color: var(--accent); text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.entry a:hover { text-decoration-color: var(--accent); }
.entry ul, .entry ol { padding-left: 1.35rem; }
.entry li { margin-bottom: 0.45rem; }
.entry li > ul, .entry li > ol { margin-top: 0.45rem; }
.entry li::marker { color: var(--accent); }
.entry ol li::marker { font-family: var(--mono); font-size: 0.86em; }
.entry blockquote, .entry .wp-block-quote {
  margin: 2rem 0; padding: 2px 0 2px 22px; border-left: 2px solid var(--accent);
  color: var(--muted); font-size: 1.1rem;
}
.entry blockquote p:last-of-type { margin-bottom: 0; }
.entry blockquote cite, .entry .wp-block-quote cite {
  display: block; margin-top: 0.7rem; font-family: var(--mono); font-size: 0.74rem; font-style: normal; color: var(--faint);
}
.entry .wp-block-pullquote { padding: 1.6rem 0; border-block: 1px solid var(--line); text-align: left; }
.entry .wp-block-pullquote blockquote { border: 0; padding: 0; margin: 0; font-size: 1.3rem; color: var(--text); }
.entry code, .entry kbd {
  font-family: var(--mono); font-size: 0.86em; padding: 0.1em 0.38em;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px;
}
.entry pre, .entry .wp-block-code {
  overflow-x: auto; padding: 16px 18px; scrollbar-width: thin;
  font-family: var(--mono); font-size: 0.84rem; line-height: 1.7; white-space: pre;
  color: #d7e2dc; background: #07090b; border: 1px solid #1b2226; border-radius: var(--radius);
}
.entry pre code, .entry .wp-block-code code {
  display: block; padding: 0; font-size: inherit; color: inherit; background: none; border: 0;
  white-space: pre; overflow-wrap: normal; word-break: normal;
}
html[data-theme='dark'] .entry pre, html[data-theme='dark'] .entry .wp-block-code { background: #0c1613; border-color: var(--accent-line); }
@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .entry pre, html:not([data-theme='light']) .entry .wp-block-code { background: #0c1613; border-color: var(--accent-line); }
}
.entry mark { color: inherit; background: var(--accent-soft); box-shadow: inset 0 -2px 0 var(--accent-line); padding: 0 0.15em; }
.entry hr, .entry .wp-block-separator { height: 0; margin: 2.6rem 0; border: 0; border-top: 1px solid var(--line); opacity: 1; }
.entry img { max-width: 100%; height: auto; border-radius: var(--radius); }
.entry figure { margin: 2rem 0; }
.entry figcaption, .entry .wp-caption-text, .entry .wp-element-caption {
  margin-top: 0.6rem; font-size: 0.8rem; color: var(--faint); text-align: left;
}
.entry .wp-block-image img { border: 1px solid var(--line); }
.entry .wp-caption { max-width: 100%; }
.entry .alignleft { float: left; margin: 0.35rem 1.6rem 1rem 0; max-width: 50%; }
.entry .alignright { float: right; margin: 0.35rem 0 1rem 1.6rem; max-width: 50%; }
.entry .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry::after { content: ''; display: table; clear: both; }
@media (max-width: 560px) {
  .entry .alignleft, .entry .alignright { float: none; margin: 1.6rem 0; max-width: 100%; }
}
.entry table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.entry th, .entry td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.entry thead th {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 400; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
}
.entry tbody tr:last-child td, .entry tbody tr:last-child th { border-bottom: 0; }
.entry .wp-block-table { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.entry .wp-block-table table { margin: 0; }
.entry .wp-block-table thead { border-bottom: 1px solid var(--line-strong); }
.entry .wp-block-table td, .entry .wp-block-table th { border: 0; border-bottom: 1px solid var(--line); padding: 11px 14px; }
.entry .wp-block-table tbody tr:last-child td, .entry .wp-block-table tbody tr:last-child th { border-bottom: 0; }
.entry .wp-block-table figcaption { padding: 0 14px 12px; }
.entry .wp-block-embed iframe, .entry iframe { max-width: 100%; }
.entry .wp-block-button__link {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px;
  font-size: 0.92rem; color: var(--text); text-decoration: none;
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.entry .wp-block-button__link:hover { border-color: var(--accent); box-shadow: var(--glow); background: var(--panel); }
.page-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2rem; font-family: var(--mono); font-size: 0.8rem; }

/* ---- 404 ---- */
.posts-tri .post-card-title { font-size: 1rem; }
