:root {
  --bg-primary: #f8f9fa;
  --bg-card: #ffffff;
  --text-primary: #212529;
  --text-muted: #6c757d;
  --accent: #063970;
  --accent-hover: #052d5a;
  --border: #e2e6ea;
  --shadow: rgba(0, 0, 0, 0.05);
  --shadow-md: rgba(0, 0, 0, 0.12);
  --btn-secondary-bg: #e2e6ea;
  --btn-secondary-text: #212529;
  --nav-bg: #063970;
  --nav-text: #ffffff;
  --nav-hover-bg: #ffffff;
  --nav-hover-text: #063970;
  --line-color: #063970;
  --input-bg: #ffffff;
  --input-border: #ced4da;
  --input-focus-shadow: rgba(6, 57, 112, 0.15);
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --text-primary: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --border: #334155;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-md: rgba(0, 0, 0, 0.45);
  --btn-secondary-bg: #334155;
  --btn-secondary-text: #e2e8f0;
  --nav-bg: #1e293b;
  --nav-text: #e2e8f0;
  --nav-hover-bg: #3b82f6;
  --nav-hover-text: #ffffff;
  --line-color: #3b82f6;
  --input-bg: #1e293b;
  --input-border: #475569;
  --input-focus-shadow: rgba(59, 130, 246, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 400;
  font-style: normal;
}

html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* NAV */
nav {
  background-color: var(--nav-bg);
  color: var(--nav-text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 7vw;
  position: sticky;
  top: 0;
  z-index: 999;
  transition: background-color 0.3s ease;
}

nav {
  font-weight: bold;
  font-size: 1.5rem;
}

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

nav .logo img {
  background-color: white;
  border-radius: 5%;
  width: 100px;
  height: auto;
  margin-right: 10px;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 25px;
  margin-right: 5vw;
}

nav ul li a {
  text-decoration: none;
  color: var(--nav-text);
  font-weight: bold;
  font-size: 1.2rem;
}

nav ul li a:hover {
  background-color: var(--nav-hover-bg);
  color: var(--nav-hover-text);
  padding: 7px 10px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

/* THEME TOGGLE */
.theme-toggle {
  background: transparent;
  border: 2px solid var(--nav-text);
  color: var(--nav-text);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle:hover {
  background-color: var(--nav-hover-bg);
  color: var(--nav-hover-text);
  border-color: var(--nav-hover-bg);
}

.icon-moon { display: none; }
.icon-sun  { display: inline; }
[data-theme="dark"] .icon-moon { display: inline; }
[data-theme="dark"] .icon-sun  { display: none; }

.menu-toggle {
  display: none;
  flex-direction: column;
  cursor: pointer;
}

.menu-toggle span {
  height: 3px;
  width: 25px;
  background: var(--nav-text);
  margin-bottom: 4px;
  border-radius: 2px;
}

/* HEADER */
header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px 5vw;
}

header h1 {
  font-size: 2.5rem;
}

header p {
  margin: 10px 0 20px;
  color: var(--text-muted);
}

.cta {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 40px;
}

h2 {
  margin-bottom: 20px;
}

ul {
  list-style: inside;
}

.cta button {
  padding: 10px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.cta button:hover {
  opacity: 0.85;
}

.cta .primary {
  background-color: var(--accent);
  color: white;
}

.cta .secondary {
  background-color: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
}

/* SECTIONS */
section {
  margin-bottom: 40px;
  padding: 20px 5vw;
}

.flex-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10%;
  padding-left: 10%;
  padding-right: 10%;
}

.about, .services {
  flex: 1;
  min-width: 280px;
}

.about {
  display: flex;
  flex-direction: column;
}

.description {
  background-color: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 40px;
  box-shadow: 0 2px 10px var(--shadow);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.about-me {
  background-color: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px var(--shadow);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.about-me p + p {
  margin-top: 12px;
}

.about img {
  max-width: 200px;
  height: auto;
  border-radius: 50%;
  margin-bottom: 15px;
}

/* SKILLS */
.box-skills {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 10px 10px 20px;
  margin-bottom: 10px;
  box-shadow: 0 2px 10px var(--shadow);
  background-color: var(--bg-card);
  flex: 1;
  max-width: 270px;
  min-height: 200px;
  min-width: 270px;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.services .box, .projects .box {
  background-color: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px var(--shadow);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

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

.skills {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* CONTACT */
.contact-section {
  text-align: center;
  padding: 60px 20px;
}

.contact-section h2 {
  font-size: 1.8rem;
  margin-bottom: 15px;
}

.contact-intro {
  color: var(--text-muted);
  margin-bottom: 30px;
  font-size: 1rem;
}

.contact-section .line {
  width: 2px;
  height: 40px;
  background-color: var(--line-color);
  margin: 0 auto 20px;
  transition: background-color 0.3s ease;
}

/* FORM */
#contact-form {
  max-width: 650px;
  margin: 0 auto 20px;
  text-align: left;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
  flex: 1;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group label span {
  color: var(--accent);
}

.form-group input,
.form-group textarea {
  padding: 10px 14px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: "Bai Jamjuree", sans-serif;
  background-color: var(--input-bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--input-focus-shadow);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.btn-submit {
  background-color: var(--accent);
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: "Bai Jamjuree", sans-serif;
  cursor: pointer;
  display: block;
  width: 100%;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.btn-submit:hover {
  background-color: var(--accent-hover);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#form-status {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
}

.form-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.form-error {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

[data-theme="dark"] .form-success {
  background-color: #064e3b;
  color: #6ee7b7;
  border-color: #059669;
}

[data-theme="dark"] .form-error {
  background-color: #7f1d1d;
  color: #fca5a5;
  border-color: #dc2626;
}

.contact-alt {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 10px;
}

.contact-alt a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.contact-alt a:hover {
  text-decoration: underline;
}

/* FOOTER */
footer {
  background-color: var(--nav-bg);
  color: var(--nav-text);
  text-align: center;
  padding: 30px 20px;
  transition: background-color 0.3s ease;
}

footer .icons {
  margin-bottom: 10px;
}

.first-icon {
  width: 55px;
  height: 35px;
  background-color: white;
  margin: 0 10px;
  border-radius: 5%;
}

.second-icon {
  width: 30px;
  height: 30px;
  background-color: white;
  margin: 0 10px;
  border-radius: 5%;
}

footer .location {
  margin-bottom: 10px;
  font-weight: 500;
}

footer .copyright {
  font-size: 0.85rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  nav ul {
    display: none;
    flex-direction: column;
    background: var(--nav-bg);
    position: absolute;
    top: 70px;
    right: 20px;
    width: 200px;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-md);
  }

  nav ul.show {
    display: flex;
  }

  .menu-toggle {
    display: flex;
  }

  header h1 {
    font-size: 2rem;
  }

  .cta {
    flex-direction: column;
    align-items: center;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

@media (max-width: 480px) {
  nav .logo img {
    width: 80px;
  }

  h2 {
    text-align: center;
    font-weight: 500;
  }

  .flex-grid {
    flex-direction: column;
  }

  .skills {
    justify-items: center;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  header {
    margin-bottom: 0;
  }

  section {
    margin-bottom: 0;
  }
}
