/* ============================================================================
   BASE — reset, typography, utilities
   โหลดหลัง tokens.css เสมอ
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

/* หัวข้อทุกระดับไม่มี margin โดยปริยาย — ระยะห่างคุมด้วย gap/utility เท่านั้น */
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }

img, video, svg { display: block; max-width: 100%; }

/* ลิงก์: ต้องกำหนดสีเองทุกครั้ง ห้ามปล่อยเป็นสีน้ำเงินของเบราว์เซอร์ */
a { color: var(--c-text); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--c-gold); }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* accessibility: focus ต้องเห็นชัดทุกจุด */
:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }

/* anchor link ต้องเผื่อความสูง sticky header */
[id] { scroll-margin-top: var(--scroll-offset); }

/* --- TYPE SCALE CLASSES --------------------------------------------------- */
.t-h1 { font-size: var(--fs-h1);    font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.t-h2 { font-size: var(--fs-h2);    font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -0.01em; text-transform: uppercase; }
.t-h2--sm { font-size: var(--fs-h2-sm); }
.t-h3 { font-size: var(--fs-h3);    font-weight: var(--fw-bold); line-height: 1.24; letter-spacing: -0.01em; }
.t-lead { font-family: var(--font-serif); font-style: italic; font-size: var(--fs-lead); line-height: 1.5; color: var(--c-gold); }
.t-body { font-size: var(--fs-body); line-height: var(--lh-loose); color: var(--c-text-2); }
.t-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-body); color: var(--c-text-3); }
.t-meta { font-size: var(--fs-caption); color: var(--c-text-4); letter-spacing: var(--ls-wide); }
.t-eyebrow {
  font-size: var(--fs-eyebrow); font-weight: var(--fw-bold);
  letter-spacing: var(--ls-eyebrow-x); text-transform: uppercase; color: var(--c-gold);
}
.t-pretty { text-wrap: pretty; }

/* พื้นดำ: สลับสีตัวอักษรทั้งบล็อกด้วยคลาสเดียว */
.on-dark { color: var(--c-text-invert); }
.on-dark .t-body   { color: var(--c-text-invert-3); }
.on-dark .t-body-sm{ color: var(--c-text-invert-3); }
.on-dark .t-meta   { color: var(--c-text-invert-4); }
.on-dark a         { color: var(--c-text-invert); }
.on-dark a:hover   { color: var(--c-gold); }

/* --- SECTION SHELL ------------------------------------------------------- */
.section { padding: var(--sp-22) var(--gutter); }
.section--white { background: var(--c-bg); padding-block: var(--sp-24); }
.section--cream { background: var(--c-bg-cream); }
.section--cream-2 { background: var(--c-bg-cream-2); }
.section--dark { background: var(--c-ink); color: var(--c-text-invert); position: relative; overflow: hidden; }
.wrap { max-width: var(--wrap); margin-inline: auto; }
.wrap--narrow { max-width: var(--wrap-narrow); margin-inline: auto; }

/* หัว section มาตรฐาน: เส้นทอง 64x1 + H2 uppercase (+ คำโปรย serif ฝั่งขวา) */
.rule { width: 64px; height: 1px; background: var(--c-gold); margin-bottom: var(--sp-6); }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: var(--sp-14); flex-wrap: wrap; margin-bottom: var(--sp-14);
}

/* --- UTILITIES ----------------------------------------------------------- */
.stack   { display: grid; }
.stack-3 { display: grid; gap: var(--sp-3); }
.stack-5 { display: grid; gap: var(--sp-5); }
.row     { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); }
.row-lg  { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-5); }
.mt-6  { margin-top: var(--sp-6); }
.mt-10 { margin-top: var(--sp-10); }
.mt-16 { margin-top: var(--sp-16); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- KEYFRAMES (ใช้ร่วมทั้งเว็บ) ----------------------------------------- */
@keyframes aritcoFloat  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes aritcoPulse  { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes aritcoMarquee{ from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
