:root {
  --bg: #f7f9f9;
  --surface: #ffffff;
  --surface-muted: #f0f4f3;
  --text: #16211f;
  --text-secondary: #4b5a57;
  --text-tertiary: #7c8b88;
  --border: #dfe7e5;
  --accent: #0b7a6f;
  --accent-hover: #086158;
  --accent-soft: rgba(11, 122, 111, 0.08);
  --warn-bg: #fdf6e8;
  --warn-border: #eddfb8;
  --warn-text: #7a5b12;
  --ok-bg: #eaf7f2;
  --ok-border: #bfe6d8;
  --ok-text: #0b6b52;
  --code-bg: #101816;
  --code-text: #e8f2ef;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --content-max: 700px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Noto Sans Thai", "Leelawadee UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
code {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.4em;
  font-size: 0.9em;
  word-break: break-word;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 8px 0;
  z-index: 100;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

/* Topbar */
.site-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.crumbs { font-size: 0.86rem; color: var(--text-tertiary); display: flex; gap: 0.5rem; align-items: center; min-width: 0; }
.crumbs a { color: var(--text-secondary); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumb-sep { color: var(--text-tertiary); }
.crumb-cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-chip {
  font-size: 0.78rem; color: var(--text-tertiary); background: var(--surface-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.25rem 0.75rem;
  white-space: nowrap; flex-shrink: 0;
}

/* Layout: TOC rail + main column */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  display: block;
  padding: 0 1.25rem;
}
.toc-rail { display: none; }
.main-col { padding: 2rem 0 4rem; max-width: var(--content-max); margin: 0 auto; }

@media (min-width: 980px) {
  .layout { display: grid; grid-template-columns: 220px minmax(0, var(--content-max)); gap: 2.5rem; align-items: start; }
  .toc-rail { display: block; position: sticky; top: 4.5rem; padding: 2rem 0; max-height: calc(100vh - 5rem); overflow-y: auto; }
  .main-col { margin: 0; }
}
.toc-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); margin: 0 0 0.6rem; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc-list li { margin: 0; }
.toc-list a {
  display: block; padding: 0.32rem 0 0.32rem 0.85rem; margin-left: -2px; border-left: 2px solid transparent;
  color: var(--text-secondary); text-decoration: none; font-size: 0.88rem; line-height: 1.4;
}
.toc-list a:hover { color: var(--accent); }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-list .toc-h3 a { padding-left: 1.6rem; font-size: 0.82rem; color: var(--text-tertiary); }

/* Article header */
.article-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); line-height: 1.25; margin: 0 0 1rem; letter-spacing: -0.01em; }
.lead { font-size: 1.08rem; color: var(--text-secondary); }

/* Fact box (real ZIP link + honest owner-fill placeholders) */
.fact-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1rem 1.15rem; margin: 1.25rem 0; display: flex; flex-direction: column; gap: 0.55rem;
}
.fact-box p { margin: 0; font-size: 0.92rem; }
.fact-label {
  display: inline-block; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  border-radius: 4px; padding: 0.12rem 0.45rem; margin-right: 0.4rem; vertical-align: middle;
}
.fact-label.ok { background: var(--ok-bg); color: var(--ok-text); border: 1px solid var(--ok-border); }
.fact-label.todo { background: var(--warn-bg); color: var(--warn-text); border: 1px solid var(--warn-border); }
.owner-fill { color: var(--text-tertiary); font-style: italic; }

/* Quick answer */
.quick-answer {
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1rem 1.15rem; margin: 1.25rem 0;
}
.quick-answer p { margin: 0 0 0.4rem; }
.quick-answer p:last-child { margin-bottom: 0; }

/* Sections */
section { margin-top: 2.5rem; }
section h2 { font-size: 1.4rem; margin: 0 0 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--border); scroll-margin-top: 5rem; }
section#netlify-คืออะไร h2 { border-top: none; padding-top: 0; }
h3 { font-size: 1.1rem; margin: 1.6rem 0 0.6rem; scroll-margin-top: 5rem; }
p, ul, ol { margin: 0 0 1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.35rem; }

.checkpoint {
  background: var(--surface-muted); border-radius: var(--radius-sm); padding: 0.7rem 0.9rem;
  font-size: 0.92rem; border-left: 3px solid var(--accent);
}

/* Screenshot placeholders — explicitly labeled, never pretending to be real */
.shot-placeholder { margin: 1.1rem 0; }
.shot-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
  border: 2px dashed var(--warn-border); border-radius: var(--radius-md); background: var(--warn-bg);
  color: var(--warn-text); padding: 2.2rem 1rem; text-align: center; font-size: 0.86rem; font-weight: 600;
}
.shot-placeholder figcaption { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 0.4rem; text-align: center; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-md); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
th, td { text-align: left; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface-muted); font-weight: 700; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }

/* Code blocks */
.code-block { position: relative; margin: 0 0 1.1rem; border-radius: var(--radius-md); overflow: hidden; }
.code-block pre {
  margin: 0; background: var(--code-bg); color: var(--code-text); padding: 1rem 1.1rem;
  overflow-x: auto; font-size: 0.85rem; line-height: 1.6;
}
.code-block code { background: none; border: none; padding: 0; color: inherit; font-size: inherit; }
.copy-btn {
  position: absolute; top: 0.5rem; right: 0.5rem; font-family: var(--font);
  background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-sm); padding: 0.3rem 0.65rem; font-size: 0.76rem; cursor: pointer;
  transition: background-color .15s ease;
}
.copy-btn:hover { background: rgba(255,255,255,0.2); }

.ext-ico { font-size: 0.8em; }

/* FAQ */
.faq-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.2rem 1.1rem; margin-bottom: 0.65rem;
}
.faq-item summary { padding: 0.85rem 0; font-weight: 600; cursor: pointer; list-style: none; position: relative; padding-right: 1.5rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 0; top: 0.8rem; font-size: 1.2rem; color: var(--accent); font-weight: 400;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item p { padding-bottom: 0.9rem; color: var(--text-secondary); }

.cta-line { font-size: 1.02rem; }

.ref-list { list-style: none; padding: 0; }
.ref-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.ref-list li:last-child { border-bottom: none; }

/* Author box + footer */
.author-box {
  max-width: var(--content-max); margin: 3rem auto 0; padding: 1.2rem 1.15rem;
  background: var(--surface-muted); border-radius: var(--radius-md); font-size: 0.86rem; color: var(--text-secondary);
}
.author-box p { margin: 0 0 0.5rem; }
.author-box p:last-child { margin-bottom: 0; }
.site-footer {
  text-align: center; padding: 2rem 1rem 3rem; color: var(--text-tertiary); font-size: 0.82rem;
}

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