:root {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-surface-alt: #f8fafc;
  --color-text: #1e293b;
  --color-muted: #64748b;
  --color-accent: #15803d;
  --color-accent-hover: #166534;
  --color-accent-light: #dcfce7;
  --color-border: #e2e8f0;
  --color-nav-bg: #ffffff;
  --color-nav-hover: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 24px rgba(15, 23, 42, .08);
  --radius: 12px;
  --font-main: 'IBM Plex Sans Thai', 'IBM Plex Sans', 'Segoe UI', 'Tahoma', sans-serif;
  --font-display: 'IBM Plex Sans Thai', 'IBM Plex Sans', 'Segoe UI', 'Tahoma', sans-serif;
  --font-size-base: 16px;
  --line-height-body: 1.65;
  --letter-tight: -0.015em;
}

body {
  margin: 0;
  font-family: var(--font-main);
  font-size: var(--font-size-base);
  font-weight: 400;
  color: var(--color-text);
  background:
    radial-gradient(900px 450px at 15% 0%, rgba(21, 128, 61, .05), transparent 55%),
    radial-gradient(700px 400px at 85% 5%, rgba(22, 163, 74, .04), transparent 60%),
    linear-gradient(180deg, #f8fafc 0%, var(--color-bg) 100%);
  line-height: var(--line-height-body);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  letter-spacing: var(--letter-tight);
  line-height: 1.3;
  font-weight: 600;
  color: var(--color-text);
}

p {
  margin: 0 0 0.75em;
}

p.lead {
  font-size: 1.05rem;
  line-height: 1.7;
  font-weight: 400;
  color: var(--color-muted);
}

p:last-child {
  margin-bottom: 0;
}

/* === Header === */
header {
  background: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .logo-area {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

header img {
  height: 32px;
  width: auto;
}

header h1 {
  margin: 0;
  font-size: 1.35em;
  font-weight: 600;
  color: var(--color-accent);
}

/* === Hamburger Toggle Button === */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1em;
  color: var(--color-text);
  transition: background .2s, color .2s, border-color .2s;
}

.nav-toggle:hover {
  background: var(--color-nav-hover);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* === Top Navigation Menu === */
nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

nav a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95em;
  padding: 8px 14px;
  border-radius: 8px;
  transition: background .2s, color .2s;
}

nav a:hover {
  background: var(--color-nav-hover);
  color: var(--color-accent);
}

nav a.is-active,
.nav-dropdown-toggle.is-active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

/* Nav item with a submenu (e.g. "Download" -> Datasheet / Manual) */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95em;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .2s;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.is-open .nav-dropdown-toggle {
  background: var(--color-nav-hover);
  color: var(--color-accent);
}

.nav-dropdown-toggle.is-active:hover {
  background: var(--color-accent-light);
  color: var(--color-accent);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 170px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
  overflow: hidden;
  z-index: 50;
}

.nav-dropdown.is-open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.9em;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border: none;
  background: none;
  border-radius: 0;
}

.nav-dropdown-menu a:hover {
  background: var(--color-nav-hover);
  color: var(--color-accent);
}

.nav-dropdown-menu a.is-active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: 600;
}

/* === Right section (search + login) === */
.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  justify-content: flex-end;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.lang-switch a.lang-btn {
  display: inline-block;
  padding: 5px 11px;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--color-muted);
  text-decoration: none;
  border: none;
  border-radius: 0;
  background: transparent;
  line-height: 1.2;
}

.lang-switch a.lang-btn:hover {
  background: var(--color-nav-hover);
  color: var(--color-accent);
  text-decoration: none;
}

.lang-switch a.lang-btn.is-active {
  background: var(--color-accent);
  color: #fff;
}

.search-form {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}

.search-form:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, .1);
  background: var(--color-surface);
}

.search-form input[type=search] {
  border: none;
  background: transparent;
  padding: 8px 0 8px 12px;
  outline: none;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.95em;
  width: 140px;
  transition: width 0.25s ease-in-out;
}

.search-form input[type=search]:focus {
  width: 200px;
}

.search-button {
  background: transparent;
  border: none;
  padding: 8px 12px;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-button:hover {
  color: var(--color-accent);
  background-color: var(--color-nav-hover);
}

.nav-right a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 600;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(21, 128, 61, .2);
  background: var(--color-accent-light);
  transition: background .2s, color .2s;
  line-height: 1;
}

.nav-right a:hover {
  background: #bbf7d0;
  text-decoration: none;
}

.nav-user-menu {
  position: relative;
}

.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.85em;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, border-color .2s;
}

.nav-user-btn:hover,
.nav-user-menu.is-open .nav-user-btn {
  background: var(--color-nav-hover);
  border-color: var(--color-border);
}

.nav-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .1);
  overflow: hidden;
  z-index: 50;
}

.nav-user-menu.is-open .nav-user-dropdown {
  display: block;
}

.nav-user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: none;
  border: none;
  background: none;
}

.nav-user-dropdown a:hover {
  background: var(--color-nav-hover);
  color: var(--color-accent);
}

/* === Main === */
main {
  max-width: 1100px;
  margin: 40px auto 40px;
  padding: 0 25px;
  flex: 1 0 auto;
  width: 100%;
  box-sizing: border-box;
}

section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

h2 {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent-light);
  padding-bottom: 8px;
  margin: 0 0 16px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: var(--letter-tight);
}

p,
li {
  font-size: 1em;
  color: var(--color-text);
}

main p a,
main li a {
  color: var(--color-accent);
  font-weight: 600;
}

main p a:hover,
main li a:hover {
  color: var(--color-accent-hover);
}

ul {
  margin: 0;
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
}

li::marker {
  color: var(--color-accent);
}

/* === Buttons === */
.button-row {
  text-align: center;
  margin-top: 10px;
}

.button {
  background: var(--color-accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  display: inline-block;
  margin: 10px 8px 0;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 2px 8px rgba(21, 128, 61, .2);
}

.button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(21, 128, 61, .25);
}

.button.secondary {
  background: var(--color-surface);
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  box-shadow: none;
}

.button.secondary:hover {
  background: var(--color-accent-light);
}

/* === Footer === */
footer {
  text-align: center;
  font-size: 0.9em;
  color: #000000;
  background: var(--color-surface);
  padding: 22px 20px;
  border-top: 1px solid var(--color-border);
}

/* === Responsive === */
@media (max-width: 1100px) {
  header {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
  }

  header .logo-area {
    order: 1;
    flex: 0 0 auto;
  }

  .nav-right {
    order: 2;
    flex: 0 0 auto;
    gap: 10px;
    margin-left: auto;
  }

  .nav-toggle {
    display: inline-flex;
    order: 3;
    margin-left: 6px;
  }

  nav#siteNav {
    order: 4;
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px 0 6px 0;
    margin-top: 10px;
    border-top: 1px solid var(--color-border);
  }

  nav#siteNav.is-open {
    display: flex;
  }

  nav#siteNav a,
  nav#siteNav .nav-dropdown-toggle {
    width: 100%;
    box-sizing: border-box;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 0.95em;
  }

  nav#siteNav .nav-dropdown {
    width: 100%;
  }

  nav#siteNav .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--color-accent);
    background: var(--color-surface-alt);
    margin: 4px 0 6px 12px;
    border-radius: 6px;
    min-width: unset;
  }

  .nav-user-dropdown {
    right: 0;
    left: auto;
  }
}

@media (max-width: 480px) {
  header {
    padding: 8px 12px;
  }

  header img {
    height: 28px;
  }

  .lang-switch a {
    padding: 4px 8px;
    font-size: 0.8em;
  }
}