/* Canvas background (particle system — currently hidden, avatar is bg) */
#workCanvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0; transition: opacity 1200ms;
}
#workCanvas.visible { opacity: 1; }

/* 3D card entrance animation (about view) */
#view-work .project.reveal-3d {
  opacity: 0;
  transform: perspective(900px) rotateX(22deg) translateY(48px);
  transition: opacity 700ms cubic-bezier(0.22,1,0.36,1), transform 700ms cubic-bezier(0.22,1,0.36,1), box-shadow 400ms;
}
#view-work .project.reveal-3d.in { opacity: 1; transform: none; }

/* Avatar background layer */
.global-robot-bg {
  opacity: 0; transition: opacity 0.4s cubic-bezier(0.22,1,0.36,1); pointer-events: none;
  position: fixed; inset: 0; background: transparent; z-index: 1;
}
body.work-active .global-robot-bg,
body.contact-active .global-robot-bg,
body.hobbies-active .global-robot-bg { opacity: 1; pointer-events: none; }

#avatar-loader {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: #888; font-size: 14px; opacity: 0.5;
  pointer-events: none; transition: opacity 0.4s ease;
}
#avatar-loader.hidden { opacity: 0; }

/* Transparent glass overlay for work view (mouse passes through) */
.work-glass-content {
  position: fixed !important;
  top: 70px; left: 0; right: 0; bottom: 0;
  z-index: 2; background: transparent !important;
  pointer-events: none; overflow: hidden;
}
.work-glass-content::before { display: none !important; }

/* Section label pinned top-left in work view */
#view-work .section-label {
  position: absolute; top: 20px; left: var(--pad);
  margin: 0; z-index: 5; pointer-events: none;
  color: rgba(13,11,46,0.38);
}
#view-work .section-label::before { background: rgba(13,11,46,0.2); }

/* Slide stage (full-height, clips overflow) */
#view-work section.page {
  position: relative; width: 100%; height: 100%;
  max-width: none; padding: 0; margin: 0; overflow: hidden;
}

/* Each project = full-screen transparent slide frame */
#view-work .project {
  position: absolute !important; inset: 0 !important;
  display: flex !important; align-items: flex-end !important; justify-content: center !important;
  padding: 0 clamp(20px,4vw,60px) clamp(48px,6vh,80px) !important;
  background: transparent !important; border: none !important;
  box-shadow: none !important; backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important; border-radius: 0 !important;
  grid-template-columns: unset !important; gap: 0 !important; margin: 0 !important;
  pointer-events: none;
  opacity: 0; transform: translateY(64px) scale(0.97);
  transition: opacity 680ms cubic-bezier(0.22,1,0.36,1), transform 680ms cubic-bezier(0.22,1,0.36,1);
}
#view-work .project.slide-active { opacity: 1; transform: none; pointer-events: auto; }
#view-work .project.slide-prev   { opacity: 0; transform: translateY(-64px) scale(0.97); pointer-events: none; }
#view-work .project.slide-next   { opacity: 0; transform: translateY(64px)  scale(0.97); pointer-events: none; }

/* Phase 2: right-panel layout */
#view-work .project {
  justify-content: flex-end !important;
  align-items: center !important;
  padding: 0 16vw 0 0 !important;
}

/* Frosted glass card */
.project-glass-card {
  display: grid; grid-template-columns: 90px 1fr 1fr; gap: 32px 52px;
  width: 25vw !important; min-width: 340px !important;
  max-width: none !important; height: auto !important;
  min-height: 75vh !important; max-height: 85vh !important;
  padding: 38px 34px !important; gap: 16px !important;
  position: relative !important; transform: none !important;
  border-radius: 24px !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  border-top: 1.5px solid rgba(255,255,255,0.8) !important;
  border-left: 1.5px solid rgba(255,255,255,0.7) !important;
  grid-template-columns: 1fr !important;
  background: linear-gradient(135deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.15) 100%) !important;
  backdrop-filter: blur(40px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(40px) saturate(180%) !important;
  box-shadow:
    0 40px 80px rgba(0,0,0,0.15),
    0 10px 30px rgba(0,0,0,0.1),
    inset 0 1px 0 rgba(255,255,255,0.8),
    inset 0 -1px 0 rgba(255,255,255,0.2) !important;
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(65,105,225,0.3) transparent;
}
.project-glass-card::-webkit-scrollbar { display: none; }
.project-glass-card .project-expanded { grid-column: 1 / -1; }
.project-glass-card > * { position: relative; z-index: 2; }

