/* =========================================================
   Левон Гончаров — персональный сайт
   Design tokens derived from reference: dark emerald consulting
   ========================================================= */

:root {
  /* surfaces */
  --bg:          #070C0A;
  --bg-2:        #0A100D;
  --panel:       #0C1410;
  --panel-2:     #0E1813;
  --panel-edge:  rgba(255,255,255,0.07);

  /* ink */
  --ink:         #EAF1EC;
  --ink-soft:    #C4D2CA;
  --muted:       #7E8F86;
  --muted-2:     #586860;
  --faint:       #3C4742;

  /* emerald */
  --em:          #34C97D;
  --em-bright:   #46E08D;
  --em-deep:     #1B7E50;
  --em-text:     #61B488;
  --em-glow:     rgba(70,224,141,0.55);
  --em-glow-soft:rgba(52,201,125,0.18);
  --em-line:     rgba(70,224,141,0.30);

  /* mars red (only in Игра и кино) */
  --mars:        #C8392B;
  --mars-bright: #E5483A;
  --mars-glow:   rgba(229,72,58,0.40);

  /* type */
  --font-display: 'Geologica', 'Onest', system-ui, sans-serif;
  --font-body:    'Onest', system-ui, -apple-system, sans-serif;

  /* metrics */
  --maxw: 1320px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 14px;
  --radius-lg: 18px;

  /* easing */
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

* { box-sizing: border-box; }

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

/* visible keyboard focus on every interactive element — the dark theme
   swallows the browser default, so paint an explicit emerald ring */
:focus-visible {
  outline: 2px solid var(--em-bright);
  outline-offset: 3px;
  border-radius: 4px;
}
/* pill/rounded controls get a softer ring that follows their shape */
.btn:focus-visible, .nav a:focus-visible, .textlink:focus-visible {
  outline-color: var(--em-bright);
}
.card:focus-visible, .podcast__cover:focus-visible {
  outline-offset: 4px;
}
/* mouse users never see it; only keyboard focus paints */
:focus:not(:focus-visible) { outline: none; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ambient field: faint green vignette + radar arcs at top center */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -12%, rgba(52,201,125,0.10), transparent 55%),
    radial-gradient(100% 60% at 50% 0%, rgba(70,224,141,0.06), transparent 60%),
    radial-gradient(140% 120% at 50% 120%, rgba(0,0,0,0.55), transparent 60%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.content { position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--em-text);
}

.section-line { /* thin emerald rule under titles */
  width: 56px; height: 2px; border: 0;
  background: linear-gradient(90deg, var(--em), transparent);
  margin: 18px 0 0;
}

/* =========================================================
   HEADER / NAV
   ========================================================= */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--gutter);
  transition: padding .4s var(--ease), border-color .4s var(--ease);
  border-bottom: 1px solid transparent;
}
/* frosted-glass bg lives on a pseudo-element: backdrop-filter on the
   header itself would make it the containing block for the fixed
   mobile drawer inside, pinning the menu to the header box */
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  background: rgba(7,12,10,0);
  transition: background .4s var(--ease), backdrop-filter .4s var(--ease);
}
.site-header.scrolled {
  border-bottom-color: var(--panel-edge);
  padding-top: 16px; padding-bottom: 16px;
}
.site-header.scrolled::before {
  background: rgba(7,12,10,0.78);
  backdrop-filter: blur(14px) saturate(120%);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand__mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
}
.brand__mark svg { width: 40px; height: 40px; overflow: visible; }
.brand__mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.footer__brand-row { display: flex; align-items: center; gap: 12px; }
.footer__brand-row .brand__mark { width: 34px; height: 34px; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.nav { display: flex; align-items: center; gap: clamp(18px, 2.4vw, 40px); }
.nav a {
  font-size: 12.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 500;
  position: relative;
  padding: 6px 0;
  transition: color .3s var(--ease);
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--em); transition: right .35s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { right: 0; }

/* contact pill in the nav — quiet emerald outline, no underline animation */
.nav__cta {
  padding: 7px 16px !important;
  border: 1px solid var(--em-line); border-radius: 100px;
  color: var(--em-text) !important;
}
.nav__cta::after { display: none; }
.nav__cta:hover { background: rgba(70,224,141,0.08); color: var(--em-bright) !important; }

.nav-toggle {
  display: none; width: 40px; height: 40px; background: none; border: 0;
  flex-direction: column; gap: 5px; align-items: center; justify-content: center;
}
.nav-toggle span { display: block; width: 22px; height: 1.6px; background: var(--ink-soft); transition: transform .35s var(--ease), opacity .25s var(--ease); }
.nav-toggle.open span:nth-child(1) { transform: translateY(6.6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6.6px) rotate(-45deg); }

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-top: clamp(88px, 11vh, 122px);
  padding-bottom: 22px;
}

