/* ---------------------------------------------------------------
   Reset
   --------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------------
   Design tokens
   --------------------------------------------------------------- */
:root {
  --bg:          #0a0a0f;
  --bg-soft:     #0f0f16;
  --surface:     #12121b;
  --surface-2:   #171724;
  --border:      #262636;
  --border-soft: #1d1d2b;
  --text:        #ececf1;
  --muted:       #9b9bab;
  --faint:       #666677;
  --accent:      #8b7cf6;
  --accent-2:    #22d3ee;
  --accent-3:    #4ade80;
  --accent-soft: rgba(139, 124, 246, 0.14);

  --maxw: 860px;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'JetBrains Mono', 'Cascadia Code', 'SF Mono', Menlo, Consolas, monospace;
}

/* ---------------------------------------------------------------
   Base
   --------------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  background-image:
    radial-gradient(60rem 40rem at 50% -10%, rgba(139, 124, 246, 0.10), transparent 70%),
    radial-gradient(40rem 30rem at 100% 0%, rgba(34, 211, 238, 0.06), transparent 60%),
    linear-gradient(rgba(139, 124, 246, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 124, 246, 0.035) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
  background-attachment: fixed;
}

a { color: inherit; }

::selection {
  background: var(--accent-soft);
  color: #fff;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface-2);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 10;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

/* ---------------------------------------------------------------
   Top nav
   --------------------------------------------------------------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(10, 10, 15, 0.7);
  border-bottom: 1px solid rgba(38, 38, 54, 0.6);
}

.topnav__brand {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.topnav__mark { color: var(--accent); }
.topnav__tld { color: var(--accent-2); }

.topnav__links {
  display: flex;
  gap: 1.1rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.topnav__links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.topnav__links a:hover { color: var(--text); }
.topnav__links a[aria-current="page"] { color: var(--accent-2); }
.topnav__links a[aria-current="page"]::before { content: '> '; }

/* ---------------------------------------------------------------
   Layout
   --------------------------------------------------------------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5rem) 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: clamp(3rem, 8vh, 5rem);
}

.container--blog { max-width: 720px; }

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */
.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (min-width: 760px) {
  .hero__grid { grid-template-columns: 1.1fr 0.9fr; }
}

.hero__status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 8px var(--accent-3);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.hero__name {
  font-size: clamp(2.4rem, 7vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  background: linear-gradient(120deg, #ffffff 0%, #c9c4f5 55%, var(--accent-2) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero__tagline {
  margin-top: 1rem;
  max-width: 42ch;
  font-size: clamp(1rem, 2.5vw, 1.12rem);
  color: var(--muted);
  letter-spacing: -0.01em;
}
.hero__tagline strong { color: var(--text); font-weight: 600; }

.hero__links {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
              background 0.2s var(--ease), transform 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
}
.link__icon {
  display: inline-flex;
  color: var(--faint);
  transition: color 0.2s var(--ease);
}
.link:hover {
  color: #fff;
  background: var(--surface-2);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 0 16px rgba(139, 124, 246, 0.25);
}
.link:hover .link__icon { color: var(--accent); }

/* ---------------------------------------------------------------
   Terminal
   --------------------------------------------------------------- */
.terminal {
  background: #0c0c13;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.82rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 24px rgba(139, 124, 246, 0.08);
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
}
.terminal__dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal__dot--r { background: #ff5f57; }
.terminal__dot--y { background: #febc2e; }
.terminal__dot--g { background: #28c840; }
.terminal__title {
  margin-left: 0.5rem;
  color: var(--faint);
  font-size: 0.74rem;
}

.terminal__body {
  padding: 1rem 1.1rem 1.2rem;
  min-height: 9.5rem;
  line-height: 1.8;
  color: var(--muted);
}
.t-prompt { color: var(--accent-3); margin-right: 0.4rem; }
.t-out { color: var(--text); }
.t-out--dim { color: var(--muted); }
.t-cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--accent-2);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------------
   Section headings
   --------------------------------------------------------------- */
.section-title {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}
.section-title__hash { color: var(--accent); margin-right: 0.4rem; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head .section-title { margin-bottom: 0; }
.section-head__more {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--faint);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.section-head__more:hover { color: var(--accent-2); }

.loadout .section-title,
.writing .section-title { margin-bottom: 1.5rem; }
.writing .section-head .section-title { margin-bottom: 0; }

/* ---------------------------------------------------------------
   Loadout
   --------------------------------------------------------------- */
.loadout__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.75rem;
  list-style: none;
}

.gear {
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
}
.gear:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(139, 124, 246, 0.18);
}
.gear__slot {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  margin-bottom: 0.2rem;
}

/* ---------------------------------------------------------------
   Blog cards (home + /blog)
   --------------------------------------------------------------- */
.post-list {
  display: grid;
  gap: 0.75rem;
}
.post-list--home { grid-template-columns: 1fr; }
@media (min-width: 700px) {
  .post-list--home { grid-template-columns: 1fr 1fr; }
}

.post-card {
  position: relative;
  padding: 1.3rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease),
              transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.post-card:hover {
  border-color: var(--border);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.08);
}

.post-card__link {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--faint);
  letter-spacing: 0.02em;
}
.post-card__dot { opacity: 0.6; }

.post-card__title {
  margin-top: 0.5rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.4;
}
.post-card:hover .post-card__title { color: #fff; }

.post-card__desc {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.tags {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}
.tags li {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  color: var(--accent-2);
  padding: 0.15rem 0.55rem;
  background: rgba(34, 211, 238, 0.07);
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 6px;
}

.widget-note {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--faint);
}
.widget-note a { color: var(--muted); }

/* ---------------------------------------------------------------
   Steam widget
   --------------------------------------------------------------- */
.steam__live {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent-3);
  letter-spacing: 0.04em;
}

.steam__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}

