/* ==========================================================================
   RepuNEXT TV — blog post page (single-post.php + template-parts/post/sidebar.php)
   1. Head      – breadcrumb, title (the only H1), meta line — full container width
   2. Layout    – article | sticky sidebar (desktop); sidebar below the article on tablets/phones
   3. Article   – featured image + content on a white reading sheet
   4. Sidebar   – About RepuNEXT TV card, recent articles
   Base content styles (headings, lists, tables, tags, previous/next) come from main.css.
   ========================================================================== */
.post-page .icon { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- 1. Head ---------- */
.post-head { padding-top: clamp(16px, 2.4vw, 32px); padding-bottom: clamp(22px, 3vw, 34px); }
.post-crumbs__list {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  margin: 0 0 clamp(14px, 1.8vw, 20px); padding: 0; list-style: none;
  font-size: .9rem; color: var(--muted);
}
.post-crumbs__item { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.post-crumbs__item + .post-crumbs__item::before { content: "/"; color: var(--sq-4); font-weight: 700; }
.post-crumbs__item a { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color .2s, color .2s; }
.post-crumbs__item a:hover { color: var(--en); border-color: var(--en); }
.post-crumbs__item [aria-current="page"] {
  color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(46ch, 60vw);
}

.post-title {
  margin: 0; max-width: none;
  font-family: var(--f-display); font-weight: 800; color: var(--ink);
  font-size: clamp(2rem, 4.4vw, 3.6rem); line-height: 1.04; letter-spacing: -.035em;
  text-wrap: balance;
}

.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  margin-top: clamp(16px, 2vw, 22px);
  font-size: .92rem; color: var(--muted);
}
.post-meta__author { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.post-meta__author strong { font-weight: 700; }
.post-meta__item { display: inline-flex; align-items: center; gap: 6px; }
.post-meta__item time { color: var(--ink); font-weight: 600; }
.post-meta__read .icon { color: var(--sq-4); }
.post-meta__item + .post-meta__item::before,
.post-meta__author + .post-meta__item::before { content: ""; width: 4px; height: 4px; margin-right: 8px; border-radius: 50%; background: var(--sq-5); }

/* Logo mark (stepped squares, as on the homepage) */
.pixels { --u: 9px; position: relative; display: inline-block; width: calc(var(--u) * 3.54); height: calc(var(--u) * 3.54); flex: none; }
.pixels i { position: absolute; width: var(--u); height: var(--u); border-radius: 2px; }
.pixels i:nth-child(1) { left: calc(var(--u) * .54);  top: 0;                        background: var(--sq-2); }
.pixels i:nth-child(2) { left: calc(var(--u) * 1.54); top: 0;                        background: var(--sq-4); }
.pixels i:nth-child(3) { left: calc(var(--u) * 2.54); top: 0;                        background: var(--sq-5); }
.pixels i:nth-child(4) { left: calc(var(--u) * 2.54); top: var(--u);                 background: var(--sq-6); }
.pixels i:nth-child(5) { left: calc(var(--u) * 2.54); top: calc(var(--u) * 2);       background: var(--sq-7); }
.pixels i:nth-child(6) { left: calc(var(--u) * 1);    top: calc(var(--u) * 1.27);    background: var(--sq-3); }
.pixels i:nth-child(7) { left: 0;                     top: calc(var(--u) * 2.54);    background: var(--sq-1); }

/* ---------- 2. Layout ---------- */
.post-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 26vw, 360px);
  gap: clamp(28px, 3.6vw, 56px); align-items: start;
}
.post-main { min-width: 0; }

