/* ============================================================
   PORTFOLIO 2 — Design System
   Theme: Green + White | Glassmorphism | Mitr Font
   ============================================================ */

/* ---- CSS Variables ---------------------------------------- */
:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;

  --glass-bg:      rgba(255, 255, 255, 0.22);
  --glass-bg-lg:   rgba(255, 255, 255, 0.30);
  --glass-border:  rgba(255, 255, 255, 0.45);
  --glass-shadow:  0 8px 32px rgba(34, 197, 94, 0.08);
  --glass-shadow-lg: 0 20px 60px rgba(34, 197, 94, 0.12);

  --blur: 16px;
  --blur-lg: 24px;
}

/* ---- Base ------------------------------------------------- */
* { box-sizing: border-box; }

body {
  font-family: 'Mitr', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Gradient Background ---------------------------------- */
.bg-gradient-main {
  background: linear-gradient(
    135deg,
    #edfbf2 0%,
    #f5fdf8 30%,
    #f0fdf4 60%,
    #e8f9ef 100%
  );
  min-height: 100vh;
}

/* ---- Ambient Blobs ---------------------------------------- */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  pointer-events: none;
  animation: blobFloat 8s ease-in-out infinite;
  z-index: 0;
}
.blob-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #86efac, #4ade80);
  top: -150px; left: -150px;
  animation-delay: 0s;
}
.blob-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #a7f3d0, #6ee7b7);
  bottom: -100px; right: -100px;
  animation-delay: -4s;
}
.blob-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #bbf7d0, #86efac);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -2s;
}
@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(20px, -20px) scale(1.05); }
  66%       { transform: translate(-15px, 15px) scale(0.97); }
}

/* Now Playing card CSS lives inline in views/partials/now-playing.ejs
   (kept self-contained so it never breaks from stylesheet caching) */

/* ---- Glassmorphism Cards ---------------------------------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}
.glass-card-lg {
  background: var(--glass-bg-lg);
  backdrop-filter: blur(var(--blur-lg));
  -webkit-backdrop-filter: blur(var(--blur-lg));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg);
}
.glass-tag {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
}
.glass-btn {
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.glass-stat {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

/* ---- Navbar ----------------------------------------------- */
#navbar {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
#navbar.scrolled {
  background: rgba(255, 255, 255, 0.6);
  border-bottom-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.06);
}

.nav-link {
  color: #4b5563;
  font-weight: 400;
}
.nav-link:hover {
  color: var(--green-600);
  background: rgba(34, 197, 94, 0.08);
}
.nav-link-active {
  color: var(--green-600) !important;
  background: rgba(34, 197, 94, 0.12) !important;
  font-weight: 500;
}
.mobile-nav-link {
  color: #4b5563;
  display: block;
}
.mobile-nav-link:hover {
  color: var(--green-600);
  background: rgba(34, 197, 94, 0.08);
}

/* Hamburger lines */
.hamburger-line {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--green-600);
  transition: all 0.3s ease;
}
#menu-btn.open .hamburger-line:nth-child(1) { transform: translateY(8px) rotate(45deg); }
#menu-btn.open .hamburger-line:nth-child(2) { opacity: 0; }
#menu-btn.open .hamburger-line:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---- Buttons ---------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  border-radius: 0.875rem;
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'Mitr', sans-serif;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  border-radius: 0.875rem;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--green-600);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: 'Mitr', sans-serif;
  border: 1.5px solid var(--green-300);
  transition: all 0.2s ease;
  text-decoration: none;
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--green-500);
  transform: translateY(-2px);
}

.btn-sm-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 1rem;
  border-radius: 0.625rem;
  background: var(--green-500);
  color: white;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: 'Mitr', sans-serif;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-sm-primary:hover { background: var(--green-600); }

.btn-sm-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 1rem;
  border-radius: 0.625rem;
  background: transparent;
  color: var(--green-600);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: 'Mitr', sans-serif;
  border: 1px solid var(--green-300);
  transition: all 0.2s;
  text-decoration: none;
}
.btn-sm-outline:hover { border-color: var(--green-500); background: rgba(34,197,94,0.05); }

/* ---- Typography ------------------------------------------- */
.text-gradient {
  background: linear-gradient(135deg, #15803d, #14532d);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Hero typewriter cursor -------------------------------- */
.typed-cursor {
  display: inline-block;
  width: 2px;
  height: 0.75em;
  background: var(--green-500, #22c55e);
  margin-left: 4px;
  vertical-align: middle;
  animation: typedBlink 0.75s step-end infinite;
}
@keyframes typedBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .typed-cursor { animation: none; opacity: 1; }
}
.page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #1a2e1a;
  line-height: 1.2;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #1a2e1a;
}

/* ---- Skill / Status Tags ---------------------------------- */
.skill-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--green-700);
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.skill-tag-sm {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.08);
  color: var(--green-600);
  font-size: 0.7rem;
  font-weight: 400;
  border: 1px solid rgba(34, 197, 94, 0.15);
}

