/* ==========================================================================
   จงเจริญรีสอร์ท — Design System
   ธีมทางการ (formal) · Mobile-first · เข้าถึงง่าย
   ========================================================================== */

/* ---------- 1. Design Tokens ---------- */
:root {
  /* สี — โทนทางการ: กรมท่า + ทองเก่า */
  --ink:        #0F2740;   /* น้ำเงินกรมท่า — สีหลัก */
  --ink-700:    #1B3B5C;
  --ink-500:    #2F5478;
  --ink-300:    #6B87A3;

  --gold:       #A2782F;   /* ทองเก่า — สีรอง/เน้น */
  --gold-soft:  #C9A15C;
  --gold-tint:  #FAF4E8;

  --paper:      #FFFFFF;
  --canvas:     #F6F5F2;   /* พื้นหลังหน้า */
  --line:       #E3E0DA;   /* เส้นขอบ */
  --line-soft:  #EFEDE8;

  --text:       #1C2530;
  --text-mute:  #5F6B78;
  --text-faint: #8A94A0;

  --ok:         #1E7A4C;
  --ok-tint:    #E8F4ED;
  --warn:       #A9701A;
  --warn-tint:  #FBF2E0;
  --danger:     #A32B2B;
  --danger-tint:#FAECEC;
  --info:       #23608F;
  --info-tint:  #E9F1F8;

  /* ตัวอักษร */
  --font-head: "Noto Serif Thai", "Sarabun", "Thonburi", Georgia, serif;
  --font-body: "Noto Sans Thai", "Sarabun", -apple-system, "Segoe UI", sans-serif;
  --font-num:  "Noto Sans Thai", ui-monospace, "SF Mono", monospace;

  /* ขนาดตัวอักษร — ปรับตามจอด้วย clamp */
  --fs-display: clamp(1.9rem, 1.2rem + 3vw, 3.1rem);
  --fs-h1:      clamp(1.55rem, 1.1rem + 1.9vw, 2.2rem);
  --fs-h2:      clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
  --fs-h3:      1.125rem;
  --fs-base:    1rem;
  --fs-sm:      0.9375rem;
  --fs-xs:      0.8125rem;

  /* ระยะห่าง */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

  /* อื่น ๆ */
  --r-sm: 6px; --r-md: 10px; --r-lg: 16px; --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(15,39,64,.06), 0 1px 3px rgba(15,39,64,.05);
  --shadow-2: 0 2px 6px rgba(15,39,64,.07), 0 8px 24px rgba(15,39,64,.07);
  --shadow-3: 0 12px 40px rgba(15,39,64,.16);
  --tap: 48px;                 /* ขนาดปุ่มขั้นต่ำสำหรับนิ้ว */
  --header-h: 60px;
  --wrap: 1180px;
  --ease: cubic-bezier(.2,.7,.3,1);
}

/* ---------- 2. Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.65;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.3; color: var(--ink); font-weight: 600; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

a { color: var(--ink-700); text-decoration: none; }
a:hover { color: var(--gold); }
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { padding: 0; list-style: none; }

:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; left: 50%; top: -80px; transform: translateX(-50%);
  z-index: 200; background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 0 0 var(--r-md) var(--r-md);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 0; color: #fff; }

/* ---------- 3. Layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--sp-4); }
@media (min-width: 768px) { .wrap { padding-inline: var(--sp-5); } }

.section { padding-block: var(--sp-7); }
@media (min-width: 768px) { .section { padding-block: var(--sp-8); } }
.section--tint { background: var(--paper); }

.stack > * + * { margin-top: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; }

.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* หัวข้อหมวด */
.sec-head { text-align: center; margin-bottom: var(--sp-6); }
.sec-head .eyebrow {
  font-size: var(--fs-xs); letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); font-weight: 600; margin-bottom: var(--sp-2);
}
.sec-head p { color: var(--text-mute); margin-top: var(--sp-2); }
.sec-head::after {
  content: ""; display: block; width: 48px; height: 2px;
  background: var(--gold); margin: var(--sp-4) auto 0;
}
.sec-head--left { text-align: left; }
.sec-head--left::after { margin-inline: 0; }