/* ---------- 3. Article ---------- */
.post-main .entry-thumbnail { margin: 0 0 clamp(18px, 2.4vw, 28px); }
.post-main .entry-thumbnail img { aspect-ratio: 16 / 9; height: auto; object-fit: cover; }
.post-content {
  padding: clamp(22px, 4vw, 48px);
  background: var(--surface);
  border: 1.5px solid var(--line-soft); border-radius: var(--radius-lg);
  font-size: clamp(1.02rem, 1.1vw, 1.1rem); line-height: 1.8; color: #1C3247;
}
.post-content > :first-child { margin-top: 0; }
.post-content > :last-child { margin-bottom: 0; }
.post-content h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); line-height: 1.2; margin: 1.7em 0 .6em; scroll-margin-top: calc(var(--header-h) + 40px); }
.post-content h3 { font-size: clamp(1.18rem, 1.6vw, 1.4rem); line-height: 1.25; margin: 1.5em 0 .5em; scroll-margin-top: calc(var(--header-h) + 40px); }
.post-content p { margin: 0 0 1.15em; }
.post-content a { color: var(--en); font-weight: 600; text-decoration: underline; text-decoration-color: var(--sq-5); text-underline-offset: .22em; }
.post-content a:hover { color: var(--ink); }
.post-content img, .post-content figure { max-width: 100%; height: auto; }
.post-content figure { margin: 1.6em 0; }
.post-content figcaption { margin-top: 8px; font-size: .85rem; color: var(--muted); text-align: center; }
.post-footer { padding-top: clamp(22px, 3vw, 32px); }
.post-footer .entry-tags { margin: 0; }
/* Comments (comments.php uses the narrow centred container for full pages): fill the article column, same white sheet */
.post-main .comments-area {
  max-width: none; margin: clamp(28px, 3.4vw, 40px) 0 0;
  padding: clamp(22px, 4vw, 48px);
  background: var(--surface);
  border: 1.5px solid var(--line-soft); border-radius: var(--radius-lg);
}
.post-main .comments-area > :first-child { margin-top: 0; }
.post-main .comment-respond { margin: 0; }
.post-main .comment-form textarea { width: 100%; }

/* ---------- 4. Sidebar ---------- */
.post-sidebar { min-width: 0; align-self: stretch; }   /* full row height: the sticky box travels within it */
.post-sidebar__sticky { display: grid; gap: 18px; }

.side-card {
  padding: 20px;
  background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 4px 0 var(--line);
}
.side-card__title { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 1.2rem; line-height: 1.2; letter-spacing: -.02em; color: var(--ink); }

