/* ---------- Base ---------- */
:root {
  --bg: #0e1116;
  --bg-soft: #151a22;
  --card: #171d26;
  --card-2: #1d242f;
  --line: #2a323f;
  --text: #e8ecf2;
  --muted: #9aa6b6;
  --accent: #ff7a18;
  --accent-2: #ffb547;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Thai", "Segoe UI", "Sarabun", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
ul.plain { list-style: none; padding: 0; margin: 0; }
.muted { color: var(--muted); }
.container { width: min(1200px, 92%); margin-inline: auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 17, 22, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1200; font-size: 1.4rem; border-radius: 12px;
}
.brand strong { display: block; font-size: 1.05rem; }
.brand small { display: block; color: var(--muted); font-size: .75rem; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; font-size: .95rem; }
.site-nav a.active { color: var(--accent); }
.site-nav a:not(.btn) { position: relative; padding: .2rem 0; }
.site-nav a:not(.btn)::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 2px; width: 0;
  background: var(--accent); transition: width .2s;
}
.site-nav a:not(.btn):hover::after { width: 100%; }
.nav-toggle, .nav-burger { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.3rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); color: inherit; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #1a1200; box-shadow: 0 6px 18px rgba(255, 122, 24, .28); }
.btn-primary:hover { color: #1a1200; }
.btn-ghost { border-color: var(--line); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: .5rem 1rem; font-size: .88rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 5.5rem 0 4.5rem;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(255, 122, 24, .18), transparent 60%),
    radial-gradient(700px 400px at 5% 110%, rgba(80, 130, 255, .12), transparent 60%),
    var(--bg);
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(circle at 50% 40%, #000, transparent 78%);
}
.hero > * { position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); border: 1px solid rgba(255, 122, 24, .35);
  background: rgba(255, 122, 24, .08); padding: .35rem .8rem; border-radius: 999px; margin-bottom: 1.2rem;
}
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); margin-bottom: 1rem; }
.hero h1 .hl { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 56ch; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.6rem; }

.spec-card { background: linear-gradient(160deg, var(--card-2), var(--card)); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem; box-shadow: var(--shadow); }
.spec-card h3 { font-size: 1rem; color: var(--muted); font-weight: 500; }
.spec-row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.spec-row:last-child { border-bottom: 0; }
.spec-row b { color: var(--accent-2); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 3rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; text-align: center; }
.stat .num { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .label { color: var(--muted); font-size: .85rem; }

/* ---------- Sections ---------- */
.section { padding: 4.5rem 0; }
.section.alt { background: var(--bg-soft); border-block: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 2.4rem; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-head p { color: var(--muted); margin: 0; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 1.2rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; transition: transform .2s, border-color .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); border-color: rgba(255, 122, 24, .5); box-shadow: var(--shadow); }
.card .icon { font-size: 1.9rem; margin-bottom: .6rem; }
.card h3 { font-size: 1.12rem; margin-bottom: .4rem; }
.card p { color: var(--muted); font-size: .93rem; }
.card .card-foot { margin-top: auto; padding-top: .9rem; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }

.thumb { aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; margin: -1.4rem -1.4rem 1rem; background: linear-gradient(135deg, #202836, #12161d); border-bottom: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.placeholder { display: grid; place-items: center; color: #3d4859; font-size: 3rem; }
.card > .thumb { border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- Badges / chips ---------- */
.badge { display: inline-block; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid var(--line); background: var(--card-2); color: var(--muted); }
.badge-ok { color: var(--ok); border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .1); }
.badge-warn { color: var(--warn); border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .1); }
.badge-bad { color: var(--bad); border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .1); }
.badge-accent { color: var(--accent); border-color: rgba(255, 122, 24, .35); background: rgba(255, 122, 24, .1); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }

/* ---------- Filters ---------- */
.filters { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.8rem; }
.filter-form { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.filter-form input[type="search"], .filter-form select {
  background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: .6rem .9rem; border-radius: 10px; font: inherit; font-size: .92rem; min-width: 180px;
}
.filter-form input[type="search"] { flex: 1; min-width: 220px; }
.filter-form input:focus, .filter-form select:focus { outline: 2px solid rgba(255, 122, 24, .5); outline-offset: 1px; }
.result-line { color: var(--muted); font-size: .9rem; margin-bottom: 1.2rem; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 780px; }
th, td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { background: var(--card-2); color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; }
tbody tr:hover { background: rgba(255, 122, 24, .04); }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Detail page ---------- */
.breadcrumb { color: var(--muted); font-size: .88rem; padding: 1.5rem 0 0; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
.detail-media { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: linear-gradient(135deg, #202836, #12161d); aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 5rem; color: #3d4859; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.spec-table { width: 100%; border-collapse: collapse; min-width: 0; }
.spec-table th { width: 42%; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; background: transparent; font-size: .92rem; position: static; }
.spec-table td, .spec-table th { white-space: normal; padding: .65rem .2rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-field { display: flex; flex-direction: column; gap: .35rem; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: .88rem; color: var(--muted); }
.form-input, .form-select, .form-textarea, .form-file {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line); color: var(--text);
  padding: .75rem .9rem; border-radius: 10px; font: inherit; font-size: .95rem;
}
.form-textarea { resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: 2px solid rgba(255, 122, 24, .5); outline-offset: 1px; border-color: transparent; }
.form-help { font-size: .8rem; color: var(--muted); }
.form-error { color: var(--bad); font-size: .82rem; }
.alert { border-radius: 10px; padding: .9rem 1.1rem; margin: 1.2rem 0; border: 1px solid var(--line); background: var(--card); }
.alert-success { border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .1); color: #bbf7d0; }
.alert-error { border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .1); }

/* ---------- CTA ---------- */
.cta {
  background: linear-gradient(135deg, rgba(255, 122, 24, .16), rgba(255, 181, 71, .06)), var(--card);
  border: 1px solid rgba(255, 122, 24, .3); border-radius: 20px;
  padding: 2.6rem; display: flex; gap: 1.5rem; justify-content: space-between; align-items: center; flex-wrap: wrap;
}
.cta h2 { margin-bottom: .3rem; }
.cta p { margin: 0; color: var(--muted); }

/* ---------- Steps ---------- */
.steps { counter-reset: step; display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; position: relative; }
.step::before {
  counter-increment: step; content: "0" counter(step);
  font-size: 1.6rem; font-weight: 800; color: rgba(255, 122, 24, .35); display: block; margin-bottom: .4rem;
}
.step h3 { font-size: 1.02rem; }
.step p { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 3rem 0 1.5rem; margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr; gap: 2rem; }
.footer-grid h4 { color: var(--accent); font-size: .95rem; letter-spacing: .05em; text-transform: uppercase; }
.footer-grid li { padding: .18rem 0; color: var(--muted); font-size: .92rem; }
.copyright { border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1.2rem; display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; flex-wrap: wrap; gap: .5rem; }

.empty { text-align: center; padding: 3.5rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero-grid, .detail-grid, .form-grid, .grid-4, .grid-3, .steps, .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-grid, .detail-grid, .footer-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .nav-burger { display: flex; flex-direction: column; gap: 5px; cursor: pointer; padding: .5rem; }
  .nav-burger span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    align-items: stretch; gap: .2rem; background: var(--bg-soft); border-bottom: 1px solid var(--line); padding: 1rem;
  }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .site-nav a { padding: .7rem .4rem; }
  .grid-2, .grid-3, .grid-4, .steps { grid-template-columns: 1fr; }
  .section { padding: 3rem 0; }
  .cta { padding: 1.8rem; }
}
