/* ==========================================================================
   ~/portfolio — base.css
   Reset + типографика + утилиты. Работает везде: сайт, .entry-content, WP.
   ========================================================================== */

/* ==========================================================================
   1. Reset
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-anchor: none;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--lime-lo) var(--bg-0);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--txt);
  background-color: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

main {
  flex: 1 0 auto;
  width: 100%;
  padding-bottom: var(--s-4xl);
}

/* ---------- Выделение и фокус ---------- */
::selection { background: var(--lime); color: #0a0a0a; }

:focus-visible {
  outline: 1px solid var(--lime);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Скроллбар ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); border-left: 1px solid var(--line); }
::-webkit-scrollbar-thumb {
  background: var(--lime-lo);
  border: 2px solid var(--bg-0);
  border-radius: 8px;
  box-shadow: 0 0 8px var(--lime-glow);
}
::-webkit-scrollbar-thumb:hover { background: var(--lime); }
::-webkit-scrollbar-corner { background: var(--bg-0); }

/* ==========================================================================
   2. Типографика — глобальная, без префиксов
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.12;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  -webkit-hyphens: auto;
  hyphens: auto;
  color: var(--txt);
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
h5, h6 {
  font-size: var(--step--1);
  color: var(--txt-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

p { margin: 0 0 var(--s-l); }

a {
  color: var(--lime);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
@media (hover: hover) {
  a:hover { color: var(--lime-hi); }
}

strong, b { color: var(--txt); font-weight: 700; }
em, i { color: var(--txt); font-style: italic; }
small { font-size: var(--step--1); color: var(--txt-3); }

mark {
  background: var(--lime-glow);
  color: var(--lime);
  padding: 0.1em 0.35em;
  border-radius: var(--r-sm);
}

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--bg-2);
  color: var(--lime);
  padding: 0.15em 0.4em;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

kbd {
  display: inline-block;
  padding: 0.15em 0.45em;
  font-size: 0.85em;
  color: var(--txt);
  background: var(--bg-3);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
}

pre {
  font-family: var(--mono);
  font-size: var(--step--1);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-m) var(--s-l);
  overflow-x: auto;
  margin: var(--s-l) 0;
  white-space: pre;
  color: var(--txt);
}
pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}

/* ---------- Списки (базовые) ---------- */
ul, ol {
  margin: 0 0 var(--s-m);
  padding-left: 1.4em;
}
li { margin-bottom: var(--s-xs); }

/* ---------- Цитата (базовая) ---------- */
blockquote {
  margin: var(--s-l) 0;
  padding: var(--s-m) var(--s-l);
  border-left: 2px solid var(--lime);
  background: linear-gradient(to right, var(--lime-fade), transparent 60%);
  color: var(--txt-2);
  font-style: italic;
}
blockquote cite {
  display: block;
  margin-top: var(--s-s);
  color: var(--txt-3);
  font-size: var(--step--1);
  font-style: normal;
  font-family: var(--mono);
}

/* ---------- Таблицы ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-l) 0;
  font-size: var(--step--1);
  font-family: var(--mono);
  background: var(--bg-2);
  border: 1px solid var(--line-grey);
  border-radius: var(--r-md);
  overflow: hidden;
}
thead th {
  background: var(--bg-4);
  color: var(--txt);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--line-grey);
}
th, td {
  border: 1px solid var(--line-grey);
  border-top: 0;
  border-left: 0;
  padding: var(--s-s) var(--s-m);
  text-align: left;
  vertical-align: top;
}
th:last-child,
td:last-child {
  border-right: 0;
}
tbody td { color: var(--txt-2); }
tbody tr:nth-child(odd) td { background: transparent; }
tbody tr:nth-child(even) td { background: var(--bg-3); }
@media (hover: hover) {
  tbody tr:hover td {
    background: var(--bg-4);
  }
}
tfoot td {
  border-top: 1px solid var(--line-grey);
  border-bottom: 0;
  color: var(--txt-3);
  font-size: var(--step--2);
  background: var(--bg-4);
}

/* ---------- Медиа ---------- */
figure { margin: 0; }
img { max-width: 100%; display: block; }

