/* Custom Styles & Animations for KATEAW Portfolio */

/* Global Smooth & Clean Baseline */
html, body {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
  font-family: 'Kanit', sans-serif;
  background-color: #020612;
  color: #ffffff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #020612;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
  background: #0066ff;
  box-shadow: 0 0 10px rgba(0, 102, 255, 0.6);
}

/* Frosted Glassmorphism (แก้วขุ่นระดับพรีเมียม - ขนาดกะทัดรัด) */
.glass-nav {
  background: rgba(2, 6, 18, 0.65);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-nav-scrolled {
  background: rgba(2, 6, 18, 0.88);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid rgba(0, 102, 255, 0.25);
  box-shadow: 0 8px 30px -5px rgba(0, 0, 0, 0.7), 0 0 15px rgba(0, 102, 255, 0.12);
}

/* Interactive Buttons: Hover ขยับขึ้นนุ่มนวลทุกปุ่ม */
.btn-interactive {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.28s ease,
              border-color 0.28s ease;
}

.btn-interactive:hover {
  transform: translateY(-3px);
}

.btn-interactive:active {
  transform: translateY(-1px) scale(0.97);
}

/* Glass Buttons (แก้วขุ่นมองทะลุเบลอพื้นหลังชัดเจน) */
.glass-btn {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.glass-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(0, 102, 255, 0.65);
  box-shadow: 0 12px 35px rgba(0, 102, 255, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Button Shimmer Shine Effect */
.btn-shine {
  position: relative;
  overflow: hidden;
}

.btn-shine::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  transition: none;
}

.btn-shine:hover::after {
  left: 125%;
  transition: all 0.75s ease-in-out;
}

/* Seamless Ultra-Soft Bottom Gradient Fade (ไม่มีรอยตัดเด็ดขาด & ขอบบนใสไร้รอยต่อ) */
.seamless-bottom-glow {
  background: linear-gradient(
    to top,
    rgba(0, 102, 255, 0.55) 0%,
    rgba(0, 102, 255, 0.38) 22%,
    rgba(0, 102, 255, 0.20) 45%,
    rgba(0, 102, 255, 0.08) 68%,
    rgba(0, 102, 255, 0.02) 86%,
    rgba(0, 102, 255, 0) 100%
  );
  mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.85) 45%, rgba(0,0,0,0) 100%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.85) 45%, rgba(0,0,0,0) 100%);
}

.seamless-cyan-ambient {
  background: radial-gradient(
    ellipse 85% 65% at 50% 100%,
    rgba(56, 189, 248, 0.35) 0%,
    rgba(0, 102, 255, 0.22) 42%,
    rgba(0, 102, 255, 0) 80%
  );
}

/* About Section Photo Frame & Cards */
.about-photo-frame {
  position: relative;
  border-radius: 2.25rem;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(0, 102, 255, 0.15) 50%, rgba(255, 255, 255, 0.05) 100%);
  box-shadow: 0 25px 60px -15px rgba(0, 102, 255, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.25);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease;
}

