/* BrazilNews.live — mobile-first, 3 брейкпоинта (SRS §11.5):
   <768 mobile · 768–1023 tablet (2-col) · ≥1024 desktop (полный layout) */

:root {
  --green: #009739;
  --green-dark: #00722b;
  --yellow: #fedd00;
  --blue: #012169;
  --text: #1c1c1e;
  --muted: #6b7280;
  --bg: #ffffff;
  --bg-soft: #f4f6f4;
  --border: #e3e7e3;
  --max: 1200px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- шапка ---------- */
.site-header { border-bottom: 3px solid var(--green); background: var(--bg); }
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.logo img { height: 32px; width: auto; }
.search-form {
  display: flex;
  flex: 1 1 160px;
  min-width: 140px;
}
.search-form input {
  flex: 1;
  min-height: 44px; /* touch target §11.5 */
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
  font-size: 16px;
}
.search-form button {
  min-height: 44px;
  min-width: 44px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--bg-soft);
  cursor: pointer;
  font-size: 16px;
}
.lang-switch { position: relative; }
.lang-btn {
  min-height: 44px;
  min-width: 56px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 15px;
  text-transform: uppercase;
}
.lang-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
  z-index: 50;
  min-width: 72px;
}
.lang-list li a {
  display: block;
  padding: 10px 14px;
  border-radius: 6px;
  text-transform: uppercase;
  color: var(--text);
}
.lang-list li a:hover, .lang-list li.focus a { background: var(--bg-soft); text-decoration: none; }
.lang-list li[aria-selected="true"] a { color: var(--green-dark); font-weight: 700; }

.site-nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 8px;
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  padding: 10px 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--green-dark); border-bottom-color: var(--yellow); text-decoration: none; }

/* ---------- тикер: CSS-анимация, НЕ JS interval (§11.5) ---------- */
.ticker {
  background: var(--blue);
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
}
.ticker-track {
  display: inline-block;
  padding-left: 100vw;
  animation: ticker-scroll 40s linear infinite;
}
.ticker-item {
  color: #fff;
  margin-right: 48px;
  font-size: 14px;
  line-height: 36px;
}
.ticker-item:hover { color: var(--yellow); }
@keyframes ticker-scroll {
  to { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; padding-left: 16px; }
}

/* ---------- основное ---------- */
.site-main { max-width: var(--max); margin: 0 auto; padding: 16px; }

.hero { margin-bottom: 24px; }
.hero-link { display: block; color: inherit; }
.hero-link:hover { text-decoration: none; }
.hero-media img { width: 100%; border-radius: 12px; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-title { font-size: 26px; line-height: 1.25; margin: 12px 0 8px; }
.hero-lead { color: var(--muted); margin: 0 0 6px; }
.badge-breaking {
  display: inline-block;
  background: #d21f26;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.cluster-feed { margin-bottom: 28px; }
.cluster-title {
  font-size: 20px;
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 4px solid var(--green);
}
.cluster-title a { color: var(--text); }

.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-link { color: inherit; display: block; }
.card-link:hover { text-decoration: none; }
.card-link:hover .card-title { color: var(--green-dark); }
.card-media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card-title { font-size: 17px; line-height: 1.3; margin: 10px 12px 6px; }
.card-lead {
  color: var(--muted);
  font-size: 14px;
  margin: 0 12px 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { font-size: 13px; color: var(--muted); margin: 0 12px 12px; }
.card-breaking { border-color: #d21f26; }

/* ---------- cross-cluster CTA (§10.6) ---------- */
.cta-block { margin: 28px 0; display: grid; gap: 12px; }
.cta {
  display: block;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--yellow);
  border-radius: 10px;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text);
}
.cta:hover { border-left-color: var(--green); text-decoration: none; color: var(--green-dark); }

/* ---------- раздел ---------- */
.section-title { font-size: 26px; margin: 4px 0 16px; padding-left: 10px; border-left: 4px solid var(--green); }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 24px 0;
}
.pagination a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
}
.page-info { color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); }

