/* Master P Development — website stylesheet
   สีและตัวอักษรตาม content-operations/docs/brand-content-guide.md */

:root {
  /* สีจากโลโก้ Master P 2026 */
  --logo-navy: #0c2446;
  --logo-green: #1ca834;

  --brand: var(--logo-navy);     /* พื้นหลักส่วน hero ปุ่ม แผงสีเข้ม */
  --brand-2: #1a3a6e;            /* navy อ่อนสำหรับ hover และ gradient */
  --green: var(--logo-green);    /* ไอคอนและเส้นตกแต่ง (ไม่ใช้กับตัวอักษรเล็กบนพื้นขาว) */
  --accent: #15802a;             /* เขียวเข้มขึ้นสำหรับตัวอักษรบนพื้นขาว (contrast 5:1) */
  --accent-soft: #e8f6eb;
  --accent-line: #bfe6c8;
  --mint: #4cd166;               /* เขียวสว่างสำหรับตัวอักษรบนพื้น navy */
  --navy: var(--logo-navy);      /* หัวข้อ */
  --footer: #071731;
  --ink: #1e293b;
  --muted: #5b6b7c;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --warning: #d97706;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --max: 1180px;
  --font: "Noto Sans Thai Looped", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 300;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; color: var(--navy); margin: 0 0 .5em; }
