/* === Reset & Base === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', 'Noto Sans Thai', sans-serif;
  background-color: #f5f5f5;
  color: #111;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

html {
  scroll-behavior: smooth;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* === Header === */
header {
  background: #fff;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 1000;
}
/* Sticky header shadow on scroll */
header.sticky {
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  transition: box-shadow 0.3s;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

header h1 {
  font-size: 1.8em;
  color: #333;
}

.navbar {
  display: flex;
  gap: 15px;
  align-items: center;
}

.navbar a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 8px 12px;
  transition: background 0.3s, color 0.3s;
}

.navbar a:hover {
  background: #eee;
  border-radius: 5px;
}

#darkModeToggle {
  margin-left: 15px;
  padding: 6px 14px;
  background: #ddd;
  color: #111;
  border: none;
  cursor: pointer;
  border-radius: 30px;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.dark-mode #darkModeToggle {
  background: #333;
  color: #eee;
}

/* === Hero Section === */
.hero {
  background: #222;
  color: #fff;
  padding: 80px 20px;
}

.hero-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
}

.hero-text {
  flex: 1;
  text-align: left;
}

.hero h2 {
  font-size: 2.5em;
  margin-bottom: 10px;
}

.hero p {
  font-size: 1.2em;
  color: #ccc;
}

.profile-pic {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
}

.buttons a {
  display: inline-block;
  margin: 10px 10px 0 0;
  padding: 10px 20px;
  background: #444;
  color: #fff;
  border-radius: 5px;
  text-decoration: none;
  transition: background 0.3s;
}

.buttons a:hover {
  background: #666;
}

/* === About === */
.about-content {
  display: flex;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
  text-align: left;
}

.about-content p {
  flex: 1;
}

.about-pic,
.my-self {
  width: 100%;
  max-width: 250px;
  height: auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #ccc;
}

/* === Portfolio === */
.portfolio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.portfolio-toggle {
  display: flex;
  gap: 10px;
}

.portfolio-toggle button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9em;
  transition: background 0.3s;
}

.portfolio-toggle button.active,
.portfolio-toggle button:hover {
  background: #007bff;
  color: #fff;
  border-color: #007bff;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.portfolio-item {
  background: #f1f1f1;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.3s ease;
}

.portfolio-item:hover {
  transform: translateY(-5px);
}

.portfolio-item img {
  max-width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
}

.portfolio-item h3 {
  margin: 10px 0 5px;
}

.about-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.my-self {
    width: 250px;
    border-radius: 10px;
    object-fit: cover;
}

.text-block {
    flex: 1;
    min-width: 300px;
}

.tab-buttons {
    margin-top: 20px;
}

.tab-buttons button {
    padding: 8px 16px;
    margin-right: 10px;
    background-color: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: bold;
    cursor: pointer;
}

.tab-buttons button.active {
    border-bottom: 2px solid #ff5555;
    color: #ff5555;
}

.tab-content {
    display: none;
    margin-top: 10px;
}

.tab-content.active {
    display: block;
}

.highlight {
  color: #DAA520; /* หรือสีอื่นที่คุณต้องการ เช่น #007bff */
  font-weight: bold;
}

.see-also {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  background-color: white;
  color: #333;
  font-weight: bold;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.see-also:hover {
  background-color: #333;
  color: white;
}

.toggle-btn.active {
    background-color: #007bff;
    color: white;
    border: none;
}

.toggle-btn {
    padding: 6px 14px;
    margin: 0 4px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}
/* === Footer === */
footer {
  background: #111;
  color: #888;
  text-align: center;
  padding: 20px;
  font-size: 0.9em;
}

/* === Dark Mode === */
.dark-mode {
  background-color: #111;
  color: #eee;
}

.dark-mode header {
  background: #1e1e1e;
  border-color: #333;
}

.dark-mode .hero {
  background: #000;
  color: #eee;
}

.dark-mode .project-card,
.dark-mode .portfolio-item {
  background: #1e1e1e;
  color: #ccc;
}

.dark-mode .buttons a {
  background: #222;
}

.dark-mode .navbar a {
  color: #eee;
}

.dark-mode .portfolio-toggle button {
  background: #333;
  color: #eee;
  border-color: #444;
}

.dark-mode .portfolio-toggle button.active {
  background: #007bff;
  color: #fff;
  border-color: #007bff;
}

/* === Animation === */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Responsive === */
@media (max-width: 768px) {
  .hero-content, .about-content, .header-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-text {
    text-align: center;
  }

  .hero h2 {
    font-size: 2em;
  }

  .buttons a {
    padding: 8px 15px;
    font-size: 0.95em;
  }

  header h1, #darkModeToggle, .navbar {
    float: none;
    text-align: center;
    display: block;
    margin: 10px auto;
  }

  .navbar {
    flex-direction: column;
    gap: 10px;
  }
}
