@font-face {
  font-family: "Anuphan";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/assets/fonts/anuphan-thai-229aaa84.woff2") format("woff2");
  unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Anuphan";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url("/assets/fonts/anuphan-latin-0354d6d5.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: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-6ab57b19.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: #ffffff;
  --ink: #111111;
  --muted: #5c5c5c;
  --line: #e6e6e6;
  --soft: #f7f7f7;
  --orange: #f26b1d;
  --orange-soft: #fff1e8;
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, rgba(242, 107, 29, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(242, 107, 29, 0.07) 1px, transparent 1px),
    linear-gradient(to right, rgba(120, 90, 60, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(120, 90, 60, 0.045) 1px, transparent 1px);
  background-size: 112px 112px, 112px 112px, 28px 28px, 28px 28px;
  color: var(--ink);
  font-family: "Anuphan", "Inter", "Noto Sans Thai", system-ui, sans-serif;
  line-height: 1.65;
  font-size: 1.05rem;
}

img, svg { max-width: 100%; height: auto; }

a { color: inherit; }

.skip {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  transform: translateY(-150%);
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  z-index: 2;
  text-decoration: none;
  font-weight: 700;
}

.skip:focus { transform: none; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
}

body.article .wrap,
body.missing .wrap { max-width: 720px; }

nav.top,
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0 1.5rem;
}

.brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  text-decoration: none;
}

.brand span { color: var(--orange); }

.nav-links {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
  color: var(--muted);
}

.nav-links a { text-decoration: none; }

.nav-links a:hover { color: var(--ink); }

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: center;
  padding: 1rem 0 2.5rem;
}

.hero > * { min-width: 0; }

.hero h1 {
  font-size: clamp(1.5rem, 4.4vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 1.5rem;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.hero h1 .line { display: block; white-space: nowrap; }

.hero h1 .accent { color: var(--orange); font-style: normal; }

.hero .sub {
  color: var(--muted);
  font-size: 1.12rem;
  margin: 0 0 1.5rem;
  max-width: 32rem;
}

.btns { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.spaced { margin-top: 1.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { filter: brightness(0.95); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-outline { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-outline:hover { background: var(--soft); }

.hero-art {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}

.hero-art picture,
.hero-art img {
  width: 100%;
  max-width: 460px;
  height: auto;
  display: block;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hero-art img { mix-blend-mode: multiply; }

section { padding: 2.4rem 0 0; }

.section-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 1.1rem;
  display: inline-block;
  position: relative;
  padding-bottom: 0.35rem;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.4rem;
  height: 3px;
  background: var(--orange);
  border-radius: 2px;
}

.lead { color: var(--muted); max-width: 40rem; margin: 0 0 1.25rem; }

.about-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 1.25rem; }
.about-grid > * { min-width: 0; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.card p { margin: 0 0 0.8rem; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }
.card a { color: var(--orange); font-weight: 700; }

.mini-art {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fffaf4;
  border-radius: var(--radius);
  border: 1px solid #f0e2d4;
  padding: 0;
  overflow: hidden;
}

.mini-art picture,
.mini-art img {
  width: 100%;
  height: auto;
  display: block;
}

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.9rem; }

.tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 0.9rem 1.05rem;
  text-align: center;
  background: #fff;
  color: inherit;
  text-decoration: none;
}

a.tile:hover { border-color: var(--orange); }

.tile .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.7rem;
  border-radius: 14px;
  background: var(--orange-soft);
  border: 1px solid #ffd7bd;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile .icon svg { width: 28px; height: 28px; }
.tile h3 { margin: 0 0 0.25rem; font-size: 0.98rem; font-weight: 700; line-height: 1.3; }
.tile p { margin: 0; font-size: 0.82rem; color: var(--muted); }

.badge {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--orange);
  background: var(--orange-soft);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.article-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.article-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(242, 107, 29, 0.08);
}

.article-card .mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.article-card h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.article-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.article-card .go { font-weight: 700; color: var(--orange); white-space: nowrap; }

.timeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  position: relative;
  margin-top: 0.5rem;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 8%;
  right: 8%;
  border-top: 2px dashed #d0d0d0;
  z-index: 0;
}

.step { position: relative; z-index: 1; text-align: center; padding: 0 0.35rem; }

.step .dot {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.step .dot svg { width: 26px; height: 26px; }
.step:nth-child(odd) .dot { border-color: var(--orange); }
.step h4 { margin: 0 0 0.2rem; font-size: 0.92rem; font-weight: 700; }
.step p { margin: 0; font-size: 0.78rem; color: var(--muted); }

.term { white-space: nowrap; }

footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}

footer a { color: var(--orange); text-decoration: none; font-weight: 700; }

.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 700;
  margin: 0 0 0.45rem;
}

body.article h1,
body.missing h1,
body.about h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.55rem;
  font-weight: 800;
}