.about-photo-frame:hover {
  box-shadow: 0 35px 75px -15px rgba(0, 102, 255, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

.about-info-card {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  padding: 1.25rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.about-info-card:hover {
  background: rgba(23, 37, 84, 0.55);
  border-color: rgba(0, 102, 255, 0.45);
  transform: translateY(-5px);
  box-shadow: 0 20px 35px -10px rgba(0, 102, 255, 0.3);
}

/* Orbiting Circular Wave Background (คลื่นวงกลมโคจร) */
@keyframes orbitRotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes orbitRotateReverse {
  from {
    transform: translate(-50%, -50%) rotate(360deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(0deg);
  }
}

@keyframes orbitalWavePulse {
  0% {
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0.25;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.03);
    opacity: 0.55;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0.25;
  }
}

.orbit-system {
  position: absolute;
  top: 45%;
  left: 50%;
  width: 1100px;
  height: 1100px;
  transform: translate(-50%, -50%);
  pointer-events-none;
  user-select: none;
  z-index: 0;
}

.orbit-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 9999px;
  transform-origin: center center;
}

.orbit-spin-slow {
  animation: orbitRotate 50s linear infinite;
}

.orbit-spin-reverse {
  animation: orbitRotateReverse 65s linear infinite;
}

.orbit-spin-medium {
  animation: orbitRotate 32s linear infinite;
}

.orbit-pulse-wave {
  animation: orbitalWavePulse 5.5s ease-in-out infinite;
}

/* Portfolio Innovation Cards (แก้วขุ่นพรีเมียม & Hover Zoom & Lift & Scale) */
.portfolio-card {
  position: relative;
  background: rgba(8, 16, 36, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
  z-index: 1;
  will-change: transform, box-shadow;
}

.portfolio-card:hover,
.reveal-item.portfolio-card:hover,
.reveal-item.portfolio-card.is-revealed:hover {
  transform: translateY(-8px) scale(1.04) !important;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease !important;
  transition-delay: 0s !important;
  border-color: rgba(0, 102, 255, 0.55);
  box-shadow: 0 25px 50px -15px rgba(0, 102, 255, 0.45);
  z-index: 20;
}

.portfolio-card .card-img {
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease-in-out;
}

.portfolio-card:hover .card-img {
  transform: scale(1.06);
}

/* Partner & Collaboration Logo Grid (ไร้กรอบ - สีเทา และเมื่อ Hover จะแสดงสีปกติ ไม่ขยับ) */
.partner-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.partner-logo {
  filter: grayscale(100%) contrast(0.8);
  opacity: 0.45;
  transition: filter 0.3s ease, opacity 0.3s ease;
}

.partner-item:hover .partner-logo,
.partner-logo:hover {
  filter: grayscale(0%) contrast(1);
  opacity: 1;
}

/* History Narrative Letter Panel (เผื่อกรณีใช้งาน) */
.history-letter-panel {
  background: rgba(10, 18, 36, 0.45);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2rem;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: border-color 0.3s ease;
}

.history-letter-panel:hover {
  border-color: rgba(0, 102, 255, 0.25);
}

/* History Article Hover Interactions (ไร้กรอบการ์ด ให้ความรู้สึกมีชีวิตชีวา) */
.history-article {
  position: relative;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-article:hover {
  transform: translateX(6px);
}

.history-label {
  transition: color 0.3s ease;
}

.history-article:hover .history-label {
  color: #38bdf8;
}

/* Animated Hamburger lines to 'X' */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  position: relative;
  cursor: pointer;
}

.burger-line {
  display: block;
  width: 22px;
  height: 2px;
  background-color: #ffffff;
  border-radius: 9999px;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease-in-out,
              background-color 0.25s ease-in-out;
  transform-origin: center;
}

/* Hamburger to X Transformation */
.burger-active #burgerLine1 {
  transform: translateY(7px) rotate(45deg);
  background-color: #38bdf8;
}

.burger-active #burgerLine2 {
  opacity: 0;
  transform: scaleX(0);
}

.burger-active #burgerLine3 {
  transform: translateY(-7px) rotate(-45deg);
  background-color: #38bdf8;
}

/* Slide-in Mobile Drawer (ทึบแสงมากจากทางขวา) */
.mobile-drawer {
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  background: rgba(3, 7, 18, 0.98);
  box-shadow: -15px 0 45px rgba(0, 0, 0, 0.9);
}

.drawer-open .mobile-drawer {
  transform: translateX(0);
}

/* Backdrop Overlay (เบลอนิดๆ & หรี่แสงลง) */
.mobile-backdrop {
  opacity: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: opacity 0.35s ease-in-out;
}

.drawer-open .mobile-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Keyframe Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(1.08);
  }
}

