:root {
  --bg: #040814;
  --surface: rgba(7, 16, 36, 0.78);
  --surface-strong: #07132d;
  --text: #e8f2ff;
  --muted: #92a6c9;
  --border: rgba(85, 219, 255, 0.28);
  --accent: #27c8ff;
  --accent-2: #2bf5bf;
  --accent-3: #76d7ff;
  --cyber-grid: rgba(57, 145, 255, 0.2);
  --cyber-line: rgba(52, 240, 255, 0.34);
  --cyber-node: #6ff1ff;
  --success: #1eaa65;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-soft: 0 20px 52px rgba(1, 6, 22, 0.62);
  --shadow-hover: 0 28px 74px rgba(0, 0, 0, 0.72);
  --max-width: 1150px;
  --mouse-x: 50%;
  --mouse-y: 50%;
  --duration: 0.35s;
}

body[data-theme="cyber"] {
  --accent: #27c8ff;
  --accent-2: #2bf5bf;
  --accent-3: #76d7ff;
}

body[data-theme="matrix"] {
  --accent: #4fe76c;
  --accent-2: #08d99d;
  --accent-3: #9af6b4;
}

body[data-theme="redteam"] {
  --accent: #ff4f66;
  --accent-2: #ff8f3f;
  --accent-3: #ffc89b;
}

body[data-theme="ice"] {
  --accent: #60b7ff;
  --accent-2: #46ebff;
  --accent-3: #87d4ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
  text-rendering: geometricPrecision;
}

.network-canvas {
  position: fixed;
  inset: 0;
  z-index: -4;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.78;
  mix-blend-mode: screen;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background:
    linear-gradient(var(--cyber-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--cyber-grid) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.26;
  -webkit-mask-image: radial-gradient(circle at 50% 16%, black 25%, transparent 76%);
  mask-image: radial-gradient(circle at 50% 16%, black 25%, transparent 76%);
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(
      420px circle at var(--mouse-x) var(--mouse-y),
      color-mix(in srgb, var(--accent-2) 30%, transparent),
      transparent 70%
    ),
    radial-gradient(
      480px circle at 12% 14%,
      color-mix(in srgb, var(--accent) 30%, transparent),
      transparent 70%
    ),
    radial-gradient(
      550px circle at 84% 16%,
      color-mix(in srgb, var(--accent-3) 28%, transparent),
      transparent 72%
    ),
    linear-gradient(160deg, #030913 0%, #061124 45%, #040814 100%);
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.09;
  background-image: repeating-radial-gradient(
    circle at 0 0,
    transparent 0,
    rgba(255, 255, 255, 0.04) 1px,
    transparent 2px
  );
  background-size: 10px 10px;
}

.scanlines-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.15;
  background: repeating-linear-gradient(
    to bottom,
    rgba(116, 226, 255, 0.12) 0,
    rgba(116, 226, 255, 0.12) 1px,
    transparent 2px,
    transparent 4px
  );
  animation: scan-slide 5s linear infinite;
}

@keyframes scan-slide {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(4px);
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  max-width: var(--max-width);
  margin: 16px auto 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--surface-strong) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 700;
  color: #f8fbff;
  background: linear-gradient(130deg, var(--accent), var(--accent-2));
  border: 1px solid rgba(255, 255, 255, 0.22);
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 0.96rem;
  padding: 6px 8px;
  border-radius: 10px;
  transition: color var(--duration), background-color var(--duration);
}

.site-nav a.active,
.site-nav a:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

.menu-toggle {
  display: none;
  border: none;
  background: transparent;
  width: 42px;
  height: 42px;
  padding: 8px;
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  background: var(--text);
  margin: 7px 0;
  transition: transform var(--duration), opacity var(--duration);
}

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

.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 24px;
  align-items: stretch;
  min-height: calc(100vh - 130px);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--accent-2);
  font-weight: 700;
  margin: 0 0 10px;
}

h1,
h2,
h3 {
  font-family: "Syne", sans-serif;
  line-height: 1.08;
  margin: 0 0 16px;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  max-width: 16ch;
}

h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.8rem);
}

h3 {
  font-size: 1.2rem;
}

#rotatingText {
  display: inline-block;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-content,