/* faint concentric radar arcs behind hero text */
.hero__arcs {
  position: absolute; top: -38%; left: 50%; transform: translateX(-50%);
  width: min(1500px, 150vw); height: min(1500px, 150vw);
  pointer-events: none; z-index: 0; opacity: .5;
}
.hero__arcs circle { fill: none; stroke: rgba(80,150,115,0.13); stroke-width: 1; }

.hero__head { text-align: center; position: relative; z-index: 2; }
.hero__name {
  font-family: var(--font-display);
  font-weight: 200;
  font-size: clamp(40px, 6vw, 88px);
  line-height: 1.0;
  letter-spacing: 0.012em;
  color: var(--ink);
  margin: 0;
  text-shadow: 0 0 60px rgba(70,224,141,0.10);
}
.hero__role {
  font-size: clamp(16px, 1.7vw, 23px);
  color: var(--em-text);
  font-weight: 500;
  margin: clamp(18px, 2.4vw, 30px) 0 0;
  letter-spacing: 0.01em;
}
.hero__role b { color: var(--em-bright); font-weight: 600; }
.hero__sub {
  max-width: 600px;
  margin: clamp(14px,1.6vw,20px) auto 0;
  color: var(--muted);
  font-size: clamp(15px, 1.2vw, 17.5px);
  line-height: 1.65;
}
.hero__topics {
  margin-top: 26px;
  display: flex; flex-wrap: wrap; gap: 10px 12px; justify-content: center;
}
.topic {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding: 7px 14px;
  border: 1px solid var(--panel-edge); border-radius: 100px;
  background: rgba(255,255,255,0.015);
  transition: border-color .3s var(--ease), color .3s var(--ease);
}
.topic:hover { color: var(--ink-soft); border-color: var(--em-line); }

.hero__cta { margin-top: clamp(20px, 2.6vw, 30px); display: flex; justify-content: center; }

/* the "route" line dropping from hero into the central card */
.route-line {
  position: relative; z-index: 2;
  width: 1px; height: clamp(22px, 4vh, 48px);
  margin: clamp(16px,2.4vh,30px) auto 0;
  background: linear-gradient(180deg, transparent, var(--em-bright));
  box-shadow: 0 0 14px 1px var(--em-glow);
}
.route-line::after {
  content: ""; position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--em-bright); box-shadow: 0 0 12px 2px var(--em-glow);
}

/* =========================================================
   THREE DIRECTION CARDS
   ========================================================= */
.cards {
  position: relative; z-index: 2;
  margin-top: clamp(10px, 2vh, 24px);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: clamp(16px, 1.6vw, 26px);
  align-items: stretch;
}
.cards.dimmed .card:not(:hover) { opacity: .58; filter: saturate(.7) brightness(.85); }

.card {
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: clamp(400px, 52vh, 588px);
  border: 1px solid var(--panel-edge);
  background: var(--panel);
  isolation: isolate;
  transform: translateY(0) scale(1);
  transition: transform .5s var(--ease-out), border-color .45s var(--ease), opacity .45s var(--ease), filter .45s var(--ease), box-shadow .45s var(--ease);
}
.card:hover { transform: translateY(-8px) scale(1.012); border-color: var(--em-line); }

/* image layer */
.card__media { position: absolute; inset: 0; z-index: 0; }
.card__media .card__img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.card--game .card__img { object-position: center 30%; }
/* desaturate by default, color on hover */
.card__media {
  filter: saturate(.42) brightness(.62) contrast(1.02);
  transition: filter .6s var(--ease);
}
.card:hover .card__media { filter: saturate(1) brightness(.86) contrast(1.04); }

/* gradient scrim so text reads */
.card__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6,11,9,0.55) 0%, rgba(6,11,9,0.0) 26%, rgba(6,11,9,0.05) 45%, rgba(6,11,9,0.72) 78%, rgba(6,11,9,0.94) 100%);
}
.card__edge { /* inner emerald edge glow appears on hover */
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px transparent;
  opacity: 0; transition: opacity .5s var(--ease);
}
.card:hover .card__edge {
  opacity: 1;
  box-shadow: inset 0 0 0 1px var(--em-line), inset 0 0 40px rgba(70,224,141,0.10), 0 24px 70px -28px var(--em-glow);
}

