/* Design tokens */
:root {
  --bg: #0B1220;
  --surface: #101A2C;
  --surface-2: #16223A;
  --border: #22304A;
  --text: #E9EEF6;
  --text-dim: #9BA8BC;
  --text-faint: #6C7A91;
  --accent: #F2A65A;
  --accent-dim: #C77F3A;
  --signal: #4FD1C5;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --wrap: 1120px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 28px;
}

img, svg { max-width: 100%; }

@media (max-width: 480px) {
  .wrap { padding: 0 18px; }
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: none;
}

.accent { color: var(--accent); }

.hero-name {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--signal);
  letter-spacing: 0.04em;
  margin: 0 0 14px;
}

/* subtle grain for depth, kept very quiet */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 18px;
}
.brand-dot { color: var(--accent); }

.nav {
  display: flex;
  gap: 32px;
}

.nav a {
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.15s ease;
}
.nav a:hover, .nav a:focus-visible { color: var(--text); }

.nav-cta { display: inline-flex; }

@media (max-width: 720px) {
  .nav { display: none; }
}

@media (max-width: 400px) {
  .header-inner { height: 60px; }
  .brand { font-size: 16px; }
  .nav-cta { font-size: 12px; padding: 8px 12px; }
}

/* Buttons*/
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #1A1206;
}
.btn-primary:hover { transform: translateY(-1px); background: #f5b478; }

.btn-outline {
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--signal); color: var(--signal); }

.btn-ghost {
  border-color: var(--border);
  color: var(--text);
  font-size: 13px;
  padding: 9px 16px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* Hero*/
.hero {
  padding: 96px 0 64px;
  position: relative;
  z-index: 1;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(34px, 5vw, 54px);
  margin: 12px 0 24px;
}

.hero-lead {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 46ch;
}

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

.hero-diagram { width: 100%; }
.topology { width: 100%; height: auto; }

.link {
  stroke: var(--border);
  stroke-width: 1.5;
}
.link-dim { stroke: var(--border); opacity: 0.35; }

.node circle:not(.node-pulse) {
  fill: var(--surface-2);
  stroke: var(--signal);
  stroke-width: 1.5;
}
.node-center circle:not(.node-pulse) {
  fill: var(--accent);
  stroke: var(--accent);
}
.node-center .node-label-mono { fill: #1A1206; font-size: 12px; }

.node-label-mono {
  font-family: var(--font-mono);
  font-size: 13px;
  fill: var(--text);
}
.node-caption {
  font-family: var(--font-mono);
  font-size: 12px;
  fill: var(--text-faint);
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-diagram { max-width: 340px; margin: 0 auto; }
}

@media (max-width: 480px) {
  .hero { padding: 64px 0 48px; }
  .hero-lead { font-size: 15.5px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions .btn { text-align: center; }
  .hero-diagram { max-width: 280px; }
}
/* Hero diagram: full motion + click-to-navigate nodes */
.packet {
  fill: var(--signal);
  filter: drop-shadow(0 0 4px rgba(79, 209, 197, 0.8));
}
@media (prefers-reduced-motion: reduce) {
  .packet { display: none; }
}

.hero-diagram-hint {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin: 4px 0 0;
}

.node-link {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.node-link:hover,
.node-link:focus-visible {
  transform: scale(1.08);
}
.node-link:hover circle:not(.node-pulse),
.node-link:focus-visible circle:not(.node-pulse) {
  stroke: var(--accent);
  fill: var(--surface-2);
}
.node-link:focus,
.node-link:focus-visible {
  outline: none;
}
.node-link:focus-visible circle:not(.node-pulse) {
  filter: drop-shadow(0 0 8px var(--accent));
}

/* gentle glow pulse on the center node's solid circle */
.node-center circle:not(.node-pulse) {
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(242, 166, 90, 0)); }
  50% { filter: drop-shadow(0 0 10px rgba(242, 166, 90, 0.45)); }
}

/* continuous "flowing" ring inside each node */
.node-pulse {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.5;
  opacity: 0.6;
  transform-box: fill-box;
  transform-origin: center;
  animation: node-ping 2.6s ease-out infinite;
  pointer-events: none;
}
.node-pulse-center { stroke: var(--accent); }
@keyframes node-ping {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.55); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .node-center circle:not(.node-pulse) { animation: none; }
  .node-pulse { animation: none; opacity: 0; }
}

/* Topology screenshot: hidden until opened, closes on tab/window blur */
.topology-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 14px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.topology-toggle:hover,
.topology-toggle:focus-visible {
  border-color: var(--signal);
  color: var(--signal);
}
.topology-toggle:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}
.topology-toggle-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}
.project-image.is-open .topology-toggle-icon {
  transform: rotate(180deg);
}
.topology-toggle-label { flex: 1; text-align: left; }

.topology-collapse {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 0;
  transition: grid-template-rows 0.4s ease, margin-top 0.4s ease;
}
.project-image.is-open .topology-collapse {
  grid-template-rows: 1fr;
  margin-top: 20px;
}
.topology-collapse-inner {
  overflow: hidden;
  min-height: 0;
}
@media (prefers-reduced-motion: reduce) {
  .topology-collapse { transition: none; }
}

