/* ============ BASE ============ */
:root {
  --bg: #0a0e1a;
  --bg-soft: #101828;
  --orange: #ff9800;
  --cyan: #00e5ff;
  --green: #4ade80;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --card: rgba(16, 24, 40, 0.75);
  --border: rgba(0, 229, 255, 0.15);
  --grad: linear-gradient(135deg, var(--orange), var(--cyan));
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  overflow-x: hidden;
  line-height: 1.6;
}

::selection { background: var(--cyan); color: var(--bg); }

/* ============ STARFIELD ============ */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============ UFO ============ */
#ufo {
  position: fixed;
  top: 12vh;
  left: -80px;
  font-size: 2.2rem;
  z-index: 5;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.6));
  animation: ufo-fly 28s linear infinite;
  user-select: none;
}
@keyframes ufo-fly {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(30vw, 6vh) rotate(-8deg); }
  50%  { transform: translate(60vw, -4vh) rotate(6deg); }
  75%  { transform: translate(85vw, 5vh) rotate(-5deg); }
  100% { transform: translate(110vw, 0) rotate(0deg); }
}
#ufo.abducting { animation-play-state: paused; }

/* ============ HERO ============ */
.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem;
}

.hero-inner {
  text-align: center;
  max-width: 720px;
}

.avatar-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 2rem;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 32%;
  box-shadow:
    0 0 40px rgba(255, 152, 0, 0.35),
    0 0 80px rgba(0, 229, 255, 0.25);
  animation: float 5s ease-in-out infinite;
  cursor: pointer;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
}
.avatar:hover { transform: scale(1.06) rotate(-3deg); }
.avatar.spin { animation: avatar-spin 0.8s ease; }
@keyframes avatar-spin { to { transform: rotate(360deg); } }
@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -12px; }
}

/* tractor beam under avatar */
.beam {
  position: absolute;
  top: 85%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 55px solid transparent;
  border-right: 55px solid transparent;
  border-top: 90px solid rgba(0, 229, 255, 0.08);
  filter: blur(2px);
  animation: beam-pulse 3s ease-in-out infinite;
  z-index: 1;
}
@keyframes beam-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* orbiting particles */
.orbit {
  position: absolute;
  inset: -25px;
  animation: orbit-rotate linear infinite;
  pointer-events: none;
  z-index: 3;
}
.orbit span {
  position: absolute;
  top: 0;
  left: 50%;
  font-size: 0.7rem;
}
.orbit-1 { animation-duration: 8s; }
.orbit-1 span { color: var(--cyan); }
.orbit-2 { animation-duration: 13s; animation-direction: reverse; inset: -42px; }
.orbit-2 span { color: var(--orange); }
.orbit-3 { animation-duration: 19s; inset: -58px; }
.orbit-3 span { color: var(--green); font-size: 0.5rem; }
@keyframes orbit-rotate { to { transform: rotate(360deg); } }

.signal-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--green);
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}
.blink { animation: blink 1.2s step-start infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* glitch title */
h1.glitch {
  font-size: clamp(3.5rem, 12vw, 6.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  display: inline-block;
  line-height: 1.1;
}
h1.glitch::before,
h1.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
}
h1.glitch:hover::before {
  opacity: 0.8;
  transform: translate(3px, -2px);
  filter: hue-rotate(90deg);
  animation: glitch-jitter 0.3s steps(2) infinite;
}
h1.glitch:hover::after {
  opacity: 0.8;
  transform: translate(-3px, 2px);
  filter: hue-rotate(-90deg);
  animation: glitch-jitter 0.3s steps(2) infinite reverse;
}
@keyframes glitch-jitter {
  0% { clip-path: inset(20% 0 60% 0); }
  50% { clip-path: inset(60% 0 10% 0); }
  100% { clip-path: inset(30% 0 40% 0); }
}

.role {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(0.95rem, 3vw, 1.25rem);
  color: var(--cyan);
  margin: 1rem 0 1.8rem;
  min-height: 1.8em;
}
.prompt { color: var(--orange); margin-right: 0.4em; }
.cursor { animation: blink 1s step-start infinite; color: var(--cyan); }

.motto {
  font-size: clamp(1rem, 3vw, 1.2rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-dim);
  max-width: 520px;
  margin: 0 auto 2.2rem;
}
.om {
  display: inline-block;
  font-style: normal;
  font-size: 1.5em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  cursor: pointer;
  transition: transform 0.4s ease, filter 0.4s ease;
  margin-left: 0.3em;
  vertical-align: middle;
}
.om:hover {
  transform: rotate(360deg) scale(1.3);
  filter: drop-shadow(0 0 10px var(--cyan));
}

.hero-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}
.btn-github:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.3);
  transform: translateY(-2px);
}

