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

html {
  background-color: #09090b;
}

body {
  background-color: #09090b;
  background-image: radial-gradient(rgba(63, 63, 70, 0.28) 1px, transparent 1px);
  background-size: 22px 22px;
  color: #fafafa;
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Cursor spotlight */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(650px circle at var(--cursor-x, -999px) var(--cursor-y, -999px),
      rgba(255, 255, 255, 0.038),
      transparent 65%);
  transition: background 0.1s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: #09090b;
}

::-webkit-scrollbar-thumb {
  background: #27272a;
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Card hover */
.card-hover {
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.card-hover:hover {
  border-color: #52525b;
  background-color: #111113;
  transform: translateY(-1px);
}

/* Badge hover */
.badge-pill {
  transition: border-color 0.15s ease, color 0.15s ease;
  cursor: default;
}

.badge-pill:hover {
  border-color: #52525b;
  color: #e4e4e7;
}

/* Pulse dot */
@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.6;
    transform: scale(0.85);
  }
}

.pulse-dot {
  animation: pulse-dot 2.2s ease-in-out infinite;
}

/* Command palette slide-in */
@keyframes cmd-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.975);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.cmd-modal {
  animation: cmd-in 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Timeline dot ring */
.tl-dot {
  position: absolute;
  left: -5px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: #18181b;
  border: 2px solid #52525b;
}

.tl-dot.active {
  border-color: #10b981;
  background: #052e1c;
}

/* Section divider */
.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, #27272a, transparent);
}

/* Avatar ring */
.avatar-ring {
  background: linear-gradient(135deg, #3f3f46 0%, #27272a 50%, #18181b 100%);
}

/* Subtle glow on nav cmd button */
.cmd-btn:hover {
  box-shadow: 0 0 0 1px #3f3f46;
}

/* Writing card read arrow */
.read-arrow {
  transition: transform 0.15s ease, opacity 0.15s ease;
  opacity: 0;
}

.card-hover:hover .read-arrow {
  transform: translateX(2px);
  opacity: 1;
}

/* Nav link active indicator */
.nav-link {
  position: relative;
  transition: color 0.15s;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: #52525b;
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-link:hover::after {
  transform: scaleX(1);
}

/* Scroll fade-in */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .pulse-dot {
    animation: none;
  }

  .cmd-modal {
    animation: none;
  }
}

/* ── Scan line ──────────────────────────────────────────────── */
#scan-line {
  position: fixed;
  top: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(16, 185, 129, 0.0) 20%,
    rgba(16, 185, 129, 0.65) 50%,
    rgba(16, 185, 129, 0.0) 80%,
    transparent 100%
  );
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5), 0 0 30px rgba(16, 185, 129, 0.18);
  pointer-events: none;
  z-index: 9998;
  animation: scan-sweep 1.4s cubic-bezier(0.4, 0, 0.6, 1) 0.1s forwards;
}
@keyframes scan-sweep {
  0%   { top: -2px; opacity: 1; }
  92%  { opacity: 1; }
  100% { top: 100vh; opacity: 0; }
}

/* ── Boot overlay ───────────────────────────────────────────── */
#boot-overlay {
  transition: opacity 0.4s ease;
}
#boot-overlay.fade-out {
  opacity: 0;
}

/* ── Typed cursor ───────────────────────────────────────────── */
.type-cursor {
  display: inline-block;
  width: 2px;
  height: 0.85em;
  background: rgba(161, 161, 170, 0.7);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: blink-cursor 0.85s step-end infinite;
}
.type-cursor.done { display: none; }
@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Glitch effect on H1 ────────────────────────────────────── */
#hero-name {
  position: relative;
  cursor: default;
}
#hero-name::before,
#hero-name::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
#hero-name::before { color: rgba(239, 68, 68, 0.7); }
#hero-name::after  { color: rgba(59, 130, 246, 0.7); }
#hero-name:hover::before { animation: glitch-red  0.42s steps(1) forwards; }
#hero-name:hover::after  { animation: glitch-blue 0.42s steps(1) forwards; }
@keyframes glitch-red {
  0%  { opacity:0; transform:translate(0,0);    clip-path:inset(0 0 60% 0); }
  10% { opacity:1; transform:translate(-2px,0); clip-path:inset(10% 0 55% 0); }
  20% {            transform:translate(2px,1px); clip-path:inset(30% 0 40% 0); }
  30% {            transform:translate(-1px,-1px); clip-path:inset(50% 0 20% 0); }
  40% {            transform:translate(3px,0);  clip-path:inset(0 0 80% 0); }
  50% {            transform:translate(-2px,1px); clip-path:inset(40% 0 30% 0); }
  60% {            transform:translate(1px,-1px); clip-path:inset(20% 0 60% 0); }
  70% {            transform:translate(-3px,0); clip-path:inset(60% 0 10% 0); }
  80% {            transform:translate(2px,1px); clip-path:inset(80% 0 0 0); }
  90% { opacity:1; transform:translate(0,0); }
  100%{ opacity:0; }
}
@keyframes glitch-blue {
  0%  { opacity:0; transform:translate(0,0);   clip-path:inset(60% 0 0 0); }
  10% { opacity:1; transform:translate(2px,0); clip-path:inset(55% 0 10% 0); }
  20% {            transform:translate(-2px,-1px); clip-path:inset(40% 0 30% 0); }
  30% {            transform:translate(1px,1px); clip-path:inset(20% 0 50% 0); }
  40% {            transform:translate(-3px,0); clip-path:inset(70% 0 5% 0); }
  50% {            transform:translate(2px,-1px); clip-path:inset(30% 0 45% 0); }
  60% {            transform:translate(-1px,1px); clip-path:inset(60% 0 15% 0); }
  70% {            transform:translate(3px,0);  clip-path:inset(10% 0 70% 0); }
  80% {            transform:translate(-2px,-1px); clip-path:inset(50% 0 25% 0); }
  90% { opacity:1; transform:translate(0,0); }
  100%{ opacity:0; }
}

/* ── Radar pulse ────────────────────────────────────────────── */
.radar-pulse {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}
.radar-pulse::before,
.radar-pulse::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(16, 185, 129, 0.5);
  width: 6px;
  height: 6px;
  animation: radar-expand 2.4s ease-out infinite;
}
.radar-pulse::before {
  background: rgba(16, 185, 129, 0.35);
  animation-delay: 0s;
}
.radar-pulse::after {
  animation-delay: 1.2s;
}
@keyframes radar-expand {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(3.5); opacity: 0;   }
}

/* ── Card data stream shimmer ───────────────────────────────── */
.card-stream {
  position: relative;
}
.card-stream::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(63, 63, 70, 0.09) 50%,
    rgba(82, 82, 91, 0.05) 55%,
    transparent 65%
  );
  background-size: 200% 100%;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
  animation: data-stream 5s linear infinite;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.card-stream:hover::before { opacity: 1; }
@keyframes data-stream {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Featured project badge glow ────────────────────────────── */
.card-featured {
  border-color: #3f3f46;
  box-shadow: 0 0 0 1px rgba(16,185,129,0.08), inset 0 1px 0 rgba(16,185,129,0.05);
}

@media (prefers-reduced-motion: reduce) {
  #scan-line, #boot-overlay { display: none; }
  #hero-name::before, #hero-name::after { display: none; }
  .radar-pulse::before, .radar-pulse::after { animation: none; opacity: 0.4; }
  .radar-pulse::after { display: none; }
  .type-cursor { display: none; }
  #hero-subtitle { opacity: 1 !important; }
  .card-stream::before { display: none; }
}
