:root {
  --ink-black: #0d1b2a;
  --prussian-blue: #1b263b;
  --dusk-blue: #415a77;
  --dusty-denim: #778da9;
  --alabaster-grey: #e0e1dd;

  --bg: var(--ink-black);
  --panel: var(--prussian-blue);
  --border: var(--dusk-blue);
  --muted: var(--dusty-denim);
  --text: var(--alabaster-grey);

  --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(640px 420px at 85% -10%, rgba(65, 90, 119, 0.35), transparent 70%),
    radial-gradient(520px 400px at 5% 110%, rgba(119, 141, 169, 0.18), transparent 70%),
    var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--dusty-denim);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--text);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.25rem, 5vw, 3rem);
  background: rgba(13, 27, 42, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(65, 90, 119, 0.35);
}

.nav-logo {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: clamp(0.75rem, 3vw, 1.75rem);
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* ---------- Layout ---------- */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
}

.section {
  padding: 5rem 0 2rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2rem;
}

.sec-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--muted);
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 72ch;
}

.section-body p {
  color: var(--muted);
}

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vw, 4rem);
  text-align: left;
  padding: 6rem 0 4rem;
  position: relative;
}

.hero-left {
  flex: 1 1 400px;
  max-width: 620px;
}

.hero-right {
  flex: 1 1 380px;
  max-width: 560px;
}

.boot-terminal {
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.9rem;
  background: rgba(13, 27, 42, 0.6);
  border-bottom: 1px solid rgba(65, 90, 119, 0.4);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dusk-blue);
}

.terminal-title {
  margin-left: auto;
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--muted);
}

.terminal-body {
  padding: 1rem 1.1rem 1.25rem;
  min-height: 130px;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-body .prompt {
  color: var(--dusty-denim);
}

.terminal-body .cmd {
  color: var(--alabaster-grey);
}

.terminal-body .out {
  color: var(--muted);
  padding-left: 1.6rem;
  display: block;
}

.term-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--alabaster-grey);
  animation: blink 1s steps(1) infinite;
}

/* ---------- Glitch name ---------- */
.hero-name {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1.25rem;
  min-height: 1.3em;
  display: flex;
  align-items: baseline;
}

.glitch-name {
  position: relative;
  display: inline-block;
}

.glitch-name.glitching::before,
.glitch-name.glitching::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
  opacity: 0.9;
}

.glitch-name.glitching::before {
  color: var(--dusty-denim);
  animation: glitch-top 0.28s steps(2, end) infinite;
}

.glitch-name.glitching::after {
  color: var(--dusk-blue);
  animation: glitch-bottom 0.34s steps(2, end) infinite;
}

.caret {
  margin-left: 0.12em;
  color: var(--text);
  animation: blink 1.1s steps(1) infinite;
  font-weight: 400;
}

.hero-tag {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  margin-bottom: 1rem;
}

.hero-tag .sep {
  color: var(--border);
  padding: 0 0.3rem;
}

.hero-desc {
  color: var(--muted);
  max-width: 52ch;
  margin-bottom: 1.75rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--alabaster-grey);
  background: var(--prussian-blue);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  color: var(--text);
  border-color: var(--alabaster-grey);
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.35);
}

.hero-socials {
  display: flex;
  gap: 0.85rem;
}

.social {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(27, 38, 59, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.social:hover {
  transform: translateY(-3px);
  border-color: var(--text);
  color: var(--text);
}

.scroll-hint {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.scroll-hint.hidden {
  opacity: 0;
  visibility: hidden;
}

.scroll-hint span {
  display: inline-block;
  animation: bob 1.8s ease-in-out infinite;
}

/* ---------- Skills ---------- */
.skill-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.skill-line {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
}

.skill-line .skill-name {
  color: var(--dusty-denim);
}

/* ---------- Experience ---------- */
.exp-item {
  border-left: 2px solid var(--border);
  padding-left: 1.4rem;
  position: relative;
}

.exp-item::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 0.55rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-black);
  border: 2px solid var(--dusty-denim);
}

.exp-head h3 {
  font-size: 1.15rem;
  color: var(--text);
}

.exp-org {
  display: block;
  color: var(--dusty-denim);
  margin: 0.2rem 0 0.6rem;
}

.exp-date {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  margin-bottom: 1rem;
}

.exp-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.exp-bullets li {
  color: var(--muted);
  padding-left: 1.4rem;
  position: relative;
}

.exp-bullets li::before {
  content: '>';
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  color: var(--border);
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  max-width: none;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.5rem;
  background: var(--panel);
  border: 1px solid rgba(65, 90, 119, 0.5);
  border-radius: 12px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--dusty-denim);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(119, 141, 169, 0.25);
}

.project-card h3 {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--text);
}

.project-tech {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--dusty-denim);
}

.project-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.project-card li {
  font-size: 0.92rem;
  color: var(--muted);
  padding-left: 1.2rem;
  position: relative;
}

.project-card li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--border);
  font-family: var(--font-mono);
}

.project-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--alabaster-grey);
  border-top: 1px dashed rgba(65, 90, 119, 0.6);
  padding-top: 0.9rem;
}

/* ---------- Education ---------- */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  max-width: none;
}

.edu-card {
  padding: 1.4rem 1.5rem;
  background: var(--panel);
  border: 1px solid rgba(65, 90, 119, 0.5);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.edu-card h3 {
  font-size: 1.05rem;
  color: var(--text);
}

.edu-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.edu-score {
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--alabaster-grey);
  border-top: 1px dashed rgba(65, 90, 119, 0.6);
  padding-top: 0.7rem;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 4rem;
  padding: 2rem clamp(1.25rem, 5vw, 3rem);
  text-align: center;
  border-top: 1px solid rgba(65, 90, 119, 0.35);
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-contact {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- Animations ---------- */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes glitch-top {
  0%, 100% { clip-path: inset(0 0 76% 0); transform: translate(-2px, -1px); }
  25% { clip-path: inset(20% 0 56% 0); transform: translate(2px, 1px); }
  50% { clip-path: inset(48% 0 30% 0); transform: translate(-2px, 0); }
  75% { clip-path: inset(70% 0 10% 0); transform: translate(2px, -1px); }
}

@keyframes glitch-bottom {
  0%, 100% { clip-path: inset(72% 0 0 0); transform: translate(2px, 1px); }
  25% { clip-path: inset(50% 0 24% 0); transform: translate(-2px, -1px); }
  50% { clip-path: inset(28% 0 52% 0); transform: translate(2px, 0); }
  75% { clip-path: inset(8% 0 76% 0); transform: translate(-2px, 1px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero {
    flex-direction: column;
    text-align: center;
  }
  .hero-left,
  .hero-right {
    max-width: 100%;
  }
  .hero-desc {
    margin-left: auto;
    margin-right: auto;
  }
  .hero-actions,
  .hero-socials {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .nav-links {
    gap: 0.6rem;
  }
  .nav-links a {
    font-size: 0.72rem;
  }
  .scroll-hint {
    display: none;
  }
  .section {
    padding: 3.5rem 0 1.5rem;
  }
}

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