.status-tag-done {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--green-600);
  font-size: 0.7rem;
  font-weight: 500;
}
.status-tag-wip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: #92400e;
  font-size: 0.7rem;
  font-weight: 500;
}
.status-tag-coming {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: rgba(156, 163, 175, 0.12);
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 500;
}

/* ---- Form ------------------------------------------------- */
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.4rem;
  font-family: 'Mitr', sans-serif;
}
.form-input {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.875rem;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  color: #374151;
  font-size: 0.875rem;
  font-family: 'Mitr', sans-serif;
  font-weight: 300;
  transition: all 0.2s ease;
  outline: none;
}
.form-input:focus {
  border-color: var(--green-400);
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.form-input::placeholder { color: #9ca3af; }

/* ---- Social Buttons --------------------------------------- */
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--green-600);
  font-size: 1rem;
  transition: all 0.2s ease;
  text-decoration: none;
}
.social-btn:hover {
  background: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
  color: var(--green-700);
}

/* ---- Animations ------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fadein {
  animation: fadeIn 0.6s ease forwards;
}
.animate-fadein-delay {
  animation: fadeIn 0.6s ease 0.15s forwards;
  opacity: 0;
}

/* ---- Scroll reveal ---------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Avatar ---------------------------------------------- */
.avatar-ring {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25), 0 8px 24px rgba(34, 197, 94, 0.18);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.avatar-ring:hover {
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.4), 0 12px 32px rgba(34, 197, 94, 0.25);
  transform: scale(1.04);
}

/* ---- Reduced motion --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
  .animate-fadein, .animate-fadein-delay { animation: none; opacity: 1; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- Status tags (work page) ----------------------------- */
.status-tag-live {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  background: rgba(37, 99, 235, 0.1); color: #1d4ed8;
  font-size: 0.7rem; font-weight: 500;
  border: 1px solid rgba(37, 99, 235, 0.2);
}
.live-pulse { animation: pulse 1.5s infinite; color: #3b82f6; }

/* ---- Mobile menu slide animation -------------------------
   Override Tailwind's `hidden` (display:none) on mobile so
   we can animate via max-height + opacity instead.         */
@media (max-width: 767px) {
  #mobile-menu {
    display: block !important;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    position: relative;
    z-index: 50;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
  }
  #mobile-menu .glass-card {
    background: rgba(240, 253, 244, 0.97) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  #mobile-menu.menu-open {
    max-height: 400px;
    opacity: 1;
    pointer-events: auto;
  }
}

/* ---- Menu overlay ---------------------------------------- */
#menu-overlay {
  transition: opacity 0.25s ease;
  opacity: 0;
}
#menu-overlay.overlay-open {
  opacity: 1;
}

/* ---- Page transition removed ---- */

/* ---- Certificate Carousel (Swiper coverflow) --------------- */
.cert-swiper {
  padding: 20px 0 50px;
}
.cert-swiper .swiper-slide {
  width: 240px;
  height: 320px;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  transform: scale(0.85);
  opacity: 0.5;
  transition: transform 0.45s, opacity 0.45s, filter 0.45s;
  filter: blur(1px);
  box-shadow: var(--glass-shadow);
  cursor: pointer;
}
.cert-swiper .swiper-slide-active {
  transform: scale(1);
  opacity: 1;
  filter: none;
  box-shadow: 0 20px 45px rgba(34, 197, 94, 0.3);
}
.cert-slide-card {
  position: relative;
  width: 100%;
  height: 100%;
}
.cert-slide-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s;
}
.cert-swiper .swiper-slide-active img {
  transform: scale(1.05);
}
.cert-slide-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 55%);
  display: flex;
  align-items: flex-end;
  padding: 16px;
}
.cert-slide-overlay .cert-name {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
}
.cert-zoom-hint {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--green-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}
.cert-swiper .swiper-pagination-bullet {
  background: var(--green-300, #86efac);
  opacity: 0.6;
}
.cert-swiper .swiper-pagination-bullet-active {
  background: var(--green-600);
  opacity: 1;
  width: 22px;
  border-radius: 999px;
}

/* Lightbox for viewing certificate images full-screen */
.cert-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 20, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.cert-lightbox.open {
  display: flex;
}
.cert-lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.cert-lightbox-caption {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  color: #fff;
  font-size: 0.85rem;
  padding: 0 16px;
}
.cert-lightbox-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: none;
  cursor: pointer;
}

