/* AI Agent ตัวแรกของคุณ — the phone half of the stage slide (IESA S-Curve MBA รุ่น 6).
   Palette from the event poster: teal #123F3D, gold #C1A05F, ivory. Mitr = headings/actions, Looped = body.
   Mitr is only used on text without digits (its zero is slashed). */

/* ---------- fonts (self-hosted, Thai + Latin subsets; OFL, see fonts/OFL-NOTICE.txt) ---------- */
@font-face {
  font-family: "Mitr";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/Mitr-500-thai.woff2) format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Mitr";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/Mitr-500-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: "Noto Sans Thai Looped";
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/NotoSansThaiLooped-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: "Noto Sans Thai Looped";
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  font-display: swap;
  src: url(fonts/NotoSansThaiLooped-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;
}

/* ---------- tokens ---------- */
:root {
  --ink-950: #031110;
  --teal-900: #082221;
  --teal-850: #0A2826;
  --teal-700: #123F3D;
  --teal-600: #1A524F;
  --teal-100: #D6EAE5;
  --gold-700: #8C6E37;
  --gold-600: #A8874A;
  --gold-500: #C1A05F;
  --gold-300: #E2C98F;
  --gold-100: #F3E7C6;
  --ivory-50: #FBF8F1;
  --ivory-100: #F5F0E6;
  --ivory-200: #EAE2D2;
  --white: #FFFFFF;

  --c-page: var(--teal-850);
  --c-on-page: #F4EFE4;
  --c-on-page-dim: rgba(244, 239, 228, 0.78);
  --c-on-page-faint: rgba(244, 239, 228, 0.5);
  --c-card: var(--ivory-50);
  --c-ink: #0B2826;
  --c-ink-dim: rgba(11, 40, 38, 0.72);
  --c-ink-faint: rgba(11, 40, 38, 0.5);
  --c-field: var(--white);
  --c-field-line: rgba(18, 63, 61, 0.22);
  --c-focus: var(--gold-500);
  --c-error: #A93C23;
  --c-error-line: #C8553A;
  --c-warn: #8C6E37;

  --font-head: "Mitr", "Noto Sans Thai Looped", system-ui, sans-serif;
  --font-body: "Noto Sans Thai Looped", system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-kicker: 0.8125rem;   /* 13px */
  --fs-title: clamp(2rem, 1.35rem + 3.2vw, 2.5rem);
  --fs-lead: 1.03125rem;    /* 16.5px */
  --fs-label: 1.0625rem;    /* 17px */
  --fs-field: 1.0625rem;    /* 17px: >= 16px keeps iOS from zooming */
  --fs-small: 0.84375rem;   /* 13.5px */
  --fs-micro: 0.78125rem;   /* 12.5px */

  --r-card: 26px;
  --r-field: 15px;
  --r-btn: 17px;
  --gutter: 18px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms;
  --dur-normal: 420ms;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 400 var(--fs-lead) / 1.6 var(--font-body);
  color: var(--c-on-page);
  background-color: var(--c-page);
  background-image:
    radial-gradient(120% 60% at 100% 0%, rgba(193, 160, 95, 0.22), transparent 58%),
    radial-gradient(90% 50% at 0% 18%, rgba(44, 110, 103, 0.35), transparent 70%),
    linear-gradient(180deg, var(--teal-700) 0%, var(--teal-850) 46%, var(--teal-900) 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
[hidden] { display: none !important; }
.ph { display: inline-block; }            /* Thai phrase group: lines break between phrases, never mid-word */

.page {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding:
    max(26px, env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(var(--gutter), env(safe-area-inset-left));
}

/* ---------- hero ---------- */
.hero { padding: 6px 4px 22px; }
.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  font: 400 var(--fs-kicker) / 1.3 var(--font-body);
  letter-spacing: 0.06em;
  color: var(--gold-300);
}
.kicker::before {
  content: "";
  flex: none;
  width: 28px;
  height: 1.5px;
  background: currentColor;
  opacity: 0.8;
}
.title {
  display: flex;
  flex-direction: column;
  margin: 0;
  font: 500 var(--fs-title) / 1.22 var(--font-head);
  letter-spacing: -0.01em;
  color: var(--c-on-page);
}
.title__accent {
  color: var(--gold-300);
  background: linear-gradient(100deg, var(--gold-100) 0%, var(--gold-300) 45%, var(--gold-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.promise {
  margin: 14px 0 0;
  max-width: 34ch;
  font-size: var(--fs-lead);
  line-height: 1.62;
  color: var(--c-on-page-dim);
}
.promise strong { font-weight: 400; color: var(--gold-300); white-space: nowrap; }

/* scan -> type -> send in LINE: the same three beats as the slide */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-small);
  color: var(--c-on-page-faint);
}
.steps__item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.steps__item + .steps__item::before {
  content: "";
  width: 18px;
  height: 1px;
  margin: 0 10px;
  background: rgba(226, 201, 143, 0.35);
}
.steps__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
}
.steps__item.is-done { color: var(--c-on-page-dim); }
.steps__item.is-done .steps__dot { background: var(--gold-500); border-color: var(--gold-500); }
.steps__item.is-current { color: var(--gold-300); }
.steps__item.is-current .steps__dot {
  border-color: var(--gold-300);
  box-shadow: 0 0 0 4px rgba(226, 201, 143, 0.18);
}
.page.is-sent .steps__item.is-current { color: var(--c-on-page-dim); }
.page.is-sent .steps__item.is-current .steps__dot { background: var(--gold-500); border-color: var(--gold-500); box-shadow: none; }
.page.is-sent .steps__item:last-child { color: var(--gold-300); }
.page.is-sent .steps__item:last-child .steps__dot { border-color: var(--gold-300); box-shadow: 0 0 0 4px rgba(226, 201, 143, 0.18); }

/* ---------- card ---------- */
.card {
  position: relative;
  padding: 24px 18px 20px;
  border-radius: var(--r-card);
  background: var(--c-card);
  color: var(--c-ink);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 28px 60px -24px rgba(3, 17, 16, 0.75),
    0 10px 24px -14px rgba(3, 17, 16, 0.6);
  color-scheme: light;
}
.card::before {             /* gold hairline catching the light at the top edge */
  content: "";
  position: absolute;
  inset: 0 22px auto;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-500) 22%, var(--gold-300) 50%, var(--gold-500) 78%, transparent);
  opacity: 0.9;
}

