/* ==========================================
   RESET & ROOT VARIABLES
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  scroll-behavior: smooth;
  font-family: "Poppins";
}
:root {
  --bg-color: #080808;
  --second-bg-color: #101010;
  --text-color: white;
  --main-color: #0cb3ea;
}

/* ==========================================
   BASE STYLES
   ========================================== */
html {
  font-size: 60%;
  overflow-x: hidden;
}
body {
  background-color: var(--bg-color);
  color: var(--text-color);
}

/* ==========================================
   HEADER & NAVIGATION
   ========================================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 4rem 15%;
  background-color: rgba(8, 8, 8, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}
#menu-icon {
  font-size: 3.5rem;
  color: var(--main-color);
  display: none;
  cursor: pointer;
}
.logo {
  font-size: 3rem;
  font-weight: 600;
  color: var(--text-color);
  cursor: pointer;
  transition: 0.3s ease-in-out;
}
.logo:hover {
  transform: scale(1.1);
}
span {
  background: linear-gradient(270deg, #b3e5fc 10%, #039be5 100%);
  background-clip: text;
  color: transparent;
}
.navbar a {
  font-size: 1.8rem;
  margin-left: 5rem;
  color: var(--text-color);
  font-weight: 500;
  transition: 0.3s ease-in-out;
  border-bottom: 3px solid transparent;
}
.navbar a:hover {
  color: var(--main-color);
  border-bottom: 3px solid var(--main-color);
}
.contact-btn {
  font-size: 1.8rem;
  border-radius: 3rem;
  padding: 1rem 2rem;
  background: linear-gradient(270deg, #b3e5fc 10%, #039be5 100%);
  letter-spacing: 1px;
  cursor: pointer;
  color: white;
  border: none;
  text-wrap: nowrap;
}
.contact-btn:hover {
  transform: scale(1.1);
}

/* ==========================================
   SECTION BASE
   ========================================== */
section {
  min-height: 100vh;
  padding: 10rem 15%;
}

/* ==========================================
   HOME SECTION
   ========================================== */
.home {
  display: flex;
  align-self: center;
  justify-content: center;
  gap: 15rem;
  margin-top: 8rem;
}
.home-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.home-content h1 {
  font-size: 8rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 1;
}
.home-content h3 {
  font-size: 4rem;
  margin: 1rem 0;
}
.home-content p {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.8;
  color: #b0b0b0;
}
.home-img img {
  width: 28vw;
  border-radius: 30%;
  box-shadow: 0 0 2rem var(--main-color);
  transition: 0.4 ease-in-out;
}
.home-img img:hover {
  box-shadow: 0 0 2rem var(--main-color), 0 0 4rem var(--main-color);
}

/* ==========================================
   IMAGE SLIDESHOW
   ========================================== */
.home-img .img-slideshow {
  position: relative;
  width: 28vw;
  cursor: pointer;
  aspect-ratio: 3 / 4;
}
.home-img img.slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 30%;
  box-shadow: 0 0 2rem var(--main-color);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  transition: opacity 0.8s ease-in-out, box-shadow 0.3s ease;
  pointer-events: none;
}
.home-img img.slide.active {
  opacity: 1;
  position: absolute;
  pointer-events: auto;
}
.home-img img.slide:hover {
  box-shadow: 0 0 2rem var(--main-color), 0 0 4rem var(--main-color);
}

/* Dot indicators */
.slide-dots {
  position: absolute;
  bottom: -3rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.8rem;
  pointer-events: none;
}
.dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transition: 0.3s ease;
  pointer-events: auto;
  cursor: pointer;
}
.dot.active {
  background: var(--main-color);
  box-shadow: 0 0 8px var(--main-color);
  transform: scale(1.3);
}

/* ==========================================
   SOCIAL ICONS
   ========================================== */