/* ---------- статья ---------- */
.article { max-width: 760px; margin: 0 auto; }
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.article-title { font-size: 28px; line-height: 1.22; margin: 6px 0 8px; }
.article-meta { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.article-hero img { width: 100%; border-radius: 12px; aspect-ratio: 16 / 9; object-fit: cover; }
.article-lead { font-size: 19px; line-height: 1.5; font-weight: 500; margin: 16px 0; }
.article-body { font-size: 17px; }
.article-body h2, .article-body h3 { line-height: 1.3; margin: 24px 0 8px; }
.article-body img { border-radius: 8px; }

/* Key Facts (§6.3, §9.2): speakable-селектор .key-facts */
.article-body .key-facts, .key-facts {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 20px 0;
}
.key-facts strong { display: block; margin-bottom: 6px; color: var(--green-dark); }
.key-facts ul { margin: 0; padding-left: 20px; }
.key-facts li { margin: 4px 0; }

/* native ad (§13) */
.native-ad {
  background: #fffbe6;
  border: 1px solid #f0e6b8;
  border-radius: 10px;
  padding: 14px 18px;
  margin: 20px 0;
}
.native-ad .ad-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.native-ad p { margin: 0 0 8px; }
.platform-ad strong { display: block; margin: 0 0 6px; } /* M10 §13 */

/* M10 §14: кнопка подписки на breaking-пуши */
.push-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  color: inherit;
  cursor: pointer;
}
.push-btn:hover { border-color: var(--green-dark); }
.footer-push { margin: 10px 0 4px; }

.article-source { font-size: 14px; color: var(--muted); margin: 18px 0 6px; }
.article-tags { font-size: 14px; }
.tag { color: var(--green-dark); margin-right: 6px; }

.prev-next {
  max-width: 760px;
  margin: 24px auto;
  display: grid;
  gap: 12px;
}
.pn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: inherit;
  display: block;
}
.pn span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.pn:hover { text-decoration: none; border-color: var(--green); }
.pn-next { text-align: right; }

