/* ===== Theme tokens ===== */
:root {
  --accent: #E5484D;
  --accent-soft: rgba(229, 72, 77, 0.15);
  --bg: #0d1117;
  --bg-alt: #111725;
  --surface: #161b26;
  --surface-2: #1c2333;
  --border: #232a38;
  --text: #e6edf3;
  --muted: #9aa7b8;
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 960px;
}

:root[data-theme="light"] {
  --accent: #CC2E33;
  --accent-soft: rgba(204, 46, 51, 0.10);
  --bg: #ffffff;
  --bg-alt: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f2f5fa;
  --border: #e2e8f2;
  --text: #14181f;
  --muted: #5a6675;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

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

.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;
}
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--accent);
  color: #fff; padding: 8px 14px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ===== Nav ===== */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  background: var(--accent); color: #fff; border-radius: 8px;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
}
.site-nav nav { display: flex; gap: 20px; margin-left: auto; }
.site-nav nav a { color: var(--muted); font-size: 14px; font-weight: 500; }
.site-nav nav a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 15px;
}
.theme-toggle:hover { border-color: var(--accent); }

/* ===== Hero ===== */
.hero { padding: 90px 0 70px; border-bottom: 1px solid var(--border); }
.hero-inner { display: flex; align-items: center; gap: 56px; }
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero-avatar { flex: 0 0 auto; }
.hero-avatar img {
  display: block; width: clamp(190px, 26vw, 300px); height: auto;
  filter: drop-shadow(0 6px 26px rgba(229, 72, 77, 0.4));
  animation: floaty 6s ease-in-out infinite;
}
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.eyebrow { font-family: var(--mono); color: var(--accent); font-size: 14px; margin: 0 0 12px; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); margin: 0 0 10px; letter-spacing: -0.02em; }
.typewriter {
  font-family: var(--mono); font-size: clamp(1rem, 2.6vw, 1.35rem);
  color: var(--text); font-weight: 600; min-height: 1.8em; margin: 0 0 22px;
}
.caret { color: var(--accent); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lead { font-size: 1.12rem; max-width: 640px; color: var(--muted); margin: 0 0 28px; }
.lead strong { color: var(--text); }
.lead em { color: var(--text); font-style: normal; border-bottom: 2px solid var(--accent-soft); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }

/* ===== Sections ===== */
.section { padding: 70px 0; border-bottom: 1px solid var(--border); }
.section-alt { background: var(--bg-alt); }
.section h2 { font-size: 1.7rem; margin: 0 0 8px; letter-spacing: -0.01em; }
.hash { color: var(--accent); font-family: var(--mono); }
.section-lead { color: var(--muted); max-width: 620px; margin: 0 0 34px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; transition: .18s;
}
.card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card-icon { font-size: 26px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.96rem; }

/* Experience timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 10px;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; padding: 0 0 26px 34px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: 0; top: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg); border: 3px solid var(--accent);
}
.tl-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tl-head h3 { margin: 0; font-size: 1.08rem; }
.tl-co { color: var(--accent); font-weight: 700; font-family: var(--mono); font-size: 0.92rem; }
.tl-meta { margin: 3px 0 6px; color: var(--muted); font-size: 0.82rem; font-family: var(--mono); }
.tl-desc { margin: 0; color: var(--muted); }
.tl-more { margin: 24px 0 0; font-weight: 600; }

/* Spotlight */
.spotlight {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius);
  padding: 26px; margin-bottom: 20px;
}
.spotlight-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.spotlight-head h3 { margin: 0; font-family: var(--mono); font-size: 1.15rem; }
.tag {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px;
}
.spotlight p { color: var(--muted); margin: 0 0 16px; }
.links-row { display: flex; gap: 20px; flex-wrap: wrap; font-weight: 600; font-size: 14px; }