.social-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 4rem; /* ห่างจากข้างบน */
  gap: 2rem; /* ระยะห่างระหว่างไอคอน */
}
.social-icons a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 60px;
  height: 60px;
  font-size: 2rem;
  background: transparent;
  border: 2px solid var(--main-color);
  border-radius: 50%;
  color: var(--main-color);
  transition: 0.3s ease-in-out;
}
.social-icons a:hover {
  color: var(--text-color);
  background-color: var(--main-color);
  transform: scale(1.2) translateY(-5px);
  box-shadow: 0 0 25px var(--main-color);
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn-group {
  display: flex;
  margin-top: 4rem;
  gap: 2rem;
  align-items: center;
}
.btn {
  display: inline-block;
  padding: 1.3rem 3.5rem;
  background-color: var(--main-color);
  box-shadow: 0 0 1rem var(--main-color);
  border-radius: 3rem;
  font-size: 1.8rem;
  color: black;
  border: 2px solid transparent;
  font-weight: 600;
  transition: 0.3s ease-in-out;
}
.btn:hover {
  background-color: transparent;
  color: var(--main-color);
  border: 2px solid var(--main-color);
}
.btn-group a:nth-last-of-type(2) {
  background-color: black;
  color: var(--main-color);
  border: 2px solid var(--main-color);
  box-shadow: 0 0 25px var(--main-color);
}
.btn-group a:nth-last-of-type(2):hover {
  background-color: var(--main-color);
  color: black;
  box-shadow: 0 0 1rem var(--main-color);
}

/* ==========================================
   ABOUT SECTION
   ========================================== */
.about {
  display: flex;
  flex-direction: column; /* ⭐ สำคัญ */
  justify-content: center;
  align-items: center;
  gap: 5rem;
  background-color: var(--second-bg-color);
}
.about-content h2 {
  font-size: 7rem;
  text-align: center;
}
.about-content p {
  font-size: 1.6rem;
}
.heading {
  text-align: center;
  font-size: 7rem;
  margin-bottom: 5rem;
}

/* ==========================================
   EDUCATION & EXPERIENCE
   ========================================== */

/* education */
.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1.5rem;
  color: var(--main-color);
}
.edu-item,
.exp-item {
  width: 100%;
  margin-bottom: 1.5rem;
}
.edu-header,
.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
}
.edu-header h4,
.exp-header h4 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-color);
}
.edu-year,
.exp-year {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-color);
}
.edu-degree,
.exp-role {
  margin-top: 0.6rem;
  font-size: 1.6rem;
  color: #ddd;
  line-height: 1.6;
}
.edu-details,
.exp-details {
  margin-top: 0.8rem;
  padding-left: 2.2rem;
}
.edu-details li,
.exp-details li {
  font-size: 1.6rem;
  margin: 0.4rem 0;
  color: #ddd;
}
.education-section,
.experience-section {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  margin-top: -2rem;
  padding: 2.5rem;
  padding-top: 0.5rem;
  border-radius: 1.5rem;
  background-color: rgba(255, 255, 255, 0.03);
}
.exp-item {
  width: 100%;
  margin-bottom: 1.5rem;
}

/* ==========================================
   SKILLS SECTION
   ========================================== */

/* ===== Skills Section ===== */
.skills {
  background-color: var(--bg-color);
}
.skills-wrap {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2rem;
  padding: 6rem 5rem;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.35);
  margin-bottom: 8rem;
}

/* Title */
.skills-title {
  position: relative;
  text-align: center;
  font-size: 6rem;
  font-weight: 800;
  color: var(--main-color);
}

/* ตัวจางๆใต้หัวข้อ */
.skills-bg-text {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, -25%);
  font-size: 3rem;
  font-weight: 900;
  color: white;
  opacity: 0.05;
  letter-spacing: 6px;
  white-space: nowrap;
  pointer-events: none;
}
.skills-subtitle {
  text-align: center;
  margin-top: 2.5rem;
  margin-bottom: 4.5rem;
  font-size: 1.6rem;
  color: #b0b0b0;
  line-height: 1.8;
}

/* เพิ่มส่วนนี้ - Container สำหรับ grid + tabs */
.skills-container {
  position: relative;
  display: flex;
  gap: 3rem;
  align-items: center;
}

