:root {
  --bg: #ffffff;
  --text: #111827;
  --text-light: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: rgba(0,0,0,.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --max-width: 1200px;
  --transition: all 0.3s ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

/* ✅ สำคัญ: ให้ body สูงเต็ม viewport */
html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;

  /* ✅ footer stick bottom */
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: var(--transition); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.container {
  width: min(var(--max-width), calc(100% - 40px));
  margin: 0 auto;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

/* Visually hidden utility (keeps semantic headings without showing them) */
.visually-hidden {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* HEADER */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
  position: relative;
}

.nav-center { display: flex; gap: 32px; align-items: center; }

.nav-center a {
  font-weight: 500;
  font-size: 15px;
  color: var(--text-light);
  position: relative;
}

.nav-center a:hover { color: var(--accent); }

.nav-center a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.nav-center a:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  position: absolute;
  right: 20px;
  font-size: 24px;
  color: var(--text);
}

/* HERO */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

#tsparticles { position: absolute; inset: 0; z-index: 0; }

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 780px;
}

.profile-image {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 32px;
  box-shadow: var(--shadow-lg);
}
.profile-image img { width: 100%; height: 100%; object-fit: cover; }

/* Updated: name + nickname same size, both blue */
.hero-identity {
  margin-bottom: 14px;
  line-height: 1.1;
}

.hero-fullname,
.hero-nickname {
  display: inline-block;
  font-size: 42px;             /* same size for both */
  font-weight: 700;
  color: #1e40af;;        /* blue for both */
}

.hero-nickname { margin-left: 10px; }

/* Updated: title is grey + bold */
.hero-title {
  font-size: 25px;
  font-weight: 700;   /* จาก 800 → 700 */
  color: #374151;     /* เข้มขึ้นนิด */
}

/* Updated: location italic only (no emoji, no "based in") */
.hero-location {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 22px;
}
.hero-location em { font-style: italic; }

.hero-bio {
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-light);
  margin: 0 auto 32px;
  max-width: 680px;
}

/* Social links (only LinkedIn + GitHub now) */
.hero-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  align-items: center;
}

.hero-links a {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text);
  transition: var(--transition);
}

.hero-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* SECTIONS */
.section { padding: 100px 0; }

.section.alt {
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,.02), transparent);
}

.section-label {
  font-size: 14px;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.section-label--big {
  font-size: 30px;      
  font-weight: 800;    
  letter-spacing: 2px; 
  margin-bottom: 18px;
}

.section-label--centered {
  text-align: center;
  position: relative;
}

.section-label--centered::after {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  background: var(--accent);
  margin: 10px auto 0;
  border-radius: 2px;
}


.section-label--muted {
  color: rgba(37, 99, 235, 0.9);
  margin-top: 18px;
  margin-bottom: 18px;
}

.section h2 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 14px;
}

.subhead {
  font-size: 18px;
  color: var(--text-light);
  margin: 0 auto 28px;
  max-width: 760px;
  text-align: center;
}

/* ABOUT */
.about-content { max-width: 820px; margin: 0 auto; }
.about-content p {
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-light);
  margin-bottom: 18px;
}

/* JOURNEY */
.journey-group { margin-bottom: 64px; }
.journey-group:last-child { margin-bottom: 0; }

.journey-subtitle {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 26px;
}

.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.journey-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  gap: 18px;
  transition: var(--transition);
}

.journey-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.journey-icon {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.journey-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.journey-content h4 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.journey-company {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.journey-date {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 10px;
}

.journey-desc {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-light);
}

/* EXPERTISE */
.prof-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 28px;
  margin-top: 40px;
}

.prof-item {
  text-align: center;
  padding: 32px 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.prof-item:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.prof-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: white;
}

.prof-item h4 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
}

.prof-item p {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.65;
}

/* PORTFOLIO TIMELINE (vertical + zigzag center divider) */
.portfolio-timeline {
  position: relative;
  margin-top: 44px;
  padding: 8px 0;
}

