/* TADA Privacy & Terms — shared styles
   Palette: editorial-industrial + warm paper + oklch
   Last updated: 2026-04-29 */

:root {
  --paper: oklch(0.97 0.012 85);
  --paper-2: oklch(0.94 0.014 85);
  --ink-1: oklch(0.18 0.02 80);
  --ink-2: oklch(0.32 0.02 80);
  --ink-3: oklch(0.50 0.02 80);
  --ink-4: oklch(0.66 0.015 80);
  --rule: oklch(0.85 0.012 80);
  --accent: oklch(0.50 0.16 30);
  --accent-soft: oklch(0.92 0.04 30);
  --warn: oklch(0.55 0.16 60);
  --max-w: 720px;
  --serif: "Charter", "Iowan Old Style", "Apple Garamond", "Sarabun", "Noto Serif Thai", Georgia, serif;
  --sans: "Inter", "IBM Plex Sans", "IBM Plex Sans Thai", "Sarabun", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

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

main {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 80px;
  flex: 1;
}

header.site {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(6px);
  background: color-mix(in oklch, var(--paper) 92%, transparent);
}

header.site .bar {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-1);
  text-decoration: none;
}

.brand .small {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-3);
  margin-left: 6px;
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper);
}

.lang-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}

.lang-toggle button.on {
  background: var(--ink-1);
  color: var(--paper);
}

.lang-toggle button:not(.on):hover { color: var(--ink-1); }

h1 {
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1.15;
  margin: 24px 0 8px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--ink-3);
  font-size: 14px;
  margin: 0 0 8px;
}

.updated {
  color: var(--ink-4);
  font-size: 13px;
  font-style: italic;
  margin: 0 0 32px;
}

h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  margin: 40px 0 8px;
  letter-spacing: -0.005em;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 4px;
  color: var(--ink-2);
}

p { margin: 0 0 14px; color: var(--ink-2); }

ul, ol { margin: 0 0 14px; padding-left: 22px; color: var(--ink-2); }
li { margin: 4px 0; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklch, var(--accent) 40%, transparent);
}
a:hover { border-bottom-color: var(--accent); }

.card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 18px 20px;
  margin: 18px 0;
}

.card h3 { margin-top: 0; }

table.data {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
}

table.data th, table.data td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

table.data tr:last-child td { border-bottom: 0; }
table.data th {
  background: var(--paper-2);
  color: var(--ink-1);
  font-weight: 600;
}

footer.site {
  border-top: 1px solid var(--rule);
  padding: 32px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-4);
  background: var(--paper-2);
}

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

.nav-back {
  display: inline-block;
  margin-top: 32px;
  font-size: 14px;
  color: var(--ink-3);
  border: 0;
}

.nav-back::before { content: "← "; }

/* Bilingual visibility — default TH visible, EN hidden
   IMPORTANT: scope to body descendants so html[lang="en"] (set by JS)
   doesn't match and hide the whole document. */
body [lang="en"] { display: none; }
html.lang-en body [lang="th"] { display: none; }
html.lang-en body [lang="en"] { display: revert; }

/* Inline mixed: when content has both, use spans */
body span[lang="en"] { display: none; }
html.lang-en body span[lang="en"] { display: inline; }
html.lang-en body span[lang="th"] { display: none; }

@media (max-width: 540px) {
  h1 { font-size: 28px; }
  h2 { font-size: 19px; }
  main { padding: 20px 18px 60px; }
  header.site .bar { padding: 12px 18px; }
}

@media print {
  header.site, footer.site, .lang-toggle { display: none; }
  [lang="en"], [lang="th"] { display: revert !important; }
  main { padding: 0; max-width: 100%; }
  body { font-size: 11pt; }
}
