/* =========================================================
   Hairline Dark
   Retheme by editing the tokens below.
   ========================================================= */
:root {
  /* color */
  --bg: #0c0d0f;
  --bg-raised: #111215;
  --card: rgba(17, 18, 21, 0.85);   /* slightly see-through so the background shows */
  --text: #e8e8e6;
  --muted: #8a8c90;      /* a touch lighter than #6d6f73 to pass WCAG AA on --bg */
  --faint: #7b7d81;      /* small labels; still passes 4.5:1 on --bg */
  --rule: #222428;
  --accent: #3ecf8e;
  --dev: #8ab4f8;        /* software & cloud track */
  --sec: #3ecf8e;        /* security track */
  --plan: #d9b65f;       /* in progress / planned */
  --glow: rgba(62, 207, 142, 0.07);   /* accent button hover */
  --particle: 138, 140, 144;           /* background dots, as r, g, b */
  --nav-bg: rgba(12, 13, 15, 0.92);

  /* type */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(2.1rem, 6vw, 3.6rem);

  /* space */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 5rem;

  --max: 960px;
  --gutter: clamp(16px, 5vw, 40px);
  --radius: 4px;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--bg); }

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

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -40px;
  background: var(--text); color: var(--bg); padding: var(--s-2) var(--s-3);
  font-family: var(--mono); font-size: var(--fs-xs); z-index: 20;
}
.skip-link:focus { top: var(--s-3); }

.link { color: var(--text); border-bottom: 1px solid var(--rule); transition: color 0.15s, border-color 0.15s; }
.link:hover { color: var(--accent); border-color: var(--accent); }

/* status dots + track labels */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: var(--s-2); vertical-align: 1px; }
.dot-plan { background: var(--plan); }
.dot-off { background: var(--faint); }

.tag { font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.tag-dev { color: var(--dev); }
.tag-sec { color: var(--sec); }
.tag-both { color: var(--text); }
.tag-plan { color: var(--plan); }

/* ===== Layout ===== */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: var(--s-8) 0; border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-6); }
.section-head .idx { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); }
.section-head h2 { font-size: var(--fs-lg); font-weight: 500; letter-spacing: -0.01em; }
.lede { color: var(--muted); max-width: 60ch; margin-bottom: var(--s-6); }

/* ===== Nav ===== */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--rule);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.wordmark { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 500; font-size: var(--fs-sm); letter-spacing: -0.01em; }
.wordmark img { width: 24px; height: 24px; }
.nav-links { display: flex; align-items: center; gap: var(--s-5); font-size: var(--fs-sm); color: var(--muted); }
.nav-links a { transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-links .resume { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); background: var(--glow); border: 1px solid var(--accent); padding: var(--s-1) var(--s-3); border-radius: var(--radius); transition: background 0.15s, color 0.15s; }
.nav-links .resume:hover { background: var(--accent); color: var(--bg); }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--text); font-family: var(--mono); font-size: var(--fs-xs); padding: var(--s-1) var(--s-3); cursor: pointer;
}

/* ===== Hero ===== */
/* fills the first screen so font swap / decrypt effect can't push the next section around */
.hero { min-height: calc(100vh - 56px); min-height: calc(100svh - 56px); display: flex; flex-direction: column; justify-content: center; padding-top: var(--s-7); padding-bottom: var(--s-7); }
.eyebrow { font-family: var(--mono); font-size: var(--fs-xs); font-weight: 400; line-height: 1.6; color: var(--accent); margin-bottom: var(--s-4); }
.hero .hero-title {
  font-size: var(--fs-xl); font-weight: 400; line-height: 1.1; letter-spacing: -0.035em;
  max-width: 16ch;
}
.hero .sub { margin-top: var(--s-4); color: var(--muted); font-size: var(--fs-lg); font-weight: 300; }
.meta {
  display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-6);
  margin-top: var(--s-7); padding-top: var(--s-5); border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: var(--fs-sm);
}
.meta dt { color: var(--faint); }
.meta dd { color: var(--text); }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1fr 280px; gap: var(--s-7); align-items: start; }
.about-text p { color: var(--muted); max-width: 62ch; }
.about-text p + p { margin-top: var(--s-4); }
.about-text strong { color: var(--text); font-weight: 500; }
.photo { width: 100%; height: auto; aspect-ratio: 4 / 5; border: 1px solid var(--rule); border-radius: var(--radius); object-fit: cover; }
.photo-placeholder { display: grid; place-items: center; font-family: var(--mono); color: var(--faint); font-size: var(--fs-lg); background: var(--bg-raised); }

