/* ==========================================================
   site.css — ของที่ใช้ร่วมกันทั้งเว็บ (หน้า home + 4 หน้า sim)
   โทนสี "Blueprint Tech": ขาว (primary) + น้ำเงิน (secondary) + กรมท่าเข้ม
   ลุคเดียวคงที่ ไม่มีโหมดมืด/สว่าง
   ========================================================== */
:root {
  --navy: #0b1c33;
  --navy-2: #16305a;
  --blue: #2563eb;
  --blue-600: #1d4ed8;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --sky-accent: #93c5fd;
  --white: #ffffff;
  --bg: #f7f9fc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff; /* ชื่อเดิมที่ app.js อ่านไปวาดกราฟ */
  --gold: #f59e0b;

  --font-display: 'Chakra Petch', 'IBM Plex Sans Thai', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Thai', 'Chakra Petch', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --nav-h: 64px;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.15;
  text-wrap: balance;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

/* ==========================================================
   NAVBAR (เหมือนกันทุกหน้า)
   ========================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 3vw, 36px);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  transition: transform 0.25s ease;
}

/* มือถือ: ซ่อนตอนเลื่อนลง โผล่ตอนเลื่อนขึ้น (คุมจาก app.js) */
@media (max-width: 600px) {
  .navbar.topbar-hidden {
    transform: translateY(-100%);
  }
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.nav-brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
}

.nav-brand-mark .icon {
  width: 22px;
  height: 22px;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.nav-brand-text small {
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav-title,
.nav-brand-text strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover,
.nav-link[aria-expanded='true'] {
  background: var(--blue-50);
  color: var(--blue);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle .icon {
  transition: transform 0.2s ease;
}

.nav-dropdown-toggle[aria-expanded='true'] .icon {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 230px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(11, 28, 51, 0.16);
}

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

.nav-dropdown-menu a .icon {
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.nav-dropdown-menu a:hover {
  background: var(--blue-50);
}

.nav-dropdown-menu a[aria-current='page'] {
  background: var(--navy);
  color: var(--white);
}

.nav-dropdown-menu a[aria-current='page'] .icon {
  color: var(--sky-accent);
}

.nav-lang {
  height: 40px;
  min-width: 48px;
  margin: 0 4px; /* ปุ่มภาษาอยู่กลาง ระหว่าง Simulators กับ Home */
  padding: 0 12px;
  border: 1.5px solid var(--navy);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-lang:hover {
  background: var(--navy);
  color: var(--white);
}

@media (max-width: 600px) {
  :root {
    --nav-h: 58px;
  }
  /* มือถือ: เหลือแค่สัญลักษณ์การทดลอง + ไอคอน Home (ชื่อซ่อนไว้แต่ screen reader ยังอ่านได้) */
  .nav-home span {
    display: none;
  }
  .nav-brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .nav-link {
    padding: 0 8px;
  }
  .nav-title,
  .nav-brand-text strong {
    font-size: 0.95rem;
  }
  .nav-brand-mark {
    width: 34px;
    height: 34px;
  }
}

/* ==========================================================
   ปุ่ม
   ========================================================== */
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.primary-button {
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: var(--white);
  font-size: 1.02rem;
  letter-spacing: 0.02em;
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-600);
}

.primary-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button:disabled {
  background: var(--navy-2);
  cursor: not-allowed;
  opacity: 0.8;
}

.secondary-button {
  padding: 7px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 0.82rem;
}

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.secondary-button .icon {
  width: 16px;
  height: 16px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
