/* ===== Tokens ===== */
:root {
  --bg: #0d1117;
  --bg-raised: #12181f;
  --bg-card: #161b22;
  --border: #30363d;
  --border-soft: #21262d;
  --text: #c9d1d9;
  --text-dim: #8b949e;
  --text-bright: #f0f3f6;

  --green: #3fb950;
  --green-bright: #56d364;
  --blue: #58a6ff;
  --purple: #bc8cff;
  --orange: #d29922;
  --pink: #f778ba;
  --cyan: #39c5cf;
  --red: #f85149;
  --yellow: #e3b341;

  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 8px;
  --max-w: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ===== background canvas ===== */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  opacity: 0.35;
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.012) 0px,
    rgba(255, 255, 255, 0.012) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ===== topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  font-weight: 700;
  color: var(--text-bright);
  font-size: 15px;
}
.brand .prompt { color: var(--green-bright); margin-right: 1px; }

.tabs {
  display: flex;
  gap: 24px;
}
.tabs a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13.5px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tabs a:hover { color: var(--text-bright); }
.tab-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s ease;
}
.tabs a:hover .tab-dot { background: var(--green-bright); }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.menu-toggle span {
  width: 20px; height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ===== layout ===== */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 24px;
}

.section { margin-top: 88px; scroll-margin-top: 84px; }
.hero { scroll-margin-top: 84px; }

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .prompt { color: var(--green-bright); }

/* ===== terminal window ===== */
.window {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.window-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid var(--border-soft);
}
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }
.window-title {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.window-body { padding: 20px 18px; min-height: 168px; }

.term-lines, .term-final {
  margin: 0;
  white-space: pre-wrap;
  font-size: 13.5px;
  color: var(--text);
}
.term-lines { min-height: 20px; }
.term-final { margin-top: 10px; }
.term-lines .prompt-line, .term-final .prompt-line { color: var(--green-bright); }
.term-lines .out-line, .term-final .out-line { color: var(--text-dim); }
.term-lines .caret, .term-final .caret {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--green-bright);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===== hero ===== */
.hero {
  padding-top: 24px;
}
.hero-window {
  width: 100%;
  max-width: 640px;
  margin-bottom: 40px;
}

/* ---- neofetch card ---- */
.neofetch-block {
  display: none;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-soft);
}
.neofetch-block.show { display: block; }
.neofetch-body {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.ascii-art {
  display: flex;
  flex-direction: column;
  line-height: 0;
  flex: none;
  border-radius: 4px;
  overflow: hidden;
}
.art-row { display: flex; }
.art-row i { width: 4px; height: 4px; display: block; font-style: normal; }

.neofetch-info {
  font-size: 12px;
  line-height: 1.85;
  min-width: 0;
  flex: 1;
}
.nf-header { margin: 0; color: var(--green-bright); font-weight: 700; font-size: 13px; }
.nf-sep { margin: 0 0 6px; color: var(--border); letter-spacing: -1px; }
.nf-row { margin: 0; color: var(--text); overflow-wrap: break-word; }
.nf-key { color: var(--cyan); display: inline-block; min-width: 88px; padding-right: 6px; }
.nf-swatches { display: flex; gap: 4px; margin-top: 12px; }
.nf-swatch { width: 14px; height: 10px; border-radius: 2px; display: block; }

.hero-copy h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 6px;
  color: var(--text-bright);
  letter-spacing: -0.5px;
}
.hero-copy .accent { color: var(--green-bright); }
.role {
  font-size: 15px;
  color: var(--blue);
  margin: 0 0 14px;
  font-weight: 600;
}
.role .dim { color: var(--text-dim); font-weight: 400; }
.pitch { color: var(--text); margin: 0 0 24px; font-size: 14px; line-height: 1.75; max-width: 640px; }
.pitch .kw { color: var(--orange); }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.btn:hover { border-color: var(--green-bright); color: var(--text-bright); transform: translateY(-1px); }
.btn-primary {
  background: rgba(63, 185, 80, 0.12);
  border-color: rgba(63, 185, 80, 0.4);
  color: var(--green-bright);
  font-weight: 600;
}
.btn-primary:hover { border-color: var(--green-bright); }

/* ===== code card / skills ===== */
.code-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
}
/* ---- skills.yaml syntax highlighting ---- */
.yaml-card { padding: 20px 24px; }
.yaml-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 32px;
}
.yaml-block pre {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}
.yk { color: var(--cyan); font-weight: 700; }
.yd { color: var(--border); }
.ys-blue { color: var(--blue); }
.ys-orange { color: var(--orange); }
.ys-purple { color: var(--purple); }
.ys-green { color: var(--green-bright); }

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-row.small { margin-top: 14px; }

