/* pythonthailand.com — design system
   Replaces AdminLTE/MDB. CSS custom properties drive light/dark theming. */

@font-face {
  font-family: "Prompt";
  font-weight: 400;
  font-display: swap;
  src: url("../dist/fonts/Prompt-Regular.ttf") format("truetype");
}
@font-face {
  font-family: "Prompt";
  font-weight: 500;
  font-display: swap;
  src: url("../dist/fonts/Prompt-Medium.ttf") format("truetype");
}
@font-face {
  font-family: "Prompt";
  font-weight: 600;
  font-display: swap;
  src: url("../dist/fonts/Prompt-SemiBold.ttf") format("truetype");
}
@font-face {
  font-family: "Prompt";
  font-weight: 700;
  font-display: swap;
  src: url("../dist/fonts/Prompt-Bold.ttf") format("truetype");
}

:root {
  --bg: #ffffff;
  --bg-alt: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f4f6fb;
  --text: #14172b;
  --text-muted: #5a6072;
  --border: #e6e8f0;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-contrast: #ffffff;
  --accent: #0891b2;
  --accent-2: #9333ea;
  --line: #06c755;
  --shadow: 0 8px 30px rgba(20, 23, 43, 0.08);
  --shadow-lg: 0 20px 60px rgba(20, 23, 43, 0.14);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --header-h: 72px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0e1a;
  --bg-alt: #10142399;
  --surface: #131829;
  --surface-2: #171d30;
  --text: #e9ebf7;
  --text-muted: #9aa1bd;
  --border: #262d47;
  --primary: #6d68f0;
  --primary-dark: #8481f5;
  --primary-contrast: #ffffff;
  --accent: #22d3ee;
  --accent-2: #c084fc;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0e1a;
    --bg-alt: #10142399;
    --surface: #131829;
    --surface-2: #171d30;
    --text: #e9ebf7;
    --text-muted: #9aa1bd;
    --border: #262d47;
    --primary: #6d68f0;
    --primary-dark: #8481f5;
    --primary-contrast: #ffffff;
    --accent: #22d3ee;
    --accent-2: #c084fc;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Prompt", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  transition: background-color .25s ease, color .25s ease;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5 { font-weight: 700; line-height: 1.25; margin: 0 0 .5em; }
p { margin: 0 0 1em; color: var(--text-muted); }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
section { padding: 72px 0; }
.text-center { text-align: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: #fff; object-fit: contain; padding: 3px;
  flex: none;
}
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  padding: 10px 14px; border-radius: 999px; color: var(--text-muted);
  font-size: .95rem; font-weight: 500; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.nav a:hover, .nav a:focus-visible { background: var(--surface-2); color: var(--text); }
.nav a.is-cta { background: var(--primary); color: #fff; }
.nav a.is-cta:hover { background: var(--primary-dark); color: #fff; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle, .nav-toggle {
  width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); display: flex; align-items: center;
  justify-content: center; cursor: pointer; flex: none;
}
.theme-toggle svg, .nav-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.nav-toggle { display: none; }

@media (max-width: 880px) {
  .nav { position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch;
    background: var(--bg); border-bottom: 1px solid var(--border); padding: 10px 20px 20px;
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: all .2s ease; gap: 2px; }
  .nav.is-open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav a { padding: 12px 14px; }
  .nav-toggle { display: flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; font-weight: 600; font-size: .96rem;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background-color .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent-2)); color: #fff; box-shadow: var(--shadow); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-line { background: var(--line); color: #fff; }
.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 84px 0 60px; }
.hero-bg {
  position: absolute; inset: -20% -10% auto -10%; height: 620px; z-index: -1;
  background:
    radial-gradient(600px circle at 15% 20%, color-mix(in srgb, var(--primary) 30%, transparent), transparent 60%),
    radial-gradient(500px circle at 85% 15%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 60%),
    radial-gradient(500px circle at 50% 90%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 60%);
  filter: blur(10px);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--primary);
  font-size: .82rem; font-weight: 600; margin-bottom: 18px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.2rem); max-width: 900px; margin-left: auto; margin-right: auto; }
