/* =========================================================
   LostSoulToru — сайт-визитка. Тема: зимняя ночь, контраст
   чёрного и белого, белые розы с чёрными стеблями.
   ========================================================= */

:root {
  --bg: #050506;
  --bg-alt: #0c0c0f;
  --bg-card: #0f0f13;
  --fg: #f6f5f2;
  --fg-dim: #b7b6bd;
  --fg-faint: #78787f;
  --line: rgba(246, 245, 242, 0.14);
  --line-strong: rgba(246, 245, 242, 0.32);
  --shadow-gray: rgba(246, 245, 242, 0.06);

  --rose-petal: #f3f1eb;
  --rose-petal-inner: #e6e2d8;
  --rose-center: #c9c2ae;
  --rose-stem: #0a0a0c;
  --rose-leaf: #111114;

  --dislike: #d9a5a5; /* используется для form-error в админке */

  --radius: 14px;
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

/* button/input/textarea/select не наследуют font-family от предков по
   умолчанию (браузерная UA-стилизация форм) — без этого все кнопки на
   сайте и в админке рендерились системным Arial вместо --sans/--serif. */
button, input, textarea, select {
  font: inherit;
  color: inherit;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--fg-faint), var(--fg-dim));
  border-radius: 8px;
  border: 3px solid var(--bg);
}

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  left: 0;
}

.muted { color: var(--fg-faint); }

/* ---------- Снег ---------- */
#snow-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
}

/* ---------- Роза (переиспользуемый SVG-символ) ---------- */
.rose-decor {
  width: 120px;
  height: 192px;
  overflow: visible;
}
.rose-stem, .rose-thorn { fill: none; stroke: var(--rose-stem); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.rose-thorn { fill: var(--rose-stem); stroke-width: 2; }
.rose-leaf { fill: var(--rose-leaf); stroke: var(--rose-stem); stroke-width: 1; }
.petal-outer { fill: var(--rose-petal); stroke: rgba(10,10,12,0.55); stroke-width: 1.2; }
.petal-inner { fill: var(--rose-petal-inner); stroke: rgba(10,10,12,0.45); stroke-width: 1; }
.rose-center { fill: var(--rose-center); }

.rose-head {
  transform-origin: 100px 90px;
  animation: rose-spin 22s linear infinite;
}
@keyframes rose-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  z-index: 1;
  background:
    radial-gradient(ellipse 70% 55% at 50% 8%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 100%, rgba(255,255,255,0.03), transparent 70%),
    var(--bg);
}

.hero-roses {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.rose-left, .rose-right {
  position: absolute;
  bottom: -40px;
  opacity: 0.85;
  filter: drop-shadow(0 12px 30px rgba(0,0,0,0.6));
}
.rose-left, .rose-right { pointer-events: auto; }
.rose-left { left: 3%; transform: scale(1) rotate(-4deg); }
.rose-right { right: 3%; transform: scale(1.15) rotate(5deg) scaleX(-1); }
@media (max-width: 760px) {
  .rose-left, .rose-right { width: 70px; height: 112px; opacity: 0.55; }
}

.hero-content {
  position: relative;
  padding: 0 24px;
}

.name-wrap {
  position: relative;
  display: inline-block;
}

.name-shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(6rem, 22vw, 16rem);
  letter-spacing: 0.06em;
  color: var(--shadow-gray);
  user-select: none;
  z-index: 0;
  white-space: nowrap;
  animation: shadow-breathe 9s ease-in-out infinite;
}
@keyframes shadow-breathe {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1.4; }
}

.name {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.2rem, 6.4vw, 4.6rem);
  letter-spacing: 0.02em;
  color: var(--fg);
  text-shadow: 0 0 40px rgba(255,255,255,0.18);
  animation: name-in 1.1s var(--ease) both;
}
@keyframes name-in {
  from { opacity: 0; transform: translateY(18px); letter-spacing: 0.3em; }
  to { opacity: 1; transform: translateY(0); letter-spacing: 0.02em; }
}

.hero-nav {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 26px 0 0;
  animation: fade-in 1.4s var(--ease) 0.3s both;
}
.hero-nav a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
}
.hero-nav a:hover { color: var(--fg); border-color: var(--line-strong); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
}
.scroll-hint-line {
  width: 1px;
  height: 56px;
  background: linear-gradient(var(--fg-faint), transparent);
  position: relative;
  overflow: hidden;
}
.scroll-hint-line::after {
  content: '';
  position: absolute;
  top: -56px;
  left: 0;
  width: 100%;
  height: 56px;
  background: linear-gradient(var(--fg), transparent);
  animation: hint-drop 2.4s ease-in-out infinite;
}
@keyframes hint-drop {
  0% { top: -56px; }
  60%, 100% { top: 56px; }
}

/* ---------- Секции ---------- */
main {
  position: relative;
  z-index: 1;
}

.section {
  max-width: 880px;
  margin: 0 auto;
  padding: 96px 24px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.section.in-view { opacity: 1; transform: translateY(0); }

.section-title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  text-align: center;
  margin: 0 0 18px;
  letter-spacing: 0.03em;
}

