@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@700;800&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #ffffff;
  --bg-secondary: #f9fafb;
  --text: #0f0f0f;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --border: #e5e7eb;
  --accent: #fff000;
  --accent-dark: #eadb00;
  --radius: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-w: 640px;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: var(--text); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* ===== HEADER ===== */
.hdr {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 120px;
}

.hdr::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 30%, transparent 100%);
  pointer-events: none;
}

.hdr__inner {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  align-items: center;
}

.hdr__random {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1.5px solid var(--text);
  padding: 5px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.hdr__random:hover {
  background: var(--text);
  color: var(--bg);
}

/* Лого — pill + typewriter */
.logo {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  border-radius: 100px;
  padding: 7px 16px;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1;
  cursor: pointer;
  transition: transform 150ms ease;
  user-select: none;
  white-space: nowrap;
}
.logo:hover { transform: scale(1.03); }
.logo:active { transform: scale(0.97); }

.logo__name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.logo__typed {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-left: 1px;
}

.logo__cursor {
  font-size: 15px;
  font-weight: 500;
  animation: blink 800ms step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ===== FEED ===== */
.feed {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px 16px;
}

/* ===== HERO ===== */
.hero {
  display: block;
  margin-bottom: 32px;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent);
  transition: transform 200ms ease;
}
.hero:hover { transform: scale(1.01); }

.hero__img-wrap {
  overflow: hidden;
  border-radius: 0;
  margin: 0;
}

.hero__img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 500ms ease;
}
.hero:hover .hero__img { transform: scale(1.02); }

.hero__body {
  padding: 20px;
}

.hero__title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 10px;
}

.hero__excerpt {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(0,0,0,0.6);
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero__meta {
  font-size: 13px;
  color: rgba(0,0,0,0.4);
}

.hero__cta {
  font-size: 14px;
  font-weight: 600;
  color: var(--bg);
  background: var(--text);
  padding: 8px 18px;
  border-radius: 100px;
  transition: transform 150ms ease;
}
.hero:hover .hero__cta { transform: scale(1.05); }

/* ===== СПИСОК ПОСТОВ ===== */
.list { margin-top: 8px; }

.item {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 12px 0;
  cursor: pointer;
}

.item__thumb {
  width: 100px;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
}

.item__thumb-empty {
  width: 100px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.item__title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-size: 0% 100%;
  background-repeat: no-repeat;
  transition: background-size 300ms ease;
  display: inline;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.item:hover .item__title { background-size: 100% 100%; }

.item__meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===== СТАТЬЯ ===== */
.article { margin-bottom: 32px; }

.article__hero {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.article__hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article__meta {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.article__title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.article__content {
  font-size: 18px;
  line-height: 1.8;
  color: #1a1a1a;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-rendering: optimizeLegibility;
  hanging-punctuation: first last;
  text-wrap: pretty;
  word-spacing: 0.03em;
  font-variant-numeric: oldstyle-nums;
}

.article__content > p:first-of-type {
  font-weight: 600;
}


.article__content p { margin-bottom: 1.25em; }
.article__content h2 { font-size: 22px; font-weight: 700; margin: 2em 0 0.75em; }
.article__content h3 { font-size: 19px; font-weight: 700; margin: 1.5em 0 0.5em; }
.article__content img { border-radius: var(--radius); margin: 1.5em 0; }

.article__content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 1.5em 0;
  color: var(--text-secondary);
}

.article__content a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.article__content a:hover { background: var(--accent); }

/* ===== ПАГИНАЦИЯ ===== */
.pager { margin-top: 40px; }

.pager__progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.pager__bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.pager__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 300ms ease;
}

.pager__count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.pager__next {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 20px 32px;
  margin: 40px 0;
  background: var(--accent);
  border-radius: 100px;
  cursor: pointer;
  transition: transform 150ms ease;
  gap: 16px;
  min-height: 52px;
}
.pager__next:hover { transform: scale(1.01); }
.pager__next--center { justify-content: center; width: auto; display: inline-flex; }

.pager__next-text { flex: 1; }

.pager__next-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(0,0,0,0.5);
  margin-bottom: 2px;
}

.pager__next-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pager__next-arrow {
  font-size: 24px;
  color: var(--text);
  flex-shrink: 0;
}

.pager__tabs {
  display: flex;
  gap: 0;
  margin-top: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--border);
}

.pager__tab {
  flex: 1;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  background: var(--bg);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  border-right: 1.5px solid var(--border);
}
.pager__tab:last-child { border-right: none; }
.pager__tab:hover { background: var(--bg-secondary); color: var(--text); }
.pager__tab--active { background: var(--accent); color: var(--text); }
.pager__tab--active:hover { background: var(--accent); }

/* Склейка кнопки + картинки рекомендации */
.pager__next + .pager__rec-img { margin-top: 0; }
.pager__next:has(+ .pager__rec-img) {
  border-radius: 24px 24px 0 0;
  margin-bottom: 0;
  padding: 20px 32px;
}

.pager__rec-img {
  display: block;
  border-radius: 0 0 24px 24px;
  overflow: hidden;
  margin-bottom: 40px;
}

.pager__rec-img img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 500ms ease;
}

.pager__rec-img:hover img { transform: scale(1.02); }

.pager--top { margin-top: 0; margin-bottom: 24px; }
.pager--top .pager__tabs { margin-top: 0; }

/* ===== КАТЕГОРИЯ ===== */
.cat-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.cat-header__name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cat-header__badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: var(--accent);
  padding: 3px 12px;
  border-radius: 100px;
  letter-spacing: 0.05em;
}

.cat-header__desc {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 15px;
}

/* ===== FOOTER ===== */
.ftr {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px 16px 48px;
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
}

