/*
Theme Name: HiTech Digest
Theme URI: https://new-nest.ru
Author: new-nest.ru
Description: Тёмная хай-тек тема новостного портала «IT-дайджест»: неоновые акценты, моноширинные метки, сетка карточек, sticky-шапка.
Version: 1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: hitech-digest
*/

/* ============ базовые переменные ============ */
:root {
  --bg: #080c14;
  --bg-soft: #0c1220;
  --panel: #0d1524;
  --panel-2: #101a2c;
  --line: rgba(148, 163, 184, .14);
  --line-strong: rgba(148, 163, 184, .32);
  --text: #dbe6f5;
  --muted: #7e93b0;
  --accent: #2dd4ff;
  --accent-2: #8b7bff;
  --glow: rgba(45, 212, 255, .35);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* техническая сетка на фоне */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 78%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

::selection { background: rgba(45, 212, 255, .28); }

/* ============ бегущая строка-статус ============ */
.ticker {
  background: rgba(45, 212, 255, .05);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}
.ticker__in { display: flex; align-items: center; gap: 10px; height: 34px; overflow: hidden; white-space: nowrap; }
.ticker__sys { color: var(--accent); font-weight: 700; }
.ticker__sep { color: var(--accent-2); }
.ticker__tag { margin-left: auto; color: rgba(126, 147, 176, .75); }
.ticker__cursor {
  width: 8px; height: 14px;
  background: var(--accent);
  display: inline-block;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ============ шапка ============ */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 12, 20, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head__in { display: flex; align-items: center; justify-content: space-between; gap: 18px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand__mark {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  color: #04121a;
  font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--glow);
}
.brand__text {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .04em;
  color: var(--text);
}
.brand__accent { color: var(--accent); }

.nav-menu { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-menu a {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.nav-menu a:hover { color: var(--text); background: rgba(45, 212, 255, .08); text-decoration: none; }

/* ============ содержимое ============ */
main.wrap { padding-top: 34px; padding-bottom: 60px; min-height: 60vh; }

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}

/* ============ сетка карточек ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--panel), #0a101c);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(45, 212, 255, .45);
  box-shadow: 0 0 0 1px rgba(45, 212, 255, .18), 0 14px 34px rgba(2, 8, 20, .6);
}
.card--hero { grid-column: span 2; }

.card__thumbwrap { display: block; }
.card__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  filter: saturate(1.06);
  border-bottom: 1px solid var(--line);
}
.card__thumb--ph {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(45, 212, 255, .16), transparent 55%),
    radial-gradient(120% 140% at 85% 100%, rgba(139, 123, 255, .16), transparent 55%),
    var(--panel-2);
  color: rgba(45, 212, 255, .5);
  font-size: 44px;
}

.card__body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 20px; flex: 1; }
.card__meta {
  display: flex; gap: 12px; align-items: baseline;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.card__cat { color: var(--accent-2); }
.card__title { margin: 0; font-size: 19px; line-height: 1.35; font-weight: 700; }
.card--hero .card__title { font-size: 26px; }
.card__title a { color: var(--text); }
.card__title a:hover { color: var(--accent); text-decoration: none; }
.card__excerpt { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }

/* ============ пагинация ============ */
.pagination, .nav-links {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.pagination .page-numbers, .nav-links .page-numbers {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 13px;
  display: inline-block;
}
.pagination .page-numbers.current, .nav-links .page-numbers.current {
  color: #04121a;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.pagination a.page-numbers:hover, .nav-links a.page-numbers:hover {
  color: var(--accent);
  border-color: rgba(45, 212, 255, .5);
  text-decoration: none;
}

/* ============ отдельная запись ============ */
.article { max-width: 780px; margin: 0 auto; }
.article__head { margin-bottom: 22px; }
.article__meta {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline;
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}
.article__meta .cat { color: var(--accent-2); }
.article__title {
  margin: 0;
  font-size: clamp(27px, 4.4vw, 42px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.01em;
}
/* любые картинки в записи сохраняют пропорции */
.article img { max-width: 100%; height: auto; }

.article__thumb { margin: 22px 0 26px; }
.article__thumb img {
  width: 100%;
  height: auto; /* иначе высота берётся из HTML-атрибута и картинка растягивается */
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}

.entry-content { font-size: 17px; line-height: 1.78; color: #c9d6e9; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content h2, .entry-content h3, .entry-content h4 {
  color: var(--text);
  line-height: 1.3;
  margin: 1.6em 0 .6em;
  font-weight: 700;
}
.entry-content h2 { font-size: 26px; border-bottom: 1px solid var(--line); padding-bottom: .3em; }
.entry-content h3 { font-size: 21px; }
.entry-content a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(45, 212, 255, .4); }
.entry-content img, .entry-content video {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.entry-content ul, .entry-content ol { padding-left: 1.4em; margin: 0 0 1.15em; }
.entry-content li { margin-bottom: .35em; }
.entry-content li::marker { color: var(--accent); }

.entry-content blockquote {
  margin: 1.3em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: rgba(45, 212, 255, .06);
  border-radius: 0 10px 10px 0;
  color: var(--text);
}

.entry-content pre {
  background: #060a12;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
}
.entry-content code {
  font-family: var(--mono);
  font-size: .92em;
  background: rgba(45, 212, 255, .1);
  color: #a9e9ff;
  border-radius: 5px;
  padding: .1em .4em;
}
.entry-content pre code { background: none; padding: 0; color: #c9d6e9; }

/* галерея wp */
.entry-content .wp-block-gallery, .entry-content .gallery { margin: 1.4em 0; }
.entry-content .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.entry-content .gallery-item { margin: 0; }
.entry-content .gallery-item img { width: 100%; height: auto; display: block; }
.entry-content .gallery-caption { font-size: 12.5px; color: var(--muted); }
.entry-content .blocks-gallery-item img, .entry-content .gallery-item img {
  border-radius: 10px;
  border: 1px solid var(--line);
}

/* теги записи */
.article__tags { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.article__tags a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.article__tags a:hover { color: var(--accent); border-color: rgba(45, 212, 255, .5); text-decoration: none; }

.article-nav {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  font-size: 14px;
}
.article-nav a { color: var(--muted); }
.article-nav a:hover { color: var(--accent); }

.back-link { display: inline-block; margin-top: 30px; font-family: var(--mono); font-size: 13px; letter-spacing: .08em; }

/* ============ подвал ============ */
.site-foot { border-top: 1px solid var(--line); background: rgba(10, 14, 24, .6); }
.site-foot__in {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 22px 20px; max-width: 1200px; margin: 0 auto;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em; color: var(--muted);
}
.site-foot .brand__text { font-size: 15px; }
.site-foot .brand__mark { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }
.site-foot__in a { color: var(--muted); }
.site-foot__in a:hover { color: var(--accent); }

/* скроллбар */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1b2740; border-radius: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }

/* ============ лайтбокс ============ */
.article__thumb img,
.entry-content img { cursor: zoom-in; }

body.lb-lock { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: rgba(3, 6, 12, .93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.lightbox.is-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.lightbox__fig {
  margin: 0;
  max-width: min(94vw, 1500px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6);
  animation: lb-in .18s ease;
}
@keyframes lb-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.lightbox__bar {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .08em;
  color: var(--muted);
  max-width: 92vw;
  text-align: center;
}
.lightbox__cap { color: var(--text); font-family: var(--sans); font-size: 13.5px; }
.lightbox__cnt.is-hidden, .lightbox__nav.is-hidden, .lightbox__close.is-hidden { display: none; }

.lightbox__nav, .lightbox__close {
  position: fixed;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(13, 21, 36, .8);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
  user-select: none;
}
.lightbox__nav:hover, .lightbox__close:hover {
  color: var(--accent);
  border-color: rgba(45, 212, 255, .5);
  text-decoration: none;
}
.lightbox__close { top: 16px; right: 16px; }
.lightbox__nav--prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox__nav--next { right: 14px; top: 50%; transform: translateY(-50%); }

@media (max-width: 760px) {
  .lightbox__nav { width: 40px; height: 40px; font-size: 22px; }
  .lightbox__img { max-height: 68vh; }
}

/* адаптив */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .card--hero { grid-column: span 1; }
  .site-head__in { height: auto; flex-wrap: wrap; padding: 10px 0; }
  .ticker__tag { display: none; }
}
