/* =====================================================================
   hellosongkhla.com — หน้าหลัก
   ใช้ design tokens และการ์ดคูปองชุดเดียวกับ pro.hellosongkhla.com (app.css)
   ห้ามใช้ style="" (CSP ไม่อนุญาต inline style)
   ===================================================================== */

:root {
  --salt: #F3F8F8;
  --ink: #12303A;
  --ink-soft: #4C6670;
  --lagoon: #0B6E73;
  --lagoon-deep: #08575B;
  --lagoon-tint: #E2F0F0;
  --mustard: #F2B705;
  --mustard-tint: #FDF3CF;
  --lantern: #D23A2E;
  --lantern-tint: #FBE6E4;
  --line: #CFE0E1;
  --paper: #FFFFFF;

  --font-head: "Mitr", "Anuphan", system-ui, sans-serif;
  --font-body: "Anuphan", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 14px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(18, 48, 58, .06), 0 6px 18px -10px rgba(18, 48, 58, .25);
  --gutter: 16px;
  --notch-bg: var(--salt);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  margin: 0; background: var(--salt); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; line-height: 1.3; margin: 0; }
p { margin: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 6px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 20;
  background: var(--mustard); color: var(--ink); padding: 8px 14px;
  border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------------------------------------------------------------------
   ปุ่ม
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 20px; border-radius: var(--pill); border: 0;
  font-family: var(--font-head); font-weight: 500; text-decoration: none; cursor: pointer;
  white-space: nowrap;
}
.btn--small { min-height: 38px; padding: 6px 16px; font-size: .92rem; }
.btn--mustard { background: var(--mustard); color: var(--ink); }
.btn--mustard:hover { background: #FFC81F; }
.btn--lantern { background: var(--lantern); color: #fff; }
.btn--lantern:hover { background: #B83126; }

/* ---------------------------------------------------------------------
   ส่วนหัว + hero (พื้นสีทะเลสาบ ขอบล่างรอยปรุกระดาษคูปอง)
   --------------------------------------------------------------------- */
.masthead {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(242, 183, 5, .16), transparent 55%),
    linear-gradient(160deg, #0D7C82 0%, var(--lagoon) 45%, var(--lagoon-deep) 100%);
  color: #fff;
  --notch-bg: var(--lagoon-deep);
}
.masthead::after {
  content: ""; display: block; height: 10px;
  background: radial-gradient(circle at 9px 10px, var(--salt) 5px, transparent 5.5px) repeat-x;
  background-size: 18px 10px;
}

.nav { display: flex; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 8px; }
.brand {
  display: inline-flex; align-items: baseline; gap: 2px; margin-right: auto;
  font-family: var(--font-head); font-weight: 600; font-size: 1.4rem;
  text-decoration: none; color: #fff; letter-spacing: .2px;
}
.brand b { color: var(--mustard); font-weight: 600; }
.nav-links { display: none; gap: 4px; }
.nav-links a {
  display: inline-flex; align-items: center; min-height: 38px; padding: 6px 12px;
  border-radius: var(--pill); color: rgba(255, 255, 255, .88); text-decoration: none; font-size: .95rem;
}
.nav-links a:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.hero { display: grid; gap: 26px; padding-top: 22px; padding-bottom: 34px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .88rem; color: rgba(255, 255, 255, .9);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mustard); }
.hero h1 { font-size: clamp(2rem, 7.4vw, 3.4rem); line-height: 1.18; margin-top: 10px; letter-spacing: -.2px; }
.hero h1 em { font-style: normal; color: var(--mustard); }
.lead { color: rgba(255, 255, 255, .86); margin-top: 12px; max-width: 34em; font-size: 1.02rem; }

.search {
  display: flex; gap: 8px; margin-top: 20px; max-width: 480px;
  background: #fff; border-radius: var(--pill); padding: 5px 5px 5px 18px;
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, .45);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); padding: 9px 0; }
.search input::placeholder { color: #7A9097; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--mustard); outline-offset: 2px; }
.search button {
  border: 0; border-radius: var(--pill); background: var(--mustard); color: var(--ink);
  font-family: var(--font-head); font-weight: 500; padding: 8px 20px; cursor: pointer;
}

.hero-stats { display: flex; gap: 10px; margin: 22px 0 0; }
.hero-stats div {
  flex: 1; max-width: 150px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16);
}
.hero-stats dt { font-size: .74rem; color: rgba(255, 255, 255, .78); }
.hero-stats dd { margin: 0; font-family: var(--font-head); font-size: 1.45rem; line-height: 1.2; color: #fff; }

.hero-visual { position: relative; }
.hero-art { display: none; }

/* ---------------------------------------------------------------------
   การ์ดคูปองที่มีต้นขั้ว — องค์ประกอบเอกลักษณ์ (เหมือน pro.hellosongkhla.com)
   --------------------------------------------------------------------- */
.ticket {
  position: relative; display: grid; grid-template-columns: 1fr 100px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.ticket:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(18, 48, 58, .08), 0 14px 26px -12px rgba(18, 48, 58, .35); }
.ticket:focus-within { outline: 3px solid var(--mustard); outline-offset: 2px; }

.ticket-main { display: flex; gap: 12px; padding: 12px; min-width: 0; }
.ticket-thumb {
  flex: 0 0 76px; width: 76px; height: 76px; border-radius: 10px; overflow: hidden;
  background: var(--lagoon-tint); display: grid; place-items: center;
}
.ticket-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { font-family: var(--font-head); font-size: 1.8rem; color: var(--lagoon); }
.ticket-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ticket-store { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-title { font-size: 1.02rem; font-weight: 500; }
.ticket-title a { text-decoration: none; }
/* ทั้งการ์ดกดได้ แต่มีลิงก์เดียว */
.ticket-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.ticket-title a:focus-visible { outline: none; }
.ticket-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; padding-top: 6px; }

.ticket-stub {
  position: relative; border-left: 2px dashed var(--line);
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center; gap: 6px; padding: 10px 8px;
  background: linear-gradient(180deg, #FBFDFD, #F2F8F8);
}
.ticket-stub::before, .ticket-stub::after {
  content: ""; position: absolute; left: -10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--notch-bg); border: 1px solid var(--line);
}
.ticket-stub::before { top: -10px; }
.ticket-stub::after { bottom: -10px; }

.stub-until { font-size: .78rem; color: var(--ink-soft); line-height: 1.3; }
.stub-until strong { display: block; font-family: var(--font-head); font-weight: 500; font-size: .95rem; color: var(--ink); }
.stub-count { font-size: .72rem; color: var(--ink-soft); line-height: 1.3; }
.stub-count strong { display: block; font-family: var(--font-head); font-size: 1.1rem; color: var(--lagoon); font-weight: 600; }

.ticket.is-pinned { border-color: #EBC3BF; }
.ticket.is-pinned::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--lantern); }
.ticket.is-ending .stub-until strong { color: var(--lantern); }

