/* /links: the promo page for the link in the Instagram bio ("แอปที่ก้างกับแก้วชอบ").
   Its own look, from the hangmandiary clip "กินอะไรก็ได้" (ruled notebook paper, ink-outlined menu cards, ก้าง and แก้ว),
   not the shop's: a fixed light theme so phone dark mode cannot spoil the paper. The list is written in by the server
   (server/promo.js); the mock-up it came from is design/promo/cover. Fonts: Kanit ExtraBold and Prompt Medium (SIL OFL,
   licence kept inside the files), cut down to Latin + Thai. */

@font-face {
  font-family: "OS Display";            /* Kanit ExtraBold (OFL) ตัวเดียวกับหัวเรื่องในคลิป */
  src: url("/promo/display.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "OS UI";                 /* Prompt Medium (OFL) ตัวเดียวกับซับในคลิป */
  src: url("/promo/ui.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #26262E;
  --ink-title: #28282F;
  --navy: #1B2340;
  --red: #FF5A4A;          /* สีแดงของคลิป ใช้เป็นสีตกแต่ง */
  --red-text: #D9382A;     /* แดงที่เข้มขึ้นนิดเดียว ให้ตัวขาวบนป้ายอ่านได้ 4.6:1 */
  --berry: #C83E5A;        /* สีหัวข้อแบบในคลิป ("ด่านยากที่สุด") */
  --paper: #FBF9F3;        /* กระดาษปก (engine.py PAPER) */
  --rule: rgba(176, 204, 230, .78);
  --margin: #ECA0A0;
  --card: #FFF8EC;         /* การ์ดเมนูในคลิป */
  --grey: #5D5D66;
  --grey-soft: #6E6E76;
  --display: "OS Display", "Kanit", "Sukhumvit Set", "Thonburi", "Noto Sans Thai", system-ui, sans-serif;
  --ui: "OS UI", "Prompt", "Sukhumvit Set", "Thonburi", "Noto Sans Thai", system-ui, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--ui);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.55;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  /* กระดาษสมุดมีเส้น เหมือนปกคลิป เต็มจอทุกขนาด */
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px);
  background-position: 0 14px;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 4px; border-radius: 12px; }

.page {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
}
/* เส้นขอบสมุดสีชมพู: ชิดซ้ายของจอเสมอ เหมือนหน้าสมุด (ไม่ลอยกลางจอเมื่อจอกว้าง) */
body::before {
  content: "";
  position: fixed;
  top: 0; bottom: 0; left: 11px;
  width: 2px;
  background: var(--margin);
  opacity: .85;
  pointer-events: none;
}

/* ---------------------------------------------------------- หัวหน้า */
/* no shop name or logo: a page of its own for hangmandiary, ก้าง and แก้ว come first */
.cover { text-align: center; padding-top: max(18px, env(safe-area-inset-top)); }

/* ก้างกับแก้วยืนเล็กๆ ข้างชื่อหน้า: หัวหน้าเตี้ย ไม่บังจอโทรศัพท์ เห็นการ์ดแอปตั้งแต่จอแรก */
.hero {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: end;
  column-gap: 14px;
  margin-top: 6px;
  text-align: left;
}
.hero__stand { position: relative; padding-bottom: 6px; }
/* เงาที่พื้นใต้เท้าทั้งสองคน */
.hero__stand::after {
  content: "";
  position: absolute;
  left: 6%; right: 4%; bottom: 0;
  height: 10px;
  border-radius: 50%;
  background: rgba(38, 38, 46, .2);
}
.hero__duo {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  transform-origin: 50% 98%;
  animation: breathe 3.2s ease-in-out infinite;
}

.cover__title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(27px, 7.6vw, 34px);
  line-height: 1.4;
  color: var(--ink-title);
}

/* ---------------------------------------------------------- การ์ดแอป แบบการ์ดเมนูในคลิป */
.menu { margin-top: 22px; }

.apps {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 34px;
}

