:root {
  --green: #1b6b3c;
  --green-dark: #0f4526;
  --green-light: #2f9457;
  --yellow: #f5b400;
  --yellow-light: #ffe08a;
  --bg: #081712;
  --bg-2: #0d2a1e;
  --card-bg: #ffffff;
  --text: #e6f2ea;
  --text-muted: #9db6a8;
  --card-text: #1f2a22;
  --card-text-muted: #62705f;
  --radius: 16px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --nav-height: 72px;
  --brand-teal: #2dd4bf;
  --brand-orange: #f0883e;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Noto Sans Thai", "Poppins", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

/* ---------- Digital circuit background ---------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cg fill='none' stroke='rgba(45,212,191,0.28)' stroke-width='1.5'%3E%3Cpath d='M0 40 H70 V100 H150 V40 H240'/%3E%3Cpath d='M0 180 H50 V130 H120'/%3E%3Cpath d='M190 0 V60 H240'/%3E%3Cpath d='M190 240 V190 H130 V150'/%3E%3Cpath d='M60 240 V210 H20 V160'/%3E%3C/g%3E%3Cg fill='rgba(240,136,62,0.5)'%3E%3Ccircle cx='70' cy='40' r='3.5'/%3E%3Ccircle cx='150' cy='100' r='3.5'/%3E%3Ccircle cx='120' cy='130' r='3'/%3E%3Ccircle cx='190' cy='60' r='3'/%3E%3Ccircle cx='130' cy='150' r='3'/%3E%3C/g%3E%3Cg fill='rgba(45,212,191,0.4)'%3E%3Ccircle cx='0' cy='40' r='2.5'/%3E%3Ccircle cx='240' cy='40' r='2.5'/%3E%3Ccircle cx='0' cy='180' r='2.5'/%3E%3Ccircle cx='190' cy='0' r='2.5'/%3E%3Ccircle cx='190' cy='240' r='2.5'/%3E%3Ccircle cx='60' cy='240' r='2.5'/%3E%3Ccircle cx='20' cy='160' r='2.5'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 240px 240px;
  background-repeat: repeat;
  opacity: 0.55;
  animation: circuit-drift 50s linear infinite;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 20%, rgba(45, 212, 191, 0.12), transparent 45%),
              radial-gradient(circle at 80% 75%, rgba(240, 136, 62, 0.1), transparent 45%);
}

@keyframes circuit-drift {
  0% { background-position: 0 0; }
  100% { background-position: 240px 240px; }
}

.navbar,
.hero,
.container,
.train-scene,
footer {
  position: relative;
  z-index: 1;
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: transparent;
}

.navbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
}

.navbar .brand-logo {
  display: block;
  height: calc(var(--nav-height) - 16px);
  width: auto;
  object-fit: contain;
  background: #fff;
  padding: 4px 8px;
  border-radius: 8px;
}

.navbar nav {
  display: flex;
  gap: 6px;
}

.navbar nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  transition: all 0.2s ease;
}

.navbar nav a:hover {
  color: var(--brand-teal);
  background: rgba(45, 212, 191, 0.1);
}

.navbar nav a.active {
  color: #fff;
  background: var(--green);
}

.navbar .menu-toggle {
  display: none;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: var(--text);
  cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  padding: 56px 24px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 25%, rgba(45, 212, 191, 0.16), transparent 42%),
              radial-gradient(circle at 85% 70%, rgba(240, 136, 62, 0.14), transparent 45%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}

.hero .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(45, 212, 191, 0.3);
  color: var(--text);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}

.hero .badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-orange);
}

.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.hero h1 .brand-aggie {
  color: var(--brand-teal);
}

.hero h1 .brand-service {
  color: var(--brand-orange);
}

.brand-underline {
  width: min(280px, 60%);
  height: 4px;
  margin: 0 auto 30px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand-orange), var(--brand-teal), var(--brand-orange));
  background-size: 200% 100%;
  animation: underline-flow 3s linear infinite;
}

@keyframes underline-flow {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

.search-box {
  margin: 30px auto 0;
  max-width: 480px;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 999px;
  padding: 6px 20px;
  box-shadow: var(--shadow);
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.95rem;
  padding: 10px 8px;
  outline: none;
  font-family: inherit;
  color: var(--card-text);
}

/* ---------- Layout ---------- */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 90px;
  position: relative;
}

.section-block {
  scroll-margin-top: calc(var(--nav-height) + 16px);
  margin-top: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 3px solid var(--accent);
  border-radius: calc(var(--radius) + 6px);
  padding: 28px 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.section-block::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%);
  pointer-events: none;
}

.section-block:first-child {
  margin-top: 0;
}

/* ---------- Two-column top row (Service + Online Forms) ---------- */
.two-col-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-top: 0;
}

.two-col-row .section-block {
  margin-top: 0;
}

@media (max-width: 900px) {
  .two-col-row {
    grid-template-columns: 1fr;
  }
}