.card__top { position: absolute; top: 22px; left: 0; right: 0; z-index: 4; display: flex; justify-content: center; }
.card__icon { width: 34px; height: 34px; color: var(--em-text); opacity: .85; transition: color .4s var(--ease), opacity .4s var(--ease); }
.card:hover .card__icon { color: var(--em-bright); opacity: 1; }

.card__body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: clamp(22px,2vw,32px); }
.card__title {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(26px, 2.5vw, 38px);
  color: var(--ink);
  margin: 0; line-height: 1.05;
}
.card__rule { width: 46px; height: 2px; margin: 14px 0; background: var(--em); opacity:.9; transition: width .5s var(--ease); }
.card:hover .card__rule { width: 72px; }
.card__cap { color: var(--muted); font-size: 14px; margin: 0; }

.card__go {
  margin-top: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--em-text);
  opacity: 0; transform: translateY(6px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.card:hover .card__go { opacity: 1; transform: translateY(0); }
.card__go svg { width: 16px; height: 16px; }

/* center card — Системы: emphasized glow + HUD overlay */
.card--systems { border-color: var(--em-line); }
.card--systems .card__edge {
  opacity: 1;
  box-shadow: inset 0 0 0 1px var(--em-line), inset 0 0 50px rgba(70,224,141,0.10), 0 30px 80px -30px var(--em-glow);
}
.card--systems:hover .card__edge {
  box-shadow: inset 0 0 0 1px rgba(70,224,141,0.55), inset 0 0 60px rgba(70,224,141,0.16), 0 36px 90px -28px var(--em-glow);
}
/* HUD term list on systems card */
.hud-terms {
  position: absolute; top: 96px; left: 26px; z-index: 4;
  display: flex; flex-direction: column; gap: 7px;
  pointer-events: none;
}
.hud-terms span {
  font-family: var(--font-display);
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: rgba(120,200,160,0.5);
  transition: color .4s var(--ease);
}
.card--systems:hover .hud-terms span { color: rgba(150,230,190,0.78); }
/* radar canvas inside systems card.
   width/height 100% are required: a canvas is a replaced element, so
   inset:0 alone keeps its intrinsic (attribute) size — JS would then read
   back its own width*dpr on every resize and grow exponentially. */
.radar-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; opacity:.9; }

/* mars card red tint on hover */
.card--observe .card__kanji {
  position: absolute; top: 86px; right: 26px; z-index: 4;
  font-size: 40px; line-height: 1; color: rgba(180,210,190,0.34);
  font-family: 'Noto Serif JP', serif; letter-spacing: 0.05em;
  writing-mode: vertical-rl; transition: color .5s var(--ease);
  text-shadow: 0 2px 18px rgba(0,0,0,.5);
}
.card--observe:hover .card__kanji { color: rgba(220,150,90,0.7); }
.card--game:hover .card__media { filter: saturate(1.05) brightness(.9) contrast(1.06); }
.card--game:hover .card__edge { box-shadow: inset 0 0 0 1px rgba(229,72,58,0.32), inset 0 0 40px rgba(229,72,58,0.10), 0 24px 70px -28px var(--mars-glow); }
.card--game .card__icon { color: #c79a93; }
.card--game:hover .card__icon { color: var(--mars-bright); }
.card--game:hover .card__rule { background: var(--mars-bright); }
.card--game:hover .card__go { color: #e08a80; }


/* scroll hint */
.scroll-hint {
  margin-top: clamp(18px,2.6vh,30px);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--muted); font-size: 13px; letter-spacing: 0.06em;
  position: relative; z-index: 2;
}
.mouse {
  width: 20px; height: 32px; border: 1.4px solid var(--muted-2); border-radius: 12px;
  position: relative; flex: none;
}
.mouse::after {
  content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 2.6px; height: 6px; border-radius: 2px; background: var(--em-text);
  animation: wheel 1.8s var(--ease) infinite;
}
@keyframes wheel { 0%{opacity:0; transform:translate(-50%,0)} 30%{opacity:1} 70%{opacity:1} 100%{opacity:0; transform:translate(-50%,7px)} }
@media (prefers-reduced-motion: reduce){ .mouse::after{ animation:none } }