.cert {
  margin-top: var(--s-6); border: 1px solid var(--rule); border-radius: var(--radius);
  font-family: var(--mono); font-size: var(--fs-xs);
}
.cert-head { padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--rule); color: var(--faint); display: flex; justify-content: space-between; gap: var(--s-4); }
.cert dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-5); padding: var(--s-4); }
.cert dt { color: var(--faint); }
.cert dd { color: var(--text); overflow-wrap: anywhere; }

/* ===== Tracks ===== */
.tracks { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.track { padding: var(--s-6) var(--s-6) var(--s-6) 0; }
.track + .track { border-left: 1px solid var(--rule); padding: var(--s-6) 0 var(--s-6) var(--s-6); }
.track h3 { font-size: var(--fs-xl); font-weight: 400; letter-spacing: -0.035em; line-height: 1; margin: var(--s-2) 0 var(--s-4); }
.track > p { color: var(--muted); margin-bottom: var(--s-5); }
.track li { padding: var(--s-2) 0; border-top: 1px solid var(--rule); font-size: var(--fs-sm); }
.track li .tag { margin-left: var(--s-2); }

/* ===== Work ===== */
.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-5); }
.chip {
  background: none; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted);
  font-family: var(--mono); font-size: var(--fs-xs); padding: var(--s-1) var(--s-3); cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--text); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); grid-auto-flow: dense; gap: var(--s-4); }
.card {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: var(--s-5); transition: border-color 0.15s;
}
.card:hover { border-color: var(--faint); }
.card[hidden] { display: none; }
.card:has(details[open]) { grid-column: 1 / -1; border-color: var(--faint); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-5); }
.card-meta { flex-shrink: 0; }
.logo {
  position: relative; width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg);
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted);
}
.logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--bg); }
/* wordmark logos: drop the box, let the logo set its own width */
.logo:has(img) { display: block; width: auto; height: 38px; max-width: 62%; border: 0; background: none; }
.logo:has(img) img { position: static; display: block; width: auto; max-width: 100%; height: 38px; object-fit: contain; object-position: left center; background: none; }
.logo:has(img) span { display: none; }
.card-meta { display: flex; gap: var(--s-3); align-items: baseline; }
.w-id { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); }

.card-title { font-size: var(--fs-lg); font-weight: 500; letter-spacing: -0.01em; margin-bottom: var(--s-2); }
.card-sum { color: var(--muted); font-size: var(--fs-sm); }
.card-stack { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); margin-top: var(--s-4); flex: 1; }

.card details { margin-top: var(--s-5); border-top: 1px solid var(--rule); padding-top: var(--s-3); }
.card summary {
  list-style: none; cursor: pointer; display: inline-flex; gap: var(--s-2);
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); transition: color 0.15s;
}
.card summary::-webkit-details-marker { display: none; }
.card summary::before { content: "+"; color: var(--faint); }
.card details[open] summary::before { content: "−"; }
.card summary:hover { color: var(--accent); }

.writeup { display: grid; grid-template-columns: 11rem 1fr; gap: var(--s-3) var(--s-5); font-size: var(--fs-sm); margin-top: var(--s-4); }
.writeup dt { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); padding-top: 2px; }
.writeup dd { color: var(--muted); max-width: 70ch; }
.writeup dt.sec-dt { color: var(--sec); }
.w-links { margin-top: var(--s-4); display: flex; gap: var(--s-5); font-family: var(--mono); font-size: var(--fs-xs); }
.placeholder-note { font-family: var(--mono); font-size: var(--fs-xs); color: var(--plan); margin-top: var(--s-3); }

/* ===== Experience ===== */
.timeline > li { display: grid; grid-template-columns: 11rem 1fr; gap: var(--s-5); padding: var(--s-5) 0; border-top: 1px solid var(--rule); }
.timeline > li:last-child { border-bottom: 1px solid var(--rule); }
.when { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); padding-top: 3px; }
.role { font-weight: 500; }
.org { color: var(--muted); }
.timeline ul { margin-top: var(--s-2); }
.timeline ul li { position: relative; padding-left: var(--s-4); color: var(--muted); font-size: var(--fs-sm); margin-top: var(--s-1); }
.timeline ul li::before { content: "–"; position: absolute; left: 0; color: var(--faint); }

