/*
Theme Name: TNW RU
Theme URI: https://thenextweb.ru
Description: Editorial theme for TheNextWeb.ru — the Russian mirror of thenextweb.com.
Author: thenextweb.ru
Version: 1.0.0
Text Domain: tnw-ru
*/

:root {
    --ink: #0b0b0f;
    --ink-2: #2b2b33;
    --muted: #6b6b76;
    --line: #e6e6ea;
    --paper: #ffffff;
    --paper-2: #f5f5f7;
    --accent: #ff2d55;
    --accent-ink: #d6123e;
    --radius: 6px;
    --wrap: 1240px;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --serif: Georgia, "PT Serif", "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.55 var(--sans);
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--accent); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- Masthead ---------- */
.masthead { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 50; }
.masthead__bar { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.logo { display: inline-flex; align-items: baseline; font-weight: 900; letter-spacing: -0.04em; line-height: 1; color: #fff; }
.logo:hover { color: #fff; }
.logo__mark { font-size: 30px; }
.logo__ru { font-size: 22px; color: var(--accent); margin-left: 1px; }
.masthead__tag { margin: 0; font-size: 13px; color: #a6a6b0; flex: 1; }
.search { display: flex; align-items: center; background: #1d1d24; border-radius: 999px; padding: 2px 4px 2px 14px; min-width: 0; }
.search input { background: transparent; border: 0; color: #fff; font: inherit; font-size: 14px; width: 220px; padding: 8px 0; outline: none; min-width: 0; }
.search input::placeholder { color: #8b8b96; }
.search button { background: transparent; border: 0; color: #fff; padding: 6px 8px; cursor: pointer; display: grid; place-items: center; }
.search button:hover { color: var(--accent); }

.topnav { border-top: 1px solid #22222a; }
.topnav__inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.topnav__inner::-webkit-scrollbar { display: none; }
.topnav a { color: #d8d8de; font-size: 14px; font-weight: 600; padding: 12px 12px; white-space: nowrap; border-bottom: 3px solid transparent; }
.topnav a:hover { color: #fff; }
.topnav a[aria-current="page"] { color: #fff; border-bottom-color: var(--accent); }

main.wrap { padding-block: 28px 56px; }

/* ---------- Shared bits ---------- */
.kicker {
    display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--accent-ink); margin-bottom: 8px;
}
.kicker + .kicker { margin-left: 12px; }
.meta { margin: 0; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.meta span { color: var(--ink-2); font-weight: 600; }
.section-h {
    font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 18px;
    padding-bottom: 10px; border-bottom: 3px solid var(--ink);
}
.is-empty { background: linear-gradient(135deg, #1d1d24, #3a1020); }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 28px; margin-bottom: 40px; }
.hero__lead { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--ink); color: #fff; min-height: 480px; display: flex; }
.hero__media { position: absolute; inset: 0; }
.hero__img { width: 100%; height: 100%; object-fit: cover; }
.hero__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,11,15,0) 30%, rgba(11,11,15,.92) 100%); }
.hero__body { position: relative; align-self: flex-end; padding: 32px; }
.hero__lead .kicker { color: #fff; background: var(--accent); padding: 4px 8px; border-radius: 3px; }
.hero__title { font-size: clamp(26px, 3.2vw, 40px); line-height: 1.12; letter-spacing: -0.02em; margin: 6px 0 12px; font-weight: 800; }
.hero__title a:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; }
.hero__dek { margin: 0 0 14px; color: #d8d8de; font-size: 16px; max-width: 60ch; }
.hero__lead .meta, .hero__lead .meta span { color: #c3c3cc; }

.hero__side { display: flex; flex-direction: column; gap: 18px; }
.mini { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mini:last-child { border-bottom: 0; padding-bottom: 0; }
.mini__media { border-radius: 4px; overflow: hidden; aspect-ratio: 1 / 1; background: var(--paper-2); }
.mini__img { width: 100%; height: 100%; object-fit: cover; }
.mini__title { font-size: 16px; line-height: 1.3; margin: 0 0 6px; font-weight: 750; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }

.row { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 22px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.row:first-of-type { padding-top: 0; }
.row__media { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--paper-2); }
.row__img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.row:hover .row__img { transform: scale(1.03); }
.row__title { font-size: 22px; line-height: 1.22; letter-spacing: -0.01em; margin: 0 0 8px; font-weight: 800; }
.row__dek { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; }

/* ---------- Rail ---------- */
.rail { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 130px; }
.box__h { font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 3px solid var(--ink); }
.ranked { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.ranked li { counter-increment: r; display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 10px 0; border-bottom: 1px solid var(--line); }
.ranked li::before { content: counter(r); grid-row: span 2; font-size: 26px; font-weight: 900; color: var(--accent); line-height: 1; }
.ranked a { font-weight: 700; font-size: 15px; line-height: 1.3; }
.ranked time { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; font-weight: 600; background: var(--paper-2); padding: 6px 10px; border-radius: 999px; }
.chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.chip:hover { background: var(--ink); color: #fff; }
.chip:hover span { color: #bbb; }
.box--accent { background: var(--ink); color: #e4e4ea; padding: 20px; border-radius: var(--radius); font-size: 14px; }
.box--accent .box__h { color: #fff; border-bottom-color: var(--accent); }
.box--accent p { margin: 0 0 10px; }
.box--accent a { color: var(--accent); font-weight: 700; }

/* ---------- Archive ---------- */
.archive-head { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 3px solid var(--ink); }
.archive-head__label { margin: 0 0 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-ink); }
.archive-head__title { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; letter-spacing: -0.03em; font-weight: 900; }
.archive-head__count { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
.pager .page-numbers { padding: 8px 14px; border: 1px solid var(--line); border-radius: 4px; font-weight: 700; font-size: 14px; }
.pager .page-numbers.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager a.page-numbers:hover { border-color: var(--ink); color: var(--ink); }

.empty { max-width: 640px; margin: 40px auto; text-align: center; }
.empty a { color: var(--accent-ink); font-weight: 700; }
.search--big { background: var(--paper-2); margin: 24px auto; max-width: 480px; }
.search--big input { color: var(--ink); width: 100%; }
.search--big button { color: var(--ink); font-weight: 700; padding: 8px 16px; }

/* ---------- Article ---------- */
.layout--article { gap: 56px; }
.article { min-width: 0; }
.article__cats { margin: 0 0 6px; }
.article__title { font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: -0.025em; font-weight: 900; margin: 0 0 16px; }
.article__meta { font-size: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.article__figure { margin: 24px 0 8px; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); }
.article__figure img { width: 100%; }

.prose { font-family: var(--serif); font-size: 19px; line-height: 1.7; color: #1a1a20; max-width: 720px; }
.prose > * { margin: 0 0 1.1em; }
.prose p:first-child { margin-top: 1.2em; }
.prose h2, .prose h3, .prose h4 { font-family: var(--sans); line-height: 1.25; letter-spacing: -0.01em; margin: 1.6em 0 .6em; font-weight: 800; }
.prose h2 { font-size: 26px; }
.prose h3 { font-size: 22px; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose img { border-radius: 4px; margin: 1.4em 0; }
.prose figure { margin: 1.4em 0; }
.prose figcaption { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 6px; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--accent); font-style: italic; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose iframe { max-width: 100%; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 15px; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }

.source { max-width: 720px; margin: 36px 0 0; padding: 20px 22px; background: var(--paper-2); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; font-size: 15px; }
.source p { margin: 0 0 8px; }
.source__label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-ink); }
.source__link { font-weight: 800; }

.related { margin-top: 56px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.card__media { display: block; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--paper-2); margin-bottom: 12px; }
.card__img { width: 100%; height: 100%; object-fit: cover; }
.card__title { font-size: 17px; line-height: 1.3; margin: 0 0 6px; font-weight: 800; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #c3c3cc; padding: 48px 0 24px; font-size: 14px; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.logo--footer .logo__mark { font-size: 36px; }
.footer__about { max-width: 48ch; margin: 14px 0 0; }
.footer__h { color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 12px; }
.footer__links { list-style: none; margin: 0; padding: 0; }
.footer__links li { margin-bottom: 8px; }
.footer__links a:hover { color: var(--accent); }
.footer__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 36px; padding-top: 18px; border-top: 1px solid #22222a; font-size: 12px; color: #8b8b96; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .layout, .layout--article { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .rail { position: static; }
    .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .hero { grid-template-columns: minmax(0, 1fr); }
    .hero__lead { min-height: 400px; }
    .masthead__tag { display: none; }
    .masthead__bar { justify-content: space-between; }
}
@media (max-width: 640px) {
    .wrap { padding-inline: 16px; }
    main.wrap { padding-block: 20px 40px; }
    .search input { width: 120px; }
    .hero__lead { min-height: 360px; }
    .hero__body { padding: 20px; }
    .hero__dek { display: none; }
    .row { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 16px 0; }
    .row__media { aspect-ratio: 1 / 1; }
    .row__title { font-size: 17px; }
    .row__dek { display: none; }
    .prose { font-size: 18px; }
    .grid4 { grid-template-columns: minmax(0, 1fr); }
    .footer__grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}
