/* wongwaritprotection.com — calm reading on a phone first
   Targets (tests/check_site.py checks the measurable ones):
   text contrast >= 4.5:1, buttons >= 48px tall, body text 18px, no JavaScript, one CSS file */

/* Fonts: Sarabun (body) + Prompt 600 (headings), self-hosted, SIL OFL 1.1 (fonts/OFL-*.txt) */
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/sarabun-400-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/sarabun-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sarabun-700-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Sarabun";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sarabun-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Prompt";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/fonts/prompt-600-thai.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Prompt";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/fonts/prompt-600-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #faf9f6;
  --surface: #f2f0ea;
  --card: #ffffff;
  --text: #222526;
  --muted: #5a6063;
  --border: #dedbd3;
  --accent: #0c6b6b;
  --accent-hover: #084f4f;
  --line: #00873c;
  --line-hover: #007a37;
  --need: #8a9094;
  --gap: #c2410c;
  --gap-text: #9a3412;
  --todo-bg: #fef3c7;
  --todo-border: #b45309;
  --todo-text: #78350f;
  --measure: 38em;
  --footer-bg: #12302c;
  --footer-text: #f3f6f4;
  --footer-muted: #b8cbc5;
  --footer-rule: #2b4a45;
  --font-body: "Sarabun", "Noto Sans Thai", "Sukhumvit Set", "Leelawadee UI", "Thonburi", sans-serif;
  --font-head: "Prompt", "Noto Sans Thai", "Sukhumvit Set", "Leelawadee UI", "Thonburi", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}

/* Draft banner (draft build only) */
.draft-banner {
  margin: 0;
  padding: 0.4rem 1rem;
  background: var(--todo-bg);
  border-bottom: 1px solid var(--todo-border);
  color: var(--todo-text);
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: center;
}

/* Header: name on the left, one LINE button on the right */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 0.55rem 0;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  box-shadow: 0 1px 0 var(--border), 0 4px 16px rgba(18, 48, 44, 0.06);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.site-name {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
}

.site-role {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  color: #3f4547;
}

.brand:hover .site-name {
  color: var(--accent);
}

.line-icon {
  width: 18px;
  height: 18px;
  margin-right: 0.4rem;
  fill: currentColor;
}

.site-nav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-nav .wrap {
  display: flex;
  gap: 1.5rem;
}

.site-nav a {
  display: inline-block;
  padding: 0.7rem 0 0.6rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--accent);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Main */
main {
  flex: 1 0 auto;
  padding-top: 1.25rem;
  padding-bottom: 3rem;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
  line-height: 1.5;
}

.breadcrumb a {
  color: var(--muted);
  display: inline-block;
  padding: 0.35rem 0;
}

.breadcrumb .sep {
  margin: 0 0.45em;
  color: var(--need);
}

/* Headings & text */
h1,
h2,
h3,
.site-name,
.cta-title {
  font-family: var(--font-head);
}

h1 {
  font-size: 1.55rem;
  line-height: 1.4;
  font-weight: 700;
  margin: 0 0 0.6rem;
}

h2 {
  font-size: 1.22rem;
  line-height: 1.5;
  font-weight: 700;
  margin: 2.4rem 0 0.7rem;
}

h3 {
  font-size: 1.05rem;
  line-height: 1.5;
  font-weight: 700;
  margin: 1.5rem 0 0.45rem;
}

p {
  margin: 0 0 1.15rem;
}

ol,
ul {
  margin: 0 0 1.3rem;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.6rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.byline {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 1.4rem;
}

/* Short answer: the paragraph readers and AI quote */
.answer {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 2rem 1.1rem 1rem;
  margin-bottom: 1.25rem;
}

.answer::before {
  content: "คำตอบสั้น";
  position: absolute;
  top: 0.6rem;
  left: 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}

/* Contents list (native details, no JavaScript) */
.toc {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.toc summary {
  cursor: pointer;
  padding: 0.7rem 0;
  min-height: 48px;
  font-weight: 600;
  color: var(--accent);
}

.toc ol {
  margin: 0 0 0.9rem;
}

.toc li {
  margin-bottom: 0.35rem;
}

/* Numbered steps */
article ol {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
}

article ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.4rem;
  margin-bottom: 0.85rem;
}

article ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.6rem;
  text-align: center;
}

article .toc ol > li {
  padding-left: 0;
}

article .toc ol > li::before {
  content: none;
}

article .toc ol {
  list-style: decimal;
  padding-left: 1.3rem;
}

/* Number figure: need / have / still short */
.gap-figure {
  margin: 1.5rem 0 1.75rem;
  padding: 1rem 1.1rem 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.gap-figure figcaption {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.bar-row {
  margin-bottom: 0.8rem;
}

.bar-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.bar-label strong {
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 0.8rem;
  background: var(--surface);
  border-radius: 3px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: 3px;
  background: var(--need);
}

.have .bar span {
  background: var(--accent);
}

.gap .bar span {
  background: var(--gap);
}

.gap .bar-label {
  color: var(--gap-text);
  font-weight: 700;
}

.fig-note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* LINE buttons and cards */
.btn-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.5rem 1.3rem;
  background: var(--line);
  color: #ffffff;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.4;
  border-radius: 999px;
  text-decoration: none;
}

.btn-line:hover {
  background: var(--line-hover);
  color: #ffffff;
}

.btn-line:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.btn-small {
  flex-shrink: 0;
  font-size: 0.88rem;
  padding: 0.4rem 1rem;
}

/* Header button: quiet outline, the CTA card at the end of the page does the asking */
.btn-outline {
  min-height: 40px;
  padding: 0.3rem 0.85rem;
  background: #ffffff;
  color: var(--line);
  font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--line);
}

