/* madewith.fun — личная витрина: общий стиль для / (EN) и /ru/ (RU) */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0B0C0F;
  --surface: #13151B;
  --surface-2: #181B23;
  --line: #242833;
  --line-strong: #353B4A;
  --text: #E8EAF0;
  --muted: #9AA0AE;      /* 7.4:1 на --bg */
  --faint: #7C8393;      /* 5.0:1 на --bg — только мелкие подписи */
  --accent: #9AA8FF;
  --green: #83C167;
  --red: #FC6255;
  --blue: #58C4DD;

  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 16px;
  --max: 1120px;

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px var(--gutter) 32px;
}

/* ---------- Утилиты ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Переключатель языка ---------- */

.lang {
  display: flex;
  width: max-content;
  margin: -6px 0 18px auto;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}
.lang__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 32px;
  border-radius: 999px;
  color: var(--faint);
  font: 600 12px/1 var(--mono);
  letter-spacing: .06em;
  text-decoration: none;
  transition: color .15s, background-color .15s;
}
.lang__link:hover { color: var(--text); }
.lang__link[aria-current] { background: var(--line); color: var(--text); }
.lang__link:focus-visible { outline-offset: 2px; border-radius: 999px; }
/* сохранённый выбор, если он не совпадает с текущей страницей */
.lang__link[data-preferred]:not([aria-current])::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Шапка ---------- */

.intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "avatar id"
    "tag tag"
    "bio bio"
    "social social";
  column-gap: 16px;
  align-items: center;
  margin-bottom: 36px;
}

.intro__avatar { grid-area: avatar; display: block; }
.intro__avatar img {
  display: block;
  width: 76px;
  height: 76px;
}

.intro__id { grid-area: id; min-width: 0; }

.intro__name {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.intro__title {
  margin: 4px 0 0;
  color: var(--muted);
  font: 500 13.5px/1.3 var(--mono);
  letter-spacing: .01em;
}

.intro__bio {
  grid-area: bio;
  margin: 12px 0 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 15px;
}

.social {
  grid-area: social;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.social__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font: 500 13px/1 var(--mono);
  text-decoration: none;
  transition: color .15s, border-color .15s, background-color .15s;
}
.social__link:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }

/* ---------- Девиз: «терминал с финалом» ---------- */
/* Призрачная копия резервирует место, живой слой лежит поверх: ничего не двигается. */

.tagline {
  grid-area: tag;
  margin: 20px 0 0;
  color: var(--muted);
  font: 500 clamp(14px, 4.1vw, 17px)/1.6 var(--mono);
  letter-spacing: -0.01em;
}
.tagline__box { position: relative; display: block; }
.tagline__ghost { display: block; visibility: hidden; }
.tagline__live { position: absolute; inset: 0; display: block; }

.tg-group { white-space: nowrap; }
/* на узких экранах строка всё равно переносится: фиксируем перенос, чтобы «vibe-» не прыгал между строками */
@media (max-width: 479px) { .tg-lead { display: block; } }
.tg-prefix { color: var(--text); font-weight: 650; }
.tg-br { color: var(--accent); font-weight: 700; }
.tg-sep { color: var(--faint); }
.tg-w { display: inline-block; }
.tg-w0 { color: #9AA8FF; }
.tg-w1 { color: #F2B05E; }
.tg-w2 { color: #7BD88F; }

.tg-cursor {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.2em;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(154, 168, 255, .55);
  animation: tg-blink 1.1s steps(1, end) infinite;
}
.is-typing .tg-cursor { animation: none; }

.is-finale .tg-br { text-shadow: 0 0 16px rgba(154, 168, 255, .6); animation: tg-flash 1s ease-out both; }
.is-finale .tg-w { animation: tg-pop .55s cubic-bezier(.2, .7, .2, 1) both; }
.is-finale .tg-w1 { animation-delay: .09s; }
.is-finale .tg-w2 { animation-delay: .18s; }

@keyframes tg-blink { 50% { opacity: 0; } }
@keyframes tg-pop { from { opacity: 0; transform: translateY(.45em); } to { opacity: 1; transform: none; } }
@keyframes tg-flash { from { opacity: 0; } 40% { opacity: 1; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .tg-cursor { display: none; }
  .is-finale .tg-br, .is-finale .tg-w { animation: none; }
}

/* ---------- Подписи секций ---------- */

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--faint);
  font: 500 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-label--minor { margin-top: 48px; }

/* ---------- Проекты ---------- */

.projects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
}
.project__link:focus-visible { outline-offset: 6px; border-radius: calc(var(--radius) + 4px); }

.preview {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color .2s, transform .25s cubic-bezier(.2,.7,.2,1);
}

.preview__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview--pixel .preview__video { image-rendering: pixelated; }

.preview__hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(11, 12, 15, .78);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--text);
  font: 500 11px/1 var(--mono);
  letter-spacing: .02em;
  pointer-events: none;
  transition: opacity .2s;
}
/* подсказка нужна только там, где видео стартует по наведению */
@media not ((hover: hover) and (pointer: fine)) { .preview__hint { display: none; } }
.is-playing .preview__hint,
.reduced-motion .preview__hint { opacity: 0; }

