:root {
  --black: #0a0a0a;
  --white: #f0ece2;
  --accent: #00e5ff;
  --mid: #1a1a1a;
  --muted: #999;
  color-scheme: light;
}

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

html,
body {
  background: var(--black);
  color: var(--white);
  font-family: 'DM Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- NOISE OVERLAY ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ---- LAYOUT ---- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ---- HEADER ---- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  width: 100%;
  transition:
    background 0.2s,
    border-color 0.2s,
    backdrop-filter 0.2s;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem 0;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 2rem;
}

.name-block h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(5rem, 15vw, 11rem);
  line-height: 0.88;
  letter-spacing: -0.02em;
  color: var(--accent);
  animation: slideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.name-block h1 span {
  color: var(--white);
}

.tagline {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 1rem;
  animation: slideUp 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ---- NAV ---- */
nav {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0;
  animation: slideUp 0.7s 0.15s cubic-bezier(0.16, 1, 0.3, 1) both;
}

nav a {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}

nav a:hover {
  color: var(--accent);
}

/* ---- DIVIDER ---- */
.divider {
  max-width: 900px;
  margin: 2.5rem auto 0;
  padding: 0 2rem;
  animation: slideUp 0.7s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.divider hr {
  border: none;
  border-top: 1px solid #444;
}

/* ---- SECTIONS ---- */
section {
  max-width: 900px;
  margin: 0 auto;
  padding: 3.5rem 2rem;
  position: relative;
  animation: slideUp 0.7s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 2rem;
  right: 2rem;
  border-top: 1px solid #444;
}

.section-label {
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
}

/* ---- ABOUT ---- */
.about-text {
  font-size: 0.95rem;
  line-height: 1.8;
  color: #aaa;
}

.about-text a {
  color: var(--white);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  transition: color 0.2s;
}

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

/* ---- PROJECTS ---- */
.project-card {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid #333;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
  position: relative;
}

.project-card:first-of-type {
  border-top: none;
}

.project-card:hover .project-title {
  color: var(--accent);
}

.project-num {
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  padding-top: 0.25rem;
  min-width: 2rem;
}

.project-info {
  flex: 1;
}

.project-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 0.03em;
  line-height: 1;
  transition: color 0.2s;
  margin-bottom: 0.4rem;
}

.project-desc {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.6;
}

.project-tag {
  font-size: 0.55rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: 1px solid #333;
  color: #666;
  padding: 0.2rem 0.5rem;
  align-self: center;
}

.project-arrow {
  font-size: 1.2rem;
  color: var(--muted);
  align-self: center;
  transition:
    transform 0.2s,
    color 0.2s;
}

.project-card:hover .project-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

/* ---- MIXES ---- */
.mixes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: #1a1a1a;
}

.mix-item {
  background: var(--black);
  padding: 1.5rem;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.mix-item:hover {
  background: #111;
}

.mix-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.mix-meta {
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mix-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: #111;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #222;
  position: relative;
  overflow: hidden;
}

.mix-placeholder::after {
  content: '▶';
  position: absolute;
  color: var(--accent);
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.mix-item:hover .mix-placeholder::after {
  opacity: 1;
}

@keyframes mix-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.mix-skeleton .mix-placeholder {
  background: linear-gradient(90deg, #111 25%, #1c1c1c 50%, #111 75%);
  background-size: 200% 100%;
  animation: mix-shimmer 1.6s ease-in-out infinite;
}

.mix-skeleton .mix-title,
.mix-skeleton .mix-meta {
  border-radius: 2px;
  background: linear-gradient(90deg, #111 25%, #1c1c1c 50%, #111 75%);
  background-size: 200% 100%;
  animation: mix-shimmer 1.6s ease-in-out infinite;
  color: transparent;
  user-select: none;
}

.mix-skeleton .mix-title {
  width: 75%;
}

.mix-skeleton .mix-meta {
  width: 45%;
}

.sc-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  margin-top: 2rem;
  border-bottom: 1px solid transparent;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.sc-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---- PORTFOLIO ---- */
.portfolio-grid {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.portfolio-category-label {
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.portfolio-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: #1a1a1a;
}

.portfolio-item {
  aspect-ratio: 1;
  background: #111;
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
}

.portfolio-item.featured {
  grid-column: span 2;
  aspect-ratio: auto;
}

.portfolio-placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #333;
  transition: background 0.2s;
}

.portfolio-item:hover .portfolio-placeholder {
  background: #161616;
}

.portfolio-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 60, 31, 0);
  transition: background 0.2s;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}

.portfolio-item:hover .portfolio-overlay {
  background: rgba(255, 60, 31, 0.05);
}

/* ---- SNAKE ---- */
#snake-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#snake-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#snake-canvas {
  cursor: default;
  image-rendering: pixelated;
}

/* ---- LIGHTBOX ---- */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

#lightbox.open {
  opacity: 1;
  pointer-events: all;
}