/* เพิ่มส่วนนี้ - Tabs ด้านขวา */
.skills-tabs {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  order: 2; /* ให้อยู่ด้านขวา */
}
.tab-indicator {
  width: 0.6rem;
  height: 5rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.4s ease;
}
.tab-indicator.active {
  background: var(--main-color);
  height: 8rem;
  box-shadow: 0 0 15px rgba(12, 179, 234, 0.5);
}
.tab-indicator:hover {
  background: rgba(12, 179, 234, 0.5);
}

/* Grid Cards */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2.2rem;
  flex: 1;
  opacity: 0;
  visibility: hidden;
  position: absolute;
  left: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  transform: translateY(30px);
}
.skills-grid.active {
  opacity: 1;
  visibility: visible;
  position: relative;
  transform: translateY(0);
}
.skill-card {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 1.6rem;
  padding: 2.6rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  border: 2px solid transparent;
  transition: 0.3s ease-in-out;
}
.skill-card i {
  font-size: 4.8rem;
  color: var(--main-color);
}
.skill-card span {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-color);
  letter-spacing: 0.5px;
}

/* Hover */
.skill-card:hover {
  transform: translateY(-6px);
  border: 2px solid var(--main-color);
  box-shadow: 0 0 25px rgba(12, 179, 234, 0.35);
}

/* ==========================================
   PROJECTS SECTION
   ========================================== */

/* ===== projects Section ===== */
.projects {
  background-color: var(--second-bg-color);
}
.projects-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  place-items: center;
  gap: 3rem;
  row-gap: 5rem;
}
.projects-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: var(--bg-color);
  border: 2px solid var(--main-color);
  border-radius: 3rem;
  gap: 2rem;
  padding: 5rem 2rem;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 0 5px var(--main-color);
  transition: 0.3s ease;
}
.projects-card:hover {
  box-shadow: 0 0 25px var(--main-color), 0 0 50px var(--main-color);
  transform: scale(1.02);
}
.projects-card img {
  max-width: 300px;
  border-radius: 2rem;
  object-fit: cover;
}
.projects-card h3 {
  font-size: 3rem;
}
.projects-card p {
  font-size: 1.6rem;
}
.projects-card .btn {
  padding: 1rem 2.5rem; /* เล็กกว่าปกติ */
  font-size: 1.6rem; /* ฟอนต์เล็กลง */
}

/* ==========================================
   FOOTER
   ========================================== */

/* Footer */
.footer {
  background-color: var(--second-bg-color);
  padding: 3rem 15%;
}

/* Social Icons ใน Footer - เล็กลง */
.footer .social-icons {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  margin-top: 1rem;
}
.footer .social-icons a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 45px;
  height: 45px;
  font-size: 1.8rem;
  background: transparent;
  border: 2px solid var(--main-color);
  border-radius: 50%;
  color: var(--main-color);
  transition: 0.3s ease-in-out;
}
.footer .social-icons a:hover {
  color: var(--text-color);
  background-color: var(--main-color);
  transform: scale(1.2) translateY(-5px);
  box-shadow: 0 0 25px var(--main-color);
}

/* Nav links ใน Footer */
.footer ul {
  display: flex;
  justify-content: center;
  gap: 3rem;
  list-style: none;
  margin-bottom: 2rem;
}
.footer ul li a {
  font-size: 1.6rem;
  color: var(--text-color);
  transition: 0.3s ease;
}
.footer ul li a:hover {
  color: var(--main-color);
}

/* Copyright */
.footer .copyright {
  text-align: center;
  font-size: 1.4rem;
  color: #b0b0b0;
}

/* ==========================================
   ANIMATIONS (Typing Text)
   ========================================== */

/* ===== Typing Text Animation in gome page ===== */
.typing-text span {
  position: relative;
  display: inline-block;
  min-width: 16ch;
}
.typing-text span::before {
  content: "Web Developer";
  color: var(--main-color);
  animation: words 12s infinite;
}
.typing-text span::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: black; /* ให้ตรงกับพื้นหลัง */
  border-left: 3px solid var(--main-color);
  animation: typing 4s steps(20) infinite, cursor 0.6s infinite;
}

