/* นัด — public site (nad-th.web.app). Mobile-first, system font, light + dark. */
:root {
  /* AppColors.green (lib/core/theme.dart) = brand; *-ink / *-strong are darker shades for text/buttons on light backgrounds. */
  --green: #34c759;
  --green-strong: #248a3d;
  --green-ink: #1d7a33;
  --green-tint: #e2f9e7;
  --blue: #007aff;
  --ink: #0b0c0e;
  --ink2: #3c3c43;
  --muted: #6b7078;
  --border: #e7e9ec;
  --bg: #eef0f2;
  --card: #ffffff;
  --surface: #f7f8f9;
  --danger: #d70015;
  --danger-bg: #ffe9e8;
  --warn-fg: #9a5200;
  --warn-bg: #fff4e5;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11, 12, 14, 0.04), 0 4px 16px rgba(11, 12, 14, 0.05);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --green-strong: #248a3d;
    --green-ink: #30d158;
    --green-tint: #12301a;
    --blue: #0a84ff;
    --ink: #f2f3f5;
    --ink2: #d1d3d8;
    --muted: #9a9fa8;
    --border: #2c2e33;
    --bg: #0b0c0e;
    --card: #17181b;
    --surface: #1f2024;
    --danger: #ff6961;
    --danger-bg: #3a1514;
    --warn-fg: #ffb340;
    --warn-bg: #33240d;
    --shadow: none;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai UI", "Noto Sans Thai", Thonburi, Tahoma, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

a {
  color: var(--green-ink);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 8px;
  background: var(--card);
  padding: 8px 12px;
  z-index: 10;
}

/* ── Header / footer ─────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 10px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  flex: none;
  white-space: nowrap;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-nav a {
  color: var(--ink2);
  text-decoration: none;
  font-size: 15px;
  padding: 6px 6px;
  border-radius: 8px;
  white-space: nowrap;
}

@media (min-width: 480px) {
  .site-nav {
    gap: 4px;
  }
  .site-nav a {
    padding: 6px 8px;
  }
}

.site-nav a[aria-current="page"] {
  color: var(--green-ink);
  font-weight: 600;
}

.site-footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 8px;
}

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

/* ── Layout ──────────────────────────────────────────────────────── */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}

h1 {
  font-size: 30px;
  line-height: 1.3;
  margin: 8px 0 8px;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 6px;
}

h3 {
  font-size: 15px;
  margin: 0 0 4px;
}

p {
  margin: 0 0 12px;
}

.lead {
  color: var(--ink2);
  font-size: 17px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}

.card > :last-child {
  margin-bottom: 0;
}

ul.clean {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

ul.clean li {
  margin: 2px 0;
}

/* ── Landing ─────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 28px 0 12px;
}

.hero .app-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  box-shadow: 0 10px 30px color-mix(in srgb, var(--green) 35%, transparent);
}

.hero h1 {
  font-size: 30px;
}

.badges {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 6px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 168px;
  padding: 9px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--card);
  text-decoration: none;
  line-height: 1.2;
  opacity: 0.55;
  cursor: default;
}

.store-badge svg {
  width: 24px;
  height: 24px;
  flex: none;
}

.store-badge small {
  display: block;
  font-size: 11px;
}

.store-badge strong {
  font-size: 15px;
}

.features {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.feature {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.feature .dot {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--green-tint);
  color: var(--green-ink);
}

.feature .dot svg {
  width: 22px;
  height: 22px;
}

.links {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--ink);
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.links a:first-child {
  border-top: 0;
}

.links a::after {
  content: "›";
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

@media (min-width: 640px) {
  .features {
    grid-template-columns: 1fr 1fr;
  }
  h1 {
    font-size: 30px;
  }
  .hero h1 {
    font-size: 30px;
  }
  main {
    padding-top: 32px;
  }
}

/* ── Legal pages ─────────────────────────────────────────────────── */
.legal-section {
  scroll-margin-top: 72px;
}

.toc ol {
  margin: 0;
  padding-left: 1.25em;
}

.toc li {
  margin: 2px 0;
}

/* ── FAQ ─────────────────────────────────────────────────────────── */
details.faq {
  border-top: 1px solid var(--border);
  padding: 4px 0;
}

details.faq:first-of-type {
  border-top: 0;
}

details.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 10px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

details.faq summary::-webkit-details-marker {
  display: none;
}

details.faq summary::after {
  content: "+";
  color: var(--muted);
  font-weight: 400;
  font-size: 20px;
  line-height: 1.2;
}

details.faq[open] summary::after {
  content: "−";
}

details.faq > div {
  color: var(--ink2);
  padding: 0 0 10px;
}

/* ── Forms ───────────────────────────────────────────────────────── */
label.field {
  display: block;
  font-weight: 600;
  margin: 0 0 6px;
}

.input {
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 50px;
}

.input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 30%, transparent);
}

.input.otp {
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 17px;
  border-radius: 14px;
  border: 0;
  cursor: pointer;
  background: var(--green-strong);
  color: #fff;
  text-decoration: none;
}

.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.link {
  background: none;
  color: var(--green-ink);
  min-height: 40px;
  width: auto;
  padding: 6px 4px;
  font-weight: 500;
  font-size: 15px;
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn .spinner {
    animation-duration: 2.4s;
  }
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0 4px;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--danger);
  flex: none;
}

.alert {
  border-radius: 12px;
  padding: 10px 12px;
  margin: 12px 0 0;
  font-size: 15px;
}

.alert.error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert.warn {
  background: var(--warn-bg);
  color: var(--warn-fg);
}

.alert.ok {
  background: var(--green-tint);
  color: var(--green-ink);
}

.steps {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--muted);
}

.steps li {
  flex: 1;
  border-top: 3px solid var(--border);
  padding-top: 6px;
}

.steps li.done,
.steps li.current {
  border-color: var(--green);
  color: var(--ink);
}

.steps li.current {
  font-weight: 600;
}

.two-col {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

.success-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 4px auto 12px;
  background: var(--green-tint);
  color: var(--green-ink);
}

[hidden] {
  display: none !important;
}

.center {
  text-align: center;
}

@media (max-width: 400px) {
  .brand-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .site-nav a {
    font-size: 13px;
    padding: 6px 5px;
  }
}
