@font-face {
  font-family: LoopSans;
  src: url('/assets/fonts/NotoSansThai-Regular.ttf');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: LoopSans;
  src: url('/assets/fonts/NotoSansThai-Medium.ttf');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: LoopSans;
  src: url('/assets/fonts/NotoSansThai-SemiBold.ttf');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: LoopSans;
  src: url('/assets/fonts/NotoSansThai-ExtraBold.ttf');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: LoopSerif;
  src: url('/assets/fonts/NotoSerifThai-Regular.ttf');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: LoopSerif;
  src: url('/assets/fonts/NotoSerifThai-Bold.ttf');
  font-weight: 700;
  font-display: swap;
}

/* ── Tokens ─────────────────────────────────────────────
   Gazette paper, statute ink, one seal red used exactly once. */
:root {
  color-scheme: light;

  --paper: #f2ede1;
  --paper-warm: #e9e2d2;
  --sheet: #fbf8f1;
  --ink: #0c2b26;
  --ink-soft: #3f5f59;
  --ink-faint: #6f8781;
  --rule: #d5cab4;
  --rule-strong: #b9ab90;
  --jade: #2f6c60;
  --seal: #8c2f27;

  --shell-max: 1180px;
  --curve: cubic-bezier(0.22, 0.61, 0.36, 1);

  font-family: LoopSans, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  overflow-x: hidden;
  /* Faint ledger rules — the paper the law is printed on. */
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 71px,
    rgba(12, 43, 38, 0.035) 71px 72px
  );
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

.skip {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -80px;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
  transition: top 0.2s var(--curve);
}
.skip:focus {
  top: 16px;
}

:focus-visible {
  outline: 3px solid var(--seal);
  outline-offset: 3px;
}

/* ── Shared type ────────────────────────────────────── */
.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--jade);
}

h1,
h2 {
  font-family: LoopSerif, Georgia, serif;
  font-weight: 700;
  /* Thai ascenders and tone marks need more room than a Latin setting */
  line-height: 1.42;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

/* ── Masthead ───────────────────────────────────────── */
.masthead {
  border-bottom: 1px solid var(--rule);
  background: rgba(242, 237, 225, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.masthead-inner {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.wordmark img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.masthead-nav {
  display: flex;
  gap: 28px;
  margin-inline-start: auto;
}
.masthead-nav a {
  text-decoration: none;
  font-size: 14px;
  color: var(--ink-soft);
  padding-block: 4px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--curve), border-color 0.2s var(--curve);
}
.masthead-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.masthead-cta {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 2px;
  transition: background 0.2s var(--curve);
}
.masthead-cta:hover {
  background: var(--jade);
}

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s var(--curve), color 0.2s var(--curve),
    border-color 0.2s var(--curve);
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--jade);
}
.btn-quiet {
  border: 1px solid var(--rule-strong);
  color: var(--ink);
}
.btn-quiet:hover {
  border-color: var(--ink);
  background: var(--paper-warm);
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: clamp(56px, 8vw, 104px) 0 clamp(64px, 9vw, 120px);
  display: grid;
  grid-template-columns: 1fr minmax(0, 452px);
  gap: clamp(40px, 6vw, 88px);
  align-items: start;
}

.hero-lede h1 {
  font-size: clamp(44px, 5.4vw, 76px);
  margin: 20px 0 0;
}
.hero-lede .mark {
  /* the underline is a reading rule, not a highlighter; Thai descenders
     sit low, so keep it tight under the baseline rather than under the box */
  background-image: linear-gradient(var(--jade), var(--jade));
  background-repeat: no-repeat;
  background-position: 0 72%;
  background-size: 100% 3px;
}

.lede {
  margin: 24px 0 0;
  max-width: 46ch;
  font-size: clamp(16px, 1.25vw, 18px);
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* ── Store buttons ──────────────────────────────────── */
.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.store-row-center {
  justify-content: center;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 22px 10px 18px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 3px;
  transition: background 0.2s var(--curve), transform 0.2s var(--curve);
}
.store-btn:hover {
  background: var(--jade);
  border-color: var(--jade);
}
.store-btn:active {
  transform: translateY(1px);
}
.store-glyph {
  width: 26px;
  height: 26px;
  flex: none;
  fill: currentColor;
}
.store-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.25;
}
.store-copy small {
  font-size: 11px;
  letter-spacing: 0.04em;
  opacity: 0.72;
}
.store-copy b {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.store-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}
.store-note a {
  color: var(--jade);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.store-note a:hover {
  color: var(--ink);
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  margin: 44px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.hero-facts div {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}
.hero-facts dt {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}
.hero-facts dd {
  margin: 0;
  font-family: LoopSerif, Georgia, serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
}
.hero-facts .facts-plain {
  font-family: LoopSans, sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0;
}

/* ── Signature: the provision sheet ─────────────────── */
.provision {
  position: relative;
  margin: 0;
}

.provision-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  font-size: 12px;
  color: var(--ink-faint);
}
.provision-source {
  letter-spacing: 0.02em;
}
.provision-badge {
  padding: 3px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--jade);
  font-weight: 600;
  white-space: nowrap;
}

.provision-sheet {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  padding: clamp(24px, 3vw, 36px);
  box-shadow: 0 1px 0 var(--rule), 14px 14px 0 -1px rgba(12, 43, 38, 0.06);
}

.provision-number {
  font-size: clamp(26px, 2.4vw, 34px);
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--ink);
}