.hero-panel,
.contact-card,
.project-card,
.timeline article {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero-content {
  padding: clamp(22px, 3.2vw, 42px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-text {
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  color: var(--muted);
  max-width: 55ch;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin: 18px 0 30px;
}

.btn {
  border-radius: 999px;
  padding: 11px 18px;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  transition: transform var(--duration), box-shadow var(--duration),
    background-color var(--duration), color var(--duration), border-color var(--duration);
}

.btn:hover {
  transform: translateY(-3px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 20px 30px color-mix(in srgb, var(--accent) 40%, transparent);
}

.btn-ghost {
  color: var(--text);
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface-strong) 86%, transparent);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stats li {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(140, 168, 255, 0.24);
  background: color-mix(in srgb, var(--accent-2) 16%, #0a1222);
}

.counter {
  display: block;
  font-family: "Syne", sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
}

.stats p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.hero-panel {
  padding: clamp(20px, 2.8vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(
      115deg,
      rgba(89, 227, 255, 0.12) 0%,
      transparent 22%,
      transparent 78%,
      rgba(89, 227, 255, 0.12) 100%
    ),
    radial-gradient(circle at 96% 8%, rgba(56, 205, 255, 0.18), transparent 45%);
}

.panel-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.status-grid div {
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid rgba(95, 227, 255, 0.28);
  background: color-mix(in srgb, var(--accent-3) 14%, #09162e);
}

.status-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.status-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 0.94rem;
}

.security-strip {
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.security-strip span {
  border: 1px solid rgba(101, 226, 255, 0.5);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--cyber-node) 88%, white);
  background: color-mix(in srgb, var(--cyber-line) 20%, #0a1222);
}

.hud-bars {
  margin-top: 6px;
  padding: 10px 10px 8px;
  border: 1px solid rgba(89, 227, 255, 0.38);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--cyber-line) 18%, #071126);
  display: grid;
  gap: 7px;
}

.hud-bars span {
  display: block;
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--accent-2) 65%, var(--cyber-node)) 0 var(--bar-level),
      rgba(255, 255, 255, 0.08) var(--bar-level) 100%
    );
  box-shadow: 0 0 12px rgba(89, 227, 255, 0.28);
}

.packet-map {
  margin-top: 4px;
  height: 170px;
  border: 1px solid rgba(86, 226, 255, 0.34);
  border-radius: var(--radius-md);
  background:
    linear-gradient(rgba(74, 153, 255, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 153, 255, 0.11) 1px, transparent 1px),
    linear-gradient(160deg, rgba(3, 10, 24, 0.94), rgba(3, 14, 32, 0.94));
  background-size: 24px 24px, 24px 24px, auto;
  position: relative;
  overflow: hidden;
}

.packet-map::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 15% 12%, rgba(75, 245, 191, 0.18), transparent 50%);
}

.packet-node {
  position: absolute;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 4px 7px;
  border: 1px solid rgba(109, 241, 255, 0.5);
  color: #b9f6ff;
  background: rgba(5, 24, 46, 0.88);
  z-index: 2;
}

.packet-node.core {
  left: 10%;
  top: 22%;
}

.packet-node.edge {
  right: 8%;
  top: 20%;
}

.packet-node.soc {
  left: 14%;
  bottom: 18%;
}

.packet-node.cloud {
  right: 8%;
  bottom: 18%;
}

.packet-route {
  position: absolute;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(118, 215, 255, 0.05), rgba(118, 215, 255, 0.9), rgba(118, 215, 255, 0.05));
  box-shadow: 0 0 10px rgba(118, 215, 255, 0.45);
}

.packet-route.route-a {
  left: 18%;
  top: 27%;
  width: 64%;
  transform: rotate(-2deg);
}

.packet-route.route-b {
  left: 18%;
  top: 30%;
  width: 17%;
  transform: rotate(66deg);
}

.packet-route.route-c {
  left: 20%;
  bottom: 24%;
  width: 59%;
  transform: rotate(-1deg);
}

.packet-pulse {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(130deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(79, 243, 255, 0.9);
  z-index: 3;
}

.packet-pulse.pulse-a {
  left: 18%;
  top: 26%;
  animation: packet-a 2.6s linear infinite;
}

.packet-pulse.pulse-b {
  left: 18%;
  top: 31%;
  animation: packet-b 3.1s linear infinite;
}

.packet-pulse.pulse-c {
  left: 20%;
  bottom: 23%;
  animation: packet-c 2.9s linear infinite;
}

@keyframes packet-a {
  0% {
    left: 18%;
    top: 26%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    left: 82%;
    top: 24%;
    opacity: 0;
  }
}

@keyframes packet-b {
  0% {
    left: 18%;
    top: 31%;
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    left: 29%;
    top: 73%;
    opacity: 0;
  }
}

@keyframes packet-c {
  0% {
    left: 20%;
    bottom: 23%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    left: 79%;
    bottom: 22%;
    opacity: 0;
  }
}

.terminal-panel {
  margin-top: 4px;
  border: 1px solid rgba(76, 225, 255, 0.36);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(1, 8, 20, 0.94);
  box-shadow: inset 0 1px 0 rgba(102, 220, 255, 0.2);
}

.terminal-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(88, 225, 255, 0.24);
  background: rgba(6, 20, 45, 0.86);
}

