:root {
  --bg: #0a0e14;
  --panel: #111823;
  --line: #1f2b3a;
  --text: #d6e2f0;
  --muted: #8396ab;
  --accent: #39ff88;
  --accent2: #38d6ff;
  --accent3: #9d7bff;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#matrix {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.16;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px max(20px, 5vw);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 1.1rem;
}
.brand:hover { text-decoration: none; text-shadow: 0 0 12px var(--accent); }

.nav nav { display: flex; gap: 20px; }
.nav nav a { color: var(--muted); font-family: var(--mono); font-size: 0.95rem; }
.nav nav a:hover, .nav nav a.active { color: var(--accent); text-decoration: none; }

main {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px 60px;
  flex: 1;
}

section { margin-top: 64px; }

.hero { margin-top: 72px; }
.page-head { margin-top: 56px; }

.eyebrow {
  font-family: var(--mono);
  color: var(--accent);
  margin: 0 0 8px;
  font-size: 0.95rem;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 4.4rem);
  line-height: 1.05;
  margin: 0 0 -0.15em;
  padding-bottom: 0.15em; /* room for descenders (g, p, y): the gradient only paints inside the box */
  background: linear-gradient(90deg, var(--accent), var(--accent2) 55%, var(--accent3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--accent2);
  font-family: var(--mono);
  word-spacing: -0.3em; /* monospace spaces are letter-wide; this makes the gaps look natural */
  margin: 12px 0 0;
}

.mission { max-width: 640px; color: var(--muted); font-size: 1.1rem; }

.cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 28px; }

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  background: var(--accent);
  color: #04130a;
  font-weight: 700;
  font-family: var(--mono);
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:hover, .btn:focus-visible { box-shadow: 0 6px 24px rgba(57, 255, 136, 0.35); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s; }
.btn.ghost:hover, .btn.ghost:focus-visible { background-color: rgba(57, 255, 136, 0.08); }

h2 { font-family: var(--mono); font-size: 1.5rem; margin: 0 0 20px; }
.hash { color: var(--accent); }