.location {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.scroll-hint {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: var(--text-dim);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: color 0.3s;
}
.scroll-hint:hover { color: var(--cyan); }
.scroll-hint .arrow { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ============ SECTIONS ============ */
.section {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section-title {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.section-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6em;
  color: var(--orange);
  vertical-align: super;
  margin-right: 0.4em;
}
.section-sub {
  color: var(--text-dim);
  margin-bottom: 2.5rem;
}
.section-sub code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.45em;
  color: var(--green);
  font-size: 0.9em;
}

/* ============ SKILL CARDS ============ */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
}

.skill-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.6rem;
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease-out, border-color 0.3s, box-shadow 0.3s;
  overflow: hidden;
  opacity: 0;
  translate: 0 30px;
}
.skill-card.visible {
  opacity: 1;
  translate: 0 0;
  transition: opacity 0.6s ease, translate 0.6s ease, transform 0.2s ease-out, border-color 0.3s, box-shadow 0.3s;
}
.skill-card:hover {
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 12px 40px rgba(0, 229, 255, 0.12);
}

.card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle 180px at var(--mx, 50%) var(--my, 50%), rgba(0, 229, 255, 0.12), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.skill-card:hover .card-glow { opacity: 1; }

.skill-card h3 {
  font-size: 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card-icon { font-size: 1.3rem; }

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}
.chips li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 0.28em 0.75em;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 229, 255, 0.05);
  color: var(--text);
  transition: all 0.25s ease;
  cursor: default;
}
.chips li:hover {
  background: var(--grad);
  color: var(--bg);
  border-color: transparent;
  transform: scale(1.1) rotate(-2deg);
  font-weight: 700;
}

.card-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  cursor: default;
}

/* ============ TERMINAL ============ */
.terminal {
  background: #0c1020;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border);
}
.dot { width: 12px; height: 12px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }
.terminal-title {
  margin-left: 0.8rem;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.terminal-body {
  padding: 1rem 1.2rem;
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  cursor: text;
}

.terminal-output { white-space: pre-wrap; word-break: break-word; }
.terminal-output .line { display: block; }
.terminal-output .cmd-echo { color: var(--text-dim); }
.terminal-output .ok { color: var(--green); }
.terminal-output .accent { color: var(--cyan); }
.terminal-output .warn { color: var(--orange); }

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.terminal-prompt { color: var(--green); white-space: nowrap; }
#terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  caret-color: var(--cyan);
}

/* ============ FOOTER ============ */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}
.footer-motto {
  font-style: italic;
  color: var(--text-dim);
  margin-bottom: 1rem;
}
.om-small {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.footer-icons {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  margin-bottom: 1.2rem;
}
.footer-icons a {
  color: var(--text-dim);
  display: inline-flex;
  padding: 0.4rem;
  transition: color 0.3s, transform 0.3s, filter 0.3s;
}
.footer-icons a:hover {
  color: var(--cyan);
  transform: translateY(-3px);
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.5));
}
.footer-meta { font-size: 0.85rem; color: var(--text-dim); }
.sep { margin: 0 0.5rem; opacity: 0.5; }
.footer-hint {
  margin-top: 1.5rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: rgba(139, 152, 169, 0.4);
  letter-spacing: 0.1em;
}

/* ============ DISCO MODE (Konami) ============ */
body.disco {
  animation: disco-bg 1s linear infinite;
}
@keyframes disco-bg {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .avatar-wrap { width: 140px; height: 140px; }
  .section { padding: 3.5rem 1.2rem; }
  .terminal-body { min-height: 220px; }
  #ufo { font-size: 1.7rem; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  #ufo { display: none; }
}