/* ---------- fields ---------- */
.field + .field { margin-top: 22px; }
.field__label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font: 500 var(--fs-label) / 1.45 var(--font-head);
  color: var(--c-ink);
}
.field__num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 0.05em;
  border-radius: 50%;
  background: var(--teal-700);
  color: var(--gold-300);
  font: 500 0.875rem / 1 var(--font-head);
}
.field__input {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 14px 15px;
  border: 1.5px solid var(--c-field-line);
  border-radius: var(--r-field);
  background: var(--c-field);
  color: var(--c-ink);
  font: 400 var(--fs-field) / 1.55 var(--font-body);
  caret-color: var(--gold-700);
  box-shadow: 0 1px 2px rgba(11, 40, 38, 0.06) inset;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  -webkit-appearance: none;
  appearance: none;
}
.field__input::placeholder { color: rgba(11, 40, 38, 0.4); opacity: 1; }
.field__input--area {
  min-height: 108px;
  resize: none;
  overflow: hidden;
  field-sizing: content;
}
.field__input--short { min-height: 84px; }
.field__input:hover { border-color: rgba(18, 63, 61, 0.38); }
.field__input:focus { outline: none; }
.field__input:focus-visible,
.field__input:focus {
  border-color: var(--gold-600);
  box-shadow: 0 0 0 4px rgba(193, 160, 95, 0.3), 0 1px 2px rgba(11, 40, 38, 0.06) inset;
}
.field__input[aria-invalid="true"] {
  border-color: var(--c-error-line);
  box-shadow: 0 0 0 4px rgba(200, 85, 58, 0.16);
}
.field__meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
  margin-top: 7px;
  font-size: var(--fs-micro);
  line-height: 1.5;
}
.field__error {
  margin: 0;
  color: var(--c-error);
  font-size: var(--fs-small);
}
.field__count {
  margin-left: auto;
  color: var(--c-ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.field__count.is-near { color: var(--c-warn); }

.budget {
  margin: 12px 0 0;
  padding: 10px 13px;
  border-radius: 12px;
  background: rgba(193, 160, 95, 0.14);
  color: var(--c-warn);
  font-size: var(--fs-small);
  line-height: 1.5;
}
.budget.is-over {
  background: rgba(200, 85, 58, 0.1);
  color: var(--c-error);
}

.privacy {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  padding: 11px 13px;
  border-radius: 13px;
  background: rgba(18, 63, 61, 0.06);
  color: var(--c-ink-dim);
  font-size: var(--fs-small);
  line-height: 1.45;
}
.privacy__icon { flex: none; width: 20px; height: 20px; color: var(--teal-600); }

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-btn);
  font: 500 1.125rem / 1.2 var(--font-head);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.btn:focus { outline: none; }
.btn:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 3px; }
.btn:active { transform: translateY(1px) scale(0.995); }
.btn--primary {
  margin-top: 20px;
  color: var(--ivory-50);
  background: linear-gradient(180deg, var(--teal-600) 0%, var(--teal-700) 55%, #0E3533 100%);
  box-shadow:
    0 0 0 1px rgba(226, 201, 143, 0.38) inset,
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 14px 28px -12px rgba(18, 63, 61, 0.7);
}
.btn--primary:hover { box-shadow: 0 0 0 1px rgba(226, 201, 143, 0.6) inset, 0 1px 0 rgba(255, 255, 255, 0.14) inset, 0 16px 30px -12px rgba(18, 63, 61, 0.8); }
.btn__icon {
  width: 30px;
  height: 30px;
  padding: 5px;
  border-radius: 50%;
  background: var(--gold-500);
  color: var(--teal-850);
}
.btn--secondary {
  margin-top: 12px;
  color: var(--teal-700);
  background: transparent;
  box-shadow: 0 0 0 1.5px rgba(18, 63, 61, 0.35) inset;
}
.btn--secondary:hover { background: rgba(18, 63, 61, 0.05); }
.how {
  margin: 12px 0 0;
  text-align: center;
  color: var(--c-ink-faint);
  font-size: var(--fs-small);
  line-height: 1.5;
}
.how b { font-weight: 400; color: var(--c-ink); }
.oa { white-space: nowrap; }

.btn-link {
  display: block;
  min-height: 44px;
  margin: 6px auto 0;
  padding: 10px 16px;
  border: 0;
  background: none;
  color: var(--c-ink-dim);
  font: 400 var(--fs-small) / 1.4 var(--font-body);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(11, 40, 38, 0.3);
  cursor: pointer;
}
.btn-link:focus { outline: none; }
.btn-link:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 2px; border-radius: 8px; }