/* ===== Skills ===== */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-7); }
.skills h3 { font-size: var(--fs-sm); font-weight: 500; margin-bottom: var(--s-4); }
.skill-list { font-family: var(--mono); font-size: var(--fs-sm); }
.skill-list li { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-2) 0; border-top: 1px solid var(--rule); }
.skill-list li span:last-child { color: var(--faint); text-align: right; }

/* ===== Achievements (row list) ===== */
.rows li { display: grid; grid-template-columns: 1fr auto; gap: var(--s-4); padding: var(--s-4) 0; border-top: 1px solid var(--rule); align-items: baseline; }
.rows li:last-child { border-bottom: 1px solid var(--rule); }
.rows .row-sub { display: block; color: var(--muted); font-size: var(--fs-sm); }
.rows .row-meta { font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); text-align: right; }

/* ===== Contact + footer ===== */
.contact .big { font-size: var(--fs-xl); font-weight: 400; letter-spacing: -0.035em; line-height: 1.1; max-width: 18ch; color: var(--text); margin: 0; }
.contact p { color: var(--muted); margin: var(--s-4) 0 var(--s-6); max-width: 52ch; }
.btn {
  display: inline-block; font-family: var(--mono); font-size: var(--fs-sm);
  background: none; border: 1px solid var(--text); color: var(--text); padding: var(--s-3) var(--s-5); border-radius: var(--radius); cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn:hover { color: var(--accent); border-color: var(--accent); }
.contact-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-7); align-items: start; }
.contact-grid .big { font-size: clamp(1.9rem, 4vw, 2.6rem); }

/* contact form */
.cform {
  display: flex; flex-direction: column; gap: var(--s-2);
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0 var(--s-5) var(--s-5);
}
.cform-bar {
  display: flex; justify-content: space-between; gap: var(--s-3); margin: 0 calc(var(--s-5) * -1) var(--s-3);
  padding: var(--s-2) var(--s-5); border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint);
}
.cform label { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); margin-top: var(--s-2); }
.cform input, .cform textarea {
  width: 100%; background: var(--bg); color: var(--text); font: inherit; font-size: var(--fs-sm);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s-2) var(--s-3);
  transition: border-color 0.15s;
}
.cform textarea { resize: vertical; min-height: 7rem; }
.cform input::placeholder, .cform textarea::placeholder { color: var(--faint); }
.cform input:focus, .cform textarea:focus { outline: none; border-color: var(--accent); }
.cform .btn { margin-top: var(--s-4); align-self: flex-start; }
.cform .btn[disabled] { opacity: 0.6; cursor: wait; }
.cform .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.contact .cform-status { margin: 0; max-width: none; min-height: 1.4em; font-family: var(--mono); font-size: var(--fs-xs); color: var(--muted); }
.cform-status.ok { color: var(--accent); }
.cform-status.err { color: #ff6b6b; }
.btn-ghost { border-color: var(--rule); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }
.contact-links { display: flex; flex-wrap: wrap; gap: var(--s-5); margin-top: var(--s-6); font-family: var(--mono); font-size: var(--fs-sm); }

.footer { border-top: 1px solid var(--rule); padding: var(--s-6) 0; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-xs); color: var(--faint); }

/* ===== Live background ===== */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ===== Gentle fade-in (only when JS + motion allowed) ===== */
.js .fade { opacity: 0; transition: opacity 0.6s ease; }
.js .fade.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .js .fade { opacity: 1; transition: none; }
  * { transition: none !important; }
}

/* ===== Mobile ===== */
@media (max-width: 760px) {
  :root { --s-8: 3.5rem; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 56px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--rule); padding: var(--s-2) var(--gutter) var(--s-4);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: var(--s-2) 0; width: 100%; }
  .nav-links .resume { width: auto; margin-top: var(--s-2); }

  .meta { grid-template-columns: 1fr; gap: 0; }
  .meta dd { margin-bottom: var(--s-3); }

  .about-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .about-photo { max-width: 260px; order: -1; }

  .tracks { grid-template-columns: 1fr; }
  .track, .track + .track { padding: var(--s-6) 0; border-left: 0; }
  .track + .track { border-top: 1px solid var(--rule); }

  .writeup, .timeline > li { grid-template-columns: 1fr; gap: var(--s-1); }
  .writeup dd { margin-bottom: var(--s-3); }

  .skills { grid-template-columns: 1fr; gap: var(--s-6); }
  .contact-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .cform-bar span:last-child { display: none; }
}