.section-title {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 22px;
  position: relative;
}

.section-title .badge-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 1px solid var(--accent);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 45%, transparent);
  color: var(--accent);
}

.badge-icon svg {
  width: 22px;
  height: 22px;
}

.section-title h2 {
  font-size: 1.2rem;
  margin: 0;
  color: var(--text);
}

.section-title span {
  display: block;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 600;
}

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

.card {
  position: relative;
  background: color-mix(in srgb, var(--accent, var(--green)) 12%, var(--card-bg));
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
  padding: 10px 14px;
  text-decoration: none;
  color: var(--card-text);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease, z-index 0s 0.15s;
  border: 1px solid rgba(27, 107, 60, 0.08);
  border-left: 3px solid var(--accent, var(--green));
}

.card:hover {
  transform: translateY(-5px) scale(1.025);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent, var(--green)) 35%, rgba(0, 0, 0, 0.18));
  background: var(--card-bg);
  border-color: color-mix(in srgb, var(--accent, var(--green)) 35%, transparent);
  border-left-color: var(--accent, var(--green));
}

.card:active {
  transform: translateY(-2px) scale(0.99);
}

.card .icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent, var(--green));
  color: #fff;
  transition: background 0.25s ease, color 0.25s ease;
}

.card .icon svg {
  width: 17px;
  height: 17px;
}

.card:hover .icon {
  background: color-mix(in srgb, var(--accent, var(--green)) 16%, white);
  color: var(--accent, var(--green));
}

.card .go {
  transition: transform 0.25s ease;
}

.card:hover .go {
  transform: translateX(4px);
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card h3 {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.3;
}

.card p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--card-text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card .go {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--accent, var(--green));
  font-weight: 700;
}