/* ---------- sent state ---------- */
.card--done { text-align: center; padding-top: 30px; }
.done__mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  color: var(--teal-850);
  background: radial-gradient(circle at 35% 30%, var(--gold-100), var(--gold-500) 70%);
  box-shadow: 0 0 0 7px rgba(193, 160, 95, 0.16), 0 12px 24px -10px rgba(140, 110, 55, 0.7);
}
.done__mark svg { width: 34px; height: 34px; }
.done__title {
  margin: 0;
  font: 500 1.5rem / 1.35 var(--font-head);
  color: var(--c-ink);
}
.done__title:focus { outline: none; }
.done__send { color: var(--gold-700); }
.done__sub { margin: 8px 0 0; color: var(--c-ink-dim); font-size: 0.9375rem; }

.bubble {
  margin: 18px 0 0 auto;
  max-width: 92%;
  padding: 12px 15px;
  border-radius: 20px 20px 6px 20px;
  background: var(--teal-100);
  text-align: left;
  box-shadow: 0 1px 0 rgba(18, 63, 61, 0.08);
}
.bubble__text {
  margin: 0;
  color: var(--c-ink);
  font-size: 0.9375rem;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.friend {
  display: grid;
  grid-template-columns: 1fr;               /* stacked: the CTA names the OA, so it needs its own row */
  justify-items: start;
  gap: 2px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--teal-700);
  color: var(--ivory-50);
  text-align: left;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(226, 201, 143, 0.3) inset;
  transition: transform var(--dur-fast) ease;
}
.friend:active { transform: translateY(1px); }
.friend:focus { outline: none; }
.friend:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 3px; }
.friend__q { font-size: 0.9375rem; line-height: 1.45; }
.friend__why { grid-row: 2; font-size: var(--fs-micro); color: rgba(244, 239, 228, 0.66); }
.friend__cta {
  grid-row: 3;
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--gold-500);
  color: var(--teal-850);
  font: 500 0.9375rem / 1 var(--font-head);
  white-space: nowrap;
}
.friend__cta svg { width: 18px; height: 18px; }

/* ---------- footer ---------- */
.foot {
  padding: 22px 8px 4px;
  text-align: center;
  color: var(--c-on-page-faint);
  font-size: var(--fs-micro);
  line-height: 1.6;
}
.foot p { margin: 0; }
.foot__brand { margin-top: 6px !important; font: 500 var(--fs-micro) / 1.4 var(--font-head); letter-spacing: 0.08em; color: rgba(226, 201, 143, 0.7); }
.noscript { color: var(--c-ink); }

/* ---------- motion (compositor only) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero, #form-view { animation: rise var(--dur-normal) var(--ease-out-expo) both; }
  #form-view { animation-delay: 80ms; }
  .card--done:not([hidden]) { animation: rise var(--dur-normal) var(--ease-out-expo) both; }
  .card--done:not([hidden]) .done__mark { animation: pop 520ms var(--ease-out-expo) 120ms both; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}

/* ---------- larger phones / tablets ---------- */
@media (min-width: 420px) {
  :root { --gutter: 22px; }
  .card { padding: 28px 22px 22px; }
}
@media (max-width: 359px) {
  :root { --gutter: 14px; }
  .steps { font-size: var(--fs-micro); }
  .steps__item + .steps__item::before { width: 12px; margin: 0 7px; }
}