.app {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  column-gap: 15px;
  min-height: 112px;
  padding: 15px 15px 21px 14px;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 0 0 4px #fff, 0 10px 22px -12px rgba(38, 38, 46, .35);
  transition: transform .15s ease, box-shadow .15s ease;
}
.app:hover { transform: translateY(-2px); box-shadow: 0 0 0 4px #fff, 0 16px 26px -12px rgba(38, 38, 46, .4); }
.app:active { transform: translateY(1px) scale(.99); }

/* ไอคอนในกรอบเล็กๆ เอียงนิดๆ เหมือนการ์ดอาหารบนผนัง */
.app__icon {
  width: 74px;
  height: 74px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 3px #fff;
  transform: rotate(-3deg);
}
.apps li:nth-child(even) .app__icon { transform: rotate(3deg); }
.app__icon img { width: 100%; height: 100%; object-fit: cover; }
.app__icon--tint { background: var(--c, #fff); } /* the app's own colour behind an icon with see-through corners */

.app__body { display: grid; min-width: 0; }
.app__cat {
  font-size: 13px;
  line-height: 1.4;
  color: var(--navy);
  opacity: .8;
}
.app__name {
  font-family: var(--display);
  font-weight: 800;
  font-size: 20px;
  line-height: 1.4;
  color: var(--ink-title);
  overflow-wrap: anywhere;
}
.app__tag {
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--grey);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  padding-bottom: 1px;
}

/* ป้ายแดงแบบป้ายใต้การ์ดเมนูในคลิป */
.app__go {
  position: absolute;
  right: 16px;
  bottom: -17px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 16px 4px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.45;
  color: #fff;
  background: var(--red-text);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 0 0 3px #fff;
  transform: rotate(-2deg);
}
.app__go::after {
  content: "";
  width: 7px; height: 7px;
  border-top: 2.5px solid #fff;
  border-right: 2.5px solid #fff;
  transform: rotate(45deg);
  margin-left: 1px;
}
.apps li:nth-child(even) .app__go { transform: rotate(2deg); }

/* nothing picked yet (or every picked app is hidden for now) */
.apps .empty {
  padding: 22px 18px;
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
  color: var(--grey);
  background: var(--card);
  border: 3px dashed rgba(38, 38, 46, .35);
  border-radius: 20px;
}

/* ---------------------------------------------------------- ท้ายหน้า */
.foot { margin-top: 24px; text-align: center; }

/* ห้องเล็กๆ ท้ายหน้า: ผนังพีชลายทาง พื้นไม้ ก้างยืนชี้ */
.stage {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
  min-height: 214px;
  margin-top: 30px;
  padding: 18px 16px 40px 8px;
  text-align: left;
  border: 3px solid var(--ink);
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(to bottom, transparent calc(100% - 26px), var(--ink) calc(100% - 26px) calc(100% - 22px), #fff calc(100% - 22px) calc(100% - 18px), #C9935F calc(100% - 18px)),
    repeating-linear-gradient(to right, rgba(255, 160, 140, .12) 0 11px, transparent 11px 29px),
    linear-gradient(to bottom, #FFF1E4, #FFDCC4);
  box-shadow: 0 0 0 5px #fff, 0 14px 28px -12px rgba(38, 38, 46, .3);
}
.stage__kang { align-self: end; position: relative; height: 100%; }
/* เท้าแตะเส้นพื้น (groundY 598/608) */
.stage__kang img {
  position: absolute;
  left: 4px;
  bottom: -25px;
  width: 88px;
  height: auto;
  max-width: none;
  z-index: 1;
}
.stage__kang::after {
  content: "";
  position: absolute;
  left: 6px; bottom: -28px;
  width: 78px; height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .22);
}
.stage__text {
  position: relative;
  z-index: 2;
}
.stage__text p {
  position: relative;
  margin: 0 0 12px;
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
}
/* หางลูกโป่งคำพูดชี้ไปหาก้าง */
.stage__text p::before {
  content: "";
  position: absolute;
  left: -9px; top: 22px;
  width: 14px; height: 14px;
  background: #fff;
  border-left: 2.5px solid var(--ink);
  border-bottom: 2.5px solid var(--ink);
  transform: rotate(45deg);
}
.stage__text b { font-family: var(--display); font-weight: 800; color: var(--berry); }
.ig {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 4px 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--ink-title);
  text-decoration: none;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
}
.ig:hover { background: #FFF1E4; }
.ig__dot {
  position: relative;
  width: 20px; height: 20px;
  margin-right: 8px;
  border: 2.5px solid var(--berry);
  border-radius: 6px;
  flex: none;
}
.ig__dot::before {
  content: "";
  position: absolute;
  inset: 3.5px;
  border: 2.5px solid var(--berry);
  border-radius: 50%;
}

/* ---------------------------------------------------------- การเคลื่อนไหว (เบามาก) */
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.012); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* จอแคบ (360–379px): ให้คำโปรยมีที่กว้างเท่าจอ 390 จะได้จบใน 2 บรรทัดเหมือนกัน */
@media (max-width: 379px) {
  .page { padding-left: 16px; padding-right: 16px; }
  body::before { left: 7px; }
  .app { grid-template-columns: 62px minmax(0, 1fr); column-gap: 12px; padding: 14px 12px 21px 12px; }
  .app__icon { width: 62px; height: 62px; border-radius: 16px; }
  .hero { grid-template-columns: 136px minmax(0, 1fr); column-gap: 12px; }
}

@media (min-width: 520px) {
  .page { padding-left: 28px; padding-right: 28px; }
  body::before { left: 14px; }
}

/* แท็บเล็ตและจอคอม: เต็มจอ ไม่ใช่คอลัมน์โทรศัพท์ลอยกลางจอ
   หัวหน้าใหญ่ขึ้นและอยู่กลาง การ์ดแอปเรียงแถวละ 2 (จอกว้างแถวละ 3) สูงเท่ากันทั้งแถว แถวสุดท้ายที่ไม่เต็มจัดไว้กลาง */
@media (min-width: 760px) {
  body::before { left: clamp(14px, 4vw, 64px); }
  .page { max-width: 980px; padding-left: 48px; padding-right: 48px; }
  .cover { padding-top: 36px; }
  .hero { justify-content: center; grid-template-columns: 240px auto; column-gap: 28px; }
  .cover__title { font-size: 48px; margin-bottom: 24px; }
  .menu { margin-top: 40px; }
  .apps { --cols: 2; --gap: 30px; display: flex; flex-wrap: wrap; justify-content: center; gap: 44px var(--gap); }
  .apps > li { display: flex; flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
  .apps > li > .app { flex: 1; }
  .apps > .empty { flex-basis: 100%; }
  .foot { margin-top: 40px; }
  .stage { max-width: 640px; margin-left: auto; margin-right: auto; }
  .stage__text p { width: fit-content; }
}

@media (min-width: 1200px) {
  .page { max-width: 1240px; }
  .hero { grid-template-columns: 280px auto; }
  .cover__title { font-size: 56px; }
  .apps { --cols: 3; }
}

.nw { white-space: nowrap; }