/* ---------- 4. Header + Navigation ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(255,255,255,.94);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__bar {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--gold-soft);
  border-radius: var(--r-sm);
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
}
.brand__name { font-family: var(--font-head); font-size: 1.0625rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.brand__sub { font-size: 11px; color: var(--text-faint); letter-spacing: .06em; }

.nav { display: none; }
@media (min-width: 900px) {
  .nav { display: flex; align-items: center; gap: var(--sp-2); }
  .nav a {
    padding: 8px 14px; border-radius: var(--r-sm);
    font-size: var(--fs-sm); color: var(--text);
  }
  .nav a:hover { background: var(--canvas); color: var(--ink); }
  .nav a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--gold); }
}
.header-cta { display: none; }
@media (min-width: 900px) { .header-cta { display: inline-flex; } }

.burger {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  background: none; border: 1px solid var(--line); border-radius: var(--r-sm);
  cursor: pointer;
}
@media (min-width: 900px) { .burger { display: none; } }
.burger span { display: block; width: 20px; height: 2px; background: var(--ink); position: relative; }
.burger span::before, .burger span::after {
  content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--ink);
  transition: transform .2s var(--ease), top .2s var(--ease);
}
.burger span::before { top: -6px; } .burger span::after { top: 6px; }
.burger[aria-expanded="true"] span { background: transparent; }
.burger[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.burger[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

/* เมนูมือถือ — เลื่อนลงจากหัวเว็บ */
.mobile-nav {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .25s var(--ease);
  border-top: 0 solid var(--line);
  background: var(--paper);
}
.mobile-nav[data-open="true"] { grid-template-rows: 1fr; border-top-width: 1px; }
.mobile-nav > div { overflow: hidden; }
.mobile-nav a {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap); padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--line-soft); font-size: var(--fs-sm);
}
.mobile-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--gold-tint); }
.mobile-nav .btn { margin: var(--sp-4); }
@media (min-width: 900px) { .mobile-nav { display: none; } }

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 var(--sp-5);
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1;
  cursor: pointer; text-align: center;
  transition: background .15s var(--ease), color .15s var(--ease),
              border-color .15s var(--ease), transform .1s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: var(--ink-700); color: #fff; }