/* cursor กระพริบ */
@keyframes cursor {
  50% { border-left-color: transparent; }
}

/* พิมพ์ → ค้าง → ลบ */
@keyframes typing {
  0%   { width: 100%; }
  30%  { width: 0%; }   /* พิมพ์เสร็จ */
  70%  { width: 0%; }   /* ค้างนานขึ้น */
  90%  { width: 100%; } /* ลบ */
  100% { width: 100%; }
}

/* เปลี่ยนคำ */
@keyframes words {
  0%, 33%   { content: "Web Developer"; }
  34%, 66%  { content: "Software Engineer"; }
  67%, 100% { content: "UX/UI Designer"; }
}

/* ==========================================
   CUSTOM SCROLLBAR
   ========================================== */

/* Custom Scrollbar - Auto Hide */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-thumb {
  background-color: transparent; /* ซ่อนตอนไม่ใช้ */
  border-radius: 10px;
  transition: background-color 0.3s ease;
}
::-webkit-scrollbar-track {
  background-color: transparent;
}

/* แสดงตอนกำลังเลื่อน */
body.scrolling::-webkit-scrollbar-thumb {
  background-color: var(--main-color);
}

/* ==========================================
   RESPONSIVE / MEDIA QUERIES
   ========================================== */

/* Responsive */
@media (max-width: 1100px) {
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
  .skills-title { font-size: 5rem; }
  .skills-bg-text { font-size: 6.5rem; }
}

@media (max-width: 650px) {
  .skills { padding: 8rem 8%; }
  .skills-wrap { padding: 4.5rem 2.5rem; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }

  /* ย้ายแท็บมาด้านบนในมือถือ */
  .skills-container { flex-direction: column; }
  .skills-tabs {
    flex-direction: row;
    order: 0;
    gap: 1rem;
  }
  .tab-indicator {
    width: 3rem;
    height: 0.5rem;
  }
  .tab-indicator.active {
    width: 5rem;
    height: 0.5rem;
  }
}

/* ===== Responsive Section ===== */
@media (max-width: 1285px) {
  #menu-icon { display: block; }
  .navbar {
    position: absolute;
    top: 100%;
    right: 0;
    width: 50%;
    padding: 1rem 3rem;
    background: rgb(0, 0, 0, 0.8);
    border-bottom-left-radius: 2rem;
    border-left: 2px solid var(--main-color);
    border-bottom: 2px solid var(--main-color);
    display: none;
  }
  .navbar a {
    display: block;
    margin: 3rem;
    font-size: 2rem;
    color: var(--text-color);
  }
  .navbar.active { display: block; }
  .contact-btn { display: none; }
  .home {
    flex-direction: column-reverse;
    margin: 5rem 0;
    gap: 5rem;
  }
  .home-content {
    align-items: center;
    text-align: center;
  }
  .home-img img { width: 60vw; }
  .home-img .img-slideshow {
    width: 60vw;
    aspect-ratio: 3 / 4;
  }
  .about {
    flex-direction: column;
    text-align: center;
  }
  .about-content { order: 1; }
  .education-section { order: 2; }
  .experience-section { order: 3; }
  .about h2 {
    text-align: center;
    margin: 2rem 0;
  }
  .about img { width: 52vw; }

  /* ⭐ ปรับ Education/Experience ให้สวยบนมือถือ */
  .education-section,
  .experience-section { padding: 2rem 1.5rem; }
  .section-title {
    font-size: 2.2rem;
    text-align: center;
  }
  .edu-header,
  .exp-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
  }
  .edu-header h4,
  .exp-header h4 { font-size: 1.8rem; }
  .edu-year,
  .exp-year { font-size: 1.6rem; }
  .edu-degree,
  .exp-role {
    text-align: center;
    font-size: 1.5rem;
  }
  .edu-details,
  .exp-details {
    text-align: left;
    padding-left: 1.5rem;
    font-size: 1.5rem;
  }
  .contact form { flex-direction: column; }
}