/* Card hover lift — mouse/trackpad only; touch gets a tap response instead
   so nothing gets stuck "hovered" on mobile */
.project-card,
.skill-card,
.edu-card {
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .project-card:hover,
  .skill-card:hover,
  .edu-card:hover {
    transform: translateY(-4px);
    border-color: var(--signal);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  }
  .skill-card-primary:hover {
    border-color: var(--signal);
  }
}

@media (hover: none) {
  .project-card:active,
  .skill-card:active,
  .edu-card:active {
    transform: scale(0.98);
    border-color: var(--signal);
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .skill-card,
  .edu-card {
    transition: none;
  }
}

/*  Sections (shared)*/
.section {
  padding: 88px 0;
  position: relative;
  z-index: 1;
}
.section-alt { background: var(--surface); }

.section-head { margin-bottom: 48px; }
.section-head h2 {
  font-size: clamp(26px, 3.5vw, 36px);
}

@media (max-width: 480px) {
  .section { padding: 60px 0; }
  .section-head { margin-bottom: 32px; }
}

/* About*/
.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 48px;
}
.about-body p { color: var(--text-dim); }
.about-body p:first-child { color: var(--text); font-size: 18px; }

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

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.skill-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
}

.skill-card-primary {
  border-color: var(--signal);
  box-shadow: 0 0 0 1px rgba(79, 209, 197, 0.25);
}

.skill-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--signal);
  margin: 0 0 12px;
}

.skill-card h3 { margin-bottom: 16px; font-size: 19px; }

.skill-card li {
  color: var(--text-dim);
  font-size: 14px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
}
.skill-card li:first-of-type { border-top: none; }

.skill-card {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.skill-card.is-highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(242, 166, 90, 0.25);
}

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

/*Project*/
.project-panel {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  grid-template-areas:
    "image image"
    "summary stats";
  gap: 28px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 44px;
}

.project-image { grid-area: image; }
.project-image img {
  width: 100%;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.project-summary { grid-area: summary; }
.project-stats { grid-area: stats; }

.project-points { margin: 20px 0 28px; }
.project-points li {
  color: var(--text-dim);
  font-size: 14.5px;
  padding: 9px 0 9px 22px;
  position: relative;
  border-top: 1px solid var(--border);
}
.project-points li:first-child { border-top: none; }
.project-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal);
}

.project-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-content: start;
}
.stat {
  border-left: 2px solid var(--accent);
  padding-left: 14px;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 30px;
  color: var(--text);
  margin: 0;
}
.stat-label {
  font-size: 13px;
  color: var(--text-faint);
  margin: 2px 0 0;
}

@media (max-width: 860px) {
  .project-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "image"
      "summary"
      "stats";
    padding: 28px;
  }
}

@media (max-width: 480px) {
  .project-panel { padding: 20px; }
  .project-title { font-size: 20px; }
  .project-stats { gap: 14px; }
  .stat-num { font-size: 24px; }
}

.project-title {
  font-size: 22px;
  margin: 10px 0 16px;
}

.project-status {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 20px;
  margin: 0;
}
.status-live {
  color: var(--signal);
  background: rgba(79, 209, 197, 0.12);
  border: 1px solid rgba(79, 209, 197, 0.35);
}

@media (max-width: 480px) {
  .edu-card, .skill-card { padding: 20px; }
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}
.project-card h3 {
  font-size: 17px;
  margin: 12px 0 10px;
}
.project-card-desc {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 16px;
}
.project-card-link {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.project-card-link:hover {
  color: var(--signal);
  border-color: var(--signal);
}
.project-card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}
@media (max-width: 860px) {
  .project-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .project-card { padding: 20px; }
}

/* Experience (timeline) */
.timeline {
  display: grid;
  gap: 32px;
}
.timeline-item {
  border-top: 1px solid var(--border);
  padding-top: 28px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
}
.timeline-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--signal);
  margin: 0;
}
.timeline-item h3 { margin-bottom: 12px; font-size: 18px; }
.timeline-item li {
  color: var(--text-dim);
  font-size: 14.5px;
  padding: 5px 0 5px 16px;
  position: relative;
}
.timeline-item li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--text-faint);
}

@media (max-width: 640px) {
  .timeline-item { grid-template-columns: 1fr; gap: 8px; }
}

/* Education */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.edu-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
}
.edu-card h3 { font-size: 17px; margin-bottom: 10px; }
.edu-sub { color: var(--text-dim); font-size: 14px; margin-bottom: 6px; }
.edu-date {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 0;
}

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

/* Contact */
.section-contact {
  text-align: center;
  background: var(--surface);
}
.contact-inner { max-width: 560px; margin: 0 auto; }
.contact-inner .eyebrow { justify-self: center; }
.contact-lead {
  color: var(--text-dim);
  font-size: 17px;
  margin-top: 16px;
}
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin: 28px 0 12px;
}
.contact-link {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.contact-link:hover { color: var(--accent); border-color: var(--accent); }

.contact-location {
  color: var(--text-faint);
  font-size: 14px;
}

@media (max-width: 480px) {
  .contact-link { font-size: 16px; }
}


/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 13px;
}
.footer-mono { font-family: var(--font-mono); }