.portfolio-timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 4px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.35) 0 10px,
    rgba(0,0,0,0) 10px 20px
  );
  border-radius: 999px;
}

.portfolio-item {
  position: relative;
  display: flex;
  margin: 0 0 34px;
}

.portfolio-item::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 26px;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
}

.portfolio-item:nth-child(odd) { justify-content: flex-start; }
.portfolio-item:nth-child(even) { justify-content: flex-end; }

.portfolio-card {
  width: min(520px, 100%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.portfolio-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.portfolio-image { width: 100%; height: 240px; overflow: hidden; background: #f3f4f6; }
.portfolio-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.portfolio-card:hover .portfolio-image img { transform: scale(1.05); }

.portfolio-content { padding: 22px 22px 24px; }
.portfolio-content h3 { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
.portfolio-content p { font-size: 15px; color: var(--text-light); margin-bottom: 14px; line-height: 1.65; }

.portfolio-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
}
.portfolio-link:hover { gap: 12px; }

/* BLOG */
.blog-scroll {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 18px 0 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.blog-scroll::-webkit-scrollbar { height: 8px; }
.blog-scroll::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.blog-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

.blog-card {
  min-width: 350px;
  max-width: 350px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  scroll-snap-align: start;
  transition: var(--transition);
  position: relative;
}

.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

.blog-number {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 48px;
  font-weight: 800;
  color: rgba(0,0,0,.05);
}

.blog-card h3 { font-size: 20px; font-weight: 800; margin-bottom: 12px; line-height: 1.4; }
.blog-card p { font-size: 15px; color: var(--text-light); margin-bottom: 18px; line-height: 1.65; }

.blog-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
}
.blog-link:hover { gap: 12px; }

/* CONTACT */
.contact-container { max-width: 820px; }
.contact-intro { text-align: center; margin-bottom: 40px; }

.contact-form {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow-sm);
}

.form-group { margin-bottom: 22px; }
.form-group label { display: block; font-size: 14px; font-weight: 800; margin-bottom: 8px; }

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-submit {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-submit:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* FOOTER */
.footer-minimal {
  background: #f9fafb;
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}
.footer-minimal p { font-size: 14px; color: var(--text-light); }

/* SKIP LINK */
.skip-link { position: absolute; left: -9999px; z-index: 999; }
.skip-link:focus {
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
}

/* Responsive: portfolio timeline collapses */
@media (max-width: 900px) {
  .portfolio-timeline::before { left: 16px; transform: none; }
  .portfolio-item { justify-content: flex-start !important; padding-left: 34px; }
  .portfolio-item::before { left: 16px; transform: none; }
  .portfolio-card { width: 100%; }
}

@media (max-width: 768px) {
  .nav-center {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: white;
    border-top: 1px solid var(--border);
    flex-direction: column;
    padding: 20px;
    gap: 16px;
  }
  .nav-center.open { display: flex; }
  .nav-toggle { display: block; }

  .hero-fullname,
  .hero-nickname { font-size: 32px; } /* keep same size even on mobile */

  .section { padding: 60px 0; }
  .section h2 { font-size: 32px; }

  .prof-grid { grid-template-columns: 1fr; }
  .journey-grid { grid-template-columns: 1fr; }
  .blog-card { min-width: 300px; max-width: 300px; }
  .contact-form { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===== CONTACT FORM STATES ===== */

.btn-submit {
  position: relative;
  overflow: hidden;
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Loader (spinner) */
.btn-loader {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: white;
  border-radius: 50%;
  display: none;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-submit.loading .btn-text {
  display: none;
}

.btn-submit.loading .btn-loader {
  display: inline-block;
}

/* Success message */
.form-success {
  display: none;
  margin-top: 18px;
  text-align: center;
  font-weight: 600;
  color: #16a34a;
  animation: fadeInUp 0.4s ease;
}

.form-success.show {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
}