.accent { color: var(--orange); }

.meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 1.25rem; }
.prose p { margin: 0 0 1rem; color: #2a2a2a; }

.note,
.example-label {
  border-left: 3px solid var(--orange);
  background: var(--orange-soft);
  padding: 0.65rem 0.9rem;
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: 0.95rem;
  border-radius: 0 10px 10px 0;
}

.plate {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.1rem 1.2rem;
  margin: 1.4rem 0;
  background: #fff;
}

.plate-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 700;
  margin: 0 0 0.3rem;
}

.plate h2 {
  font-size: 1.15rem;
  margin: 0 0 0.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.plate .lead { margin: 0 0 0.75rem; font-size: 0.95rem; }
.hint { font-size: 0.82rem; color: var(--muted); margin: 0 0 0.65rem; }

.caption {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0.8rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.caption strong { color: var(--ink); }

.sent {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin: 0.25rem 0 0.75rem;
}

.tok {
  font: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  min-width: 2.7rem;
  text-align: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}

.tok:hover { border-color: var(--orange); transform: translateY(-1px); }
.tok[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tok.is-target { background: var(--orange); border-color: var(--orange); color: #fff; }

.viz-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  overflow: hidden;
}

.viz-wrap svg { display: block; width: 100%; height: auto; }

.status,
.formula {
  overflow-wrap: anywhere;
}

.status {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.55rem 0 0;
  min-height: 1.2em;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.2rem 0 0.85rem;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: min(100%, 12rem);
  font-weight: 600;
  font-size: 0.92rem;
}

.controls input[type="range"] {
  flex: 1;
  accent-color: var(--orange);
  min-width: 8rem;
}

.temp-val {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--orange);
  font-weight: 700;
  min-width: 3.2rem;
}

.bars { display: grid; gap: 0.45rem; }

.bar-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 3.2rem;
  gap: 0.5rem;
  align-items: center;
}

.bar-row .name { font-weight: 700; font-size: 0.9rem; }
.bar-track { height: 1.3rem; background: #eee; border-radius: 6px; overflow: hidden; }

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #111, #f26b1d);
  border-radius: 6px;
  transition: width 0.12s ease;
}

.bar-pct {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
}

.formula {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.7rem 0 0;
  background: var(--soft);
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
}

:focus { outline: none; }

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

@media (max-width: 860px) {
  .hero, .about-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .timeline { grid-template-columns: 1fr; gap: 1rem; }
  .timeline::before { display: none; }
  .step {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0.75rem;
    text-align: left;
    align-items: center;
  }
  .step .dot { margin: 0; }
}

@media (max-width: 420px) {
  .wrap { padding: 1rem 0.9rem 3rem; }
  .article-card { grid-template-columns: auto 1fr; }
  .article-card .go { grid-column: 2; }
  .bar-row { grid-template-columns: 3.6rem 1fr 2.8rem; }
  .tok { font-size: 0.95rem; padding: 0.35rem 0.65rem; }
  .controls label { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .article-card:hover, .tok:hover { transform: none; }
}