.tag {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  white-space: nowrap;
}
.tag-blue { color: var(--blue); border-color: rgba(88,166,255,0.35); background: rgba(88,166,255,0.08); }
.tag-purple { color: var(--purple); border-color: rgba(188,140,255,0.35); background: rgba(188,140,255,0.08); }
.tag-orange { color: var(--orange); border-color: rgba(210,153,34,0.35); background: rgba(210,153,34,0.08); }
.tag-diff { color: var(--green-bright); background: rgba(63,185,80,0.08); border-color: var(--border-soft); font-family: var(--font-mono); }

/* ===== git log experience ===== */
.gitlog { position: relative; }

.commit {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 4px;
  position: relative;
}

.commit-rail {
  position: relative;
  display: flex;
  justify-content: center;
}
.commit-rail::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: -34px;
  width: 2px;
  background: var(--border);
}
.commit:last-child .commit-rail::before { display: none; }

.commit-node {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--green-bright);
  margin-top: 4px;
  z-index: 1;
  box-shadow: 0 0 0 4px var(--bg);
}
.commit-root .commit-node { border-color: var(--text-dim); }

.commit-body {
  padding-bottom: 44px;
  padding-left: 12px;
}

.commit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12.5px;
}
.commit-hash {
  color: var(--yellow);
  background: rgba(227,179,65,0.1);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(227,179,65,0.25);
}
.commit-branch {
  color: var(--cyan);
  border: 1px solid rgba(57,197,207,0.3);
  background: rgba(57,197,207,0.08);
  padding: 2px 7px;
  border-radius: 4px;
}
.commit-date { color: var(--text-dim); }

.commit-title {
  margin: 0 0 2px;
  font-size: 17px;
  color: var(--text-bright);
}
.commit-loc { margin: 0 0 12px; color: var(--text-dim); font-size: 13px; }
.commit-msg { margin: 0 0 12px; font-size: 13.5px; color: var(--text); }
.commit-bullets { margin: 0 0 4px; padding-left: 20px; }
.commit-bullets li { margin-bottom: 6px; font-size: 13.5px; color: var(--text); }
.commit-bullets li strong { color: var(--green-bright); }

/* ===== project file-listing ===== */
.listing-body { padding: 8px 0; }

.file-listing {
  list-style: none;
  margin: 0;
  padding: 0;
}

.file-row a {
  display: grid;
  grid-template-columns: 84px 168px 16px 1fr auto;
  align-items: center;
  column-gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.12s ease;
}
.file-row:last-child a { border-bottom: none; }
.file-row a:hover { background: rgba(63, 185, 80, 0.06); }
.file-row a:hover .f-name { color: var(--green-bright); }

.f-mode {
  color: var(--text-dim);
  font-size: 12.5px;
}
.f-name {
  color: var(--blue);
  font-weight: 600;
  font-size: 13.5px;
  transition: color 0.12s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.f-arrow {
  color: var(--border);
  font-size: 12px;
}
.f-desc {
  color: var(--text-dim);
  font-size: 13px;
}

.tag-cyan { color: var(--cyan); border-color: rgba(57,197,207,0.35); background: rgba(57,197,207,0.08); }

/* ===== json / code blocks ===== */
.json-card pre, .contact-json {
  margin: 0;
  font-size: 13.5px;
  white-space: pre-wrap;
  line-height: 1.9;
}
.json-card .k, .contact-json .k { color: var(--blue); }
.json-card .s, .contact-json .s { color: var(--green-bright); }
.json-card .p, .contact-json .p { color: var(--text-dim); }
.contact-json a { color: var(--green-bright); border-bottom: 1px dashed rgba(86,211,100,0.4); }
.contact-json a:hover { color: var(--text-bright); border-color: var(--text-bright); }

.contact-window .window-body { padding: 22px 24px; }

/* ===== footer ===== */
.footer {
  max-width: var(--max-w);
  margin: 90px auto 0;
  padding: 24px 24px 48px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-size: 13px;
}
.footer p { margin: 4px 0; }
.dim { color: var(--text-dim); }

/* ===== reveal-on-scroll ===== */
.section, .hero { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.section.is-visible, .hero.is-visible { opacity: 1; transform: translateY(0); }

/* ===== responsive ===== */
@media (max-width: 480px) {
  .neofetch-body { flex-direction: column; }
}

@media (max-width: 720px) {
  .tabs { display: none; }
  .menu-toggle { display: flex; }
  .tabs.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 24px 18px;
    gap: 14px;
  }
}

@media (max-width: 640px) {
  .file-row a {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name  tag"
      "desc  desc";
    row-gap: 4px;
  }
  .f-mode, .f-arrow { display: none; }
  .f-name { grid-area: name; white-space: normal; }
  .f-desc { grid-area: desc; }
  .file-row .tag { grid-area: tag; justify-self: end; }
}

@media (max-width: 520px) {
  main { padding: 32px 16px 16px; }
  .section { margin-top: 64px; }
  .cta-row { flex-direction: column; align-items: stretch; }
  .btn { text-align: center; }
  .yaml-grid { grid-template-columns: 1fr; }
}