.game {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease),
              box-shadow 0.25s var(--ease);
}
.game:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 20px rgba(139, 124, 246, 0.2);
}

.game__img {
  display: block;
  width: 100%;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  background: var(--bg-soft);
}

.game__body { padding: 0.8rem 0.95rem 0.95rem; }

.game__name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game__stats {
  margin-top: 0.35rem;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}
.game__recent { color: var(--accent-3); }

/* XP-style bar showing recent playtime share */
.game__bar {
  margin-top: 0.6rem;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-soft);
  overflow: hidden;
}
.game__bar span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.game--skeleton {
  height: 190px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border: 1px solid var(--border-soft);
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}

/* ---------------------------------------------------------------
   Blog pages (/blog, /blog/:slug)
   --------------------------------------------------------------- */
.page-head__kicker,
.post__head .page-head__kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-2);
  margin-bottom: 0.6rem;
}
.page-head__kicker a { color: inherit; text-decoration: none; }
.page-head__kicker a:hover { text-decoration: underline; }

.page-head__title {
  font-size: clamp(2rem, 6vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #ffffff 0%, #c9c4f5 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.page-head__sub {
  margin-top: 0.8rem;
  color: var(--muted);
  max-width: 55ch;
}

.post__title {
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.8rem;
  color: #fff;
}
.post__head .tags { margin-top: 0.8rem; }
.post__head { margin-bottom: 2.2rem; padding-bottom: 1.8rem; border-bottom: 1px solid var(--border-soft); }
.post__back { margin-top: 2.5rem; font-family: var(--mono); font-size: 0.85rem; }
.post__back a { color: var(--muted); text-decoration: none; }
.post__back a:hover { color: var(--accent-2); }

.prose { font-size: 1.02rem; color: #cfcfda; }
.prose h2 {
  margin: 2.2rem 0 0.8rem;
  font-size: 1.3rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: #fff;
}
.prose h2::before { content: '## '; color: var(--accent); font-family: var(--mono); font-size: 1rem; }
.prose h3 { margin: 1.8rem 0 0.6rem; font-size: 1.1rem; color: #fff; }
.prose p { margin: 0.9rem 0; }
.prose ul, .prose ol { margin: 0.9rem 0 0.9rem 1.4rem; }
.prose li { margin: 0.35rem 0; }
.prose strong { color: var(--text); }
.prose a { color: var(--accent-2); text-decoration-color: rgba(34, 211, 238, 0.4); }
.prose blockquote {
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 0.12em 0.4em;
  color: var(--accent-2);
}
.prose pre {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  background: #0c0c13;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.6;
}
.prose pre code {
  background: none;
  border: none;
  padding: 0;
  color: #d6d6e2;
  font-size: 0.84rem;
}

/* ---------------------------------------------------------------
   Footer
   --------------------------------------------------------------- */
.footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.85rem;
  color: var(--faint);
}
.footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.footer a:hover { color: var(--text); }
.footer__sep { opacity: 0.5; }
.footer__quip { font-family: var(--mono); font-size: 0.75rem; }

/* ---------------------------------------------------------------
   Scroll reveal (progressive enhancement; see main.js)
   --------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
.no-js .reveal {
  opacity: 1;
  transform: none;
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (min-width: 560px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* ---------------------------------------------------------------
   Accessibility: respect reduced motion
   --------------------------------------------------------------- */
@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;
  }
  .reveal { opacity: 1; transform: none; }
}
