/* ---------- tokens (GitHub dark) ---------- */
:root {
  --bg:        #0f1117;
  --inset:     #1a1d25;
  --surface:   #161820;
  --raised:    #1d1f2b;
  --border:    #2a2d3a;
  --border-hi: #3a3d4a;
  --text:      #e2e4ed;
  --muted:     #7a7d8f;

  --blue:      #61afef;
  --amber:     #e5c07b;
  --red:       #e06c75;
  --cyan:      #56b6c2;

  --blue-tint:  rgba(97, 175, 239, 0.1);
  --amber-tint: rgba(229, 192, 123, 0.1);

  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px;
  --width: 1040px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --section-y: clamp(3rem, 7vw, 5rem);
  --nav-h: 56px;
}

/* ---------- base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  overflow-x: hidden;
  background-image:
    radial-gradient(900px 480px at 50% -80px, rgba(97,175,239,.13), transparent 70%),
    radial-gradient(600px 400px at 100% 40%, rgba(86,182,194,.05), transparent 70%);
  background-repeat: no-repeat;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

main { max-width: calc(var(--width) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: var(--section-y) 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: 0; }

.section-label {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 2rem;
  font: 700 15px var(--mono);
  color: var(--text);
}
.section-label i { color: var(--blue); font-size: 14px; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- nav ---------- */
nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  padding: 0 max(var(--gutter), calc((100% - var(--width)) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(15, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { font: 700 14px var(--mono); color: var(--text); }
.nav-logo span { color: var(--blue); margin-right: 4px; }
.nav-logo:hover { text-decoration: none; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a, .mobile-nav a {
  font: 12px var(--mono);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: var(--radius);
}
.nav-links a:hover, .mobile-nav a:hover { color: var(--text); background: var(--raised); text-decoration: none; }
.nav-links a[aria-current], .mobile-nav a[aria-current] { color: var(--text); }
.nav-links a[aria-current]:not(.nav-cta) { box-shadow: inset 0 -2px 0 var(--blue); border-radius: 0; }

.nav-links .nav-cta, .mobile-nav .nav-cta {
  color: var(--bg); background: var(--blue); font-weight: 700;
  padding: 5px 14px;
}
.nav-links .nav-cta:hover, .mobile-nav .nav-cta:hover { background: var(--blue); opacity: .88; }

.nav-toggle {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  background: var(--raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--border-hi); }

.mobile-nav {
  display: none;
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 99;
  padding: 1rem; gap: 4px; flex-direction: column;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.mobile-nav.open { display: flex; }
.mobile-nav a { font-size: 14px; padding: 10px 14px; }
.mobile-nav .nav-cta { text-align: center; margin-top: 4px; }

/* ---------- buttons, tags, cards ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px;
  font: 700 13px var(--mono);
  color: var(--blue); background: transparent;
  border: 1px solid var(--border-hi); border-radius: var(--radius);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: var(--blue-tint); border-color: var(--blue); text-decoration: none; }
.btn-primary { color: var(--bg); background: var(--blue); border-color: var(--blue); }
.btn-primary { box-shadow: 0 4px 16px rgba(97,175,239,.25); }
.btn-primary:hover { background: var(--blue); opacity: 1; box-shadow: 0 6px 22px rgba(97,175,239,.4); }

.tag, .pill {
  display: inline-block;
  font: 11px var(--mono);
  border-radius: 20px;
}
.tag { padding: 2px 8px; }
.tag-amber { color: var(--amber); background: var(--amber-tint); border: 1px solid rgba(229, 192, 123, 0.25); }
.pill { font-size: 12.5px; padding: 5px 13px; background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, color .15s, background .15s; }
.pill:hover { background: var(--blue-tint); }
.pill:hover { border-color: var(--blue); color: var(--blue); }
.pill-amber { color: var(--amber); border-color: rgba(229, 192, 123, 0.3); background: var(--amber-tint); }
.pill-amber:hover { border-color: var(--amber); color: var(--amber); }

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  transition: border-color .2s, background .2s;
}
.card:hover { border-color: var(--border-hi); }
.card p { font-size: .94rem; color: #9a9db0; line-height: 1.8; }
.card p + p { margin-top: 1rem; }
.card strong { color: var(--text); font-weight: 500; }
.card-title {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: .75rem;
  font: 700 14px var(--mono);
  color: var(--blue);
}
.card-title-spaced { margin-top: 1.5rem; }

/* ---------- hero / terminal ---------- */
#hero { padding: clamp(1.5rem, 4vw, 3rem) 0 var(--section-y); }

.terminal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45), 0 0 0 1px rgba(97,175,239,.04), 0 0 80px -20px rgba(97,175,239,.18);
}
.terminal-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: linear-gradient(var(--raised), var(--inset));
  border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 -1px 2px rgba(0,0,0,.3); }
.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }
.dot-green { background: #98c379; }
.terminal-title { margin-left: 8px; font: 12px var(--mono); color: var(--muted); }

.terminal-body {
  min-height: 240px;
  max-height: clamp(440px, 75vh, 720px);
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
  font: 13px/1.8 var(--mono);
}

/* intro (sits at the top of the terminal) */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name    name"
    "title   title"
    "desc    desc"
    "actions side";
  align-items: center;
  column-gap: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border);
}
.intro .name    { grid-area: name; }
.intro .title   { grid-area: title; }
.intro .desc    { grid-area: desc; max-width: none; margin-bottom: 1.5rem; }
.intro .actions { grid-area: actions; }
.intro-side {
  grid-area: side;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: .75rem 1.5rem;
}
.intro-side .meta { margin-top: 0; }
.intro-side .social { margin-top: 0; }