.project__body { padding: 14px 2px 0; }

.project__title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
  font-weight: 620;
  letter-spacing: -0.01em;
}
.project__title::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--p, var(--accent));
  transform: translateY(-2px);
}
.project__arrow {
  color: var(--faint);
  font-weight: 400;
  transition: transform .2s, color .2s;
}

.project__desc {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.project__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
}
.project__host {
  color: var(--faint);
  font: 400 12.5px/1 var(--mono);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(179, 156, 255, .12);
  color: #CBBBFF;
  font: 500 12px/1 var(--mono);
}

/* Наведение / фокус */
@media (hover: hover) {
  .project__link:hover .preview { border-color: color-mix(in srgb, var(--p, var(--accent)) 55%, var(--line)); transform: translateY(-2px); }
  .project__link:hover .project__arrow { color: var(--p, var(--accent)); transform: translate(2px, -2px); }
}
.project__link:focus-visible .preview { border-color: var(--p, var(--accent)); }

/* Компактная карточка (Vibe Learn) */
.project--compact .project__link {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.project--compact .preview { width: 132px; flex: none; border-radius: var(--radius-sm); }
.project--compact .project__body { padding: 0; min-width: 0; }
.project--compact .project__title { font-size: 17px; }
.project--compact .project__desc { font-size: 14px; }
@media (hover: hover) {
  .project--compact .project__link:hover { border-color: var(--line-strong); }
  .project--compact .project__link:hover .preview { transform: none; }
}

/* ---------- Подвал ---------- */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font: 400 13px/1.4 var(--mono);
}
.footer a { color: var(--muted); text-underline-offset: 3px; }
.footer a:hover { color: var(--text); }

/* ---------- Брейкпоинты ---------- */

@media (min-width: 640px) {
  .page { padding: 28px 32px 40px; }
  .lang { margin: 0 0 22px auto; }
  .intro {
    grid-template-areas:
      "avatar id"
      "avatar tag"
      "avatar bio"
      "avatar social";
    grid-template-rows: auto auto auto 1fr;
    column-gap: 28px;
    align-items: start;
    margin-bottom: 48px;
  }
  .intro__avatar img { width: 112px; height: 112px; }
  .intro__name { font-size: 32px; }
  .intro__title { font-size: 14.5px; }
  .tagline { margin-top: 18px; font-size: clamp(16px, 2.4vw, 19px); }
  .intro__bio { font-size: 16px; margin-top: 10px; }
  .social { margin-top: 14px; }
  .projects { grid-template-columns: 1fr 1fr; gap: 40px 24px; }
  .projects--minor { grid-template-columns: 1fr; }
  .project--compact .preview { width: 176px; }
}

@media (min-width: 1024px) {
  .page { padding: 32px 40px 48px; }
  .intro__avatar img { width: 128px; height: 128px; }
  .intro__name { font-size: 36px; }
  .tagline { font-size: 20px; }
  .projects { gap: 48px 32px; }
  .project__title { font-size: 21px; }
  .projects--minor { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