.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0 0 44px;
}
.divider::before, .divider::after {
  content: '';
  height: 1px;
  width: 90px;
  max-width: 30vw;
  background: linear-gradient(90deg, transparent, var(--line-strong));
}
.divider::after { background: linear-gradient(270deg, transparent, var(--line-strong)); }
.divider-rose {
  width: 22px;
  height: 22px;
  opacity: 0.85;
}
.divider-rose .rose-head { animation: none; }

/* ---------- Про меня ---------- */
.about-text {
  font-size: 1.08rem;
  color: var(--fg-dim);
}
.about-text p { margin: 0 0 1.1em; }
.about-text p:last-child { margin-bottom: 0; }

/* ---------- Проекты ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
  opacity: 0;
  transform: translateY(20px);
}
.project-card.in-view {
  animation: card-in 0.7s var(--ease) both;
  animation-delay: var(--delay, 0ms);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 18px 40px rgba(255,255,255,0.05);
}
.project-card h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.15rem;
}
.project-card p {
  margin: 0 0 12px;
  color: var(--fg-dim);
  font-size: 0.96rem;
}
.project-link {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--fg);
  border-bottom: 1px solid var(--line-strong);
  text-decoration: none;
  transition: opacity 0.2s;
}
.project-link:hover { opacity: 0.7; }

.project-reactions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.project-reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.25s, background 0.25s, opacity 0.25s;
}
.project-reaction-btn svg { fill: currentColor; display: block; }
.project-reaction-btn:hover { border-color: var(--line-strong); }
.project-reaction-btn:active { transform: scale(0.94); }
.project-reaction-btn.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.project-reaction-btn:disabled { opacity: 0.55; cursor: default; }
.project-reaction-count {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.btn {
  font-family: var(--sans);
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 32px;
  transition: all 0.3s var(--ease);
}
.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line-strong);
}
.btn-outline:hover {
  background: var(--fg);
  color: var(--bg);
  box-shadow: 0 10px 30px rgba(255,255,255,0.12);
}
.btn-outline:disabled { opacity: 0.5; cursor: default; }

/* ---------- Футер ---------- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 70px 24px 50px;
  color: var(--fg-faint);
  font-size: 0.85rem;
}
.rose-footer {
  width: 60px;
  height: 96px;
  margin-bottom: 8px;
  opacity: 0.7;
}

.contact-form {
  max-width: 420px;
  margin: 0 auto 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.contact-label {
  font-size: 0.88rem;
  color: var(--fg-dim);
}
.contact-form textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--fg);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
}
.contact-form textarea:focus {
  outline: none;
  border-color: var(--line-strong);
}
.btn-small-pad { padding: 9px 26px; font-size: 0.88rem; }
.contact-status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--fg-dim);
}
.contact-status-error { color: var(--dislike); }

/* =========================================================
   Прелоадер: распускающаяся роза при первом заходе за сессию
   ========================================================= */
html.preloader-active { overflow: hidden; }

#preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: var(--bg);
  cursor: pointer;
  transition: opacity 0.65s var(--ease), visibility 0.65s var(--ease);
}
html.no-preloader #preloader { display: none !important; }
html.preloader-done #preloader { opacity: 0; visibility: hidden; pointer-events: none; }

.preloader-rose { width: 150px; height: 240px; overflow: visible; }
.preloader-rose .rose-stem {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: pl-stem-draw 0.9s ease-out forwards;
}
.preloader-rose .rose-leaf,
.preloader-rose .rose-thorn {
  opacity: 0;
  animation: pl-fade-in 0.4s ease-out forwards;
  animation-delay: 0.7s;
}
.preloader-rose .rose-head {
  transform-origin: 100px 90px;
  transform: scale(0.15) rotate(-22deg);
  opacity: 0;
  animation: pl-bloom 1.15s cubic-bezier(0.22, 1.4, 0.36, 1) forwards;
  animation-delay: 0.85s;
}
@keyframes pl-stem-draw { to { stroke-dashoffset: 0; } }
@keyframes pl-fade-in { to { opacity: 1; } }
@keyframes pl-bloom {
  0% { transform: scale(0.15) rotate(-22deg); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.preloader-hint {
  margin: 0;
  opacity: 0;
  color: var(--fg-faint);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  animation: pl-fade-in 0.6s ease-out forwards;
  animation-delay: 1.9s;
}

/* =========================================================
   Атмосфера: иней/виньетка, морозный курсор, лепестки
   ========================================================= */
.frost-vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.frost-vignette::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 90% at 50% 40%, transparent 50%, rgba(0, 0, 0, 0.45) 100%);
}
.frost-vignette::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-size: 140px 140px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#frost-cursor-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

#petal-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}
.falling-petal {
  position: fixed;
  background: linear-gradient(135deg, #f7f5f0, #e3ddd0);
  border-radius: 0 100% 0 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  opacity: 0.95;
  pointer-events: none;
  animation-name: petal-fall;
  animation-timing-function: cubic-bezier(0.4, 0.05, 0.6, 1);
  animation-fill-mode: forwards;
}
@keyframes petal-fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0.95; }
  80% { opacity: 0.75; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

.divider-rose .rose-head {
  animation: divider-twinkle 5s ease-in-out infinite;
  transform-origin: 100px 90px;
}
@keyframes divider-twinkle {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.07); }
}