p { margin: 0 0 1em; }
ul { padding-left: 1.2em; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-sm { width: 16px; height: 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--navy); }
.brand-logo { height: 34px; width: auto; }
.site-header .container { max-width: 1320px; }
.brand { flex: none; }
.brand-name { display: flex; flex-direction: column; line-height: 1.3; padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; }
.brand-name strong { font-weight: 500; font-size: 13px; color: var(--logo-navy); }
.brand-name span { font-size: 11.5px; color: var(--muted); }
.nav a { white-space: nowrap; }
@media (max-width: 1340px) { .brand-name { display: none; } }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  padding: 8px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 400; color: var(--ink);
}
.nav a:hover, .nav a.active { background: var(--accent-soft); color: var(--brand); }
.header-cta { margin-left: 8px; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--navy); cursor: pointer; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  font: 500 15px/1.2 var(--font); cursor: pointer; transition: .15s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #126e24; color: #fff; }
.btn-light { background: #fff; color: var(--brand); }
.btn-light:hover { background: var(--accent-soft); color: var(--brand); }
.btn-ghost { border-color: rgba(255,255,255,.4); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.btn-outline { border-color: var(--line); color: var(--brand); background: #fff; }
.btn-outline:hover { border-color: var(--accent); color: var(--brand); }

/* ---------- Sections ---------- */
section { padding: 88px 0; }
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 10px;
}
.section-head h2 { font-size: clamp(26px, 3.2vw, 36px); }
.section-head p { color: var(--muted); font-size: 17px; }
.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; color: #fff; padding: 96px 0 104px;
  background:
    radial-gradient(800px 400px at 85% 10%, rgba(28,168,52,.22), transparent 60%),
    radial-gradient(600px 400px at 0% 100%, rgba(26,58,110,.9), transparent 60%),
    var(--brand);
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .07;
  background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 22px 22px;
}
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; }
.hero h1 { color: #fff; font-size: clamp(32px, 4.6vw, 52px); margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--mint); }
.hero .lead { font-size: 18px; color: rgba(255,255,255,.85); max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); font-size: 13.5px; margin-bottom: 20px;
}
.hero-panel {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 20px; padding: 22px;
  backdrop-filter: blur(6px);
}
.hero-panel h3 { color: #fff; font-size: 15px; font-weight: 500; margin-bottom: 14px; opacity: .9; }
.hero-group { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; color: #fff; }
.hero-group:hover { background: rgba(255,255,255,.08); color: #fff; }
.hero-group .gicon { width: 40px; height: 40px; border-radius: 10px; background: rgba(76,209,102,.14); display: grid; place-items: center; color: var(--mint); }
.hero-group strong { display: block; font-weight: 500; font-size: 15px; }
.hero-group small { display: block; color: rgba(255,255,255,.7); font-size: 12.5px; }
.hero-group .count { margin-left: auto; font-size: 12px; color: var(--mint); white-space: nowrap; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: -48px; position: relative; z-index: 2; box-shadow: var(--shadow); }
.stat { background: #fff; padding: 22px 24px; }
.stat b { display: block; font-size: 28px; font-weight: 600; color: var(--brand); line-height: 1.2; }
.stat span { font-size: 14px; color: var(--muted); }
.stats-wrap { padding: 0; }

/* ---------- Pillars ---------- */
.pillars { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pillar { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pillar .picon { width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.pillar .picon .icon { width: 28px; height: 28px; }
.pillar h3 { font-size: 22px; }
.pillar > p { color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; }
.checklist li .icon { color: var(--green); margin-top: 3px; width: 18px; height: 18px; }
.checklist li b { font-weight: 500; }
.pillar .btn { margin-top: auto; align-self: flex-start; }

/* ---------- Standards ---------- */
.group-block { margin-bottom: 44px; }
.group-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.group-title .gicon { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.group-title h3 { margin: 0; font-size: 19px; }
.group-title small { color: var(--muted); font-size: 13px; display: block; }
.std-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.std-card {
  position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; color: var(--ink); transition: .18s ease;
}
.std-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--ink); }
.std-code { font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: .03em; }
.std-card h4 { font-size: 17px; margin: 4px 0 8px; }
.std-card p { font-size: 14.5px; color: var(--muted); margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.std-meta { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--brand); font-size: 12.5px; font-weight: 400; }
.chip.warn { background: #fef3c7; color: #92400e; }
.std-card.request { border-style: dashed; background: transparent; justify-content: center; text-align: center; align-items: center; color: var(--muted); }
.std-card.request .icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 8px; }

/* Filters */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 32px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chips button {
  font: 400 14px var(--font); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer;
}
.filter-chips button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.search { margin-left: auto; position: relative; }
.search input { font: 400 14.5px var(--font); padding: 9px 14px 9px 38px; border-radius: 12px; border: 1px solid var(--line); width: 260px; background: #fff; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }

/* ---------- Process ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; }
.step { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--brand); color: #fff; font-weight: 600; margin-bottom: 14px;
}
.step h4 { font-size: 17px; margin-bottom: 6px; }
.step p { font-size: 14.5px; color: var(--muted); margin: 0; }

/* ---------- Knowledge ---------- */
.kn-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.kn-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; color: var(--ink); transition: .18s ease; }
.kn-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); color: var(--ink); }
.kn-card img { aspect-ratio: 4 / 3; object-fit: cover; object-position: top; width: 100%; border-bottom: 1px solid var(--line); }
.kn-body { padding: 16px 18px 20px; }
.kn-body h4 { font-size: 16px; margin: 8px 0 4px; }
.kn-body small { color: var(--muted); font-size: 13px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; }
.values { display: grid; gap: 14px; }
.value { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.value .picon { width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.value h4 { font-size: 16px; margin-bottom: 2px; }
.value p { font-size: 14.5px; color: var(--muted); margin: 0; }
.note {
  border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 0 12px 12px 0;
  font-size: 14.5px; color: var(--brand);
}
.placeholder { border: 1px dashed #94a3b8; background: #f1f5f9; color: #475569; border-radius: 12px; padding: 14px 18px; font-size: 14px; }

/* ---------- Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.3fr; gap: 40px; }
.contact-info { background: var(--brand); color: #fff; border-radius: 20px; padding: 32px; }
.contact-info h3 { color: #fff; }
.contact-info p { color: rgba(255,255,255,.8); }
.contact-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.15); }
.contact-row .icon { color: var(--mint); margin-top: 3px; }
.contact-row a, .contact-row span { color: #fff; }
.form { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 500; }
.field input, .field select, .field textarea {
  font: 400 15px var(--font); padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); background: #fff; }
.radio-row { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-row label { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.form small { color: var(--muted); }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { background: radial-gradient(700px 300px at 90% 0%, rgba(28,168,52,.18), transparent 60%), var(--brand); color: #fff; padding: 56px 0 48px; }
.page-hero h1 { color: #fff; font-size: clamp(28px, 3.6vw, 40px); margin-bottom: 10px; }
.page-hero p { color: rgba(255,255,255,.82); max-width: 720px; margin: 0; font-size: 17px; }
.crumbs { font-size: 13.5px; margin-bottom: 14px; color: rgba(255,255,255,.7); }
.crumbs a { color: var(--mint); }
.page-hero .std-code { color: var(--mint); font-size: 15px; }

/* Standard detail */
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 40px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; margin-bottom: 20px; }
.panel h2 { font-size: 20px; display: flex; gap: 10px; align-items: center; }
.panel h2 .icon { color: var(--accent); }
.course-list { list-style: none; padding: 0; margin: 0; }
.course-list li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.course-list li:first-child { border-top: 0; padding-top: 0; }
.course-list .c-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.side { position: sticky; top: 96px; }
.side .panel { background: var(--accent-soft); border-color: var(--accent-line); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* Training table */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; font-size: 13.5px; color: var(--muted); background: var(--bg); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .std-code { display: block; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 24px; padding: 40px; display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta-band h3 { color: #fff; font-size: 24px; margin-bottom: 4px; }
.cta-band p { margin: 0; color: rgba(255,255,255,.82); }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer); color: #cbd5e1; padding: 56px 0 28px; font-size: 14.5px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h5 { color: #fff; font-size: 15px; font-weight: 500; margin: 0 0 12px; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: var(--mint); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-brand { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.footer-brand img { height: 40px; width: auto; align-self: flex-start; }
.footer-brand strong { color: #fff; font-weight: 500; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; color: #94a3b8; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .nav { display: none; position: absolute; top: 72px; left: 0; right: 0; background: #fff; flex-direction: column; padding: 12px 20px 20px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .menu-toggle { display: inline-flex; }
  .header-cta { display: none; }
  .hero .container, .about, .contact, .detail { grid-template-columns: 1fr; }
  .steps, .kn-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .side { position: static; }
}
@media (max-width: 720px) {
  section { padding: 64px 0; }
  .container { padding: 0 16px; }
  .hero { padding: 64px 0 88px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .pillars, .steps, .kn-grid, .form-grid, .footer-grid { grid-template-columns: 1fr; }
  .search { margin-left: 0; width: 100%; }
  .search input { width: 100%; }
  .course-list li { flex-direction: column; }
  .course-list .c-meta { justify-content: flex-start; }
  .cta-band { padding: 28px; }
  .brand-name span { display: none; }
}

/* Grid items may shrink below their content width (prevents horizontal scroll on narrow screens) */
.hero .container > *, .about > *, .contact > *, .detail > *, .pillars > *, .form-grid > * { min-width: 0; }
.contact-row a, .contact-row span { overflow-wrap: anywhere; }

/* Language switch (TH / EN) */
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--brand); background: #fff;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 1024px) {
  .lang-switch { margin-left: auto; }
  .menu-toggle { margin-left: 8px; }
}

/* Contact form: consent, spam trap, status */
.consent { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; font-size: 14px; color: var(--muted); cursor: pointer; }
.consent input { margin-top: 5px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form { position: relative; }
.form-actions { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 20px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.form-status { margin-top: 18px; padding: 14px 18px; border-radius: 12px; font-size: 14.5px; }
.form-status.ok { background: var(--accent-soft); color: var(--brand); border: 1px solid var(--accent-line); }
.form-status.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.form-status b { display: block; font-weight: 600; margin-bottom: 2px; }

/* Expert profile (About section) */
.expert {
  margin-top: 48px; display: grid; grid-template-columns: 150px 1.3fr 1fr; gap: 32px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
}
.expert-photo { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 4px solid var(--accent-soft); }
.expert-body h3 { font-size: 24px; margin: 0 0 2px; }
.expert-role { color: var(--accent); font-size: 14.5px; font-weight: 500; margin-bottom: 14px; }
.expert-body > p:not(.expert-role) { color: var(--ink); }
.expert-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.expert-stats div { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.expert-stats b { display: block; font-size: 22px; font-weight: 600; color: var(--brand); line-height: 1.2; }
.expert-stats span { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 4px; }
.expert-skills { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 16px; padding: 20px 22px; }
.expert-skills h4 { font-size: 16px; margin-bottom: 12px; }
.expert-skills dl { margin: 0; display: grid; gap: 12px; }
.expert-skills dt { font-size: 13.5px; font-weight: 500; color: var(--brand); margin-bottom: 4px; }
.expert-skills dd { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.expert-skills .chip { background: #fff; }
@media (max-width: 1024px) {
  .expert { grid-template-columns: 120px 1fr; }
  .expert-photo { width: 120px; height: 120px; }
  .expert-skills { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .expert { grid-template-columns: 1fr; padding: 24px; gap: 20px; }
  .expert-stats { grid-template-columns: 1fr; }
  .expert-skills { grid-column: auto; }
}