/* ---------- Disabled cards (no link yet) ---------- */
.card.card-disabled {
  --accent: #8a94a3;
  background: color-mix(in srgb, var(--accent) 8%, var(--card-bg));
  filter: grayscale(0.6);
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.card.card-disabled .go {
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Compact grid (Online Forms) ---------- */
.grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 9px;
}

.grid-compact .card {
  padding: 9px 12px;
  gap: 10px;
  border-radius: 9px;
}

.grid-compact .card .icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.grid-compact .card .icon svg {
  width: 15px;
  height: 15px;
}

.grid-compact .card h3 {
  font-size: 0.8rem;
}

.grid-compact .card p {
  font-size: 0.7rem;
}

.grid-compact .card .go {
  font-size: 0.84rem;
}

/* ---------- Square grid (Service) ---------- */
.grid-square {
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
}

.grid-square .card {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 180px;
  padding: 18px 12px;
  gap: 10px;
  overflow: hidden;
}

.grid-square .card .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.grid-square .card .icon svg {
  width: 24px;
  height: 24px;
}

.grid-square .card-body {
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 0;
}

.grid-square .card h3 {
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.grid-square .card p {
  -webkit-line-clamp: 2;
  font-size: 0.7rem;
}

.grid-square .card .go {
  display: none;
}

.grid-square .card-disabled .go {
  display: block;
  font-size: 0.62rem;
  margin-top: -2px;
}

.no-result {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  display: none;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  padding: 30px 24px 44px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer .gold-line {
  width: 60px;
  height: 3px;
  background: var(--yellow);
  margin: 0 auto 16px;
  border-radius: 2px;
}

/* ---------- Train scene ---------- */
.train-scene {
  position: relative;
  z-index: 1;
  height: 130px;
  overflow: hidden;
  background: linear-gradient(180deg, #eef3f0 0%, #dde6e0 100%);
}

.train-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 48px;
  height: 6px;
  background: #b7c2bc;
}

.train-pillars {
  position: absolute;
  left: 0;
  right: 0;
  top: 54px;
  bottom: 0;
  display: flex;
  justify-content: space-around;
  padding: 0 40px;
}

.train-pillars span {
  width: 10px;
  background: #b7c2bc;
  border-radius: 0 0 3px 3px;
}

.train-bushes {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 10px;
}

.train-bushes span {
  width: 90px;
  height: 62px;
  margin-bottom: -14px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.9;
  box-shadow:
    62px 6px 0 -12px var(--green),
    -62px 6px 0 -12px var(--green),
    34px -22px 0 -18px var(--green-light),
    -34px -22px 0 -18px var(--green-light),
    0 -32px 0 -22px var(--green-light);
  transform-origin: bottom center;
  animation: bush-sway 3.5s ease-in-out infinite;
}

.train-bushes span:nth-child(even) {
  background: var(--green-light);
  box-shadow:
    62px 6px 0 -12px var(--green-light),
    -62px 6px 0 -12px var(--green-light),
    34px -22px 0 -18px var(--green),
    -34px -22px 0 -18px var(--green),
    0 -32px 0 -22px var(--green);
}

.train-bushes span:nth-child(1) { animation-delay: 0s; }
.train-bushes span:nth-child(2) { animation-delay: 0.4s; }
.train-bushes span:nth-child(3) { animation-delay: 0.8s; }
.train-bushes span:nth-child(4) { animation-delay: 1.2s; }
.train-bushes span:nth-child(5) { animation-delay: 0.2s; }
.train-bushes span:nth-child(6) { animation-delay: 0.6s; }

@keyframes bush-sway {
  0%, 100% { transform: rotate(-3deg) scaleY(1); }
  50% { transform: rotate(3deg) scaleY(1.03); }
}

.train-sign {
  position: absolute;
  left: 30px;
  bottom: 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

.sign-board {
  background: var(--green-dark);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  text-align: center;
  line-height: 1.35;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  border: 2px solid #fff;
  white-space: nowrap;
}

.sign-board strong {
  display: block;
  font-size: 0.85rem;
}

.sign-board span {
  font-size: 0.62rem;
  opacity: 0.9;
}

.sign-pole {
  width: 4px;
  height: 40px;
  background: #8a948e;
}

.train-wrap {
  position: absolute;
  top: 5px;
  right: -320px;
  width: 320px;
  animation: train-move 14s ease infinite;
}

.train-svg {
  width: 100%;
  height: auto;
  display: block;
  transform: scaleX(-1);
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25));
}

@keyframes train-move {
  0% { transform: translateX(0); animation-timing-function: ease-out; }
  45% { transform: translateX(calc(-100vw + 220px)); animation-timing-function: linear; }
  70% { transform: translateX(calc(-100vw + 220px)); animation-timing-function: ease-in; }
  100% { transform: translateX(calc(-100vw - 320px)); }
}

/* ---------- Social sidebar ---------- */
.social-sidebar {
  position: fixed;
  top: 140px;
  right: 14px;
  z-index: 49;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

@keyframes slide-in-side {
  from { transform: translateX(70px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.social-sidebar > * {
  animation-name: slide-in-side;
  animation-duration: 0.5s;
  animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  animation-fill-mode: backwards;
}

.social-sidebar > *:nth-child(1) { animation-delay: 0.1s; }
.social-sidebar > *:nth-child(2) { animation-delay: 0.2s; }
.social-sidebar > *:nth-child(3) { animation-delay: 0.3s; }
.social-sidebar > *:nth-child(4) { animation-delay: 0.4s; }
.social-sidebar > *:nth-child(5) { animation-delay: 0.5s; }
.social-sidebar > *:nth-child(6) { animation-delay: 0.6s; }

.phone-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--yellow-light), var(--yellow));
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.phone-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.phone-btn:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

@keyframes phone-pulse {
  0% { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(245, 180, 0, 0.55); }
  70% { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 12px rgba(245, 180, 0, 0); }
  100% { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(245, 180, 0, 0); }
}

.phone-btn {
  animation-name: slide-in-side, phone-pulse;
  animation-duration: 0.5s, 2.2s;
  animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1), ease-out;
  animation-fill-mode: backwards, none;
  animation-delay: 0.1s, 0.6s;
  animation-iteration-count: 1, infinite;
}

@keyframes icon-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.floating-cta svg,
.social-btn svg {
  animation: icon-bounce 2.4s ease-in-out infinite;
}

.floating-cta svg { animation-delay: 0s; }
.social-facebook svg { animation-delay: 0.2s; }
.social-tiktok svg { animation-delay: 0.4s; }
.social-youtube svg { animation-delay: 0.6s; }

.floating-cta,
.social-btn {
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.floating-cta {
  background: linear-gradient(135deg, var(--green), var(--green-light));
}

.floating-cta svg,
.social-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.floating-cta:hover,
.social-btn:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

.social-map {
  background: #14b8a6;
}

.social-facebook {
  background: #1877f2;
}

.social-tiktok {
  background: #010101;
}

.social-youtube {
  background: #ff0000;
}

@media (max-width: 480px) {
  .social-sidebar {
    right: 8px;
    gap: 8px;
  }

  .phone-btn {
    height: 36px;
    padding: 0 12px;
    font-size: 0.72rem;
  }

  .floating-cta,
  .social-btn {
    width: 36px;
    height: 36px;
  }

  .floating-cta svg,
  .social-btn svg {
    width: 17px;
    height: 17px;
  }
}

@media (max-width: 760px) {
  .navbar nav {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(8, 23, 18, 0.97);
    border-bottom: 1px solid rgba(45, 212, 191, 0.15);
    flex-direction: column;
    padding: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-140%);
    opacity: 0;
    transition: all 0.25s ease;
    gap: 4px;
  }

  .navbar nav.open {
    transform: translateY(0);
    opacity: 1;
  }

  .navbar nav a {
    padding: 12px 16px;
    text-align: center;
  }

  .navbar .menu-toggle {
    display: block;
  }
}