.btn--gold { background: var(--gold); color: #fff; }
.btn--gold:hover { background: #8E6828; color: #fff; }
.btn--outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--outline:hover { background: var(--ink); color: #fff; }
.btn--ghost { background: var(--paper); border-color: var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--ink-300); color: var(--ink); }
.btn--light { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.45); color: #fff; }
.btn--light:hover { background: #fff; color: var(--ink); }
.btn--sm { min-height: 38px; padding: 0 var(--sp-4); font-size: var(--fs-xs); }
.btn--lg { min-height: 54px; padding: 0 var(--sp-6); font-size: 1.0625rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---------- 6. Cards / Surfaces ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.card__body { padding: var(--sp-4); }
@media (min-width: 768px) { .card__body { padding: var(--sp-5); } }
.card__head {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.card__head h3 { font-size: 1rem; }

/* การ์ดห้องพัก */
.room-card { display: flex; flex-direction: column; transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.room-card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.room-card__media { position: relative; aspect-ratio: 4/3; background: var(--ink-300); }
.room-card__media .ph { width: 100%; height: 100%; }
.room-card__badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(15,39,64,.86); color: #fff;
  font-size: var(--fs-xs); font-weight: 600;
  padding: 5px 10px; border-radius: var(--r-pill);
}
.room-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; }
.room-card__price { font-family: var(--font-head); font-size: 1.35rem; color: var(--ink); font-weight: 700; }
.room-card__price small { font-family: var(--font-body); font-size: var(--fs-xs); font-weight: 400; color: var(--text-mute); }
.feature-list { display: flex; flex-wrap: wrap; gap: 6px; }
.feature-list li {
  font-size: var(--fs-xs); color: var(--text-mute);
  background: var(--canvas); border: 1px solid var(--line-soft);
  padding: 4px 10px; border-radius: var(--r-pill);
}

/* รูปแทน (placeholder) */
.ph {
  background:
    linear-gradient(135deg, rgba(255,255,255,.10) 0 40%, transparent 40%),
    linear-gradient(160deg, var(--ink-500), var(--ink));
  display: grid; place-items: center; color: rgba(255,255,255,.5);
  font-size: var(--fs-xs); letter-spacing: .1em;
}
.ph--gold { background: linear-gradient(160deg, var(--gold-soft), var(--gold)); }

/* ---------- 7. Badges / Status ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1;
  padding: 6px 10px; border-radius: var(--r-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--ok     { background: var(--ok-tint);     color: var(--ok); }
.badge--warn   { background: var(--warn-tint);   color: var(--warn); }
.badge--danger { background: var(--danger-tint); color: var(--danger); }
.badge--info   { background: var(--info-tint);   color: var(--info); }
.badge--mute   { background: var(--canvas);      color: var(--text-mute); }
.badge--plain::before { display: none; }

/* ---------- 8. Forms ---------- */
.field { display: block; }
.field + .field { margin-top: var(--sp-4); }
.label {
  display: block; font-size: var(--fs-sm); font-weight: 600;
  color: var(--ink); margin-bottom: 6px;
}
.label .req { color: var(--danger); }
.hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 6px; }
.error { font-size: var(--fs-xs); color: var(--danger); margin-top: 6px; }

.input, .select, .textarea {
  width: 100%; min-height: var(--tap);
  padding: 12px var(--sp-4);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 16px;               /* กัน iOS ซูมอัตโนมัติ */
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.textarea { min-height: 110px; padding-block: var(--sp-3); resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-300); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--ink-500);
  box-shadow: 0 0 0 3px rgba(47,84,120,.16);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235F6B78' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 40px;
}

/* ตัวเลือกแบบการ์ด (แตะง่ายบนมือถือ) */
.choice-group { display: grid; gap: var(--sp-2); }
@media (min-width: 640px) { .choice-group--inline { grid-auto-flow: column; grid-auto-columns: 1fr; } }
.choice {
  position: relative; display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap); padding: var(--sp-3) var(--sp-4);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice__dot {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
}
.choice__dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform .15s var(--ease); }
.choice:hover { border-color: var(--ink-300); }
.choice:has(input:checked) { border-color: var(--ink); background: #F9FAFC; }
.choice:has(input:checked) .choice__dot { border-color: var(--ink); }
.choice:has(input:checked) .choice__dot::after { transform: scale(1); }
.choice:has(input:focus-visible) { outline: 3px solid var(--gold-soft); outline-offset: 2px; }
.choice__text { display: flex; flex-direction: column; gap: 2px; }
.choice__text b { font-size: var(--fs-sm); }
.choice__text span { font-size: var(--fs-xs); color: var(--text-mute); }

/* ---------- 9. Stepper (ขั้นตอนการจอง) ---------- */
.stepper { display: flex; align-items: flex-start; counter-reset: s; }
.stepper li { flex: 1; text-align: center; position: relative; font-size: var(--fs-xs); color: var(--text-faint); }
.stepper li::before {
  counter-increment: s; content: counter(s);
  display: grid; place-items: center; margin: 0 auto 6px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--line);
  font-weight: 700; font-size: var(--fs-xs); color: var(--text-faint);
}
.stepper li::after {
  content: ""; position: absolute; top: 15px; left: calc(-50% + 22px); right: calc(50% + 22px);
  height: 1.5px; background: var(--line);
}
.stepper li:first-child::after { display: none; }
.stepper li[data-state="done"] { color: var(--ink); }
.stepper li[data-state="done"]::before { content: "✓"; background: var(--ink); border-color: var(--ink); color: #fff; }
.stepper li[data-state="done"]::after { background: var(--ink); }
.stepper li[data-state="current"] { color: var(--ink); font-weight: 700; }
.stepper li[data-state="current"]::before { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 4px rgba(15,39,64,.09); }

/* ---------- 10. Tables (มือถือ = การ์ด) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 12px var(--sp-4); text-align: left; white-space: nowrap; }
.table thead th {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-mute);
  background: var(--canvas); border-bottom: 1px solid var(--line);
}
.table tbody tr { border-bottom: 1px solid var(--line-soft); }
.table tbody tr:hover { background: #FBFBFA; }
.table td b { color: var(--ink); }

@media (max-width: 767px) {
  .table--cards thead { display: none; }
  .table--cards tbody tr {
    display: grid; grid-template-columns: auto 1fr; gap: 4px var(--sp-3);
    padding: var(--sp-4); border: 1px solid var(--line);
    border-radius: var(--r-md); background: var(--paper); margin-bottom: var(--sp-3);
  }
  .table--cards td { padding: 0; white-space: normal; display: contents; }
  .table--cards td::before {
    content: attr(data-th); font-size: var(--fs-xs); color: var(--text-faint);
    align-self: center;
  }
}

/* ---------- 11. Floating contact (มือถือ) ---------- */
.fab-stack {
  position: fixed; right: var(--sp-4); z-index: 50;
  bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.fab {
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; box-shadow: var(--shadow-3);
  border: none; cursor: pointer;
}
.fab--line { background: #06C755; }
.fab--call { background: var(--ink); }
.fab:hover { color: #fff; filter: brightness(1.06); }

/* ---------- 12. Sticky action bar ---------- */
.sticky-bar {
  position: sticky; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: var(--sp-3) var(--sp-4);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: var(--sp-4);
  box-shadow: 0 -4px 16px rgba(15,39,64,.06);
}
.sticky-bar .btn { flex: 1; max-width: 260px; }

/* ---------- 13. Footer ---------- */
.site-footer { background: var(--ink); color: rgba(255,255,255,.72); padding-block: var(--sp-7) var(--sp-5); }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: var(--sp-3); }
.site-footer a { color: rgba(255,255,255,.72); }
.site-footer a:hover { color: var(--gold-soft); }
.site-footer .brand__name { color: #fff; }
.site-footer__grid { display: grid; gap: var(--sp-6); grid-template-columns: 1fr; }
@media (min-width: 768px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer__base {
  margin-top: var(--sp-6); padding-top: var(--sp-4);
  border-top: 1px solid rgba(255,255,255,.14);
  font-size: var(--fs-xs); text-align: center;
}
.foot-links li + li { margin-top: 10px; }
.foot-links a { font-size: var(--fs-sm); }

/* ---------- 14. Utilities ---------- */
.mute { color: var(--text-mute); }
.faint { color: var(--text-faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.bold { font-weight: 700; }
.center { text-align: center; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line-soft); border: 0; margin-block: var(--sp-4); }
.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;
}
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: revert; } .hide-desktop { display: none; } }
