/* ===========================================================
   DESIGN TOKENS
   =========================================================== */
:root {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #191922;
  --text: #ededf2;
  --text-muted: #8a8a94;
  --accent-violet: #7c5cff;
  --accent-blue: #5c9fff;
  --accent-pink: #ff5ca8;
  --border: rgba(237, 237, 242, 0.1);

  --font-display: 'Caveat', cursive;
  --font-body: 'Inter', -apple-system, sans-serif;

  --radius: 16px;
  --radius-lg: 28px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; }

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
}

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

.hidden { display: none !important; }

/* ===========================================================
   INTRO
   =========================================================== */
#intro {
  position: relative;
  height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 30%, #14101f 0%, #0a0a0f 70%);
}

#intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.intro-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 1.5rem;
}

.intro-name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-blue), var(--accent-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-tagline {
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  color: var(--text-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  z-index: 2;
  animation: bob 2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.6; }
  50% { transform: translate(-50%, 6px); opacity: 1; }
}

/* ===========================================================
   BUBBLE NAV
   =========================================================== */
.bubble-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 3rem;
  padding: 0 1.5rem;
}

.bubble {
  --wobble-delay: 0s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,0.35), rgba(255,255,255,0.05) 40%, transparent 60%),
    linear-gradient(160deg, rgba(124,92,255,0.18), rgba(92,159,255,0.12), rgba(255,92,168,0.15));
  border: 1px solid rgba(237,237,242,0.25);
  backdrop-filter: blur(6px);
  box-shadow:
    inset 0 0 20px rgba(255,255,255,0.08),
    0 8px 24px rgba(0,0,0,0.35);
  color: var(--text);
  text-align: center;
  animation: float 5s ease-in-out infinite;
  animation-delay: var(--wobble-delay);
  transition: transform 0.2s ease;
}

.bubble:nth-child(1) { --wobble-delay: 0s; }
.bubble:nth-child(2) { --wobble-delay: 0.6s; }
.bubble:nth-child(3) { --wobble-delay: 1.2s; }
.bubble:nth-child(4) { --wobble-delay: 1.8s; }

.bubble:hover { transform: scale(1.06); }
.bubble:active { animation: pop 0.35s ease; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1.5deg); }
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.bubble-icon { font-size: 1.6rem; }
.bubble-label { font-size: 0.7rem; color: var(--text-muted); }

/* ===========================================================
   SHARED SECTION STYLES
   =========================================================== */
.section {
  position: relative;
  padding: 6rem 0;
  overflow: hidden;
}

.section canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.section-inner {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.5rem;
}

.section-blurb {
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 2.5rem;
}

/* ===========================================================
   PENCIL ART
   =========================================================== */
#pencil-art { background: #0c0c12; }

.masonry {
  columns: 3 220px;
  column-gap: 1rem;
  margin-bottom: 3rem;
}

@media (max-width: 640px) {
  .masonry { columns: 2 160px; }
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.gallery-item img {
  width: 100%;
  display: block;
  cursor: pointer;
}

.gallery-item-meta {
  padding: 0.75rem 1rem 1rem;
}

.gallery-item-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.view-desc-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.view-desc-btn:hover { color: var(--text); border-color: var(--accent-blue); }

.gallery-loading { color: var(--text-muted); padding: 2rem 0; }

/* Full-screen lightbox, reels-style */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  scroll-snap-type: y mandatory;
  overflow-y: auto;
}

#lightbox-track {
  height: 100%;
}

.lightbox-slide {
  height: 100vh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.lightbox-slide img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.lightbox-caption {
  position: absolute;
  bottom: 2rem;
  left: 1.5rem;
  right: 1.5rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.lightbox-caption h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.lightbox-caption p { font-size: 0.9rem; opacity: 0.85; margin: 0; }

#lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 101;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
}

/* Preview popover */
#preview-popover {
  position: fixed;
  z-index: 90;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: 340px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}

#preview-popover-close {
  margin-top: 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.75rem;
}

/* AI art tool */
.ai-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.ai-tool-note { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }

#ai-art-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }

#ai-art-prompt {
  flex: 1;
  min-width: 200px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.ai-tool-card button,
.tool-card button,
#contact-form button {
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-blue));
  color: #fff;
  font-weight: 600;
}

#ai-art-result { margin-top: 1.25rem; }
#ai-art-result img { max-width: 100%; border-radius: var(--radius); }
#ai-art-result a { display: inline-block; margin-top: 0.6rem; font-size: 0.85rem; color: var(--accent-blue); }

/* ===========================================================
   WEB DEV
   =========================================================== */
#web-dev { background: #0a0a10; }

.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 720px) {
  .tools-grid { grid-template-columns: 1fr; }
}

.tool-card.simple {
  background: #f4f4f6;
  color: #17171c;
  border-radius: var(--radius);
  padding: 1.5rem;
}

.tool-card.simple h3 { margin-bottom: 1rem; color: #17171c; }

#qr-input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #d5d5da;
  margin-bottom: 0.75rem;
}

#qr-output { margin-top: 1rem; min-height: 132px; display: flex; align-items: center; justify-content: center; }
#qr-output img { border-radius: 8px; }

#draw-canvas {
  width: 100%;
  background: #fff;
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
}

.draw-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.draw-controls button {
  background: #17171c;
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

/* ===========================================================
   VIDEO & MUSIC
   =========================================================== */
#video-music { background: #0c0c12; }

.beatpad-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.beatpad-kits { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }

.kit-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.kit-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(90deg, var(--accent-violet), var(--accent-pink));
}

.beatpad-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.pad {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.08s ease, background 0.15s ease;
}

.pad:active,
.pad.hit {
  transform: scale(0.94);
  background: linear-gradient(160deg, var(--accent-violet), var(--accent-blue));
}

/* ===========================================================
   CONTACT
   =========================================================== */
#contact { background: #0a0a10; }

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.contact-info { display: flex; flex-direction: column; gap: 1rem; }

.contact-line {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease;
}

.contact-line:hover { border-color: var(--accent-blue); }

.contact-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

#contact-status { font-size: 0.85rem; color: var(--text-muted); min-height: 1.2em; }

/* ===========================================================
   FOOTER
   =========================================================== */
.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ===========================================================
   CHATBOT
   =========================================================== */
#chatbot-root {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 200;
}

#chatbot-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #12121a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

#chatbot-bubble svg { width: 26px; height: 26px; }

#chatbot-bubble::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 0deg, var(--accent-violet), var(--accent-blue), var(--accent-pink), var(--accent-violet));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: spin 4s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#chatbot-window {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: min(340px, 90vw);
  height: 440px;
  background: #101017;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

#chatbot-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.chatbot-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-title { font-weight: 600; font-size: 0.9rem; }
.chatbot-subtitle { font-size: 0.7rem; color: var(--text-muted); }

#chatbot-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
}

#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.msg {
  max-width: 85%;
  padding: 0.55rem 0.8rem;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.msg.user {
  align-self: flex-end;
  background: var(--surface-2);
}

.msg.bot {
  align-self: flex-start;
  background: linear-gradient(160deg, rgba(124,92,255,0.25), rgba(255,92,168,0.15));
}

#chatbot-form {
  display: flex;
  border-top: 1px solid var(--border);
}

#chatbot-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.8rem 1rem;
  font-family: inherit;
}

#chatbot-form button {
  background: none;
  border: none;
  color: var(--accent-blue);
  padding: 0 1rem;
}

@media (max-width: 480px) {
  #chatbot-window { height: 70vh; }
}
