:root {
  --background: oklch(0.99 0.002 200);
  --foreground: oklch(0.15 0.01 200);
  --card: oklch(0.995 0.001 200);
  --card-foreground: oklch(0.15 0.01 200);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.15 0.01 200);
  --primary: oklch(0.25 0.05 200);
  --primary-foreground: oklch(0.98 0 0);
  --secondary: oklch(0.55 0.12 200);
  --secondary-foreground: oklch(0.98 0 0);
  --muted: oklch(0.96 0.005 200);
  --muted-foreground: oklch(0.5 0.01 200);
  --accent: oklch(0.5 0.15 195);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.92 0.005 200);
  --input: oklch(0.92 0.005 200);
  --ring: oklch(0.5 0.15 195);
  --radius: 1rem;
}

.dark {
  --background: oklch(0.08 0.01 200);
  --foreground: oklch(0.98 0.002 200);
  --card: oklch(0.11 0.015 200);
  --card-foreground: oklch(0.98 0.002 200);
  --popover: oklch(0.11 0.015 200);
  --popover-foreground: oklch(0.98 0.002 200);
  --primary: oklch(0.98 0.002 200);
  --primary-foreground: oklch(0.15 0.01 200);
  --secondary: oklch(0.5 0.15 195);
  --secondary-foreground: oklch(0.98 0 0);
  --muted: oklch(0.17 0.015 200);
  --muted-foreground: oklch(0.65 0.01 200);
  --accent: oklch(0.5 0.15 195);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.5 0.2 27);
  --border: oklch(0.19 0.015 200);
  --input: oklch(0.19 0.015 200);
  --ring: oklch(0.5 0.15 195);
}

html {
  font-size: 100%;
  scroll-behavior: smooth;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: var(--border);
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(20, 184, 166, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(14, 165, 233, 0.02) 0%, transparent 50%);
  background-attachment: fixed;
}

img,
video {
  display: block;
  max-width: 100%;
}

section {
  scroll-margin-top: 5rem;
}

main {
  overflow-x: clip;
}

* {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

@media (max-width: 640px) {
  body {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }
}

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

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
  }
  50% {
    box-shadow: 0 0 40px rgba(20, 184, 166, 0.6);
  }
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes gradient-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes scale-in {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes blob-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.2;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.4;
  }
}

@keyframes blob-pulse-alt {
  0%,
  100% {
    transform: scale(1.12);
    opacity: 0.2;
  }
  50% {
    transform: scale(1);
    opacity: 0.4;
  }
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

.animate-spin-slow {
  animation: spin-slow 20s linear infinite;
}

.animate-gradient {
  background-size: 200% 200%;
  animation: gradient-shift 8s ease infinite;
}

.animate-scale-in {
  animation: scale-in 0.5s ease-out;
}

.hero-blob-1 {
  animation: blob-pulse 8s ease-in-out infinite;
}

.hero-blob-2 {
  animation: blob-pulse-alt 10s ease-in-out infinite;
}

/* Hero photo ring rotation */
@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}

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

.hero-ring-outer {
  animation: ring-spin 6s linear infinite;
}

.hero-ring-inner {
  animation: ring-spin-reverse 8s linear infinite;
}

.hero-photo-wrap:hover .hero-ring-outer {
  animation-duration: 2s;
}

.hero-photo-wrap:hover .hero-ring-inner {
  animation-duration: 3s;
}

/* Floating nav visibility */
#floating-nav {
  transform: translate(-50%, -120%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#floating-nav.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

/* Experience expand */
.exp-details {
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}

.exp-details.is-collapsed {
  max-height: 0 !important;
  opacity: 0;
}

.exp-details:not(.is-collapsed) {
  opacity: 1;
}

/* Progress bar for carousel */
.carousel-progress {
  transition: width 0.1s linear;
}

/* Chatbot */
.chat-panel {
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 700px);
}

.chat-messages {
  flex: 1;
  min-height: 0;
}

.chat-msg-bubble strong {
  font-weight: 700;
  color: inherit;
}

.chat-msg-bubble a {
  color: #0d9488;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dark .chat-msg-bubble a {
  color: #2dd4bf;
}

.chat-typing-dot {
  animation: typing-bounce 0.6s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.chip-btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chip-btn:hover {
  transform: translateY(-1px);
}

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

#chat-launcher-pulse {
  animation: launcher-pulse 2s ease-in-out infinite;
}

@keyframes launcher-pulse {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 0.45;
  }
}

/* Skills progress bar */
.skill-progress-fill {
  transition: width 0.6s ease;
}

/* Layout tightening */
.section-shell,
.section-shell-wide,
.hero-shell {
  width: min(92vw, 78rem);
  margin-inline: auto;
}

.hero-grid {
  display: grid;
  align-items: center;
  gap: 2.75rem;
}

.hero-photo-size {
  width: clamp(220px, 40vw, 462px);
  height: clamp(220px, 40vw, 462px);
}

.hero-copy {
  max-width: 52rem;
}

.compact-card {
  border-radius: 1rem;
}

.compact-stack > * + * {
  margin-top: 1rem;
}

.portfolio-grid,
.skills-grid,
.contact-grid,
.education-grid {
  align-items: stretch;
}

.contact-cta-row {
  align-items: center;
}

.chat-panel {
  width: min(24rem, calc(100vw - 1rem));
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: 5.75rem;
}

#chat-hint {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: 7.75rem;
}

#chat-fab {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
}

@media (max-width: 1024px) {
  .hero-shell,
  .section-shell,
  .section-shell-wide {
    width: min(88vw, 100%);
  }

  .hero-grid {
    gap: 2rem;
  }

  .hero-copy {
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  html {
    font-size: 94%;
  }

  body {
    background-attachment: scroll;
  }

  .hero-shell,
  .section-shell,
  .section-shell-wide {
    width: min(100% - 1rem, 100%);
  }

  .hero-grid {
    gap: 1.5rem;
  }

  .hero-photo-size {
    width: clamp(180px, 58vw, 280px);
    height: clamp(180px, 58vw, 280px);
  }

  #floating-nav {
    display: none !important;
  }

  .chat-panel {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 5.25rem;
    width: auto;
    max-height: min(68vh, 36rem);
    border-radius: 1.25rem;
  }

  #chat-hint {
    left: auto;
    right: 0.75rem;
    bottom: 5.75rem;
    max-width: min(15rem, calc(100vw - 4rem));
    padding-inline: 0.875rem;
    padding-block: 0.75rem;
  }
}

.chat-panel, #chat-hint {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#chat-hint.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Carousel & Portfolio Styles */
#pm-collage-wrap {
  perspective: 1000px;
}

.collage-item {
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  filter: blur(4px) brightness(0.4);
  transform: scale(0.85);
  z-index: 10;
}

.collage-item.is-active {
  filter: blur(0) brightness(1);
  transform: scale(1);
  z-index: 30;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.collage-item.is-prev,
.collage-item.is-next {
  filter: blur(2px) brightness(0.6);
  transform: scale(0.9);
  z-index: 20;
  opacity: 0.8;
}

@media (max-width: 768px) {
  .collage-item {
    transform: scale(0.7);
  }
  .collage-item.is-active {
    transform: scale(1);
  }
  .collage-item.is-prev,
  .collage-item.is-next {
    display: none;
  }
}

.carousel-progress {
  transition: width 0.1s linear;
}