.ftr__links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.ftr__links a {
  color: var(--text-tertiary);
  transition: color 150ms ease;
}
.ftr__links a:hover { color: var(--text); }

/* ===== STATIC PAGES ===== */
.static {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px;
}

.static h1 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
}

.static h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 24px 0 8px;
}

.static p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ===== 404 ===== */
.err { text-align: center; padding: 80px 16px; }
.err__code { font-size: 72px; font-weight: 800; color: var(--accent); line-height: 1; }
.err__text { font-size: 18px; color: var(--text-secondary); margin-top: 12px; }
.err__link {
  display: inline-block;
  margin-top: 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  border: 1.5px solid var(--text);
  padding: 8px 20px;
  border-radius: 100px;
  transition: background 150ms ease, color 150ms ease;
}
.err__link:hover { background: var(--text); color: var(--bg); }

/* ===== HOME NAV ===== */
.home-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.home-nav__back {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  border: 1.5px solid var(--text);
  color: var(--text);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  flex-shrink: 0;
}
.home-nav__back:hover {
  background: var(--text);
  color: var(--bg);
}

.home-page-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-page-label__arrow {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}
.home-page-label__arrow:hover {
  border-color: var(--text);
  color: var(--text);
}

.home-nav__next {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  background: var(--accent);
  padding: 14px 32px;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 150ms ease;
}
.home-nav__next:hover { transform: scale(1.03); }

/* ===== ADS ===== */
.ad-block {
  margin: 20px 0;
  text-align: center;
  min-height: 50px;
  overflow: hidden;
}

/* ===== END CTA ===== */
.end-cta {
  margin: 40px 0;
  text-align: center;
}

.end-cta__title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.end-cta__buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.end-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 100px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 150ms ease;
  border: none;
  font-family: var(--font);
}
.end-cta__btn:hover { transform: scale(1.03); }

.end-cta__btn--primary {
  background: var(--accent);
  color: var(--text);
}

.end-cta__btn--share {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--text);
}
.end-cta__btn--share {
  position: relative;
}
.end-cta__btn--share:hover {
  background: var(--text);
  color: var(--bg);
}

.end-cta__btn--primary {
  position: relative;
}

.end-cta__bonus {
  position: absolute;
  top: -6px;
  right: 20px;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  line-height: 1;
}

.end-cta__bonus--dark {
  background: var(--text);
  color: var(--bg);
}

.end-cta__share {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.end-cta__share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text);
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background 150ms ease;
}
.end-cta__share-btn:hover { background: var(--border); }
.end-cta__share-btn svg { flex-shrink: 0; }

/* ===== ТАКЖЕ ЧИТАЮТ ===== */
.also-read {
  margin-top: 40px;
}

.also-read__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* ===== GAMIFICATION ===== */

/* Бейдж в шапке */
.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  transition: transform 200ms ease;
}

.points-badge--pulse {
  animation: badge-pulse 400ms ease;
}

@keyframes badge-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); filter: drop-shadow(0 0 6px var(--accent)); }
  100% { transform: scale(1); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 100px;
  z-index: 300;
  opacity: 0;
  transition: transform 300ms ease, opacity 300ms ease;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.toast--visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Achievement-блок */
.achievement {
  text-align: center;
  padding: 24px;
  margin: 32px 0;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.achievement__icon {
  margin-bottom: 8px;
}

.achievement__text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.achievement__level {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.achievement__progress {
  max-width: 300px;
  margin: 0 auto;
}

.achievement__bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.achievement__fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 500ms ease;
}

.achievement__next {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: right;
}

/* ===== TELEGRAM CTA ===== */
.end-cta__btn--tg {
  background: #2AABEE;
  color: var(--bg);
  border: none;
  position: relative;
  gap: 8px;
}
.end-cta__btn--tg:hover { background: #229ED9; transform: scale(1.03); }
.end-cta__btn--tg svg { fill: var(--bg); }

.end-cta__bonus--tg {
  background: var(--accent);
  color: var(--text);
}

/* ===== LEVEL UP MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal__emoji {
  position: absolute;
  pointer-events: none;
  animation: emoji-float 2s ease-out forwards;
  opacity: 0;
}

@keyframes emoji-float {
  0% { transform: scale(0) rotate(0deg); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(1) rotate(20deg); opacity: 0.8; }
}

.modal__wrap {
  position: relative;
  z-index: 1;
  text-align: center;
}

.modal__title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
}

.modal {
  display: inline-block;
  text-align: left;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 360px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  width: 100%;
  animation: modal-in 300ms ease;
}

@keyframes modal-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal__canvas {
  width: 100%;
  height: auto;
  display: block;
}

.modal__buttons {
  display: flex;
  gap: 8px;
  padding: 16px;
}

.modal__btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
  transition: transform 150ms ease;
}
.modal__btn:hover { transform: scale(1.03); }

.modal__btn--share {
  background: var(--accent);
  color: var(--text);
}

.modal__btn--close {
  background: var(--border);
  color: var(--text);
}

/* ===== READING PROGRESS BAR ===== */
.reading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--accent);
  z-index: 200;
  transition: width 100ms linear;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .hero__title { font-size: 20px; }
  .hero__body { padding: 16px; }
  .item { grid-template-columns: 80px minmax(0, 1fr); gap: 14px; padding: 10px 0; }
  .item__title {
    font-size: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .item__thumb, .item__thumb-empty { width: 80px; height: 80px; }
  .article__title { font-size: 24px; }
  .article__content { font-size: 17px; line-height: 1.75; }
  .pager__tab-full { display: none; }
  .item__title, .hero__title { background-image: none !important; }
  .end-cta__buttons { flex-direction: column; }
  .end-cta__btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; transform: none !important; }
  .logo__cursor { animation: none; }
}