/* =========================================================
   Hero extras: CTA
   ========================================================= */
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--s-7); align-items: center; }
.hero-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4); margin-top: var(--s-6); }
kbd {
  font-family: var(--mono); font-size: 0.7rem; color: var(--text);
  border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; padding: 0 0.35em;
}
.btn-accent { border-color: var(--accent); color: var(--accent); }
.btn-accent:hover { background: var(--glow); }
/* solid accent: reserved for the resume download, the main call to action */
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 500; }
.btn-solid:hover { background: transparent; color: var(--accent); border-color: var(--accent); }

/* decrypt effect: scrambled glyphs */
.scrambling { color: var(--accent); }

/* =========================================================
   Terminal: a small live panel in the hero that can go full screen
   ========================================================= */
.hero-term { min-width: 0; }
.term {
  display: flex; flex-direction: column; height: 22rem;
  background: var(--card); color: var(--text);
  border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  font-family: var(--mono); font-size: var(--fs-xs); line-height: 1.6;
  transition: border-color 0.15s;
}
.term:focus-within { border-color: var(--faint); }
.term.is-full {
  position: fixed; inset: 0; z-index: 50; height: auto;
  background: var(--bg); border: 0; border-radius: 0; font-size: var(--fs-sm);
  animation: termIn 0.2s ease;
}
@keyframes termIn { from { transform: scale(0.98); opacity: 0.6; } to { transform: none; opacity: 1; } }
.term-bar { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--rule); color: var(--faint); font-size: var(--fs-xs); }
.term.is-full .term-bar { padding: var(--s-2) var(--gutter); }
.term-bar .d { width: 10px; height: 10px; border-radius: 50%; background: var(--rule); flex-shrink: 0; }
.term-bar .d:nth-child(1) { background: #ff5f56; } .term-bar .d:nth-child(2) { background: #ffbd2e; } .term-bar .d:nth-child(3) { background: #27c93f; }
.term-title { margin: 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-full {
  flex-shrink: 0; background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--muted); font: inherit; padding: 2px var(--s-2); cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.term-full:hover { color: var(--text); border-color: var(--text); }
.term-body { flex: 1; overflow-y: auto; padding: var(--s-3); }
.term.is-full .term-body { padding: var(--s-4) var(--gutter); }
.term.is-full .term-body > * { max-width: 1100px; margin-left: auto; margin-right: auto; }
.term-out > div { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; }
.term-out a { color: var(--accent); border-bottom: 1px solid currentColor; }
.term-line { display: flex; gap: 0.6em; align-items: baseline; }
.term-prompt, .t-prompt { color: var(--accent); white-space: nowrap; }
.t-path { color: var(--dev); }
.term-line input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none; caret-color: var(--accent);
  color: var(--text); font: inherit; padding: 0;
}
.term-line input::placeholder { color: var(--faint); }
.t-dir { color: var(--dev); font-weight: 500; }
.t-ok { color: var(--accent); }
.t-err { color: #ff6b6b; }
.t-warn { color: var(--plan); }
.t-dim { color: var(--faint); }
.t-head { color: var(--text); font-weight: 500; }
.t-info { color: var(--dev); }
.term-chips { display: none; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-top: 1px solid var(--rule); overflow-x: auto; }
.term-chips button { flex-shrink: 0; background: none; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); font: inherit; font-size: var(--fs-xs); padding: var(--s-1) var(--s-3); }
@media (hover: none), (pointer: coarse) { .term-chips { display: flex; } }
.term-hint { margin-top: var(--s-2); font-family: var(--mono); font-size: var(--fs-xs); color: var(--faint); }
body.term-active { overflow: hidden; }

@media (max-width: 760px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-6); }
  .term { height: 20rem; }
  .term.is-full { font-size: var(--fs-xs); }
  .term-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .term.is-full { animation: none; }
}