/* Мягкая "вспышка" при нажатии на кнопки — без лишнего JS */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.4) 0%, transparent 70%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}
.btn:active::after { opacity: 1; transform: scale(1.5); transition: opacity 0s, transform 0s; }

/* =========================================================
   Часы — обычный раздел страницы (не прилипший виджет):
   аналоговый циферблат Киева + LED-табло с точным временем
   ========================================================= */
.clock-widget {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 40px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 0;
}
.clock-face { width: 190px; height: 190px; flex-shrink: 0; }
.clock-face-ring { fill: rgba(255, 255, 255, 0.03); stroke: var(--line-strong); stroke-width: 1.3; }
.clock-ticks line { stroke: var(--fg-faint); stroke-width: 1.4; stroke-linecap: round; }
.clock-hand {
  stroke: var(--fg);
  stroke-linecap: round;
  transform-origin: 50px 50px;
  transition: transform 0.25s cubic-bezier(0.4, 2, 0.6, 1);
}
.clock-hand-hour { stroke-width: 3; }
.clock-hand-minute { stroke-width: 2; }
.clock-hand-second { stroke-width: 0.9; opacity: 0.8; }
.clock-pivot { fill: var(--fg); }

.clock-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* LED-табло: настоящие 7-сегментные цифры на CSS, без внешних шрифтов */
.clock-digits {
  --led-w: 34px;
  --led-h: 62px;
  --led-on: #bfe4ff;
  --led-off: rgba(191, 228, 255, 0.07);
  display: flex;
  align-items: center;
}
.led-digit {
  position: relative;
  width: var(--led-w);
  height: var(--led-h);
  margin: 0 3px;
}
.led-digit .seg {
  position: absolute;
  background: var(--led-off);
  transition: background-color 0.12s, box-shadow 0.12s;
}
.led-digit .seg.on {
  background: var(--led-on);
  box-shadow: 0 0 6px rgba(160, 210, 255, 0.9), 0 0 16px rgba(120, 180, 255, 0.55);
}
.led-digit .seg-a, .led-digit .seg-g, .led-digit .seg-d {
  left: 8%;
  width: 84%;
  height: 12%;
  clip-path: polygon(10% 0%, 90% 0%, 100% 50%, 90% 100%, 10% 100%, 0% 50%);
}
.led-digit .seg-a { top: 0; }
.led-digit .seg-g { top: 44%; }
.led-digit .seg-d { top: 88%; }
.led-digit .seg-b, .led-digit .seg-c, .led-digit .seg-f, .led-digit .seg-e {
  width: 14%;
  height: 41%;
  clip-path: polygon(50% 0%, 100% 10%, 100% 90%, 50% 100%, 0% 90%, 0% 10%);
}
.led-digit .seg-f { top: 5%; left: 0; }
.led-digit .seg-b { top: 5%; right: 0; }
.led-digit .seg-e { bottom: 5%; left: 0; }
.led-digit .seg-c { bottom: 5%; right: 0; }

.led-colon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: var(--led-h);
  width: 16px;
  gap: 22%;
  margin: 0 2px;
}
.led-colon .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--led-on);
  box-shadow: 0 0 8px rgba(160, 210, 255, 0.85);
  animation: led-blink 1s steps(1) infinite;
}
@keyframes led-blink { 50% { opacity: 0.25; } }

.clock-local {
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: #6b6b70;
}

@media (max-width: 600px) {
  .section { padding: 70px 18px; }
  .post-card { padding: 22px 18px 18px; }
  .name-shadow { letter-spacing: 0.02em; }
}

/* =========================================================
   Страница 404
   ========================================================= */
.not-found {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.not-found-code {
  font-family: var(--serif);
  font-size: clamp(4rem, 16vw, 9rem);
  line-height: 1;
  color: var(--fg);
  text-shadow: 0 0 50px rgba(255, 255, 255, 0.15);
  margin: 0 0 8px;
}
.not-found-title {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  margin: 0 0 14px;
  color: var(--fg-dim);
}
.not-found-text {
  color: var(--fg-faint);
  max-width: 440px;
  margin: 0 0 34px;
}
.not-found .rose-decor {
  width: 90px;
  height: 144px;
  margin-bottom: 18px;
  opacity: 0.8;
}

/* =========================================================
   GitHub
   ========================================================= */
.github-status {
  text-align: center;
  margin: -18px 0 26px;
  color: var(--fg-dim);
  font-size: 0.95rem;
}
.github-repos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.github-repo-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.github-repo-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.github-repo-card h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--fg);
}
.github-repo-card p {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--fg-dim);
  min-height: 1.3em;
}
.github-repo-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--fg-faint);
}
.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.github-note {
  text-align: center;
  font-size: 0.8rem;
  margin-top: 18px;
}
.github-link-wrap {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}