.name {
  font: 700 clamp(1.75rem, 6vw, 3.5rem)/1.1 var(--mono);
  overflow-wrap: anywhere;
  letter-spacing: -1px;
}
.name-accent { color: var(--blue); text-shadow: 0 0 32px rgba(97,175,239,.35); }
.title { margin: .6rem 0 1.25rem; font: 1.15rem var(--sans); color: var(--cyan); }
.desc { max-width: none; margin-bottom: 2rem; font: .95rem/1.75 var(--sans); color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 1.5rem; font-size: 12px; color: var(--muted); }
.meta i { margin-right: 4px; color: var(--blue); }
.social { display: flex; gap: 8px; margin-top: 1.25rem; }
.social a {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 50%;
}
.social a:hover { color: var(--text); border-color: var(--border-hi); background: var(--raised); text-decoration: none; }

/* terminal output */
#term-output .row { display: grid; grid-template-columns: var(--kw, 12ch) minmax(0, 1fr); }
#term-output .row .k { white-space: pre; }
#term-output pre { font: inherit; white-space: pre-wrap; word-break: break-word; color: var(--muted); }
#term-output .echo { color: var(--text); margin-top: .5rem; }
.prompt, #term-output .echo .ps { color: var(--blue); font-weight: 700; white-space: nowrap; }
.ok   { color: var(--blue); }
.info { color: var(--cyan); }
.warn { color: var(--amber); }
.err  { color: var(--red); }

.prompt-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: .5rem; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.prompt-row:focus-within { border-top-color: rgba(97,175,239,.5); }
.input-wrap { position: relative; flex: 1; display: flex; }
#term-input {
  flex: 1; min-width: 0;
  background: none; border: 0; outline: 0;
  font: inherit; color: var(--text); caret-color: var(--blue);
}
#term-input::placeholder { color: var(--muted); opacity: .5; }

