:root {
  --ink: #18181b;
  --paper-op: 0.025;
  --ease-ink: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-brush: cubic-bezier(0.22, 0.68, 0.16, 1);
}

.dark {
  --ink: #fafafa;
  --paper-op: 0.045;
}

@layer base {
  html {
    overflow-x: hidden;
    scroll-behavior: smooth;
    /* Prevent zoom on focus in iOS while keeping crisp text */
    -webkit-text-size-adjust: 100%;
  }

  body {
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
  }

  /* Selection highlight in pure monochrome */
  ::selection {
    background-color: #18181b;
    color: #ffffff;
  }
  .dark ::selection {
    background-color: #f4f4f5;
    color: #09090b;
  }
}

/* Fallback color transition only for browsers without View Transitions */
@supports not (view-transition-name: root) {
  body {
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  header,
  section,
  footer,
  article {
    transition: border-color 0.3s ease;
  }
}

/* ============================================
   ENOWXLABS INK BLOOM VIEW TRANSITIONS
   ============================================ */
::view-transition-group(root) {
  animation-duration: 0.8s;
  animation-timing-function: cubic-bezier(0.2, 0.9, 0.25, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
  height: 100%;
  overflow: clip;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 9999;
}

/* Keep cursor canvas active on top during transition */
#ink-cursor {
  view-transition-name: none;
}

/* Physical Ink Bloom Shockwave Wave */
.ink-bloom-wave {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0.85;
  will-change: transform, opacity;
}

.ink-bloom-wave.to-dark {
  background: radial-gradient(
    circle,
    transparent 50%,
    rgba(24, 24, 27, 0.25) 70%,
    rgba(9, 9, 11, 0.65) 88%,
    rgba(9, 9, 11, 0.92) 97%,
    transparent 100%
  );
  filter: blur(8px);
}

.ink-bloom-wave.to-light {
  background: radial-gradient(
    circle,
    transparent 50%,
    rgba(255, 255, 255, 0.3) 70%,
    rgba(255, 255, 255, 0.75) 88%,
    rgba(255, 255, 255, 0.96) 97%,
    transparent 100%
  );
  filter: blur(8px);
}

/* Subtle tactile content landing during theme switch */
.theme-bloom-landing {
  animation: themeStamp 0.8s cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
}

@keyframes themeStamp {
  0% {
    transform: scale(0.993);
    filter: blur(1px);
  }
  60% {
    transform: scale(0.998);
    filter: blur(0.3px);
  }
  100% {
    transform: scale(1);
    filter: blur(0);
  }
}

/* Enowxlabs Theme Toggle Button */
#theme-toggle {
  transition: border-color 0.3s var(--ease-ink), color 0.3s var(--ease-ink), transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1);
}

#theme-toggle:hover {
  transform: rotate(180deg);
}

#theme-toggle:active {
  transform: rotate(180deg) scale(0.88);
}

#theme-toggle.recoil {
  animation: toggleRecoil 0.7s cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
}

@keyframes toggleRecoil {
  0% {
    transform: scale(0.85) rotate(0deg);
  }
  45% {
    transform: scale(1.12) rotate(195deg);
  }
  100% {
    transform: scale(1) rotate(180deg);
  }
}

#theme-toggle .sun-icon,
#theme-toggle .moon-icon {
  position: absolute;
  transition: opacity 0.5s cubic-bezier(0.2, 0.9, 0.25, 1), transform 0.65s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.dark #theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.dark #theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(-120deg) scale(0.4);
  pointer-events: none;
}

html:not(.dark) #theme-toggle .sun-icon {
  opacity: 0;
  transform: rotate(120deg) scale(0.4);
  pointer-events: none;
}

html:not(.dark) #theme-toggle .moon-icon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}




/* ============================================
   ENOWXLABS AMBIENT BREATHE TEXTURE
   ============================================ */
body::before {
  content: "";
  position: fixed;
  inset: -60px;
  z-index: 0;
  pointer-events: none;
  opacity: var(--paper-op);
  mix-blend-mode: multiply;
  background-image:
    repeating-linear-gradient(94deg, transparent 0 3px, currentColor 3px 3.4px),
    repeating-linear-gradient(4deg, transparent 0 7px, currentColor 7px 7.3px);
  animation: 20s ease-in-out infinite breathe;
}

.dark body::before {
  mix-blend-mode: screen;
}

@keyframes breathe {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-8px, 6px) scale(1.012);
  }
}

/* ============================================
   ENOWXLABS INK CURSOR
   ============================================ */
.ink-cursor {
  z-index: 9999;
  pointer-events: none;
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.ink-cursor[data-active="true"] {
  display: block;
}

@media (pointer: fine) {
  .ink-cursor-on,
  .ink-cursor-on a,
  .ink-cursor-on button,
  .ink-cursor-on [role="button"] {
    cursor: none !important;
  }

  .ink-cursor-on input,
  .ink-cursor-on textarea {
    cursor: text !important;
  }
}

/* Subtle scrollbar */
::-webkit-scrollbar {
  width: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #e4e4e7;
  border-radius: 9999px;
}
.dark ::-webkit-scrollbar-thumb {
  background: #27272a;
}
::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #3f3f46;
}

/* Filter pill active state */
.filter-btn {
  color: #71717a;
  border: 1px solid transparent;
  transition: background-color 0.25s var(--ease-ink), color 0.25s var(--ease-ink), border-color 0.25s var(--ease-ink), transform 0.25s var(--ease-ink);
  will-change: transform;
  backface-visibility: hidden;
}

.filter-btn:hover {
  color: #3f3f46;
  border-color: #d4d4d8;
}

.dark .filter-btn:hover {
  color: #a1a1aa;
  border-color: #52525b;
}

.filter-btn.active {
  background-color: #18181b;
  color: #ffffff;
}

.dark .filter-btn.active {
  background-color: #fafafa;
  color: #09090b;
}

/* Subtle scale animation on click */
.filter-btn:active {
  transform: scale(0.96);
}

.filter-btn.active:active {
  transform: scale(0.98);
}

/* Subtle pulse for availability indicator */
@keyframes soft-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.88); }
}
.status-dot {
  animation: soft-pulse 2.5s ease-in-out infinite;
}

/* Touch target comfort on mobile */
@media (max-width: 640px) {
  button, a {
    touch-action: manipulation;
  }
}

/* ============================================
   ENOWXLABS BLUR REVEAL ANIMATIONS (.rv)
   ============================================ */
.rv {
  opacity: 0;
  filter: blur(14px);
  transform: translateY(16px) scale(0.985);
  will-change: opacity, filter, transform;
}

.rv[data-in="true"] {
  opacity: 1;
  filter: blur(0);
  transform: none;
  transition:
    opacity 1.25s var(--ease-ink),
    transform 1.25s var(--ease-ink),
    filter 1.35s var(--ease-ink);
}

/* Subtle hover for project cards */
#projects-list article {
  transition: transform 0.3s var(--ease-ink), opacity 0.3s var(--ease-ink);
}

#projects-list article:hover {
  transform: translateX(6px);
}

/* ============================================
   PROJECT FILTER ANIMATIONS (ENOWXLABS STYLE)
   ============================================ */

@keyframes projectFadeIn {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes projectFadeOut {
  from {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
  to {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-8px);
  }
}

.animate-project-in {
  opacity: 0;
  animation: projectFadeIn 0.4s var(--ease-ink) forwards;
}

.animate-project-out {
  animation: projectFadeOut 0.25s ease forwards;
}

/* ============================================
   ACCESSIBILITY & REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
  .rv {
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  body::before {
    animation: none !important;
  }
}