/* ---------- поиск ---------- */
.search-page-form { display: flex; max-width: 560px; margin: 0 0 20px; }
.search-page-form input {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px 0 0 8px;
}
.search-page-form button {
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  border-radius: 0 8px 8px 0;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.search-results-title { font-size: 18px; margin: 0 0 14px; }

/* ---------- статичные страницы и ошибки ---------- */
.static-page { max-width: 760px; margin: 0 auto; }
.static-page h1 { font-size: 28px; }
.error-page { text-align: center; padding: 40px 0; }
.error-code { font-size: 72px; font-weight: 800; color: var(--green); margin: 0; line-height: 1; }
.error-sections { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.error-sections a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ---------- футер ---------- */
.site-footer { border-top: 3px solid var(--green); background: var(--bg-soft); margin-top: 32px; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 20px 16px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 10px; }
.footer-nav a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }
.footer-langs a {
  text-transform: uppercase;
  margin-right: 12px;
  color: var(--muted);
  padding: 6px 4px;
}
.footer-langs a.active { color: var(--green-dark); font-weight: 700; }
.footer-contact { margin: 4px 0; }
.footer-copy { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

/* ---------- tablet ≥768 (§11.5): 2-col grid ---------- */
@media (min-width: 768px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-link { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: center; }
  .hero-title { margin-top: 0; }
  .cta-block { grid-template-columns: repeat(2, 1fr); }
  .prev-next { grid-template-columns: 1fr 1fr; }
  .article-title { font-size: 32px; }
}

/* ---------- desktop ≥1024 (§11.5): полный layout ---------- */
@media (min-width: 1024px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
  .section-grid { grid-template-columns: repeat(4, 1fr); }
  .hero-title { font-size: 32px; }
  .card-title { font-size: 16px; }
}

/* ============ M11 (§11.4, §12, §14): share, auth, комментарии, newsletter ============ */

/* reader.js управляет видимостью атрибутом hidden; классы с display:grid/flex
   не должны его перебивать (иначе форма комментария видна без входа) */
[hidden] { display: none !important; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--green);
  color: #fff;
  border: 0;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
.btn:hover { background: var(--green-dark); color: #fff; text-decoration: none; }
.btn-danger { background: #b3261e; }
.btn-danger:hover { background: #8c1d17; }
.btn-google { background: var(--blue); margin-top: 8px; }
.btn-google:hover { background: #001a4d; }
.btn-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--green-dark);
  font-size: 14px;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- share (§11.4): круглые иконки в цветах сетей ---------- */
.share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 20px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;                  /* §11.5: touch targets */
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  padding: 0;
  transition: transform .12s ease, filter .12s ease;
}
.share-btn svg { width: 22px; height: 22px; }
.share-btn:hover { transform: translateY(-2px) scale(1.06); filter: brightness(1.08); text-decoration: none; color: #fff; }
.share-tg   { background: #229ed9; }
.share-wa   { background: #25d366; }
.share-x    { background: #14171a; }
.share-copy { background: var(--green); }
.share-copy.copied { background: var(--green-dark); }
.share-fallback { width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 6px; }

/* ---------- страницы auth (§12) ---------- */
.auth-page { max-width: 420px; margin: 0 auto; padding: 8px 0 32px; }
.auth-page h1 { font-size: 26px; }
.auth-page form { display: grid; gap: 14px; margin: 16px 0; }
.auth-page label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.auth-page input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  color: var(--text);
}
.auth-page small { color: var(--muted); }
.auth-links { font-size: 14px; }
.auth-email { color: var(--muted); }
.auth-msg {
  background: var(--bg-soft);
  border-left: 3px solid var(--green);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 14px;
  margin: 12px 0;
}
.auth-msg-error { border-left-color: #b3261e; }
.danger-zone { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ---------- комментарии (§12.3) ---------- */
.comments { max-width: 720px; margin: 32px auto 0; padding: 0 0 24px; }
.comments h2 { font-size: 22px; }
.comments-login { font-size: 14px; }
.comment-form { display: grid; gap: 10px; margin: 12px 0 20px; }
.comment-form textarea {
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  resize: vertical;
}
.comment-form .btn { justify-self: start; }
.comment { border-top: 1px solid var(--border); padding: 14px 0 8px; }
.comment-reply { margin-left: 24px; border-top: 1px dashed var(--border); }
.comment-head { display: flex; gap: 10px; align-items: baseline; margin: 0 0 6px; }
.comment-head time { color: var(--muted); font-size: 13px; }
.comment-body { margin: 0 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-del { color: var(--muted); font-style: italic; }
.comment-actions { display: flex; gap: 16px; margin: 0 0 8px; }
.comment-like {
  background: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2px 12px;
  min-height: 28px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.comment-like.liked { color: #b3261e; border-color: #b3261e; }
.comments-none { color: var(--muted); }

/* ---------- newsletter в футере (§14) ---------- */
.footer-newsletter { margin: 16px 0 8px; }
.footer-newsletter label { display: block; font-size: 14px; margin-bottom: 6px; }
.nl-row { display: flex; gap: 8px; max-width: 420px; margin: 0 auto; }
.nl-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.nl-msg { font-size: 13px; color: var(--green-dark); margin: 6px 0 0; }

/* ---------- desktop ≥1024 (§11.5): sticky share sidebar ---------- */
@media (min-width: 1024px) {
  .article { position: relative; padding-left: 68px; }
  .article .share {
    position: sticky;
    top: 20px;
    float: left;
    margin: 4px 0 0 -68px;
    width: 44px;
    flex-direction: column;
    gap: 12px;
  }
}