/* Animation Helper Classes */
.animate-nav-entry {
  animation: fadeInDown 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-hero-title {
  opacity: 0;
  animation: fadeInUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

.animate-hero-sub {
  opacity: 0;
  animation: fadeInUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.28s forwards;
}

.animate-hero-btn {
  opacity: 0;
  animation: fadeInUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.42s forwards;
}

/* รูปคน: มีเฉพาะ Animation เปิดตัวตอนแรกเท่านั้น ไม่ขยับขึ้นลง */
.animate-hero-person {
  opacity: 0;
  animation: fadeInRight 1s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

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

/* Scroll Reveal Animations (เลื่อนลงมาแล้วค่อยๆ ปรากฏขึ้นอย่างนุ่มนวล) */
.reveal-item {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.85s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-item.reveal-left {
  transform: translateX(-40px);
}

.reveal-item.reveal-right {
  transform: translateX(40px);
}

.reveal-item.reveal-scale {
  transform: scale(0.93) translateY(20px);
}

.reveal-item.is-revealed {
  opacity: 1;
  transform: none;
}

/* Stagger Delay Classes */
.delay-100 { transition-delay: 0.1s; }
.delay-150 { transition-delay: 0.15s; }
.delay-200 { transition-delay: 0.2s; }
.delay-250 { transition-delay: 0.25s; }
.delay-300 { transition-delay: 0.3s; }
.delay-350 { transition-delay: 0.35s; }
.delay-400 { transition-delay: 0.4s; }
.delay-500 { transition-delay: 0.5s; }

/* Accessible Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ===================================================
   3D Stacked Coverflow Slider (ภาพซ้อนเลื่อน 3D)
=================================================== */
.stacked-slider-container {
  perspective: 1200px;
  position: relative;
  width: 100%;
  height: 300px;
}

@media (min-width: 640px) {
  .stacked-slider-container {
    height: 370px;
  }
}

@media (min-width: 1024px) {
  .stacked-slider-container {
    height: 430px;
  }
}

.stacked-slide {
  position: absolute;
  top: 0;
  left: 50%;
  width: 88%;
  max-width: 720px;
  height: 100%;
  transform: translateX(-50%);
  transition: transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.55s ease,
              box-shadow 0.55s ease,
              filter 0.55s ease;
  will-change: transform, opacity;
  border-radius: 1.75rem;
  overflow: hidden;
  user-select: none;
}

/* Active Slide (Front & Center) */
.stacked-slide.slide-active {
  transform: translateX(-50%) translateZ(0) scale(1);
  opacity: 1;
  z-index: 30;
  box-shadow: 0 25px 60px -15px rgba(0, 102, 255, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.18);
  cursor: pointer;
  filter: blur(0px);
}

/* Previous Slide (Left Stack) */
.stacked-slide.slide-prev {
  transform: translateX(-95%) translateZ(-120px) scale(0.85);
  opacity: 0.55;
  z-index: 20;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  filter: blur(0.5px);
}

.stacked-slide.slide-prev:hover {
  opacity: 0.8;
}

/* Next Slide (Right Stack) */
.stacked-slide.slide-next {
  transform: translateX(-5%) translateZ(-120px) scale(0.85);
  opacity: 0.55;
  z-index: 20;
  box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  filter: blur(0.5px);
}

.stacked-slide.slide-next:hover {
  opacity: 0.8;
}

/* Hidden Slides Behind */
.stacked-slide.slide-hidden-left {
  transform: translateX(-120%) translateZ(-250px) scale(0.7);
  opacity: 0;
  z-index: 10;
  pointer-events: none;
}

.stacked-slide.slide-hidden-right {
  transform: translateX(20%) translateZ(-250px) scale(0.7);
  opacity: 0;
  z-index: 10;
  pointer-events: none;
}

/* Cyber Matrix Background for Events Section */
.cyber-grid-mesh {
  background-image: 
    linear-gradient(to right, rgba(0, 102, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 102, 255, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

.cyber-dots-pattern {
  background-image: radial-gradient(rgba(0, 229, 255, 0.15) 1.2px, transparent 1.2px);
  background-size: 28px 28px;
}

/* ===================================================
   Contact Section Input & Card Styles
=================================================== */

/* Contact Input Styles */
.contact-input {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 0.85rem 1.15rem;
  color: #ffffff;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
  width: 100%;
}

.contact-input:focus {
  background: rgba(15, 23, 42, 0.9);
  border-color: #0066ff;
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.25), 0 0 20px -3px rgba(0, 102, 255, 0.4);
}

.contact-input::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

/* Contact Channel Card (Frosted Glass Blur พรีเมียม) */
.contact-channel-card {
  position: relative;
  background: rgba(8, 16, 36, 0.78);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}

.contact-channel-card:hover {
  background: rgba(14, 26, 56, 0.88);
  border-color: rgba(0, 102, 255, 0.55);
  box-shadow: 0 16px 40px -10px rgba(0, 102, 255, 0.35), inset 0 1px 2px rgba(255, 255, 255, 0.15);
}

/* ==========================================
   Services Section: Concentric Orbit & App Cards (บริการของเรา)
   ========================================== */
.services-orbit-stage {
  perspective: 1000px;
}

.services-orbit-track {
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

/* Card holder positioned at (x, y) along circular orbit - Stays 100% upright */
.services-orbit-item-holder {
  position: absolute;
  top: 50%;
  left: 50%;
  will-change: transform;
  z-index: 25;
}

/* App Card สี่เหลี่ยมมนสีขาว ตั้งตรงตลอดเวลา */
.services-app-card {
  position: relative;
  width: 58px;
  height: 58px;
  background: #ffffff;
  border-radius: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.55), 0 0 18px rgba(0, 102, 255, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease, border-color 0.35s ease;
}

@media (min-width: 640px) {
  .services-app-card {
    width: 68px;
    height: 68px;
    border-radius: 1.35rem;
  }
}

.services-app-card:hover {
  transform: scale(1.18);
  box-shadow: 0 18px 35px -5px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 102, 255, 0.75);
  border-color: #0066ff;
  z-index: 35;
}

.services-app-card img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  pointer-events: none;
  transition: transform 0.3s ease;
}

@media (min-width: 640px) {
  .services-app-card img {
    width: 38px;
    height: 38px;
  }
}

.services-app-card:hover img {
  transform: scale(1.08);
}

/* Tooltip on App Card Hover */
.services-card-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(4, 9, 29, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 102, 255, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 102, 255, 0.3);
  padding: 6px 14px;
  border-radius: 9999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 40;
}

.services-app-card:hover .services-card-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Center Hub Pulsing Border */
.services-center-badge {
  box-shadow: 0 0 40px rgba(0, 102, 255, 0.35), inset 0 0 15px rgba(255, 255, 255, 0.1);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.services-center-badge:hover {
  transform: scale(1.06);
  box-shadow: 0 0 50px rgba(0, 102, 255, 0.55), inset 0 0 20px rgba(255, 255, 255, 0.15);
}