.terminal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}
.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #0d141d;
  border-bottom: 1px solid var(--line);
}
.term-bar span { width: 12px; height: 12px; border-radius: 50%; background: #ff5f56; }
.term-bar span:nth-child(2) { background: #ffbd2e; }
.term-bar span:nth-child(3) { background: #27c93f; }
.term-bar em { margin-left: 10px; color: var(--muted); font-family: var(--mono); font-size: 0.85rem; font-style: normal; }

#typed {
  margin: 0;
  padding: 20px;
  min-height: 220px;
  font-family: var(--mono);
  font-size: 0.98rem;
  color: var(--accent);
  white-space: pre-wrap;
}
#typed .t-cmd { color: var(--accent); }
#typed .t-out { color: var(--text); }
#typed .cursor {
  display: inline-block;
  width: 9px;
  height: 1.1em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
}
.stat strong { display: block; font-family: var(--mono); font-size: 1.35rem; color: var(--accent2); }
.stat span { color: var(--muted); font-size: 0.9rem; }

.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.skill { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.skill-head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.lvl { font-family: var(--mono); color: var(--accent); }
.bar { height: 8px; background: #0b121a; border-radius: 999px; overflow: hidden; }
.fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 999px; }
.skill small { color: var(--muted); display: block; margin-top: 8px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card h3 { margin: 6px 0 8px; font-size: 1.25rem; }
.card p { margin: 0; color: var(--muted); }
.card time { font-family: var(--mono); color: var(--accent2); font-size: 0.85rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.grid .card { margin-bottom: 0; }

.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent3);
  color: var(--accent3);
}
.badge.live { border-color: var(--accent); color: var(--accent); }
.badge.planned { border-color: var(--muted); color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tags span { font-family: var(--mono); font-size: 0.78rem; color: var(--accent2); background: #0b121a; padding: 3px 9px; border-radius: 6px; }

.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--accent), var(--accent3)); }
.phase { position: relative; margin-bottom: 22px; }
.phase .dot {
  position: absolute;
  left: -33px;
  top: 26px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.phase ul { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.phase li { margin-bottom: 6px; }

footer {
  position: sticky; bottom: 0; z-index: 10;
  text-align: center; padding: 12px 20px; color: var(--accent); font-family: var(--mono); font-size: 0.8rem;
  border-top: 1px solid var(--line); background: rgba(10, 14, 20, 0.85); backdrop-filter: blur(8px);
}
footer p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .footer-extra { display: none; }
  /* Hero buttons, scaled down proportionally so all three fit one row on small phones.
     Golden ratio (1.618): horizontal padding = 1.618 x vertical; gap = vertical padding. */
  .cta { gap: 0.618em; }
  .btn { font-size: 0.875rem; padding: 0.618em 1em; border-radius: 0.5em; }
}

@media (max-width: 560px) {
  .nav { justify-content: center; }
  section { margin-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

.focus { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.focus .card { margin-bottom: 0; }
.focus .card h3 { color: var(--accent); font-family: var(--mono); font-size: 1.05rem; }
.links { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.links a { font-family: var(--mono); font-size: 0.95rem; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent2); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.links a:hover, .links a:focus-visible { border-color: var(--accent2); box-shadow: 0 6px 20px rgba(56, 214, 255, 0.25); text-decoration: none; }
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.contact-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; }
.contact-list strong { display: block; font-family: var(--mono); color: var(--accent); margin-bottom: 4px; }
.contact-list span { display: block; color: var(--muted); margin-top: 4px; font-size: 0.92rem; }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.contact-email { font-family: var(--mono); font-weight: 700; color: var(--accent); font-size: 1.2rem; overflow-wrap: anywhere; }
.copy-btn { font-family: var(--mono); font-size: 0.8rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--accent2); cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.copy-btn:hover, .copy-btn:focus-visible { border-color: var(--accent2); box-shadow: 0 4px 14px rgba(56, 214, 255, 0.25); }
.copy-btn.done { color: var(--accent); border-color: var(--accent); }
.contact-list .copy-wrap { position: relative; display: inline-block; margin: 0; }
/* Callout bubble above the copy button; invisible while empty, still in the accessibility tree for announcements. */
.contact-list .copy-status {
  position: absolute; bottom: calc(100% + 10px); left: calc(100% - 14px);
  display: block; margin: 0; padding: 6px 10px; white-space: nowrap;
  font-family: var(--mono); font-size: 0.8rem; color: var(--bg); background: var(--accent);
  border-radius: 6px 6px 6px 0; box-shadow: 0 6px 20px rgba(57, 255, 136, 0.3);
  pointer-events: none; transition: opacity 0.15s;
}
.contact-list .copy-status::after {
  content: ""; position: absolute; top: 100%; left: 0;
  border: 7px solid transparent; border-top-color: var(--accent); border-left-color: var(--accent);
}
.contact-list .copy-status:empty { opacity: 0; }
/* North-west variant, used by main.js when the bubble would leave the screen on the right. */
.contact-list .copy-status.flip { left: auto; right: calc(100% - 14px); border-radius: 6px 6px 0 6px; }
.contact-list .copy-status.flip::after {
  left: auto; right: 0;
  border-left-color: transparent; border-right-color: var(--accent);
}

/* ---- Link and button feedback ---- */
/* Text links: an underline that slides in from the left. */
.nav nav a, .contact-email {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px;
  transition: background-size 0.25s ease, color 0.15s;
}
.nav nav a:hover, .nav nav a:focus-visible, .nav nav a.active,
.contact-email:hover, .contact-email:focus-visible { background-size: 100% 1px; text-decoration: none; }

/* Keyboard users: same feedback plus a clear outline. */
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent2); outline-offset: 3px; }

/* Lift effects only where a real pointer can hover, so they never get stuck after a tap on phones. */
@media (hover: hover) {
  .btn:hover, .links a:hover { transform: translateY(-2px); }
  .copy-btn:hover { transform: translateY(-1px); }
}
.btn:focus-visible, .links a:focus-visible { transform: translateY(-2px); }
