/* ----- Base ----- */
:root {
  --bg: #0f172a;
  --bg-alt: #111a30;
  --surface: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --border: #334155;
  --radius: 12px;
  --maxw: 1100px;
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Interactive canvas background */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
}

/* Solid section backgrounds — work consistently across all browsers */
.section-alt { background: var(--bg-alt); }
.hero { background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.18), transparent 60%); }

a { color: var(--accent-hover); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 1rem; }
h3 { font-size: 1.25rem; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ----- Header / Nav ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--muted);
  font-weight: 500;
}
.nav-links a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ----- Hero ----- */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
  background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15), transparent 60%);
}

.eyebrow {
  color: var(--accent-hover);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

.tagline {
  color: var(--muted);
  font-size: 1.15rem;
  margin: 0 0 2rem;
}

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ----- Buttons ----- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent-hover); color: var(--accent-hover); }

/* ----- Sections ----- */
.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }
.section-lead { color: var(--muted); margin-bottom: 2.5rem; }

/* ----- About ----- */
.about-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

.avatar-placeholder {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
}

.avatar-img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 3px solid var(--accent);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.skills {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
  margin-top: 1.5rem;
}
.skills li {
  background: var(--surface);
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

/* ----- Video Gallery ----- */
.video-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.video-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition);
  display: flex;
  flex-direction: column;
}
.video-card:hover { transform: translateY(-4px); border-color: var(--accent); }

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }
.video-body h3 { margin: 0; }
.video-body p { color: var(--muted); margin: 0; }
.video-link {
  margin-top: auto;
  font-weight: 600;
  align-self: flex-start;
  padding: 0.5rem 0;
}

/* ----- Project page ----- */
.project-hero { padding: 5rem 0 3rem; text-align: left; }
.project-hero h1 { margin-bottom: 0.5rem; }
.project-hero .hero-cta { justify-content: flex-start; }
.back-link {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  font-weight: 500;
}
.back-link:hover { color: var(--accent-hover); }

.project-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.project-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.project-content { max-width: 820px; }
.project-content h2 { margin-top: 2rem; }
.project-content h2:first-child { margin-top: 0; }
.project-content p { margin-bottom: 1rem; }
.project-content code {
  background: var(--surface);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.feature-list {
  padding-left: 1.2rem;
  line-height: 1.8;
}
.feature-list li { margin-bottom: 0.6rem; }

.project-tags { gap: 0.5rem; }

.project-cta { text-align: center; }
.project-cta .section-lead { margin: 0 auto 1.5rem; }

.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.screenshot-grid img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}

/* ----- Error page ----- */
.error-page {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 0;
}

.error-glitch {
  position: relative;
  display: inline-block;
  margin-bottom: 0.5rem;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.error-code {
  display: inline-block;
  position: relative;
  font-size: clamp(7rem, 22vw, 14rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.06em;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 40%, #ec4899 75%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 8px 30px rgba(168, 85, 247, 0.4));
}

/* Glitch layers */
.error-code::before,
.error-code::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  pointer-events: none;
}
.error-code::before {
  animation: glitch-1 3s infinite;
  text-shadow: 2px 0 #06b6d4;
  clip-path: inset(0 0 70% 0);
}
.error-code::after {
  animation: glitch-2 3.5s infinite;
  text-shadow: -2px 0 #ec4899;
  clip-path: inset(70% 0 0 0);
}
@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(0); }
  92% { transform: translate(-3px, 1px); }
  94% { transform: translate(3px, -1px); }
  96% { transform: translate(-2px, 0); }
  98% { transform: translate(2px, 0); }
}
@keyframes glitch-2 {
  0%, 88%, 100% { transform: translate(0); }
  90% { transform: translate(2px, -1px); }
  92% { transform: translate(-2px, 1px); }
  95% { transform: translate(3px, 0); }
  97% { transform: translate(-3px, 0); }
}

.error-page h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0.5rem 0 1rem;
}

.error-msg {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent-hover);
  max-width: 520px;
  margin: 0 auto 0.5rem;
}

.error-sub {
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 2.5rem;
}

.error-page .hero-cta {
  justify-content: center;
  margin-bottom: 3rem;
}

.error-links {
  list-style: none;
  list-style-type: none;
  padding: 1.5rem 0 0 0;
  margin: 0 auto;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  max-width: 600px;
}
.error-links li {
  padding: 0;
  margin: 0;
  list-style: none;
}
.error-links li::marker { content: ''; }
.error-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}
.error-links a:hover { color: var(--accent-hover); }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags span {
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-hover);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}

.empty-gallery {
  color: var(--muted);
  text-align: center;
  padding: 3rem 0;
}

.works-extra {
  margin-top: 2rem;
  color: var(--muted);
  text-align: center;
}
.works-extra a { font-weight: 600; }


/* ----- Contact ----- */
.contact-form {
  display: grid;
  gap: 1rem;
  max-width: 600px;
  margin-bottom: 2rem;
}

.field { display: flex; flex-direction: column; }
.field label { font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--muted); }

.field input, .field textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color var(--transition);
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-status { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }
.form-status.success { color: #10b981; }
.form-status.error { color: #ef4444; }

.contact-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.skill-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

/* Skills groups */
.skills-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}
.skill-group h3 { margin-bottom: 1rem; color: var(--accent-hover); }

/* Accomplishments */
.accomp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.accomp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--transition);
}
.accomp-card:hover { border-color: var(--accent); }
.accomp-card h3 { color: var(--accent-hover); margin-bottom: 0.75rem; }
.accomp-card ul { padding-left: 1.2rem; margin: 0; color: var(--text); }
.accomp-card li { margin-bottom: 0.4rem; }

/* Pricing */
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 700px;
}
.price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.price-amount {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-hover);
}
.price-or { color: var(--muted); font-size: 1rem; }
.price-suffix { color: var(--muted); font-size: 0.95rem; width: 100%; }
.pricing-list { padding-left: 1.2rem; margin: 0; line-height: 1.8; }
.pricing-list li { margin-bottom: 0.4rem; }

/* Extra contact links under Discord embed */
.other-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.other-links a { font-weight: 600; }

/* Discord embed card */
.discord-embed {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #5865F2 0%, #4752c4 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  border-left: 4px solid #fff;
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.35);
  max-width: 380px;
  width: 100%;
  position: relative;
}
.discord-embed:hover,
.discord-embed:focus-visible {
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(88, 101, 242, 0.5);
}

.discord-embed-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}
.discord-embed-icon svg {
  display: block;
  width: 28px;
  height: auto;
}

.discord-embed-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.2;
}
.discord-embed-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}
.discord-embed-name {
  font-size: 1.15rem;
  font-weight: 700;
}

.discord-embed-action {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  flex-shrink: 0;
  transition: background var(--transition);
}
.discord-embed:hover .discord-embed-action {
  background: rgba(255, 255, 255, 0.3);
}

.copy-hint {
  position: absolute;
  bottom: -1.5rem;
  left: 0;
  color: #10b981;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.copy-hint.show { opacity: 1; }

/* ----- Footer ----- */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* ----- Responsive ----- */
@media (max-width: 720px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-alt);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .nav { position: relative; }

  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .avatar-placeholder { margin: 0 auto; }
  .skills { text-align: left; }
}