.tag {
  display: inline-block; font-size: .72rem; line-height: 1; padding: 5px 8px;
  border-radius: var(--pill); background: var(--lagoon-tint); color: var(--lagoon-deep); font-weight: 500;
}
.tag--pin { background: var(--lantern); color: #fff; }
.tag--ending { background: var(--lantern-tint); color: #A52A20; }
.tag--days { background: var(--mustard-tint); color: #6B5200; }

/* คูปองใหญ่ใน hero — ต้นขั้วอยู่ด้านล่าง */
.ticket--hero { grid-template-columns: 1fr; border: 0; box-shadow: 0 22px 48px -20px rgba(0, 0, 0, .6); }
.ticket--hero:hover { transform: none; }
.ticket--hero .ticket-main { flex-direction: column; padding: 0; gap: 0; }
.ticket--hero .ticket-thumb { flex: none; width: 100%; height: 170px; border-radius: 0; }
.ticket--hero .thumb-fallback { font-size: 3.2rem; }
/* โปรที่ยังไม่มีรูป: พื้นลายคลื่นแทนรูป และเตี้ยลง */
.ticket--hero .ticket-thumb.is-empty {
  height: 112px;
  background:
    radial-gradient(circle at 18% 120%, rgba(242, 183, 5, .35) 0 38px, transparent 39px),
    repeating-radial-gradient(circle at 100% 100%, transparent 0 14px, rgba(11, 110, 115, .08) 14px 16px),
    var(--lagoon-tint);
}
.ticket--hero .ticket-thumb.is-empty .thumb-fallback {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); box-shadow: var(--shadow); font-size: 2rem;
}
.stub-pair { display: flex; gap: 18px; }
.ticket--hero .ticket-body { padding: 14px 16px 16px; gap: 4px; min-height: 104px; }
.ticket--hero .ticket-title { font-size: 1.32rem; }
.ticket--hero .ticket-stub {
  border-left: 0; border-top: 2px dashed var(--line);
  flex-direction: row; justify-content: space-between; padding: 14px 16px; min-height: 66px;
}
.ticket--hero .ticket-stub::before, .ticket--hero .ticket-stub::after { top: -10px; bottom: auto; border: 0; }
.ticket--hero .ticket-stub::before { left: -10px; }
.ticket--hero .ticket-stub::after { left: auto; right: -10px; }
.ticket--hero .stub-until, .ticket--hero .stub-count { text-align: left; }
.ticket-cta {
  position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  background: var(--lantern); color: #fff; text-decoration: none;
  font-family: var(--font-head); font-weight: 500; padding: 10px 18px; border-radius: var(--pill);
}
.ticket-cta:hover { background: #B83126; }
.hero-label {
  position: absolute; z-index: 2; top: 12px; left: 12px;
  background: var(--mustard); color: var(--ink); font-family: var(--font-head);
  font-size: .8rem; padding: 4px 12px; border-radius: var(--pill);
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .35);
}

/* โครงร่างระหว่างโหลด */
.is-loading { pointer-events: none; }
.is-loading .ticket-body { gap: 8px; flex: 1; }
.sk { display: block; height: 12px; border-radius: 6px; background: #E6EEEF; width: 100%; }
.sk--short { width: 40%; }
.sk--mid { width: 70%; }
@media (prefers-reduced-motion: no-preference) {
  .sk, .is-loading .ticket-thumb { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: .55; } }
}

/* ---------------------------------------------------------------------
   ส่วนเนื้อหา
   --------------------------------------------------------------------- */
.section { padding-top: 40px; padding-bottom: 8px; }
.section--tint { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 40px; padding-bottom: 40px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.kicker { font-size: .82rem; color: var(--lagoon); font-weight: 600; letter-spacing: .2px; }
.section-head h2 { font-size: clamp(1.4rem, 4.6vw, 1.9rem); }
.link-more {
  flex: none; color: var(--lagoon); font-weight: 600; text-decoration: none; font-size: .95rem;
  padding: 6px 0;
}
.link-more:hover { text-decoration: underline; }

/* แถบวัน */
.days { margin-bottom: 16px; }
.days ul { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.days a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 52px; border-radius: 12px; text-decoration: none;
  background: var(--paper); border: 1px solid var(--line);
  font-family: var(--font-head); font-size: 1rem; line-height: 1.1;
}
.days a small { font-family: var(--font-body); font-size: .68rem; color: var(--ink-soft); margin-top: 3px; }
.days a:hover { border-color: var(--lagoon); }
.days a[aria-current] { background: var(--lagoon); border-color: var(--lagoon); color: #fff; }
.days a[aria-current] small { color: var(--mustard); }

/* รายการโปร: มือถือเลื่อนแนวนอน, จอใหญ่เป็นตาราง */
.ticket-grid {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(290px, 86%);
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px var(--gutter) 14px; margin: 0 calc(var(--gutter) * -1);
  scroll-padding: 0 var(--gutter); scrollbar-width: thin;
}
.ticket-grid > li { scroll-snap-align: start; }
.ticket-grid > .feed-fallback { grid-column: 1 / -1; }

.feed-status { font-size: .9rem; color: var(--ink-soft); margin-top: 6px; }
.feed-status:empty { display: none; }
.feed-fallback {
  padding: 26px 18px; text-align: center; border: 2px dashed var(--line);
  border-radius: var(--radius); background: var(--paper);
}
.feed-fallback h3 { font-size: 1.1rem; margin-bottom: 4px; }
.feed-fallback p { color: var(--ink-soft); margin-bottom: 14px; }

/* พื้นที่ */
.areas { margin-top: 22px; }
.areas h3 { font-size: 1rem; margin-bottom: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
  padding: 6px 14px; border-radius: var(--pill); border: 1px solid var(--line);
  background: var(--paper); font-size: .92rem; text-decoration: none;
}
.chip:hover { border-color: var(--lagoon); color: var(--lagoon-deep); }
.chip span {
  font-size: .75rem; min-width: 22px; text-align: center; padding: 1px 7px;
  border-radius: var(--pill); background: var(--lagoon-tint); color: var(--lagoon-deep);
}

/* สำรวจ */
.explore-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.explore {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--salt);
}
.explore-icon {
  width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--lagoon);
  fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.explore:nth-child(2) .explore-icon { background: #0F7FA8; }
.explore:nth-child(3) .explore-icon { background: #6B5BB5; }
.explore:nth-child(4) .explore-icon { background: var(--lantern); }
.explore h3 { font-size: 1.25rem; margin-top: 6px; }
.explore p { font-size: .88rem; color: var(--ink-soft); }
.explore .explore-meta { margin-top: auto; padding-top: 6px; font-size: .8rem; color: var(--ink-soft); font-weight: 600; }
.explore a.explore-meta { color: var(--lagoon); text-decoration: none; }
.explore a.explore-meta:hover { text-decoration: underline; }

/* 3 ขั้นตอน */
.steps { display: grid; gap: 12px; counter-reset: none; }
.step {
  position: relative; padding: 18px 18px 18px 72px; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.step-no {
  position: absolute; left: 18px; top: 18px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; background: var(--mustard); color: var(--ink);
  font-family: var(--font-head); font-weight: 600; font-size: 1.1rem;
}
.step h3 { font-size: 1.08rem; }
.step p { font-size: .9rem; color: var(--ink-soft); margin-top: 2px; }

/* ชวนร้านค้า */
.merchant { grid-template-columns: 1fr; }
.merchant .ticket-main { padding: 22px 20px; }
.merchant h2 { font-size: 1.35rem; margin: 4px 0 6px; }
.merchant p { color: var(--ink-soft); }
.merchant .ticket-stub { border-left: 0; border-top: 2px dashed var(--line); padding: 16px; }
.merchant .ticket-stub::before, .merchant .ticket-stub::after { top: -10px; bottom: auto; }
.merchant .ticket-stub::before { left: -10px; }
.merchant .ticket-stub::after { left: auto; right: -10px; }

/* ---------------------------------------------------------------------
   ส่วนท้าย
   --------------------------------------------------------------------- */
.site-footer { margin-top: 48px; background: var(--ink); color: rgba(255, 255, 255, .78); padding: 34px 0 30px; font-size: .9rem; }
.footer-grid { display: grid; gap: 24px; }
.site-footer .brand { font-size: 1.25rem; margin-bottom: 6px; }
.site-footer h2 { font-size: .95rem; color: #fff; margin-bottom: 8px; }
.site-footer ul { display: grid; gap: 4px; }
.site-footer nav a { color: rgba(255, 255, 255, .78); text-decoration: none; }
.site-footer nav a:hover { color: #fff; text-decoration: underline; }
.footer-note { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: .8rem; color: rgba(255, 255, 255, .6); display: grid; gap: 6px; }

/* ---------------------------------------------------------------------
   จอใหญ่
   --------------------------------------------------------------------- */
@media (min-width: 720px) {
  :root { --gutter: 24px; }
  .nav-links { display: flex; }
  .ticket-grid {
    grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); grid-auto-columns: auto;
    overflow: visible; padding: 4px 0 0; margin: 0;
  }
  .explore-grid { grid-template-columns: repeat(4, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .merchant { grid-template-columns: 1fr 220px; }
  .merchant .ticket-stub { border-top: 0; border-left: 2px dashed var(--line); }
  .merchant .ticket-stub::before { left: -10px; top: -10px; }
  .merchant .ticket-stub::after { left: -10px; right: auto; top: auto; bottom: -10px; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
@media (min-width: 960px) {
  .hero { grid-template-columns: 1.1fr .9fr; align-items: center; gap: 48px; padding-top: 40px; padding-bottom: 56px; }
  .hero-art { display: block; position: absolute; left: -40px; right: -40px; bottom: -36px; width: calc(100% + 80px); opacity: .55; }
  #hero-slot { position: relative; max-width: 420px; margin-left: auto; }
  .ticket-grid { grid-template-columns: repeat(3, 1fr); }
  .section { padding-top: 56px; }
  .section--tint { margin-top: 56px; padding-bottom: 56px; }
}

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