:root {
  --bg: #000000;
  --bg-elev: #050a05;
  --border: #17611f;
  --text: #00ff66;
  --text-dim: #4fb45c;
  --prompt: #00ff41;
  --accent: #9bff7a;
  --link: #00ff66;
  --danger: #ff5555;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --maxw: 720px;
  --pad: 1.25rem;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  background-color: #000;
  background-image:
    radial-gradient(ellipse at top, rgba(0, 255, 65, 0.06), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(0, 255, 65, 0.03), transparent 60%);
  text-shadow: 0 0 1px rgba(0, 255, 65, 0.22);
}

.matrix-rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.26;
  mix-blend-mode: screen;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  opacity: 0.12;
  background:
    linear-gradient(rgba(0, 255, 65, 0.09) 50%, rgba(0, 0, 0, 0.08) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 65, 0.015), rgba(0, 0, 255, 0.02));
  background-size: 100% 4px, 6px 100%;
  animation: scanDrift 14s linear infinite;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem var(--pad) 4rem;
}

/* ---------- Nav ---------- */
.nav {
  border-bottom: 1px solid var(--border);
  padding: 1rem var(--pad);
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  font-size: 0.85rem;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}
.nav .prompt { color: var(--prompt); }
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  padding: 0.15rem 0.25rem;
  transition: color 0.2s ease;
}
.nav a:hover, .nav a:focus-visible { color: var(--accent); outline: none; }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"]::before { content: "["; color: var(--prompt); }
.nav a[aria-current="page"]::after  { content: "]"; color: var(--prompt); }
.nav a[aria-current="page"]::before,
.nav a[aria-current="page"]::after {
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.45);
}
.nav .sep { color: var(--border); }

/* ---------- Hero ---------- */
.hero {
  padding: 2.5rem 0 1rem;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 2rem;
}
.hero-row {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.avatar {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 0.7rem;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 18px rgba(0, 255, 65, 0.08), 0 0 22px rgba(0, 255, 65, 0.08);
}
.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0 42%, rgba(0, 255, 65, 0.1) 50%, transparent 58% 100%);
  transform: translateX(-120%);
  animation: avatarSweep 4.8s ease-in-out infinite;
}
.avatar-initials {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-meta { min-width: 0; }
.boot {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: 0 0 0.75rem;
  min-height: 1.2em;
}
.boot .ok { color: var(--prompt); }
h1 {
  font-size: 1.65rem;
  margin: 0 0 0.25rem;
  font-weight: 600;
  letter-spacing: 0;
}
h1 .cursor { display: inline-block; width: 0.6ch; background: var(--prompt); margin-left: 2px; animation: blink 1.1s steps(2) infinite; }
.tagline { color: var(--accent); margin: 0; font-size: 0.95rem; }
.locale { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.4rem; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.9rem;
}
.action-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  background: rgba(0, 255, 65, 0.025);
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.action-link::before {
  content: "> ";
  color: var(--prompt);
}
.action-link:hover,
.action-link:focus-visible {
  color: var(--text);
  border-color: var(--prompt);
  background: rgba(0, 255, 65, 0.07);
  box-shadow: 0 0 18px rgba(0, 255, 65, 0.11);
  transform: translateY(-1px);
  outline: none;
}
.action-primary {
  color: #001b08;
  background: var(--prompt);
  border-color: var(--prompt);
  text-shadow: none;
}
.action-primary::before { color: #001b08; }
.action-primary:hover,
.action-primary:focus-visible {
  color: #000;
  background: var(--accent);
}

/* ---------- Sections ---------- */
section { margin: 2.25rem 0; }
h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--prompt);
  margin: 0 0 0.9rem;
  letter-spacing: 0.02em;
}
h2::before { content: "~/ $ "; color: var(--text-dim); }

p { margin: 0 0 1rem; }

a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
a:hover, a:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}

ul.bare { list-style: none; padding: 0; margin: 0; }

/* ---------- Job entries ---------- */
.job {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  transition: border-color 0.25s ease;
}
.job:hover { border-left-color: var(--prompt); }
.job-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.35rem;
}
.job-title { color: var(--text); font-weight: 600; }
.job-co { color: var(--accent); }
.job-date { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }
.job ul { margin: 0.4rem 0 0; padding-left: 1.1rem; color: var(--text-dim); }
.job ul li { margin-bottom: 0.25rem; line-height: 1.55; }
.job ul li::marker { color: var(--prompt); content: "› "; }

