/*
Theme Name: Кибергазета
Description: Адаптивная тема для игрового и новостного издания.
Version: 1.3.0
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: kibergazeta
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

:root {
  --paper: #f8f4ed;
  --panel: #f3ede4;
  --line: #d7cec2;
  --line-dark: #c5baab;
  --ink: #171513;
  --muted: #61584e;
  --serif: Georgia, 'Times New Roman', serif;
  --masthead: Georgia, 'Times New Roman', serif;
  --frame: 1400px;
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 0%, #fdf9f3, transparent 75%), var(--paper);
  font: 16px/1.55 var(--serif);
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }
:focus-visible { outline: 2px solid #805a30; outline-offset: 3px; }
img { max-width: 100%; height: auto; vertical-align: middle; }
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
.container { margin-inline: auto; max-width: var(--frame); width: calc(100% - clamp(28px, 6vw, 88px)); }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 100000; background: var(--ink); color: var(--paper); width: auto; height: auto; padding: 10px; clip-path: none; }
.header-row {
  min-height: 83px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 0 7px;
  border-bottom: 1px solid var(--line-dark);
}
.masthead { text-align: center; min-width: 0; }
.brand {
  display: block;
  font: 700 clamp(30px, 4.45vw, 66px)/.96 var(--masthead);
  letter-spacing: .055em;
  text-transform: uppercase;
  text-decoration: none;
  color: #0f0e0d;
  overflow-wrap: anywhere;
  transform: scaleX(.83);
}
.brand:hover { text-decoration: none; }
.custom-logo { max-height: 61px; width: auto; max-width: min(44vw, 430px); }
.tagline {
  margin-top: 5px;
  font: 600 9px/1.15 system-ui, sans-serif;
  letter-spacing: .23em;
  text-transform: uppercase;
}
.header-actions { justify-self: end; display: flex; gap: clamp(10px, 2vw, 28px); align-items: center; font-size: 11px; white-space: nowrap; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 11px;
  min-height: 28px;
  line-height: 1.2;
  text-align: center;
  border: 1px solid var(--line-dark);
  font-size: 11px;
}
.button:hover { background: #eee5d8; text-decoration: none; }
.button-dark { padding-inline: 15px; color: #fff9ee; background: #181817; border-color: #181817; }
.button-dark:hover { background: #42362d; }
.search-form { display: flex; align-items: center; width: min(150px, 100%); }
.search-form input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: 4px 3px; font-size: 11px; }
.search-form input::placeholder { color: var(--ink); opacity: 1; }
.search-form button { flex: 0 0 22px; height: 28px; padding: 0 5px 0 0; border: 0; background: transparent; color: var(--ink); }
.search-icon { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid currentColor; position: relative; vertical-align: 1px; }
.search-icon::after { content: ''; position: absolute; width: 5px; height: 1.5px; background: currentColor; transform: rotate(45deg); left: 6px; top: 7px; }
.site-nav > ul { display: flex; justify-content: center; gap: clamp(10px, 4.7vw, 68px); margin: 0; }
.site-nav ul, .footer-nav ul { list-style: none; padding: 0; }
.site-nav li { position: relative; }
.site-nav a { display: block; padding: 10px 8px 9px; text-transform: uppercase; font-size: 11px; white-space: nowrap; }
.site-nav .current-menu-item > a, .site-nav .current-menu-ancestor > a { font-weight: 700; box-shadow: inset 0 -2px var(--ink); }
.site-nav .sub-menu { display: none; position: absolute; z-index: 5; top: 100%; left: 0; margin: 0; background: var(--paper); min-width: max-content; padding: 2px 5px; border: 1px solid var(--line); }
.site-nav li:hover > .sub-menu, .site-nav li:focus-within > .sub-menu { display: block; }

.home-layout {
  display: grid;
  grid-template-columns: minmax(140px, 16%) minmax(0, 1fr) minmax(185px, 20%);
  grid-template-areas: 'news center popular';
  border: 1px solid var(--line);
}
.home-center { grid-area: center; min-width: 0; border-inline: 1px solid var(--line); }
.news-rail { grid-area: news; }
.popular-rail { grid-area: popular; }
.rail { padding: 12px clamp(10px, 1.24vw, 19px) 14px; min-width: 0; }
.rail h2 { font-size: 11px; text-transform: uppercase; line-height: 1.25; }
.rail ul, .rail ol { list-style: none; padding: 0; margin: 3px 0 0; }
.rail li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.rail li:last-child { border-bottom: 0; }
.rail-title { display: block; font-size: clamp(11px, .91vw, 14px); line-height: 1.26; overflow-wrap: anywhere; }
.rail time, .card time { display: block; color: var(--muted); font-size: 9px; line-height: 1.2; }
.news-rail time { margin-bottom: 4px; }
.popular-periods { display: flex; margin-top: 8px; border: 1px solid var(--line-dark); }
.popular-periods a { width: 50%; padding: 4px; text-align: center; font-size: 11px; }
.popular-periods a[aria-current="true"] { background: var(--ink); color: var(--paper); }
.trailer-rail { margin-top: 14px; border-top: 1px solid var(--line-dark); padding-top: 13px; }
.trailer-card { display: block; }
.trailer-image { display: block; position: relative; aspect-ratio: 16 / 9; background: #d8cbbc; margin-bottom: 5px; }
.trailer-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.trailer-play { position: absolute; left: 8px; bottom: 7px; display: grid; place-items: center; width: 23px; height: 19px; background: #181817; }
.trailer-play::after { content: ''; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid #fff9ee; }
.ranked li {
  display: grid;
  grid-template-columns: max-content clamp(42px, 5.1vw, 71px) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 101px;
}
.rank { width: .7em; line-height: 1; text-align: left; font-size: 18px; font-weight: 700; }
.rank-image { aspect-ratio: 4 / 5; background: #e2d9ca; }
.rank-image img { width: 100%; height: 100%; object-fit: cover; }
.rank-content .rail-title { font-size: clamp(10px, .88vw, 13px); }
.rank-content time { margin-top: 7px; }
.rail .empty-text { margin-top: 10px; font-size: 13px; }

.headlines {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 13px;
}
.headlines.has-secondary { grid-template-columns: minmax(0, 2.08fr) minmax(0, 1fr); }
.lead-stack { display: grid; grid-auto-rows: minmax(0, 1fr); gap: 8px; min-width: 0; }
.lead {
  position: relative;
  display: grid;
  align-items: end;
  min-width: 0;
  isolation: isolate;
  overflow: hidden;
  background: #342e29;
  color: #fffdf6;
}
.lead-main, .lead-empty { min-height: clamp(265px, 26vw, 388px); }
.lead::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, transparent 24%, rgba(18, 14, 10, .2) 47%, rgba(13, 10, 8, .92) 100%);
}
.lead-img, .lead-img-secondary { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.lead-img { object-position: center 44%; }
.lead-content { padding: clamp(13px, 1.8vw, 29px); padding-bottom: clamp(9px, 1.2vw, 18px); }
.lead h2 { max-width: 24ch; margin: 3px 0 4px; font-size: clamp(23px, 2.4vw, 36px); font-weight: 700; line-height: 1.02; letter-spacing: -.045em; overflow-wrap: anywhere; text-wrap: pretty; }
.lead-content p { max-width: 49ch; color: #f7f0e5; font-size: 12px; line-height: 1.2; }
.lead time { display: block; margin-top: 7px; font-size: 10px; line-height: 1.2; }
.lead-secondary .lead-content { padding: 10px; }
.lead-secondary h2 { font-size: clamp(12px, 1.14vw, 17px); letter-spacing: -.015em; line-height: 1.13; }
.lead-empty { align-items: center; background: var(--panel); color: var(--ink); }
.lead-empty::after { content: none; }
.topic { font-size: 9px; text-transform: uppercase; line-height: 1.16; }
.lead .topic, .card-media .topic { display: inline-block; color: #fff9ee; padding: 3px 5px; background: rgb(27 22 17 / .76); }

.latest { padding: 10px 13px 12px; border-top: 1px solid var(--line); }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.home-center .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); min-width: 0; }
.card-media { position: relative; display: block; background: #e3d9c9; aspect-ratio: 1.8; }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media .topic { position: absolute; top: 3px; left: 3px; }
.card-content { flex: 1; display: flex; flex-direction: column; padding: 11px; }
.home-center .card-content { padding: 7px 9px 9px; }
.card h2, .card h3 { font-size: clamp(16px, 1.52vw, 22px); font-weight: 700; line-height: 1.24; text-wrap: pretty; overflow-wrap: anywhere; }
.home-center .card h3 { font-size: clamp(11px, .97vw, 15px); line-height: 1.24; }
.card p { margin-top: 7px; font-size: 14px; color: var(--muted); }
.card time { margin-top: auto; padding-top: 9px; }

.archive-heading { border-top: 1px solid var(--line); margin-bottom: 22px; padding-top: 23px; }
.archive-heading h1 { font: 700 clamp(30px, 4.2vw, 58px)/1.1 var(--masthead); }
.archive-heading p { margin-top: 8px; color: var(--muted); }
.listing { margin-bottom: 42px; min-height: 45vh; }
.listing .search-form { border-bottom: 1px solid var(--line-dark); }
.pagination { margin-top: 20px; }
.page-numbers { display: inline-block; text-align: center; border: 1px solid var(--line); min-width: 30px; padding: 3px 8px; }
.page-numbers.current { background: var(--panel); font-weight: 700; }
.story { max-width: 920px; margin: 0 auto 45px; padding-top: 30px; min-height: 45vh; }
.story h1 { font: 700 clamp(34px, 5.1vw, 67px)/1.03 var(--masthead); letter-spacing: -.04em; margin: 5px 0 12px; overflow-wrap: anywhere; }
.story-meta { color: var(--muted); font-size: 13px; }
.story img.cover { display: block; width: 100%; max-height: 520px; object-fit: cover; margin: 18px 0; }
.story-body, .comments-area { max-width: 690px; margin: 22px auto; overflow-wrap: anywhere; }
.story-body > * + *, .comments-area > * + * { margin-top: 1em; }
.story-body a, .comments-area a { text-decoration: underline; text-underline-offset: 3px; }
.story-body .alignwide, .story-body .alignfull { width: 100%; }
.story .post-tags { margin: 18px auto; max-width: 690px; color: var(--muted); }
.comments-area textarea { width: 100%; }
.comments-area input:not([type=checkbox]) { max-width: 100%; }
.empty-text { color: var(--muted); }

.subscribe-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 49px;
  padding: 8px 13px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.home .subscribe-bar { border-top: 0; }
.subscribe-bar p { display: flex; gap: 12px; align-items: center; max-width: 29ch; font-size: 12px; line-height: 1.18; }
.feed-icon { position: relative; flex: 0 0 18px; height: 13px; border: 1px solid #a18a6f; }
.feed-icon::before { content: ''; position: absolute; left: 3px; top: -4px; width: 9px; height: 9px; transform: rotate(45deg); border-right: 1px solid #a18a6f; border-bottom: 1px solid #a18a6f; }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; font-size: 10px; }
.footer-nav ul { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; }

@media(max-width: 980px) {
  .home-layout { grid-template-columns: minmax(115px, 17%) minmax(0, 1fr) minmax(152px, 20%); }
  .rail { padding-inline: 8px; }
  .ranked li { gap: 5px; min-height: 92px; }
}
@media(max-width: 805px) {
  .home-layout { grid-template-columns: 1fr 1fr; grid-template-areas: 'center center' 'news popular'; }
  .home-center { border-inline: 0; border-bottom: 1px solid var(--line); }
  .popular-rail { border-left: 1px solid var(--line); }
  .rail { padding-inline: 14px; }
  .rail-title { font-size: 13px; }
  .rank-content .rail-title { font-size: 13px; }
  .ranked li { grid-template-columns: max-content 48px minmax(0, 1fr); gap: 7px; min-height: 73px; }
  .lead-secondary h2 { font-size: clamp(12px, 2vw, 16px); }
  .home-center .card h3 { font-size: 13px; }
}
@media(max-width: 540px) {
  .header-row { grid-template-columns: 1fr 1fr; row-gap: 7px; min-height: 0; padding-bottom: 7px; }
  .masthead { grid-column: 1 / -1; grid-row: 1; }
  .brand { font-size: clamp(27px, 9vw, 49px); letter-spacing: .04em; }
  .tagline { font-size: 8px; }
  .site-nav > ul { gap: 0; justify-content: center; flex-wrap: wrap; }
  .site-nav a { padding-inline: 6px; font-size: 10px; }
  .headlines.has-secondary { grid-template-columns: 1fr; }
  .headlines { padding: 8px; }
  .lead-main, .lead-empty { min-height: 265px; }
  .lead-stack { grid-template-columns: 1fr 1fr; grid-auto-rows: auto; }
  .lead-secondary { min-height: 135px; }
  .latest { padding-inline: 8px; }
  .card-grid, .home-center .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-layout { grid-template-columns: 1fr; grid-template-areas: 'center' 'news' 'popular'; }
  .popular-rail { border-left: 0; border-top: 1px solid var(--line); }
  .subscribe-bar { grid-template-columns: 1fr auto; }
}

/* Настройки последней версии макета Кибергазеты */
[hidden] { display:none !important; } .preview-back { display:inline-block; margin-bottom:18px; font-size:13px; }
.header-actions { gap: 6px; }
.social-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-dark);
  border-radius: 2px;
  color: var(--ink);
}
.social-icon svg { width: 17px; height: 17px; }
a.social-icon:hover { color: var(--paper); background: var(--ink); text-decoration: none; }
.social-icon[role="img"] { color: var(--muted); }
.site-nav > ul { column-gap: clamp(3px, 2.7vw, 38px); flex-wrap: wrap; }
.more-articles { display: flex; justify-content: center; margin: 16px 0 4px; }
.more-articles button { min-width: 142px; min-height: 36px; font-size: 12px; }

