/* rainsnews.com — modern news theme */

:root {
  --fg:        #0f172a;
  --fg-soft:   #334155;
  --muted:     #64748b;
  --bg:        #ffffff;
  --bg-soft:   #f8fafc;
  --line:      #e5e7eb;
  --line-strong: #cbd5e1;
  --accent:    #b91c1c;          /* news red */
  --accent-h:  #991b1b;
  --link:      #1d4ed8;
  --max:       1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
                "Helvetica Neue", Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky; top: 0; z-index: 50;
}
.topbar-row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.65rem 1rem;
}

.brand {
  display: inline-flex; align-items: center; gap: .35rem;
  font-weight: 800; letter-spacing: -0.02em;
  color: var(--fg); flex-shrink: 0;
  font-size: 1.25rem;
}
.brand-mark {
  display: inline-grid; place-items: center;
  width: 1.6em; height: 1.6em;
  background: var(--accent); color: #fff;
  border-radius: 6px; font-size: .9em;
}
.brand-name { letter-spacing: -.025em; }

.regions {
  display: flex; gap: 0.4rem; flex: 1; min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.regions::-webkit-scrollbar { display: none; }
.regions a {
  padding: .35rem .75rem; border-radius: 999px;
  color: var(--fg-soft); font-size: .92rem; font-weight: 500;
  white-space: nowrap;
}
.regions a:hover { background: var(--bg-soft); color: var(--fg); }
.regions a.on { background: var(--fg); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: .25rem; flex-shrink: 0; }
.lang { display: flex; gap: 2px; }
.lang a {
  padding: .25rem .5rem; font-size: .8rem; font-weight: 600;
  color: var(--muted); border-radius: 4px;
}
.lang a.on { color: var(--accent); background: var(--bg-soft); }

.hamburger {
  display: none;
  width: 36px; height: 36px; padding: 8px;
  background: transparent; border: 0; cursor: pointer;
  flex-direction: column; justify-content: space-between;
}
.hamburger span { display: block; height: 2px; background: var(--fg); border-radius: 2px; }

/* Categories bar — strong nav */
.cats {
  display: flex; gap: 0; align-items: stretch;
  border-top: 1px solid var(--line);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cats a {
  padding: .65rem 1rem;
  font-size: .92rem; font-weight: 600;
  color: var(--fg-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.cats a:hover { color: var(--accent); }
.cats a.on    { color: var(--accent); border-bottom-color: var(--accent); }

/* ============================================================
   Mobile (<= 720px)
   ============================================================ */
@media (max-width: 720px) {
  .topbar-row { padding: .5rem .75rem; gap: .5rem; }
  .brand { font-size: 1.1rem; }
  .brand-name { display: none; }       /* show only the R mark */
  .hamburger { display: inline-flex; }
  .regions {
    position: absolute; left: 0; right: 0; top: 100%;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; padding: .25rem .75rem .5rem;
    display: none;
  }
  body.nav-open .regions { display: flex; }
  .regions a { padding: .55rem .25rem; border-radius: 0; border-bottom: 1px solid var(--bg-soft); }
  .regions a.on { background: transparent; color: var(--accent); }
  .cats a { padding: .55rem .8rem; font-size: .88rem; }
}

/* ============================================================
   Hero / section heading
   ============================================================ */
.hero {
  padding: 1.4rem 0 0.6rem;
  display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap;
}
.hero h1 {
  font-size: 1.6rem; margin: 0; letter-spacing: -.01em;
  font-weight: 800;
}
.hero h1::before {
  content: ''; display: inline-block;
  width: 4px; height: 1.1em; background: var(--accent);
  vertical-align: -.18em; margin-right: .5rem; border-radius: 2px;
}
.lede { color: var(--muted); margin: 0; font-size: .95rem; }

/* ============================================================
   Card grid
   ============================================================ */
.cards {
  list-style: none; padding: 1rem 0 2.5rem; margin: 0;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.card-link { display: block; color: inherit; }
.card-img {
  width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block;
  background: var(--bg-soft);
}
.card-body { padding: .85rem 1rem 1rem; }

.meta {
  font-size: .75rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  display: flex; gap: .35rem; align-items: center;
}
.meta a { color: var(--accent); font-weight: 600; }

.card-title {
  font-size: 1.05rem; margin: .4rem 0 .4rem;
  line-height: 1.35; font-weight: 700; color: var(--fg);
}
.card-lead { font-size: .92rem; color: var(--fg-soft); margin: 0; line-height: 1.5; }

/* Featured card variant — first in the list takes 2 columns on wider screens */
@media (min-width: 900px) {
  .cards .card:first-child { grid-column: span 2; }
  .cards .card:first-child .card-img { aspect-ratio: 21/9; }
  .cards .card:first-child .card-title { font-size: 1.45rem; }
  .cards .card:first-child .card-lead  { font-size: 1rem; }
}

.empty { color: var(--muted); padding: 2rem 0 4rem; text-align: center; font-size: .95rem; }

/* Pagination */
.pagination {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  justify-content: center;
  padding: 1.5rem 0 3rem;
  font-size: .92rem;
}
/* Single shared "chip" style for every clickable + current + disabled item */
.pg-btn,
.pg-nums > li > a,
.pg-nums > li.pg-cur,
.pg-nums > li.pg-ellipsis {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.4rem; height: 2.4rem;
  padding: 0 .8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--fg-soft);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.pg-btn:hover,
.pg-nums > li > a:hover {
  border-color: var(--accent); color: var(--accent);
}
.pg-disabled,
.pg-disabled:hover {
  opacity: .4; cursor: default;
  border-color: var(--line); color: var(--fg-soft);
}
.pg-nums { list-style: none; padding: 0; margin: 0;
  display: inline-flex; gap: .35rem; align-items: center; }
.pg-nums > li.pg-cur {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
  cursor: default;
}
.pg-nums > li.pg-ellipsis {
  border: 0; background: transparent; min-width: 1.2rem; padding: 0 .25rem;
  color: var(--muted);
}
@media (max-width: 720px) {
  .pg-btn, .pg-nums > li > a, .pg-nums > li.pg-cur {
    min-width: 2.2rem; height: 2.2rem; padding: 0 .55rem;
  }
  .pagination { font-size: .88rem; gap: .35rem; }
}

/* ============================================================
   Article page
   ============================================================ */
.article {
  padding: 1.5rem 0 3rem; max-width: 760px; margin: 0 auto;
}
.article-head { margin-bottom: 1.4rem; }
.article-head .meta { font-size: .8rem; }
.article-head h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem);
  margin: .55rem 0; line-height: 1.18;
  letter-spacing: -.015em; font-weight: 800;
}
.article-head .lead {
  font-size: 1.1rem; color: var(--fg-soft); line-height: 1.55;
  margin: .8rem 0;
}
.byline { font-size: .9rem; color: var(--muted); }
.byline a { color: var(--fg-soft); border-bottom: 1px dotted var(--line-strong); }

.hero-img { margin: 1rem 0 1.5rem; }
.hero-img img { width: 100%; border-radius: 6px; aspect-ratio: 16/9; object-fit: cover; }
.hero-img figcaption { color: var(--muted); font-size: .82rem; margin-top: .35rem; }

.article-body { font-size: 1.05rem; line-height: 1.75; color: var(--fg); }
.article-body p  { margin: 1.05rem 0; }
.article-body h2 { margin: 2rem 0 .8rem; font-size: 1.25rem; }
.article-body h3 { margin: 1.6rem 0 .6rem; font-size: 1.1rem; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li { margin: .35rem 0; }
.article-body a { color: var(--link); }

.cite a {
  color: var(--accent); text-decoration: none;
  font-weight: 600; font-size: .8em;
  padding: 0 .15em;
}
.cite a:hover { text-decoration: underline; }

/* Google Reader Revenue Manager inline CTAs — wrap so they don't bleed full-width. */
.rrm-cta {
  margin: 1.6rem 0;
  min-height: 4rem;   /* keep height while SwG renders, prevents layout jump */
}
.rrm-cta-register { margin-top: 2rem; }

/* Gallery */
.gallery { margin-top: 2rem; }
.gallery h2 { margin: 1.5rem 0 .8rem; font-size: 1.1rem; }
.gallery-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.gallery-grid img {
  width: 100%; aspect-ratio: 1.4; object-fit: cover;
  border-radius: 6px; display: block; background: var(--bg-soft);
}
.gallery-grid figcaption { font-size: .72rem; color: var(--muted); padding: .25rem .15rem 0; }

/* Sources */
.sources {
  margin-top: 2.5rem; padding-top: 1.2rem;
  border-top: 1px solid var(--line); font-size: .92rem;
}
.sources h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
.sources ol { padding-left: 1.4rem; }
.sources li { padding: .25rem 0; }
.sources li:target {
  background: #fef3c7; padding: .35rem .55rem;
  border-radius: 4px; margin-left: -.55rem;
}
.sources a { color: var(--link); }

/* Static pages */
.article.static h2 { font-size: 1.15rem; margin-top: 1.7rem; color: var(--fg); }
.article.static ul, .article.static ol { padding-left: 1.4rem; }
.article.static li { margin: .25rem 0; }
.article.static code {
  background: var(--bg-soft); padding: 0 .35rem;
  border-radius: 3px; font-size: .9em;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0;
  background: var(--bg-soft);
  color: var(--muted); font-size: .9rem; margin-top: 3rem;
}
.footer-grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.footer-grid h4 { font-size: .85rem; text-transform: uppercase;
                  letter-spacing: .06em; color: var(--fg-soft);
                  margin: 0 0 .5rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { padding: .15rem 0; }
.footer-grid a { color: var(--muted); }
.footer-grid a:hover { color: var(--accent); }
.brand-line { font-weight: 600; color: var(--fg-soft); margin: 0 0 .25rem; }

/* Creator application form */
.apply-form { max-width: 720px; }
.creator-form { margin-top: 2rem; }
.creator-form .row { margin: 1.1rem 0; }
.creator-form .row.inline { display: flex; gap: 1rem; flex-wrap: wrap; }
.creator-form .row.inline label { flex: 1 1 200px; }
.creator-form label {
  display: block; font-weight: 600; font-size: .92rem; color: var(--fg-soft);
}
.creator-form input, .creator-form select, .creator-form textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; margin-top: .3rem; background: #fff;
}
.creator-form textarea { resize: vertical; }
.creator-form .req { color: var(--accent); }
.creator-form .row.has-error input,
.creator-form .row.has-error select,
.creator-form .row.has-error textarea,
.creator-form .has-error input,
.creator-form .has-error select { border-color: var(--accent); }
.creator-form .form-error { color: var(--accent); font-weight: 600; }
.creator-form .btn.primary {
  background: var(--accent); color: #fff; border: 0; padding: .7rem 1.5rem;
  border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 1rem;
}
.creator-form .btn.primary:hover { background: var(--accent-h); }
.creator-form small.muted { font-size: .8rem; }

.hero-uploader {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  margin: .35rem 0;
  border: 1px dashed var(--line-strong); border-radius: 6px;
  padding: .8rem; background: var(--bg-soft);
}
.hero-uploader input[type=file] { width: auto; padding: .4rem; }
.hero-uploader img[data-uploader-preview] {
  max-width: 280px; max-height: 160px; height: auto; border-radius: 4px;
  object-fit: cover;
}
.hero-uploader [data-uploader-clear] {
  background: #fff; color: var(--accent); border: 1px solid var(--accent);
  padding: .35rem .8rem; border-radius: 4px; cursor: pointer; font-size: .85rem;
}

#tui-editor { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