.suggest {
  display: none;
  position: absolute; bottom: 100%; left: 0; right: 0; z-index: 10;
  margin-bottom: 8px;
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.suggest.open { display: block; }
.suggest div { padding: 6px 12px; font-size: 12px; color: var(--muted); cursor: pointer; }
.suggest div:hover, .suggest div.active { background: var(--border); color: var(--text); }

/* ---------- about ---------- */
.edu-degree { color: var(--text) !important; font-weight: 500; }
.edu-school { font-size: .82rem !important; margin: 2px 0 6px; }

/* ---------- skills ---------- */
.skills { display: flex; flex-direction: column; gap: 1.5rem; }
.skill-group {
  margin-bottom: .6rem;
  font: 700 13px var(--mono);
  color: var(--muted);
}
.pills { display: flex; flex-wrap: wrap; gap: 7px; }

/* ---------- projects ---------- */
.project { position: relative; display: flex; flex-direction: column; padding: 1.5rem 1.75rem; overflow: hidden; }
.project::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); transform: scaleY(0); transform-origin: top; transition: transform .25s ease; }
.project:hover { border-color: var(--border-hi); background: var(--raised); }
.project:hover::before { transform: scaleY(1); }
.project-kind { margin-bottom: .75rem; font: 10px var(--mono) !important; }
.project-name { margin-bottom: .6rem; font-size: 1.1rem; font-weight: 600; letter-spacing: -.2px; }
.project-desc { flex: 1; margin-bottom: 1rem; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 1.25rem; }
.project-links { display: flex; gap: 14px; font: 12px var(--mono); }
.project-links a { color: var(--text); padding: 4px 0; border-bottom: 1px solid var(--border-hi); }
.project-links a:hover { border-bottom-color: var(--blue); }
.project-links a:hover { color: var(--blue); text-decoration: none; }
.project-links i { margin-right: 4px; }

/* ---------- contact ---------- */
.contact { grid-template-columns: 5fr 6fr; gap: 2rem; align-items: start; }
.contact-list { display: flex; flex-direction: column; gap: 1rem; }
.contact-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px;
  color: inherit;
  transition: border-color .15s, background .15s;
}
.contact-item:hover { border-color: var(--blue); background: var(--raised); text-decoration: none; }
.contact-icon {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--blue);
  background: var(--blue-tint); border-radius: 8px;
}
.contact-label { display: block; font-size: 11px; color: var(--muted); }
.contact-value { display: block; font: 13px var(--mono); overflow-wrap: anywhere; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form .btn { align-self: flex-start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font: 11px var(--mono); letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.field input, .field textarea {
  padding: 8px 12px;
  font: 14px var(--sans); color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
  resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.field ::placeholder { color: var(--muted); opacity: .5; }
.field textarea { min-height: 100px; }
.form-status { font: 12px var(--mono); color: var(--blue); }

/* ---------- footer ---------- */
footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 2rem max(var(--gutter), calc((100% - var(--width)) / 2));
  border-top: 1px solid var(--border);
}
.footer-mono { font: 12px var(--mono); color: var(--muted); }
.footer-mono span { color: var(--blue); }
.footer-links { display: flex; gap: 16px; font-size: 13px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--blue); }

/* ---------- scroll fade-in ---------- */
.fade-in { opacity: 0; transform: translateY(10px); transition: opacity .6s ease, transform .6s ease; }
.fade-in.visible { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (min-width: 1600px) {
  :root { --width: 1200px; }
  .terminal-body { font-size: 14px; }
}

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

@media (max-width: 820px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "name" "title" "desc" "actions" "side";
  }
  .intro-side { justify-content: flex-start; margin-top: 1.25rem; }
}

@media (max-width: 700px) {
  .grid-projects { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .form-row { grid-template-columns: 1fr; }
  .grid-2 { gap: 1rem; }
  .terminal-body { max-height: none; min-height: 0; }
  .card { padding: 1.15rem 1.25rem; }
}

@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .actions { gap: 8px; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .actions .btn-primary { flex-basis: 100%; }
  .desc { font-size: .9rem; margin-bottom: 1.25rem; }
  .title { margin-bottom: .75rem; }
  .intro { margin-bottom: 1rem; padding-bottom: 1rem; }
  .intro-side { margin-top: 1rem; flex-direction: column; align-items: flex-start; gap: .75rem; }
  .terminal-body { padding: 1rem .9rem; }
  .section-label { margin-bottom: 1.25rem; }
  .prompt { font-size: 11px; }
  .prompt-row { gap: 6px; }
  #term-input { font-size: 16px; }
  .terminal-bar { padding: 9px 12px; }
  .terminal-body { font-size: 12px; line-height: 1.7; }
  .contact-item { padding: .85rem 1rem; }
  footer { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 380px) {
  .btn { padding: 7px 12px; font-size: 12px; }
  .terminal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .terminal-body { max-height: 85vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .fade-in { opacity: 1; transform: none; }
}