@media (max-width: 540px) {
  .site-nav > ul { column-gap: 0; }
  .header-actions { gap: 4px; }
  .social-icon { width: 27px; height: 27px; }
}
.site-nav > ul { column-gap: clamp(2px, 2vw, 28px); }
.site-nav a { font-size: clamp(13px, 1.08vw, 16px); font-weight: 600; }
.rail h2 { font-size: clamp(15px, 1.3vw, 18px); line-height: 1.2; }
.rail-title, .rank-content .rail-title {
  font-size: clamp(13px, 1.14vw, 16px);
  line-height: 1.34;
}
.rail time, .card time { font-size: 11px; }
.popular-periods a { font-size: 13px; padding-block: 6px; }
.home-center .card h3 { font-size: clamp(14px, 1.24vw, 17px); }
.lead-secondary h2 { font-size: clamp(15px, 1.35vw, 20px); }
.topic { font-size: 11px; }
.more-articles button { font-size: 14px; }
.release-rail { border-top: 1px solid var(--line-dark); margin-top: 14px; padding-top: 13px; }
.release-rail .release-date { font-size: 13px; color: var(--muted); margin-top: 6px; }
.release-rail .release-platform-label { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.release-source, .release-status { font-size: 11px; color: var(--muted); line-height: 1.35; }
.release-source { margin-top: 7px; }
.release-status:not(:empty) { margin-top: 7px; }
.release-source a { text-decoration: underline; }

@media (max-width: 540px) {
  .site-nav > ul { column-gap: 0; }
  .site-nav a { font-size: 13px; }
}
.home-center .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.history-rail { border-top: 1px solid var(--line-dark); margin-top: 14px; padding-top: 13px; }
.history-date { margin-top: 6px; color: var(--muted); }
.rail .history-date { font-size: 13px; }
.history-year { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.history-rail .rail-title a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }


/* Загрузка новых строк и сохранение двухколоночной сетки */
.home-center .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.more-articles button { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); font-weight: 700; padding: 10px 23px; }
.more-articles button:hover { background: #40372e; }
.more-articles button[disabled] { opacity:.5;cursor:wait; }
.kg-status { color:var(--muted); font-size: 12px; text-align:center; min-height: 1em; margin-top: 7px; }
.social-icon span {font: 700 9px/1 system-ui,sans-serif;}
.social-icon--max span {font-size:8px;}
.social-icon.is-disabled { opacity:.65; cursor:default; }
.release-rail #release-list:empty { min-height: 0; }
.release-source:empty, .release-status:empty { display:none; }
.history-rail p { margin:0; }
@media(max-width: 540px) { .home-center .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