.terminal-head p {
  margin: 0 0 0 2px;
  color: #8fb6e8;
  font-size: 0.74rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.red {
  background: #ff4f66;
}

.dot.yellow {
  background: #ffd05b;
}

.dot.green {
  background: #38f2a7;
}

.terminal-feed {
  list-style: none;
  margin: 0;
  padding: 10px 10px 12px;
  display: grid;
  gap: 6px;
  min-height: 130px;
}

.terminal-feed li {
  font-size: 0.76rem;
  color: #c9f7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.84;
}

.terminal-feed li.new {
  animation: terminal-enter 360ms ease;
}

.terminal-feed .time {
  color: #65d6ff;
}

.terminal-feed .label {
  color: #37efbc;
  font-weight: 700;
}

@keyframes terminal-enter {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 0.95;
  }
}

.section-heading {
  max-width: 72ch;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.skill-cloud {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skill-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--surface-strong) 84%, transparent);
  font-weight: 600;
  color: color-mix(in srgb, var(--text) 88%, var(--accent-2));
  transition: transform var(--duration), background-color var(--duration);
}

.skill-pill:hover {
  transform: translateY(-3px) scale(1.02);
  background: color-mix(in srgb, var(--accent) 20%, #0b1326);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 18px;
}

.filter-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  font-family: inherit;
  font-weight: 700;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-strong) 80%, transparent);
  cursor: pointer;
  transition: transform var(--duration), color var(--duration),
    background-color var(--duration);
}

.filter-btn:hover,
.filter-btn.active {
  transform: translateY(-2px);
  color: var(--text);
  background: color-mix(in srgb, var(--accent-3) 28%, #0a1326);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  grid-column: span 6;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: transform var(--duration), box-shadow var(--duration);
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 44%, transparent), transparent 70%);
  pointer-events: none;
}

.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.project-card h3 {
  margin-top: 8px;
}

.project-card p {
  color: var(--muted);
  margin: 8px 0 14px;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.project-meta span {
  font-size: 0.78rem;
  border-radius: 999px;
  padding: 5px 9px;
  border: 1px solid rgba(140, 168, 255, 0.28);
  background: color-mix(in srgb, var(--accent-2) 16%, #0b1427);
}

.project-links {
  display: flex;
  gap: 10px;
}

.project-links a {
  font-weight: 700;
  color: color-mix(in srgb, var(--text) 80%, var(--accent-3));
  text-decoration: none;
}

.project-links a:hover {
  color: var(--accent-2);
}

.about .timeline {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.timeline article {
  padding: 16px;
}

.timeline span {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.88rem;
}

.timeline p {
  margin: 0;
  color: var(--muted);
}

.contact {
  padding-bottom: 80px;
}

.contact-card {
  padding: clamp(24px, 4vw, 44px);
  text-align: center;
}

.contact-actions {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 20px 12px 42px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .packet-map {
    height: 156px;
  }

  .project-card {
    grid-column: span 12;
  }

  .about .timeline {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .site-header {
    border-radius: 18px;
    padding: 10px 14px;
    margin-inline: 12px;
  }

  .menu-toggle {
    display: block;
    order: 2;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    margin: 0 10px;
    border-radius: var(--radius-md);
    padding: 10px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav a {
    padding: 10px 12px;
  }

  body.nav-open .site-nav {
    display: flex;
  }

  body.nav-open .menu-toggle span:first-child {
    transform: translateY(4px) rotate(45deg);
  }

  body.nav-open .menu-toggle span:last-child {
    transform: translateY(-5px) rotate(-45deg);
  }
}

@media (max-width: 640px) {
  .section {
    padding-top: 62px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn,
  .filter-btn {
    text-align: center;
  }

  .packet-map {
    height: 138px;
  }

  .terminal-feed li {
    font-size: 0.72rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scanlines-overlay {
    animation: none;
  }

  .packet-pulse {
    animation: none !important;
  }
}