#lightbox-inner {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- CHAT ---- */
#chat-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 52px;
  height: 52px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 1000;
  transition:
    transform 0.2s,
    background 0.2s;
}

#chat-toggle:hover {
  transform: scale(1.08);
  background: #00b8d4;
}

#chat-toggle .icon-open {
  display: block;
}
#chat-toggle .icon-close {
  display: none;
}
#chat-toggle.open .icon-open {
  display: none;
}
#chat-toggle.open .icon-close {
  display: block;
}

#chat-panel {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 360px;
  max-height: 520px;
  background: var(--mid);
  border: 1px solid #2a2a2a;
  z-index: 999;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid #2a2a2a;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.chat-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.chat-header-text {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--white);
}

.chat-header-sub {
  font-size: 0.55rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 100%;
}

.msg-bubble {
  padding: 0.15rem 0;
  font-size: 0.72rem;
  line-height: 1.7;
  color: #ccc;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user .msg-bubble {
  color: var(--muted);
}

.msg.user .msg-bubble::before {
  content: '$ ';
  color: var(--accent);
}

.msg.bot .msg-bubble {
  color: #bbb;
}

.msg.bot .msg-bubble a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.msg.bot .msg-bubble a:hover {
  border-color: var(--accent);
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.6rem 0.9rem;
  background: #252525;
  border: 1px solid #2f2f2f;
  width: fit-content;
}

.typing-dot {
  width: 5px;
  height: 5px;
  background: var(--muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

.chat-input-row {
  display: flex;
  align-items: center;
  border-top: 1px solid #2a2a2a;
  padding-left: 1rem;
  gap: 0.4rem;
}

.chat-prompt {
  font-size: 0.72rem;
  color: var(--accent);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.9rem 0;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  color: var(--white);
}

#chat-input::placeholder {
  color: #444;
}

#chat-send {
  background: transparent;
  border: none;
  border-left: 1px solid #2a2a2a;
  padding: 0 1rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
  transition: color 0.2s;
}

#chat-send:hover {
  color: var(--accent);
}

/* ---- FOOTER ---- */
footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--white);
}

.footer-copy {
  font-size: 0.55rem;
  color: #333;
  letter-spacing: 0.1em;
}

/* ---- ANIMATIONS ---- */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- HAMBURGER ---- */
#nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
}

#nav-toggle:hover {
  background: var(--accent);
  color: var(--black);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  header {
    background: var(--black);
    border-bottom: 1px solid #1a1a1a;
  }

  .header-inner {
    flex-direction: row;
    align-items: center;
    padding: 1rem 2rem;
  }

  .name-block h1 {
    font-size: 2.5rem !important;
  }

  .tagline {
    display: none;
  }

  #nav-toggle {
    display: flex;
  }

  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.97);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid #1a1a1a;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 1rem 2rem 1.5rem;
    gap: 1rem !important;
  }

  nav.open {
    display: flex;
  }

  nav a {
    font-size: 0.7rem;
  }

  .mixes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .portfolio-item:first-child {
    grid-column: span 2;
  }

  #chat-panel {
    width: calc(100vw - 2rem);
    right: 1rem;
  }
}