/* ---- Game Ranking (homepage) -------------------------------- */
.rank-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}
.rank-badge {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--green-400, #4ade80), var(--green-600));
}
.rank-badge.rank-1 { background: linear-gradient(135deg, #fde68a, #f59e0b); }
.rank-badge.rank-2 { background: linear-gradient(135deg, #e5e7eb, #9ca3af); }
.rank-badge.rank-3 { background: linear-gradient(135deg, #fdba74, #c2703d); }
.rank-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(34, 197, 94, 0.08);
  flex-shrink: 0;
}

/* ---- Rotating hero quote transition ------------------------- */
.quote-inner {
  transition: opacity 0.55s ease, transform 0.55s ease, filter 0.55s ease;
  opacity: 1;
  transform: translateY(0) scale(1) rotateX(0deg);
  filter: blur(0);
  transform-style: preserve-3d;
}
.quote-inner.quote-hide {
  opacity: 0;
  transform: translateY(-22px) scale(0.92) rotateX(55deg);
  filter: blur(10px);
}
@media (prefers-reduced-motion: reduce) {
  .quote-inner { transition: none; }
}

/* ---- Tech Stack Logo Loop ------------------------------------ */
/* ทำให้แถบโลโก้กว้างเต็มจอ ไม่ติด padding ของ container พ่อแม่ */
.logo-loop-fullbleed {
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  overflow: hidden;
}
.logo-loop-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
}
/* fade แบบ mask โปร่งใสจริง (ไม่ใช่สีทึบทับ) เลยเข้ากับพื้นหลังได้เสมอไม่ว่าพื้นหลังจะเป็นอะไร */
.logo-loop-wrap.fade-mask {
  -webkit-mask-image: linear-gradient(to right, transparent, black var(--llw-fade-width, 60px), black calc(100% - var(--llw-fade-width, 60px)), transparent);
  mask-image: linear-gradient(to right, transparent, black var(--llw-fade-width, 60px), black calc(100% - var(--llw-fade-width, 60px)), transparent);
}
.logo-loop-wrap.fade-mask[data-direction="up"],
.logo-loop-wrap.fade-mask[data-direction="down"] {
  -webkit-mask-image: linear-gradient(to bottom, transparent, black var(--llw-fade-width, 60px), black calc(100% - var(--llw-fade-width, 60px)), transparent);
  mask-image: linear-gradient(to bottom, transparent, black var(--llw-fade-width, 60px), black calc(100% - var(--llw-fade-width, 60px)), transparent);
}
.logo-loop-track {
  display: flex;
  align-items: center;
  gap: var(--llw-gap, 48px);
  width: max-content;
  animation: llw-scroll-x var(--llw-speed, 28s) linear infinite;
  will-change: transform;
}
.logo-loop-wrap[data-direction="right"] .logo-loop-track {
  animation-direction: reverse;
}
.logo-loop-wrap[data-direction="up"],
.logo-loop-wrap[data-direction="down"] {
  height: calc(var(--llw-logo-height, 40px) * 4);
}
.logo-loop-wrap[data-direction="up"] .logo-loop-track,
.logo-loop-wrap[data-direction="down"] .logo-loop-track {
  flex-direction: column;
  width: auto;
  height: max-content;
  animation-name: llw-scroll-y;
}
.logo-loop-wrap[data-direction="down"] .logo-loop-track {
  animation-direction: reverse;
}
@keyframes llw-scroll-x {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes llw-scroll-y {
  from { transform: translateY(0); }
  to { transform: translateY(-50%); }
}
.logo-loop-item {
  flex: none;
  height: var(--llw-logo-height, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-loop-item img {
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: contain;
  transition: transform 0.25s ease, filter 0.25s ease;
  display: block;
}
.logo-loop-wrap.hover-scale .logo-loop-item:hover img {
  transform: scale(var(--llw-hover-scale, 1.15));
}
/* "ใช้สีจาก Theme" — ปรับโทนโลโก้ (ส่วนใหญ่) ให้เขียวเข้ากับธีมเว็บแบบ best-effort ด้วย CSS filter
   (โลโก้หลายสีอาจไม่ได้ผลลัพธ์เป๊ะเท่าโลโก้ทรงเรียบ/ขาวดำ) */
.logo-loop-item.theme-color img {
  filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(3) brightness(0.9);
}
@media (prefers-reduced-motion: reduce) {
  .logo-loop-track { animation: none !important; }
}