/* ---------- Skill groups ---------- */
.skill-group { margin-bottom: 1.25rem; }
.skill-group h3 {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0 0 0.4rem;
  font-weight: 500;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  font-size: 0.78rem;
  padding: 0.18rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  background: var(--bg-elev);
  transition: opacity 0.45s ease, transform 0.45s ease, border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.reveal:not(.in) .tag { opacity: 0; transform: translateY(7px); }
.reveal.in .tag { transition-delay: calc(var(--tag-index, 0) * 45ms); }
.tag:hover {
  transform: translateY(-2px);
  border-color: var(--prompt);
  color: var(--text);
  background: rgba(0, 255, 65, 0.05);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
.contact-row { display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.contact-row .k { color: var(--text-dim); min-width: 5.5rem; }
.contact-row .v { color: var(--text); }

/* ---------- Footer ---------- */
footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* ---------- Terminal ---------- */
.term-toggle {
  margin-left: auto;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: transparent;
  color: var(--prompt);
  border: 1px solid var(--prompt);
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-size: 0.74rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.25s ease, transform 0.15s ease;
}

/* ON — glowing */
.term-toggle[aria-pressed="true"] {
  color: #000;
  background: var(--prompt);
  border-color: var(--prompt);
  box-shadow:
    0 0 8px rgba(0, 255, 65, 0.65),
    0 0 18px rgba(0, 255, 65, 0.45),
    0 0 36px rgba(0, 255, 65, 0.25),
    inset 0 0 6px rgba(255, 255, 255, 0.15);
  text-shadow: none;
  animation: termPulse 2.4s ease-in-out infinite;
}
.term-toggle[aria-pressed="true"]:hover,
.term-toggle[aria-pressed="true"]:focus-visible {
  transform: translateY(-1px);
  box-shadow:
    0 0 12px rgba(0, 255, 65, 0.85),
    0 0 26px rgba(0, 255, 65, 0.55),
    0 0 48px rgba(0, 255, 65, 0.3);
  outline: none;
}

/* OFF — muted */
.term-toggle[aria-pressed="false"] {
  color: var(--text-dim);
  border-color: var(--border);
  background: transparent;
  box-shadow: none;
  opacity: 0.7;
  animation: none;
}
.term-toggle[aria-pressed="false"]:hover,
.term-toggle[aria-pressed="false"]:focus-visible {
  color: var(--prompt);
  border-color: var(--prompt);
  opacity: 1;
  outline: none;
}

.term-toggle .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #000;
  vertical-align: middle;
  transition: background-color 0.2s ease, box-shadow 0.25s ease;
}
.term-toggle[aria-pressed="true"] .dot {
  background: #000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.term-toggle[aria-pressed="false"] .dot {
  background: var(--text-dim);
  box-shadow: none;
}

@keyframes termPulse {
  0%, 100% {
    box-shadow:
      0 0 8px rgba(0, 255, 65, 0.55),
      0 0 18px rgba(0, 255, 65, 0.35),
      0 0 36px rgba(0, 255, 65, 0.2),
      inset 0 0 6px rgba(255, 255, 255, 0.15);
  }
  50% {
    box-shadow:
      0 0 12px rgba(0, 255, 65, 0.85),
      0 0 26px rgba(0, 255, 65, 0.55),
      0 0 48px rgba(0, 255, 65, 0.3),
      inset 0 0 8px rgba(255, 255, 255, 0.2);
  }
}

.terminal {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 1.5rem 0 2rem;
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.12), 0 10px 40px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  background: #030803;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.term-bar .dots { display: flex; gap: 0.35rem; }
.term-bar .dots span {
  width: 11px; height: 11px; border-radius: 50%;
  background: #2a2f37;
}
.term-bar .dots span:nth-child(1) { background: #ff5f57; }
.term-bar .dots span:nth-child(2) { background: #febc2e; }
.term-bar .dots span:nth-child(3) { background: #28c840; }
.term-bar .title { margin-left: 0.5rem; font-size: 0.72rem; }

.term-body {
  padding: 0.85rem 0.95rem 0.75rem;
  font-size: 0.86rem;
  line-height: 1.55;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.term-body::-webkit-scrollbar { width: 8px; }
.term-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.user .ps { color: var(--prompt); }
.term-line.user .cmd { color: var(--text); }
.term-line.sys { color: var(--text-dim); }
.term-line.err { color: var(--danger); }
.term-line.ok  { color: var(--prompt); }
.term-line.accent { color: var(--accent); }
.term-line .k { color: var(--accent); display: inline-block; min-width: 8.5rem; }
.term-cursor {
  display: inline-block;
  width: 0.6ch;
  height: 1.05em;
  margin-left: 2px;
  background: var(--prompt);
  vertical-align: -0.15em;
  animation: blink 1s steps(2) infinite;
}

.term-input-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding-top: 0.15rem;
}
.term-input-row .ps { color: var(--prompt); flex: 0 0 auto; }
.term-input {
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  caret-color: var(--prompt);
  padding: 0;
  min-width: 0;
}
.term-input:placeholder-shown {
  background-image: linear-gradient(var(--prompt), var(--prompt));
  background-repeat: no-repeat;
  background-size: 0.6ch 1.05em;
  background-position: 0 50%;
  animation: inputCaretBlink 1s steps(2) infinite;
}
.term-input:focus {
  caret-color: var(--accent);
}
.term-input:not(:placeholder-shown) {
  background-image: none;
  animation: none;
}
.term-input-row:focus-within .ps {
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.45);
}

.term-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 0.95rem 0.9rem;
}
.term-quick button {
  font: inherit;
  font-size: 0.72rem;
  color: var(--text-dim);
  background: rgba(0, 255, 65, 0.025);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.22rem 0.55rem;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}
.term-quick button::before {
  content: "$ ";
  color: var(--prompt);
}
.term-quick button:hover,
.term-quick button:focus-visible {
  color: var(--text);
  border-color: var(--prompt);
  background: rgba(0, 255, 65, 0.06);
  transform: translateY(-1px);
  outline: none;
}

.term-hint {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 0.5rem 0 0;
}

/* Hide menu hero in terminal mode and vice versa */
body.term-on .menu-mode { display: none !important; }
body.term-off .term-mode { display: none !important; }

/* ---------- Collapsible job entries ---------- */
details.job-toggle {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: rgba(0, 255, 65, 0.02);
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
details.job-toggle[open] {
  border-color: var(--prompt);
  background: rgba(0, 255, 65, 0.04);
  box-shadow: 0 0 22px rgba(0, 255, 65, 0.08);
}
details.job-toggle:hover { transform: translateY(-1px); }
details.job-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  user-select: none;
  border-radius: 5px;
}
details.job-toggle > summary::-webkit-details-marker { display: none; }
details.job-toggle > summary:hover { background: rgba(0, 255, 65, 0.05); }
details.job-toggle > summary:focus-visible { outline: 2px solid var(--prompt); outline-offset: 2px; }

.chev {
  display: inline-block;
  flex: 0 0 auto;
  width: 0.9em;
  color: var(--prompt);
  transition: transform 0.25s ease;
  font-size: 0.85em;
}
details.job-toggle[open] > summary .chev { transform: rotate(90deg); }

.summary-main {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.15rem 1rem;
  min-width: 0;
}
.summary-main .job-title { color: var(--text); font-weight: 600; }
.summary-main .job-co { color: var(--accent); }
.summary-main .job-date { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }

details.job-toggle .job-body {
  padding: 0 0.9rem 0.85rem 2.2rem;
  animation: detailBodyIn 0.22s ease both;
}
details.job-toggle .job-body ul {
  margin: 0.25rem 0 0;
  padding-left: 1rem;
  color: var(--text-dim);
}
details.job-toggle .job-body ul li { margin-bottom: 0.3rem; line-height: 1.55; }
details.job-toggle .job-body ul li::marker { color: var(--prompt); content: "› "; }

.job-controls {
  display: flex;
  gap: 0.6rem;
  margin: 0.25rem 0 1.25rem;
  font-size: 0.78rem;
}
.job-controls button {
  font: inherit;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.job-controls button:hover,
.job-controls button:focus-visible {
  color: var(--prompt);
  border-color: var(--prompt);
  outline: none;
}

@media (max-width: 480px) {
  .summary-main { flex-direction: column; gap: 0.1rem; }
  details.job-toggle .job-body { padding-left: 1rem; }
}

/* ---------- Motion ---------- */
.reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.in { opacity: 1; transform: none; }

@keyframes scanDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 48px, 0 0; }
}

@keyframes avatarSweep {
  0%, 55%, 100% { transform: translateX(-120%); }
  72% { transform: translateX(120%); }
}

@keyframes detailBodyIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@keyframes blink {
  0%, 50%   { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

@keyframes inputCaretBlink {
  0%, 50% { background-size: 0.6ch 1.05em; }
  50.01%, 100% { background-size: 0 1.05em; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .reveal:not(.in) .tag { opacity: 1; transform: none; }
  body::before { animation: none; }
  h1 .cursor { animation: none; opacity: 1; }
  .term-input:placeholder-shown { animation: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  :root { --pad: 1rem; }
  body { font-size: 14px; line-height: 1.7; }
  .nav { padding: 0.75rem var(--pad); }
  .nav-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    align-items: center;
  }
  .nav-links {
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    overflow: visible;
  }
  .nav .prompt,
  .nav .sep { display: none; }
  .nav a { padding: 0.2rem 0.1rem; white-space: nowrap; }
  .term-toggle {
    margin-left: 0;
    justify-self: end;
    padding: 0.42rem 0.65rem;
    font-size: 0.68rem;
    white-space: nowrap;
  }
  .wrap { padding-top: 1.75rem; }
  .hero { padding-top: 1.6rem; }
  .hero-row { gap: 0.95rem; align-items: center; }
  .avatar { width: 66px; height: 66px; }
  h1 { font-size: 1.35rem; }
  h1 .cursor { width: 0.38ch; }
  .tagline { max-width: 15rem; line-height: 1.45; }
  .hero-actions { gap: 0.45rem; }
  .action-link {
    flex: 1 1 9rem;
    justify-content: center;
    padding-inline: 0.55rem;
  }
  .job-head { flex-direction: column; gap: 0.15rem; }
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--prompt);
  outline-offset: 2px;
  border-radius: 2px;
}
