/* MAIN LAYOUT: feed + sidebar */
.layout{display:grid;grid-template-columns:1fr 340px;gap:48px;padding:56px 0 70px;}
.feed-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px;}
.feed-head h2{font-size:22px;font-weight:800;}
.feed-head .sort{font-size:13.5px;color:var(--muted);font-weight:600;}

.row{display:grid;grid-template-columns:220px 1fr;gap:22px;padding:24px 0;border-bottom:1px solid var(--line);align-items:center;}
.row:first-of-type{padding-top:14px;}
.row .rimg{height:150px;border-radius:12px;position:relative;overflow:hidden;}
.row .rimg .rcat{position:absolute;top:10px;left:10px;background:#fff;color:var(--brand);font-size:10px;font-weight:700;letter-spacing:.3px;text-transform:uppercase;padding:4px 9px;border-radius:5px;}
.row .rc h3{font-size:20px;line-height:1.3;margin-bottom:8px;transition:.15s;}
.row:hover .rc h3{color:var(--brand);}
.row .rc p{font-size:14px;color:var(--body);margin:0 0 12px;}
.row .rmeta{display:flex;align-items:center;gap:10px;font-size:12.5px;color:var(--muted);}
.row .rmeta .av{width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,var(--brand),#6f9bf0);color:#fff;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:11px;}
.row .rmeta b{color:var(--ink);font-weight:600;}
.dotsep{width:3px;height:3px;border-radius:50%;background:var(--muted);}

.loadmore{text-align:center;margin-top:36px;display:flex;gap:12px;justify-content:center;flex-wrap:wrap;}
.loadmore .btn[hidden]{display:none;}
/* "Show less" collapses back to the first page — same ghost button, arrow up. */
.loadmore .feed-loadless .arrow-up{transform:rotate(180deg);}
/* Load more: while the next page is fetching the button shows a spinner and its
   label swaps to "Loading…" (articlefeed.js toggles .is-loading). */
.loadmore .lm-spinner{display:none;width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-top-color:transparent;animation:lm-spin .6s linear infinite;flex:none;}
/* The spinner belongs in the button only — never swap the mouse cursor. */
.loadmore .feed-loadmore.is-loading{opacity:.75;cursor:default;}
.loadmore .feed-loadmore.is-loading .lm-spinner{display:inline-block;}
.loadmore .feed-loadmore.is-loading .arrow,
.loadmore .feed-loadmore.is-loading svg{display:none;}
.loadmore .lm-status{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
@keyframes lm-spin{to{transform:rotate(360deg);}}
@media (prefers-reduced-motion:reduce){.loadmore .lm-spinner{animation-duration:1.8s;}}
/* Category tab / search switch: soften just the current rows and float a spinner
   chip in the middle of the screen, so the wait reads as "loading" rather than
   "nothing happened". The rest of the page is left alone. */
.feed{position:relative;}
.feed[aria-busy="true"] .feed-rows{opacity:.4;filter:blur(2px);pointer-events:none;transition:opacity .15s;}
.feed-loading{display:none;}
/* Fixed, so the chip sits in the middle of the screen whatever the scroll
   position or feed length is. */
.feed[aria-busy="true"] .feed-loading{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;pointer-events:none;}
.feed-loading .fl-box{display:inline-flex;align-items:center;gap:10px;background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px 18px;box-shadow:0 8px 24px rgba(16,24,40,.10);font-size:14.5px;font-weight:600;color:var(--ink);}
.feed-loading .fl-spinner{width:16px;height:16px;border-radius:50%;border:2px solid var(--brand);border-top-color:transparent;animation:lm-spin .6s linear infinite;flex:none;}
@media (prefers-reduced-motion:reduce){.feed-loading .fl-spinner{animation-duration:1.8s;}}
.feed-empty{color:var(--muted);padding:24px 0;font-size:15px;}

/* SIDEBAR */
.side{position:sticky;top:96px;display:flex;flex-direction:column;gap:22px;align-self:start;}
.scard{background:#fff;border:1px solid var(--line);border-radius:16px;padding:22px;}
.scard h4{font-size:13px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);margin:0 0 16px;}
.ssearch{display:flex;align-items:center;gap:10px;background:var(--soft);border:1.5px solid var(--line);border-radius:11px;padding:11px 14px;color:var(--muted);}
.ssearch input{border:none;outline:none;background:transparent;font-family:inherit;font-size:14.5px;width:100%;color:var(--ink);}
/* The search box is a real <form>; keep it visually identical to the old div. */
.ssearch{margin:0;}
.ssearch input[type="search"]{-webkit-appearance:none;appearance:none;padding:0;}
.ssearch input[type="search"]::-webkit-search-decoration,
.ssearch input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none;}
.catlist a{display:flex;justify-content:space-between;align-items:center;padding:9px 0;font-size:14.5px;color:var(--body);border-bottom:1px solid var(--line2);transition:.15s;}
.catlist a:last-child{border-bottom:none;}
.catlist a:hover{color:var(--brand);}
.catlist .count{font-size:12px;font-weight:600;color:var(--muted);background:var(--soft);border-radius:999px;padding:2px 9px;}
.trend a{display:flex;gap:13px;align-items:flex-start;padding:11px 0;border-bottom:1px solid var(--line2);}
.trend a:last-child{border-bottom:none;}
.trend .rk{font-size:18px;font-weight:800;color:var(--brand-tint2);line-height:1;flex:0 0 auto;width:22px;}
.trend .tt{font-size:14px;font-weight:600;line-height:1.35;transition:.15s;}
.trend a:hover .tt{color:var(--brand);}
.trend .tm{font-size:12px;color:var(--muted);margin-top:3px;}
.scard.news{background:linear-gradient(135deg,var(--brand),var(--brand-dark));color:#fff;border:none;}
.scard.news h4{color:#bcd0ff;}
.scard.news p{font-size:14px;color:#d7e2fb;margin:0 0 14px;}
.scard.news input{width:100%;border:none;border-radius:10px;padding:12px 14px;font-family:inherit;font-size:14px;outline:none;margin-bottom:10px;}
/* The signup box is a real AJAX form; keep it visually identical to the static
   markup it replaced, and add the states it now needs. */
.scard.news .news-form{margin:0;}
.scard.news .news-form p{margin:0;}
.scard.news button.btn-white{width:100%;justify-content:center;border:none;font-size:15px;}
.scard.news button.btn-white:disabled{opacity:.7;cursor:default;}
.scard.news .news-trap{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden;}
.scard.news .news-msg:empty{display:none;}
.scard.news .news-msg{margin-top:10px;font-size:13.5px;line-height:1.45;}
.scard.news .news-msg.is-ok{color:#d9ffe8;}
.scard.news .news-msg.is-error{color:#ffd7d7;}
.scard.news .news-note{margin-top:10px;font-size:12px;line-height:1.5;color:#bcd0ff;}
.scard.news .news-note a{color:#fff;text-decoration:underline;}
/* Scoped to .tags: a bare `.tag` also matches <body class="tag"> on a tag
   archive, which painted the pill's border + 999px radius across the page. */
.tags{display:flex;flex-wrap:wrap;gap:8px;}
.tags .tag{font-size:12.5px;font-weight:600;color:var(--body);background:var(--soft);border:1px solid var(--line);border-radius:999px;padding:6px 12px;transition:.15s;}
.tags .tag:hover{border-color:var(--brand);color:var(--brand);}

@media(max-width:1040px){
  .layout{grid-template-columns:1fr;gap:40px;}
  .side{position:static;flex-direction:row;flex-wrap:wrap;}
  .scard{flex:1;min-width:240px;}
}
@media(max-width:560px){
  .row{grid-template-columns:1fr;}
  .row .rimg{height:180px;}
  .side{flex-direction:column;}
}