.provision-body .line {
  position: relative;
  margin: 0;
  padding: 8px 0 8px 62px;
  font-family: LoopSerif, Georgia, serif;
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-faint);
  transition: color 0.4s var(--curve);
}
.line-time {
  position: absolute;
  left: 0;
  top: 12px;
  font-family: LoopSans, sans-serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--rule-strong);
}
.line.is-read {
  color: var(--ink-soft);
}
.line.is-reading {
  color: var(--ink);
}
/* the reading rule sits in the margin beside the line being read */
.line.is-reading::before {
  content: '';
  position: absolute;
  left: 46px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--jade);
}

.provision-player {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}
.play {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 0.2s var(--curve);
}
.play:hover {
  background: var(--jade);
}
.play svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.player-track {
  flex: 1;
  min-width: 0;
}
.player-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  margin-bottom: 7px;
}
.player-rule {
  height: 2px;
  background: var(--rule);
}
.player-rule i {
  display: block;
  height: 100%;
  width: 26%;
  background: var(--jade);
}
.player-speed {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.provision-mascot {
  position: absolute;
  right: -46px;
  bottom: -70px;
  width: clamp(96px, 10vw, 120px);
  height: auto;
  filter: drop-shadow(0 12px 20px rgba(12, 43, 38, 0.18));
  pointer-events: none;
}

/* ── The turn ───────────────────────────────────────── */
.turn {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: clamp(56px, 8vw, 96px) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-align: center;
}
.turn-from {
  margin: 0;
  font-size: 15px;
  color: var(--ink-faint);
}
.turn-to {
  margin: 10px auto 0;
  max-width: 22ch;
  font-family: LoopSerif, Georgia, serif;
  font-weight: 700;
  font-size: clamp(28px, 3.8vw, 46px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

/* ── Chapters ───────────────────────────────────────── */
.chapter {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: clamp(64px, 9vw, 112px) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr);
  gap: clamp(36px, 6vw, 80px);
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
.chapter-flip .chapter-text {
  order: 2;
}

.chapter-text h2 {
  font-size: clamp(30px, 3.6vw, 46px);
  margin: 16px 0 20px;
}
.chapter-text > p {
  margin: 0;
  max-width: 44ch;
  color: var(--ink-soft);
}

.chapter-example {
  margin-top: 24px;
  padding: 14px 18px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--jade);
  font-family: LoopSerif, Georgia, serif;
}
.chapter-text > p.chapter-example {
  color: var(--ink);
}
.chapter-example span {
  display: block;
  font-family: LoopSans, sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 2px;
}

.chapter-list {
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  max-width: 40ch;
}
.chapter-list li {
  position: relative;
  padding-left: 22px;
  font-size: 15px;
  color: var(--ink-soft);
}
.chapter-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 13px;
  width: 12px;
  height: 1px;
  background: var(--rule-strong);
}

/* Screenshots are cropped to the device itself, so the page states each
   heading once instead of repeating the one baked into the source image. */
.chapter-shot {
  justify-self: center;
  max-width: 340px;
}
.chapter-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule-strong);
  box-shadow: 12px 12px 0 -1px rgba(12, 43, 38, 0.06);
}
.chapter-shot-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
  max-width: 400px;
  justify-self: start;
}
.chapter-shot-pair img:last-child {
  margin-top: 36px;
}