.repo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.repo {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; color: var(--text); transition: .18s;
}
.repo:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-3px); }
.repo h4 { margin: 0 0 6px; font-family: var(--mono); color: var(--accent); }
.repo p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* Talks */
.talks { list-style: none; padding: 0; margin: 0 0 28px; }
.talk { display: flex; gap: 22px; padding: 20px 0; border-top: 1px solid var(--border); }
.talk:last-child { border-bottom: 1px solid var(--border); }
.talk-date { font-family: var(--mono); color: var(--accent); font-weight: 700; min-width: 56px; }
.talk-body h3 { margin: 0 0 4px; font-size: 1.1rem; }
.talk-role { margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.cta-line { color: var(--muted); }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 20px; }
.badge {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted); font-size: 13px; font-weight: 600;
  transition: .18s;
}
.badge:hover { border-color: var(--accent); transform: translateY(-4px); text-decoration: none; color: var(--text); }
.badge img { width: 96px; height: 96px; object-fit: contain; }

/* Expired state + corner ribbon */
.badge.expired img { filter: grayscale(0.7) opacity(0.65); }
.badge.expired { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.ribbon {
  position: absolute; top: 14px; right: -40px;
  width: 140px; padding: 4px 0;
  transform: rotate(45deg);
  background: var(--accent); color: #fff;
  text-align: center; line-height: 1.1;
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.ribbon small { display: block; font-size: 8px; font-weight: 600; letter-spacing: 0.02em; opacity: 0.95; }

/* Off the Clock (Steam) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.stat {
  display: flex; flex-direction: column; gap: 2px; padding: 20px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); transition: .18s;
}
.stat:hover { border-color: var(--accent); transform: translateY(-3px); }
.stat-icon { font-size: 1.7rem; line-height: 1; margin-bottom: 6px; }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--text); font-family: var(--mono); }
.stat-label { margin-top: 6px; font-size: 0.9rem; font-weight: 600; }
.stat-quip { color: var(--muted); font-size: 0.8rem; }
/* Steam-style circular level badge */
.level-badge {
  width: 58px; height: 58px; border-radius: 50%; margin-bottom: 4px;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(229, 72, 77, 0.28), transparent 70%), var(--surface-2);
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 3px var(--surface), 0 0 14px rgba(229, 72, 77, 0.4);
}
.level-badge span {
  font-family: var(--mono); font-weight: 800; font-size: 1.2rem; color: var(--text);
}
.mini-h { margin: 30px 0 10px; font-size: 1.05rem; }
.game-list { list-style: none; margin: 0; padding: 0; }
.game-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.game-list .g-name { color: var(--text); font-weight: 600; }
.game-list .g-hrs { margin-left: auto; font-family: var(--mono); color: var(--accent); font-size: 0.9rem; }
.offclock-quip { margin: 18px 0 0; color: var(--muted); font-style: italic; }
.offclock-quip a { font-style: normal; font-weight: 600; }

/* Mood (Spotify) */
.mood-loading { color: var(--muted); font-family: var(--mono); }
.mood-now {
  display: flex; gap: 16px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 18px;
}
.mood-art {
  width: 76px; height: 76px; flex: 0 0 auto; border-radius: 8px; object-fit: cover;
  background: var(--surface-2); display: grid; place-items: center; font-size: 28px; color: var(--muted);
}
.mood-now-body { min-width: 0; }
.mood-quip {
  margin: 0 0 4px; color: var(--accent); font-family: var(--mono);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}
.mood-now-body h3 { margin: 0 0 2px; font-size: 1.08rem; }
.mood-now-body h3 a { color: var(--text); }
.mood-artist { margin: 0; color: var(--muted); font-size: 0.95rem; }
.mood-when { color: var(--accent); }
.mood-list { list-style: none; margin: 18px 0 0; padding: 0; }
.mood-track { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.mood-track .num { font-family: var(--mono); color: var(--muted); font-size: 12px; width: 18px; flex: 0 0 auto; }
.mood-track .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mood-track .t a { color: var(--text); }
.mood-track .t span { color: var(--muted); }
.mood-track .ago { margin-left: auto; color: var(--muted); font-size: 12px; font-family: var(--mono); flex: 0 0 auto; }
.mood-foot { margin: 14px 0 0; color: var(--muted); font-size: 12px; }
.mood-chip {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700;
}

/* Contact */
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; }

/* Footer */
.site-footer { padding: 30px 0; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.footer-quote { font-family: var(--mono); }

/* ===== Svarog fire easter egg ===== */
.hero-avatar { position: relative; }
.hero-avatar img { cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }

/* Easter-egg hint speech bubble */
.avatar-hint {
  position: absolute; top: 8px; right: calc(100% + 20px); z-index: 6;
  width: 244px; padding: 14px 30px 14px 16px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 12px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  font-size: 13.5px; line-height: 1.45; text-align: left;
  opacity: 0; transform: translateY(6px) scale(0.96); transform-origin: right center;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}
.avatar-hint.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.avatar-hint strong { display: block; margin-bottom: 4px; color: var(--accent); }
.avatar-hint::after {
  content: ""; position: absolute; top: 20px; left: 100%;
  border: 9px solid transparent; border-left-color: var(--surface-2);
}
.avatar-hint-close {
  position: absolute; top: 5px; right: 8px; padding: 2px;
  background: none; border: none; color: var(--muted);
  font-size: 17px; line-height: 1; cursor: pointer;
}
.avatar-hint-close:hover { color: var(--text); }
/* Dark stage behind the flames so they stay visible in light theme too */
#fire-backdrop {
  position: fixed; inset: 0; z-index: 998; pointer-events: none;
  opacity: 0; transition: opacity 0.45s ease;
  background: linear-gradient(to top,
    rgba(8, 4, 2, 0.85), rgba(8, 4, 2, 0.5) 26%, rgba(8, 4, 2, 0.14) 48%, transparent 64%);
}
#fire-backdrop.active { opacity: 1; }
#fire-canvas {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  mix-blend-mode: screen; opacity: 0; transition: opacity 0.4s ease;
}
#fire-canvas.active { opacity: 1; }
/* Reduced-motion fallback: a static warm wash instead of the animated fire */
#flame-layer {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  opacity: 0; transition: opacity 0.35s ease;
}
#flame-layer.active { opacity: 1; }
.flame-glow {
  position: absolute; left: 0; right: 0; bottom: 0; height: 55vh;
  background: radial-gradient(130% 100% at 50% 100%,
    rgba(255, 190, 70, 0.5), rgba(229, 72, 77, 0.3) 42%, transparent 74%);
  mix-blend-mode: screen;
}
#main.shake { animation: page-shake 0.5s ease-in-out; }
@keyframes page-shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 2px) rotate(-0.2deg); }
  40% { transform: translate(5px, -2px) rotate(0.2deg); }
  60% { transform: translate(-4px, -1px); }
  80% { transform: translate(4px, 1px); }
}

@media (max-width: 760px) {
  .hero-inner { flex-direction: column-reverse; text-align: center; gap: 30px; }
  .hero-text .lead { margin-left: auto; margin-right: auto; }
  .cta-row { justify-content: center; }
  /* Hint bubble sits below the (now centered, top) avatar with an upward tail */
  .avatar-hint {
    top: calc(100% + 16px); right: auto; left: 50%;
    transform: translate(-50%, 6px) scale(0.96); transform-origin: top center;
  }
  .avatar-hint.show { transform: translate(-50%, 0) scale(1); }
  .avatar-hint::after {
    top: auto; bottom: 100%; left: 50%;
    border: 9px solid transparent; border-left-color: transparent; border-bottom-color: var(--surface-2);
    transform: translateX(-50%);
  }
}

@media (max-width: 600px) {
  .site-nav nav { display: none; }
  .hero { padding: 60px 0 50px; }
  .section { padding: 50px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .caret { animation: none; }
  .hero-avatar img { animation: none; }
}