/* About card: navy, like the homepage's dark bands */
.side-about {
  background: linear-gradient(140deg, var(--ink-deep), var(--ink) 70%, var(--sq-1));
  border-color: var(--ink); box-shadow: 0 5px 0 var(--sq-5); color: #fff;
}
.side-about .side-card__title { color: #fff; font-size: 1.35rem; }
.side-about__top { display: flex; align-items: center; gap: 14px; }
.side-about__mark { --u: 11px; }
.side-about__eyebrow { margin: 0 0 2px; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sq-7); }
.side-about__text { margin: 12px 0 14px; font-size: .92rem; line-height: 1.6; color: #C6D4DE; }
.side-about__channels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.side-about__channel {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px 10px; border-radius: 12px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14);
  color: #fff; font-weight: 600; font-size: .82rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .2s, border-color .2s, transform .25s var(--ease-out);
}
.side-about__channel:hover { color: #fff; background: rgba(255,255,255,.12); border-color: var(--sq-5); transform: translateY(-2px); }
.side-about__tag { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 6px; border-radius: 7px; font-size: .72rem; font-weight: 800; }
.side-about__channel--en .side-about__tag { background: var(--en); color: #fff; }
.side-about__channel--ta .side-about__tag { background: var(--ta-bright); color: var(--ink); font-size: .85rem; }

/* Recent articles */
.side-recent__list { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.side-recent__item + .side-recent__item { border-top: 1px solid var(--line-soft); }
.side-recent__link {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 6px 6px; margin-inline: -6px; border-radius: 12px;
  text-decoration: none; color: var(--ink);
  transition: background .2s;
}
.side-recent__link:hover, .side-recent__link:focus-visible { background: var(--paper); }
.side-recent__thumb { display: block; width: 56px; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: var(--en-tint); }
.side-recent__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.side-recent__link:hover .side-recent__thumb img { transform: scale(1.08); }
.side-recent__text { display: grid; gap: 4px; min-width: 0; }
.side-recent__title {
  font-family: var(--f-display); font-weight: 700; font-size: .95rem; line-height: 1.3; letter-spacing: -.01em;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.side-recent__link:hover .side-recent__title { color: var(--en); }
.side-recent__date { font-size: .78rem; color: var(--muted); }

/* ---------- Sticky sidebar + compact steps for shorter windows (after the card rules, so they win) ---------- */
/* Sticky on desktop, always just below the floating header — no inner scrolling. Shorter windows get a more compact
   sidebar so it still fits whole between the header and the bottom of the window; very short windows don't stick. */
@media (min-width: 1024px) {
  .post-sidebar__sticky { position: sticky; top: calc(var(--header-h) + 34px); }
  .admin-bar .post-sidebar__sticky { top: calc(var(--header-h) + 34px + 32px); }
}
@media (min-width: 1024px) and (max-height: 845px) {   /* full sidebar (738 px) needs a 846 px window */
  .post-sidebar__sticky { gap: 14px; }
  .side-card { padding: 16px 18px; }
  .side-about__text { margin: 10px 0 12px; font-size: .88rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .side-recent__list { margin-top: 6px; gap: 0; }
  .side-recent__link { grid-template-columns: 48px minmax(0, 1fr); gap: 10px; padding: 5px 6px; }
  .side-recent__thumb { width: 48px; border-radius: 8px; }
  .side-recent__title { font-size: .88rem; }
  .side-recent__date { font-size: .74rem; }
}
@media (min-width: 1024px) and (max-height: 754px) {   /* step 1 (647 px) needs 755 px */
  .side-about__text { display: none; }
  .side-about__channels { margin-top: 12px; }
  .side-about .side-card__title { font-size: 1.2rem; }
  .side-recent__date { display: none; }
}
@media (min-width: 1024px) and (max-height: 610px) {   /* step 2 (503 px) needs 611 px */
  .side-card { padding: 10px 14px; }
  .post-sidebar__sticky { gap: 8px; }
  .side-card__title, .side-about .side-card__title { font-size: 1.05rem; }
  .side-about__eyebrow { display: none; }
  .side-about__mark { --u: 8px; }
  .side-about__channels { margin-top: 10px; }
  .side-about__channel { padding: 6px 10px; }
  .side-recent__list { margin-top: 4px; }
  .side-recent__link { grid-template-columns: 40px minmax(0, 1fr); padding: 2px 6px; }
  .side-recent__thumb { width: 40px; }
  .side-recent__title { -webkit-line-clamp: 1; }
}
@media (min-width: 1024px) and (max-height: 483px) {   /* step 3 (376 px) needs 484 px */
  .post-sidebar__sticky { position: static; }   /* too short to keep the whole sidebar in view: it scrolls with the page */
}

/* ---------- Responsive: sidebar below the article, not sticky ---------- */
@media (max-width: 1023px) {
  .post-layout { grid-template-columns: minmax(0, 1fr); }
  .post-sidebar { align-self: auto; }
  .post-sidebar__sticky { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .side-about__channels { grid-template-columns: minmax(0, 1fr); }   /* half-width card: full handles */
}
@media (max-width: 680px) {
  .post-sidebar__sticky { grid-template-columns: minmax(0, 1fr); }
  .post-meta { gap: 8px 14px; font-size: .88rem; }
  .post-meta__author { flex-basis: 100%; }   /* author on its own line */
  .post-meta__author + .post-meta__item::before { display: none; }
  .post-crumbs__item [aria-current="page"] { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .side-about__channel, .side-recent__thumb img { transition: none; }
}