.hero .lead { font-size: 1.15rem; max-width: 680px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.hero-meta { display: flex; gap: 28px; justify-content: center; flex-wrap: wrap; color: var(--text-muted); font-size: .9rem; margin-top: 24px; }
.hero-meta strong { color: var(--text); font-size: 1.3rem; display: block; }

.stack-strip { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 36px; }
.stack-strip span {
  padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: .85rem; color: var(--text-muted); font-weight: 500;
}

/* ---------- Section head ---------- */
.section-head { text-align: center; max-width: 700px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.section-head p { margin: 0; }
.section-alt { background: var(--bg-alt); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } .grid-6 { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.card .icon-wrap {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 18%, transparent), color-mix(in srgb, var(--accent) 18%, transparent));
  margin-bottom: 18px; font-size: 1.5rem;
}
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card p { font-size: .93rem; margin-bottom: 0; }
.card.is-ai { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); position: relative; }
.card.is-ai::before {
  content: "AI"; position: absolute; top: 18px; right: 18px; font-size: .68rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--primary));
}

.mini-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 18px 14px; text-align: center; font-size: .85rem; font-weight: 500; color: var(--text-muted);
}
.mini-card .mini-icon {
  width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.mini-card.is-ai { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); color: var(--text); }
.mini-card.is-ai .mini-icon {
  background: linear-gradient(135deg, var(--accent-2), var(--primary));
}

/* ---------- Process / steps ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; counter-reset: step; }
@media (max-width: 780px) { .steps { grid-template-columns: 1fr; } }
.step { text-align: center; padding: 0 12px; }
.step-num {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 18px; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1.3rem; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.step h3 { font-size: 1.05rem; }
.step p { font-size: .92rem; }

/* ---------- IoT / showcase ---------- */
.showcase { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 780px) { .showcase { grid-template-columns: 1fr; } }
.showcase figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.showcase img { aspect-ratio: 16/10; object-fit: cover; }
.showcase figcaption { padding: 16px 18px; font-weight: 600; }

/* ---------- Follow / social row ---------- */
.follow-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.follow-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: .9rem;
  box-shadow: var(--shadow);
}
.follow-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 780px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-card { text-align: center; }
.contact-card .icon-wrap { margin: 0 auto 18px; }

/* ---------- Blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
@media (max-width: 980px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .blog-grid { grid-template-columns: 1fr; } }
.blog-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.blog-card img { aspect-ratio: 4/3; object-fit: cover; }
.blog-card .blog-card-body { padding: 16px 18px; }
.blog-card .blog-card-body h3 { font-size: 1rem; margin-bottom: 6px; }
.blog-card .blog-card-body span { font-size: .8rem; color: var(--text-muted); }
.blog-cats { display: flex; gap: 8px; flex-wrap: wrap; }
.blog-cats a { padding: 6px 14px; border-radius: 999px; background: var(--surface-2); font-size: .82rem; font-weight: 600; }
.blog-cats a.is-active { background: var(--primary); color: #fff; }
.post-body { max-width: 780px; margin: 0 auto; }
.post-body img { border-radius: var(--radius); margin: 20px 0; }
.post-meta { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; color: var(--text-muted); font-size: .9rem; margin-bottom: 24px; }

/* ---------- Breadcrumb ---------- */
.breadcrumb-nav { font-size: .85rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb-nav a { color: var(--text-muted); }
.breadcrumb-nav a:hover { color: var(--primary); }
.breadcrumb-nav .sep { margin: 0 6px; opacity: .5; }

/* ---------- Pagination ---------- */
.pagination-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 40px; flex-wrap: wrap; }
.pagination-row a, .pagination-row span {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: .9rem; font-weight: 600; color: var(--text);
}
.pagination-row a:hover { border-color: var(--primary); color: var(--primary); }
.pagination-row .is-current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-row .is-disabled { opacity: .4; pointer-events: none; }

/* ---------- Share buttons ---------- */
.share-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 28px 0; }
.share-row a {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 1rem;
}
.share-row a:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Related posts ---------- */
.related-heading { font-size: 1.1rem; margin: 48px 0 18px; text-align: center; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 48px 0 28px; background: var(--bg-alt); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { font-size: .9rem; margin-bottom: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-grid a { color: var(--text-muted); font-size: .92rem; }
.footer-grid a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 22px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: var(--text-muted); font-size: .85rem; }

/* ---------- Reveal-on-scroll (replaces AOS) ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------- Modal (line QR) ---------- */
.qr-modal img { border-radius: var(--radius-sm); }

/* ---------- Misc ---------- */
.badge-soft { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: .75rem; font-weight: 600; color: var(--text-muted); }
hr.divider { border: none; border-top: 1px solid var(--border); margin: 0; }