.btn-outline:hover {
  background: var(--line);
  color: #ffffff;
}

.cta-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  margin: -0.25rem 0 1.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.cta-card {
  margin: 2.5rem 0 1.5rem;
  padding: 1.25rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: 4px solid var(--line);
  border-radius: 6px;
}

.cta-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.cta-card .btn-line {
  width: 100%;
  margin: 0.25rem 0 0.5rem;
}

.cta-reassure {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 0;
}

.qr {
  display: none;
}

@media (min-width: 768px) {
  .qr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 0.9rem 0 0;
    font-size: 0.88rem;
    color: var(--muted);
  }

  .qr img {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 6px;
  }
}

.share {
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  text-align: center;
}

.share a {
  display: inline-block;
  padding: 0.5rem 0;
}

/* Author */
.avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 1.4rem;
}

.avatar-todo {
  background: var(--todo-bg);
  border: 2px dashed var(--todo-border);
  color: var(--todo-text);
}

.author {
  display: flow-root;
  margin-top: 1.5rem;
  padding: 1.1rem;
  background: var(--surface);
  border-radius: 6px;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--muted);
}

.author .avatar {
  float: left;
  margin: 0.15rem 0.85rem 0.4rem 0;
}

.author p {
  margin-bottom: 0.2rem;
}

.author p:first-child {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.verify {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
  margin-top: 0.4rem;
}

.verify a {
  display: inline-block;
  padding: 0.4rem 0;
}

.author-note {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.author-note p {
  margin: 0;
}

.about-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.about-head h1 {
  margin: 0;
}

/* References: source names, not raw URLs */
.references {
  margin-top: 2rem;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--muted);
}

.references h2 {
  font-size: 1rem;
  margin: 0 0 0.6rem;
  color: var(--text);
}

.references ul {
  padding-left: 1.1rem;
  margin: 0;
}

.references li {
  margin-bottom: 0.7rem;
}

.ref-host {
  white-space: nowrap;
  font-size: 0.8rem;
}

/* Home and group pages */
.group-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 1.5rem;
}

.group-list li {
  margin: 0 0 0.6rem;
}

.group-list a {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 56px;
  padding: 0.7rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  line-height: 1.5;
}

.group-list a:hover {
  border-color: var(--accent);
}

.group-title {
  flex: 1;
}

.group-count {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.group-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--surface);
  font-weight: 700;
  color: var(--accent);
}

h1 .group-letter {
  margin-right: 0.3rem;
  vertical-align: 0.1em;
}

.home-links {
  margin: 0.9rem 0;
  font-size: 0.95rem;
}

.group-intro {
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.topic-item {
  margin: 0 0 1rem;
  padding: 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.topic-item h2 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.topic-item h2 a {
  color: var(--text);
  text-decoration: none;
}

.topic-item h2 a:hover {
  color: var(--accent);
}

.topic-item p {
  font-size: 0.95rem;
}

.read-more {
  margin: 0;
  font-weight: 700;
}

.read-more a {
  display: inline-block;
  padding: 0.35rem 0;
}

/* Related reading */
.related {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.related h2 {
  font-size: 1.05rem;
  margin: 0 0 0.7rem;
}

.related ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.related li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.related li a {
  display: block;
  padding: 0.75rem 0;
  line-height: 1.55;
  text-decoration: none;
}

.related-meta {
  font-size: 0.92rem;
  margin: 0.5rem 0 0;
}

/* Draft placeholders */
.todo {
  background: var(--todo-bg);
  border: 2px dashed var(--todo-border);
  color: var(--todo-text);
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
  margin: 1.25rem 0;
}

/* Footer */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 2.25rem 0 1.5rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.site-footer a {
  color: var(--footer-text);
}

.site-footer p {
  margin: 0;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--footer-rule);
}

.footer-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1.4;
}

.footer-role {
  color: var(--footer-muted);
  font-size: 0.85rem;
}

.site-footer .footer-cta {
  color: #ffffff;
  align-self: flex-start;
  white-space: nowrap;
}

.footer-mid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--footer-rule);
}

.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-contact li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  min-height: 44px;
}

.ficon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--footer-muted);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.footer-contact a {
  display: inline-block;
  padding: 0.45rem 0;
  font-weight: 700;
  text-underline-offset: 0.25em;
}

.footer-contact .footer-address {
  align-items: flex-start;
  padding: 0.35rem 0;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--footer-muted);
}

.footer-address .ficon {
  width: 15px;
  height: 15px;
  margin: 0.2rem 0.15rem 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin: 0;
}

.footer-links a {
  display: inline-block;
  padding: 0.6rem 0;
  color: var(--footer-muted);
}

.footer-links a:hover,
.footer-contact a:hover {
  color: #ffffff;
}

.footer-bottom {
  padding-top: 1.25rem;
  color: var(--footer-muted);
  font-size: 0.8rem;
}

.site-footer .footer-note {
  line-height: 1.7;
  margin-bottom: 0.9rem;
}

.footer-copy {
  opacity: 0.9;
}

.nowrap {
  white-space: nowrap;
}

.contact {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 1rem;
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.contact dt {
  font-weight: 700;
  color: var(--muted);
}

.contact dd {
  margin: 0;
}

@media (min-width: 640px) {
  h1 {
    font-size: 1.85rem;
  }

  h2 {
    font-size: 1.32rem;
  }

  main {
    padding-top: 2rem;
  }

  .cta-card .btn-line {
    width: auto;
  }

  .footer-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .site-footer .footer-cta {
    align-self: center;
  }

}

@media print {
  .site-header,
  .site-nav,
  .site-footer,
  .cta-card,
  .cta-inline,
  .toc,
  .related,
  .draft-banner {
    display: none;
  }
}
