:root {
  --bg: #0a0d14;
  --bg-soft: #0e121b;
  --panel: #121826;
  --panel-border: #232b3d;
  --text: #e7eaf2;
  --muted: #8a93a8;
  --accent: #5b8cff;
  --accent-dim: #2d3f6b;
  --amber: #ffb454;
  --green: #3ddc84;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }

img { max-width: 100%; display: block; }

/* subtle grain overlay for texture, avoids flat-vector AI look */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 13, 20, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}
.logo .dot { color: var(--accent); }
.nav { display: flex; gap: 28px; }
.nav a {
  font-size: 0.92rem;
  color: var(--muted);
  transition: color .2s;
}
.nav a:hover { color: var(--text); }
.nav-cta { font-size: 0.88rem; }

@media (max-width: 720px) {
  .nav { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.btn-primary {
  background: var(--accent);
  color: #060810;
  font-weight: 600;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost {
  border-color: var(--panel-border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- Status dots ---------- */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  position: relative;
}
.status-live { background: var(--green); box-shadow: 0 0 0 0 rgba(61,220,132,.6); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61,220,132,.5); }
  70% { box-shadow: 0 0 0 6px rgba(61,220,132,0); }
  100% { box-shadow: 0 0 0 0 rgba(61,220,132,0); }
}

.section-label {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}
.section-sub { color: var(--muted); max-width: 520px; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
  padding-top: 76px;
  padding-bottom: 96px;
  min-height: 88vh;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
}
.role {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.1rem;
  margin: 12px 0 22px;
}
.hero-desc {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 0 34px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.portrait-frame {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--panel-border);
  box-shadow: 0 0 0 8px rgba(91,140,255,0.06);
  flex-shrink: 0;
}
.portrait { width: 100%; height: 100%; object-fit: cover; }

.terminal {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border);
}
.tdot { width: 10px; height: 10px; border-radius: 50%; }
.tdot.r { background: #ff5f57; }
.tdot.y { background: #febc2e; }
.tdot.g { background: #28c840; }
.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 8px;
}
.terminal-body {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  padding: 18px 16px;
  margin: 0;
  min-height: 220px;
  white-space: pre-wrap;
  color: #cfd6e6;
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 48px; }
  .hero-visual { margin-top: 40px; }
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 60px;
  padding: 90px 24px;
  align-items: start;
  border-top: 1px solid var(--panel-border);
}
.about-photo img {
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
}
.about-copy h2 { font-size: 2rem; margin-bottom: 20px; }
.about-copy p { color: #c3c9d8; }
.about-facts {
  display: flex;
  gap: 32px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.fact-num {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--accent);
  display: block;
  font-weight: 600;
}
.fact-label {
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 780px) {
  .about { grid-template-columns: 1fr; }
}

/* ---------- Stack ---------- */
.stack { padding: 90px 24px; border-top: 1px solid var(--panel-border); }
.stack h2 { font-size: 2rem; margin-bottom: 32px; }
.stack-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.stack-chip {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: #c3c9d8;
  background: var(--bg-soft);
}

/* ---------- Projects ---------- */
.projects { padding: 90px 24px; border-top: 1px solid var(--panel-border); }
.projects h2 { font-size: 2rem; margin-bottom: 10px; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
}
.project-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform .18s ease, border-color .18s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}
.project-top {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.project-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.project-card h3 { font-size: 1.3rem; margin-bottom: 6px; }
.project-url {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--amber);
  margin: 0 0 12px;
}
.project-desc { color: var(--muted); font-size: 0.9rem; margin: 0 0 18px; }
.project-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
}

@media (max-width: 900px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* ---------- Contact ---------- */
.contact {
  padding: 100px 24px;
  border-top: 1px solid var(--panel-border);
  text-align: center;
}
.contact h2 { font-size: 2.2rem; margin-bottom: 12px; }
.contact .section-sub { margin: 0 auto 32px; }
.contact-links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.edit-hint {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ---------- Footer ---------- */
.footer {
  padding: 32px 24px 48px;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--panel-border);
}

/* ---------- Leo widget ---------- */
#leo-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  font-family: var(--font-body);
}
#leo-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #060810;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px -6px rgba(91,140,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease;
}
#leo-toggle:hover { transform: scale(1.06); }

#leo-panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  max-width: 86vw;
  height: 460px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#leo-panel.hidden { display: none; }

.leo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--panel-border);
}
.leo-title { display: flex; align-items: center; gap: 8px; }
.leo-sub { font-size: 0.72rem; color: var(--muted); }
#leo-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
}

#leo-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.leo-msg {
  font-size: 0.88rem;
  padding: 10px 13px;
  border-radius: 10px;
  max-width: 88%;
  line-height: 1.45;
}
.leo-msg.user {
  background: var(--accent);
  color: #060810;
  align-self: flex-end;
}
.leo-msg.bot {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  align-self: flex-start;
  color: #dfe4ee;
}
.leo-msg.typing { color: var(--muted); font-style: italic; }

#leo-form {
  display: flex;
  border-top: 1px solid var(--panel-border);
}
#leo-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  padding: 14px 16px;
  font-size: 0.88rem;
  font-family: var(--font-body);
}
#leo-form button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.1rem;
  padding: 0 18px;
  cursor: pointer;
}