/* ── PLUS ───────────────────────────────────────────── */
.plus {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: clamp(64px, 9vw, 112px) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: clamp(36px, 6vw, 80px);
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
.plus-text h2 {
  font-size: clamp(30px, 3.6vw, 46px);
  margin: 16px 0 20px;
}
.plus-text p {
  margin: 0;
  max-width: 40ch;
  color: var(--ink-soft);
}

.rate {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 20px 22px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
}
.rate + .rate {
  margin-top: 12px;
}
.rate-term {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--ink-soft);
}
.rate-price {
  font-family: LoopSerif, Georgia, serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.rate-unit {
  font-size: 13px;
  color: var(--ink-faint);
}
.rate-best {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.rate-best .rate-term,
.rate-best .rate-unit {
  color: #b6ccc6;
}
.rate-note {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ── Closing download CTA ───────────────────────────── */
.get {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: clamp(64px, 9vw, 112px) 0;
  border-bottom: 1px solid var(--rule);
}
.get-inner {
  position: relative;
  max-width: 640px;
  margin: auto;
  padding: clamp(36px, 5vw, 56px) clamp(24px, 4vw, 48px);
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  box-shadow: 14px 14px 0 -1px rgba(12, 43, 38, 0.06);
  text-align: center;
}
.get-mascot {
  display: block;
  width: clamp(88px, 11vw, 116px);
  height: auto;
  margin: 0 auto 18px;
  filter: drop-shadow(0 10px 18px rgba(12, 43, 38, 0.16));
}
.get-eyebrow {
  margin-bottom: 14px;
}
.get h2 {
  font-size: clamp(28px, 3.4vw, 42px);
}
.get-lede {
  margin: 16px auto 0;
  max-width: 38ch;
  color: var(--ink-soft);
}
.get-note {
  margin: 20px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ── Source & trust ─────────────────────────────────── */
.source {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: clamp(64px, 9vw, 112px) 0;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}

/* the one bold accent on the page */
.source-seal {
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  border: 2px solid var(--seal);
  border-radius: 50%;
  color: var(--seal);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
  transform: rotate(-8deg);
}
.source-seal span {
  display: block;
  padding: 8px;
  border-top: 1px solid var(--seal);
  border-bottom: 1px solid var(--seal);
}

.source-text h2 {
  font-size: clamp(28px, 3.2vw, 40px);
  margin: 14px 0 18px;
}
.source-text > p {
  margin: 0;
  max-width: 52ch;
  color: var(--ink-soft);
}
.source-link {
  display: inline-block;
  margin-top: 20px;
  font-weight: 600;
  color: var(--jade);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: color 0.2s var(--curve);
}
.source-link:hover {
  color: var(--ink);
}
.source-text > p.source-note {
  margin: 32px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-faint);
  max-width: 52ch;
}

/* ── Colophon ───────────────────────────────────────── */
.colophon {
  width: min(var(--shell-max), 100% - 48px);
  margin: auto;
  padding: 56px 0 40px;
  border-top: 1px solid var(--rule-strong);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.colophon-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}
.colophon-mark img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}
.colophon-mark b,
.colophon-mark span {
  display: block;
}
.colophon-mark b {
  font-size: 18px;
}
.colophon-mark span {
  font-size: 13px;
  color: var(--ink-faint);
}
.colophon-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.colophon-links div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.colophon-links b {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  font-weight: 600;
}
.colophon-links a {
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s var(--curve);
}
.colophon-links a:hover {
  color: var(--ink);
}
.colophon-line {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-faint);
}

/* ── Motion ─────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--curve), transform 0.6s var(--curve);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
html:not(.motion-ready) .reveal {
  opacity: 1;
  transform: none;
}

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 960px) {
  .masthead-nav {
    display: none;
  }
  .masthead-cta {
    margin-inline-start: auto;
  }
  .hero,
  .chapter,
  .plus,
  .source {
    grid-template-columns: 1fr;
  }
  .chapter-flip .chapter-text {
    order: 0;
  }
  .chapter-shot {
    max-width: 420px;
    width: 100%;
  }
  .chapter-shot-pair {
    max-width: 100%;
  }
  .provision-mascot {
    right: -8px;
    bottom: -38px;
  }
}

@media (max-width: 640px) {
  body {
    background-image: none;
  }
  .masthead-inner,
  .hero,
  .turn,
  .chapter,
  .plus,
  .source,
  .colophon {
    width: calc(100% - 32px);
  }
  .hero {
    padding-top: 36px;
  }
  .hero-lede h1 {
    font-size: 34px;
  }
  .lede {
    font-size: 15px;
  }
  .hero-actions .btn {
    flex: 1 1 100%;
  }
  .store-row {
    flex-direction: column;
    margin-top: 28px;
  }
  .store-btn {
    justify-content: flex-start;
  }
  .hero-facts {
    gap: 28px;
    margin-top: 32px;
  }
  .hero-facts dd {
    font-size: 26px;
  }
  .provision-body .line {
    padding-left: 52px;
    font-size: 15px;
  }
  .line.is-reading::before {
    left: 38px;
  }
  .provision-mascot {
    width: 96px;
    right: -6px;
    bottom: -30px;
  }
  .chapter-shot-pair {
    gap: 10px;
  }
  .chapter-shot-pair img:last-child {
    margin-top: 20px;
  }
  .source-seal {
    width: 132px;
    height: 132px;
    font-size: 12px;
  }
  .colophon {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