/* Liquid glass glare highlight */
.project-glass-card::before {
  content: '';
  position: absolute; inset: 0; border-radius: 24px;
  background: radial-gradient(800px circle at top left, rgba(255,255,255,0.3) 0%, transparent 40%);
  pointer-events: none; z-index: 1;
}
.project-glass-card::after { display: none; }

/* Slide counter */
.slide-counter {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 10; font-family: 'JetBrains Mono', monospace;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
  color: rgba(13,11,46,0.38);
  display: flex; align-items: center; gap: 14px;
  pointer-events: none; opacity: 0; transition: opacity 500ms;
}
.slide-counter.visible { opacity: 1; }
.slide-counter .sep { width: 28px; height: 1px; background: rgba(13,11,46,0.18); display: inline-block; }

/* Arrow buttons */
.slide-arrows {
  position: fixed; right: var(--pad); top: 50%; transform: translateY(-50%);
  z-index: 10; display: flex; flex-direction: column; gap: 10px;
  opacity: 0; transition: opacity 500ms;
}
.slide-arrows.visible { opacity: 1; }
.slide-arrow {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid rgba(13,11,46,0.14); background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px); display: grid; place-items: center;
  cursor: pointer; color: var(--ink-dim); font-size: 14px;
  transition: background 200ms, border-color 200ms, transform 200ms;
  font-family: inherit; align-items: center; justify-content: center;
}
.slide-arrow:hover { background: rgba(255,255,255,0.95); border-color: var(--accent); color: var(--accent); transform: scale(1.1); }
.slide-arrow:disabled { opacity: 0.3; cursor: default; transform: none !important; }

body.work-active { overflow: hidden; }

/* Scroll hint button */
.scroll-hint-btn {
  position: fixed; bottom: clamp(75px, 9vh, 130px); right: 10px; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px 11px 14px;
  background: rgba(255,255,255,0.70); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(13,11,46,0.14); border-radius: 100px;
  cursor: pointer; font-family: inherit; font-size: 13px;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-dim);
  opacity: 0; transition: opacity 500ms, background 200ms, border-color 200ms, color 200ms;
  pointer-events: none;
}
.scroll-hint-btn:hover { background: rgba(255,255,255,0.95); border-color: var(--accent); color: var(--accent); animation: none; }
.scroll-mouse { width: 16px; height: 24px; border: 1.5px solid currentColor; border-radius: 8px; position: relative; flex-shrink: 0; }
.scroll-mouse-dot {
  width: 2px; height: 5px; background: currentColor; border-radius: 2px;
  position: absolute; left: 50%; top: 3px; transform: translateX(-50%);
  animation: mouseScroll 1.6s ease-in-out infinite;
}
@keyframes mouseScroll {
  0%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
  55% { opacity: 0.2; transform: translateX(-50%) translateY(5px); }
}
@keyframes scrollBtnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(65,105,225,0); transform: scale(1); }
  50% { box-shadow: 0 0 0 6px rgba(65,105,225,0.12); transform: scale(1.04); }
}
.scroll-hint-btn.visible { opacity: 1; pointer-events: auto; animation: scrollBtnPulse 2.4s ease-in-out infinite; }

/* Danger Zone button */
.danger-zone-btn {
  position: fixed; bottom: clamp(20px, 3vh, 75px); right: 10px; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 11px 18px;
  background: rgba(160,0,0,0.65); backdrop-filter: blur(16px) saturate(200%); -webkit-backdrop-filter: blur(16px) saturate(200%);
  border: 1px solid rgba(255,0,0,0.6); border-top: 1px solid rgba(255,80,80,0.8);
  border-radius: 100px; cursor: pointer; font-family: inherit; font-size: 13px;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: #fff; text-shadow: 0 0 8px rgba(0,0,0,0.8);
  transition: transform 200ms; width: 154px; pointer-events: auto;
  animation: dangerGlow 2s ease-in-out infinite alternate;
}
.danger-zone-btn:hover { transform: scale(1.05); }
@keyframes dangerGlow {
  from { box-shadow: 0 4px 20px rgba(160,0,0,0.6), inset 0 2px 5px rgba(255,255,255,0.3); background: rgba(160,0,0,0.65); }
  to { box-shadow: 0 4px 40px rgba(255,0,0,0.9), inset 0 2px 10px rgba(255,255,255,0.5); background: rgba(220,0,0,0.85); border-color: rgba(255,80,80,1); }
}

/* Expanded card layout fix for work view */
#view-work .expand-inner { grid-template-columns: 1fr !important; gap: 24px !important; }