figure img,
.entry-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  display: block;
  margin: var(--s-l) 0;
}

figcaption {
  margin-top: var(--s-xs);
  color: var(--txt-3);
  font-size: var(--step--1);
  font-family: var(--mono);
  text-align: left;
}

/* ---------- Разделитель ---------- */
hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin: var(--s-3xl) 0;
}
hr.ide { margin: var(--s-3xl) 0; }

.hero-main + hr.ide {
  margin-top: 0;
}

/* ---------- Интерактивным: мгновенный :active ---------- */
a, button, label, summary, input, select, [role="button"] {
  touch-action: manipulation;
}

/* ==========================================================================
   3. Утилиты
   ========================================================================== */
.mono { font-family: var(--mono); }
.lime { color: var(--lime); }
.violet { color: var(--violet); }
.muted { color: var(--txt-2); }
.faint { color: var(--txt-3); }
.dim { color: var(--txt-3); }
.small { font-size: var(--step--1); }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--step--1);
  color: var(--txt-3);
  letter-spacing: 0.06em;
  margin-bottom: var(--s-s);
}
.eyebrow .punct { color: var(--lime-lo); }

.section-head { margin-bottom: var(--s-xl); }
.section-head > * + * { margin-top: var(--s-xs); }
.section-head > *:last-child { margin-bottom: 0; }
.section-head > .section-title:not(:last-child) { margin-bottom: 0; }
.section-title { font-size: var(--step-3); margin-bottom: var(--s-m); }
.section-sub { color: var(--txt-2); max-width: 60ch; }
.section-sub--cta { margin: 20px auto 0; }

.section--center { text-align: center; }
.section--center .hero-actions { justify-content: center; }

.empty-state {
  grid-column: 1 / -1;
  max-width: 46em;
  margin: 0 auto;
  padding: var(--s-l) var(--s-m);
  font-family: var(--mono);
  font-size: var(--step--1);
  line-height: 1.8;
  color: var(--txt-3);
  text-align: center;
}
.empty-state::before { content: "0_o "; color: var(--lime); }

.char-print { display: inline-block; opacity: 0; animation: char-in 0.2s var(--ease) forwards; }
@keyframes char-in {
  from { opacity: 0; transform: translateY(0.15em); }
  to { opacity: 1; transform: none; }
}

.glitch { animation: glitch-flash 0.12s steps(2) 2; }
@keyframes glitch-flash {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); filter: hue-rotate(-40deg); }
  50% { transform: translate(1px, -1px); filter: hue-rotate(40deg); }
  75% { transform: translate(-1px, 0); }
  100% { transform: translate(0, 0); }
}

.grid-bg { position: relative; }
.grid-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(42, 241, 107, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 241, 107, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 85%);
}

/* Лайм-пятно свечения: начинается от шапки (шапка поверх hero, hero — сразу после неё) */
.grid-bg::after {
  content: "";
  position: absolute;
  top: calc(-1 * var(--header-h));
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1000px 520px at 85% -8%, rgba(42, 241, 107, 0.04), transparent 40%);
  background-size: cover;
}

.skiplink {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--lime);
  color: #0a0a0a;
  padding: 0.6em 1em;
  font-family: var(--mono);
  font-size: var(--step--1);
}
.skiplink:focus { left: 0; }

.pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.9); opacity: 0.4; }
}

/* ---------- Контейнер, секции ---------- */
.container {
  width: min(100% - var(--gutter) * 2, var(--maxw));
  margin-inline: auto;
}
section { padding-bottom: var(--s-xl); }

/* ---------- Reveal ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}
.js .reveal.is-in { opacity: 1; transform: none; }

.js .is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease), visibility 0s var(--dur-slow);
}
.js .is-hidden.is-exposed {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .glitch { animation: none; }
}