/* GLOBAL FUTURISTIC BUTTON OVERRIDES */
.see-work-btn, .project-toggle, .splash-enter, .contact-email.primary {
  background: rgba(65,105,225,0.85) !important;
  backdrop-filter: blur(12px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
  border-top: 1px solid rgba(255,255,255,0.5) !important;
  box-shadow: 0 4px 20px rgba(65,105,225,0.3), inset 0 1px 4px rgba(255,255,255,0.3) !important;
  color: #fff !important; transform: none !important;
  transition: all 0.3s cubic-bezier(0.25,1,0.5,1) !important;
  animation: none !important; border-radius: 100px !important;
}
.see-work-btn:hover, .project-toggle:hover, .splash-enter:hover, .contact-email.primary:hover {
  background: rgba(65,105,225,0.95) !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  border-top: 1px solid rgba(255,255,255,0.7) !important;
  box-shadow: 0 8px 28px rgba(65,105,225,0.5), 0 0 15px rgba(65,105,225,0.5), inset 0 1px 6px rgba(255,255,255,0.5) !important;
  transform: translateY(-2px) scale(1.02) !important; filter: brightness(1.1) !important;
}
.see-work-btn:active, .project-toggle:active, .splash-enter:active, .contact-email.primary:active {
  transform: scale(0.96) !important;
  box-shadow: 0 2px 10px rgba(65,105,225,0.2), inset 0 1px 2px rgba(255,255,255,0.2) !important;
}

.nav-tab, .contact-email:not(.primary), .doc-link, .cinematic-skip, .slide-arrow, .scroll-hint-btn, .sound-btn {
  background: rgba(255,255,255,0.5) !important;
  backdrop-filter: blur(12px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(180%) !important;
  border: 1px solid rgba(255,255,255,0.6) !important;
  border-top: 1px solid rgba(255,255,255,0.9) !important;
  color: var(--ink) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05), inset 0 1px 2px rgba(255,255,255,0.8) !important;
  transform: none !important;
  transition: all 0.3s cubic-bezier(0.25,1,0.5,1) !important;
  border-radius: 100px !important;
}
.nav-tab.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  border-top-color: rgba(255,255,255,0.4) !important;
  box-shadow: 0 4px 16px rgba(65,105,225,0.35), inset 0 1px 4px rgba(255,255,255,0.3) !important;
}
.nav-tab.active:hover {
  background: var(--accent) !important;
  color: #fff !important;
  filter: brightness(1.1) !important;
  transform: translateY(-1px) scale(1.02) !important;
}

.nav-tab:hover, .contact-email:not(.primary):hover, .doc-link:hover, .cinematic-skip:hover, .slide-arrow:hover, .scroll-hint-btn:hover, .sound-btn:hover {
  background: rgba(255,255,255,0.7) !important;
  border: 1px solid rgba(255,255,255,0.8) !important;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 0 12px rgba(255,255,255,0.5), inset 0 1px 4px rgba(255,255,255,1) !important;
  transform: translateY(-2px) scale(1.02) !important; color: var(--accent) !important;
}
.nav-tab:active, .contact-email:not(.primary):active, .doc-link:active, .cinematic-skip:active, .slide-arrow:active, .scroll-hint-btn:active, .sound-btn:active {
  transform: scale(0.96) !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05), inset 0 1px 2px rgba(255,255,255,0.5) !important;
}

/* Mobile fallbacks */
@media (max-width: 768px) {
  #avatar-canvas, #avatar-loader { display: none !important; }
  #view-work .global-robot-bg { opacity: 0; background: var(--bg); }
  #view-work .project { justify-content: center !important; padding: 0 clamp(20px,4vw,60px) clamp(48px,6vh,80px) !important; }
  .project-glass-card { width: 100% !important; max-width: 960px !important; }
  .scroll-hint-btn { bottom: 24px; right: 50%; transform: translateX(50%); padding: 16px 28px 16px 22px; font-size: 16px; gap: 12px; }
  .scroll-hint-btn.visible { animation: scrollBtnPulseMobile 2.4s ease-in-out infinite; }
  .scroll-mouse { width: 22px; height: 34px; border-radius: 11px; }
  .scroll-mouse-dot { width: 3px; height: 7px; top: 5px; }
  .danger-zone-btn { bottom: -40px; right: 50%; transform: translateX(50%); }
}
@keyframes scrollBtnPulseMobile {
  0%, 100% { box-shadow: 0 0 0 0 rgba(65,105,225,0); transform: translateX(50%) scale(1); }
  50% { box-shadow: 0 0 0 8px rgba(65,105,225,0.12); transform: translateX(50%) scale(1.04); }
}
