/* =============================================================================
   Social Link — หน้ารวมช่องทางติดต่อของสมาชิก (/social/:slug)
   ทุกตัวแปรผูกกับ .sl-page จึงใช้ได้ทั้งหน้าจริงและกรอบพรีวิวในหน้า /social
   ค่าสี (--bg, --text, --card ฯลฯ) ถูกเขียนลง style ของ .sl-page จาก social-render.js
   ตามสีที่ผู้ใช้เลือก และสลับโหมดสว่าง/มืดด้วย .sl-page--light / .sl-page--dark
   ========================================================================== */

.sl-page {
  /* ค่าเริ่มต้น (พื้นเทาอ่อน) — ถูกแทนด้วยค่าจาก themeVars() */
  --bg: #F4F4F5;
  --bg-top: #FAFAFA;
  --bg-bottom: #E4E4E7;
  --text: #18181B;
  --text-soft: rgba(24,24,27,.66);
  --text-faint: rgba(24,24,27,.48);
  --card: #FFFFFF;
  --card-hover: #FFFFFF;
  --card-border: rgba(24,24,27,.09);
  --card-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.05);
  --tile-bg: #27272A;
  --tile-fg: #FFFFFF;
  --brand: #27272A;
  --accent: #A8A29E;
  --accent-dim: rgba(168,162,158,.45);
  --accent-ink: #18181B;
  --accent-text: #6B6662;
  --cta: #06C755;
  --cta-ink: #FFFFFF;
  --cta-shadow: rgba(6,199,85,.30);
  --pattern-opacity: .06;

  --r: 20px;
  --r-lg: 28px;
  --ease: cubic-bezier(.2,.7,.3,1);
  --font: 'Poppins', 'Sarabun', 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-script: 'Dancing Script', 'Sarabun', cursive;

  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  isolation: isolate;
}
.sl-page *, .sl-page *::before, .sl-page *::after { box-sizing: border-box; }

/* ---- พื้นหลัง ---- */
.sl-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: var(--bg);
}
.sl-page--gradient .sl-bg {
  background: radial-gradient(120% 80% at 50% -10%, var(--bg-top) 0%, var(--bg) 45%, var(--bg-bottom) 100%);
}
/* ลายโมเสก (SVG ฝังในไฟล์ ไม่ต้องโหลดรูป) — สีเส้นเปลี่ยนตามโหมด */
.sl-page--pattern .sl-bg::after {
  content: "";
  position: absolute;
  inset: -10%;
  opacity: var(--pattern-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Cg fill='none' stroke='%23fff' stroke-width='9' stroke-linejoin='round'%3E%3Cpath d='M-10 40 L60 10 L120 55 L95 120 L20 110 Z'/%3E%3Cpath d='M120 55 L185 20 L250 50 L240 115 L170 130 L95 120 Z'/%3E%3Cpath d='M250 50 L310 30 L320 110 L240 115 Z'/%3E%3Cpath d='M20 110 L95 120 L110 195 L40 215 L-5 160 Z'/%3E%3Cpath d='M110 195 L170 130 L240 115 L265 185 L195 235 Z'/%3E%3Cpath d='M240 115 L320 110 L330 200 L265 185 Z'/%3E%3Cpath d='M40 215 L110 195 L195 235 L175 300 L60 300 Z'/%3E%3Cpath d='M195 235 L265 185 L330 200 L320 300 L175 300 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 300px 300px;
  transform: rotate(-4deg) scale(1.15);
  pointer-events: none;
}
.sl-page--light.sl-page--pattern .sl-bg::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Cg fill='none' stroke='%23000' stroke-width='9' stroke-linejoin='round'%3E%3Cpath d='M-10 40 L60 10 L120 55 L95 120 L20 110 Z'/%3E%3Cpath d='M120 55 L185 20 L250 50 L240 115 L170 130 L95 120 Z'/%3E%3Cpath d='M250 50 L310 30 L320 110 L240 115 Z'/%3E%3Cpath d='M20 110 L95 120 L110 195 L40 215 L-5 160 Z'/%3E%3Cpath d='M110 195 L170 130 L240 115 L265 185 L195 235 Z'/%3E%3Cpath d='M240 115 L320 110 L330 200 L265 185 Z'/%3E%3Cpath d='M40 215 L110 195 L195 235 L175 300 L60 300 Z'/%3E%3Cpath d='M195 235 L265 185 L330 200 L320 300 L175 300 Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* ในกรอบพรีวิว พื้นหลังต้องอยู่ในกรอบ ไม่ใช่เต็มจอ */
.sl-page--preview { min-height: 100%; }
.sl-page--preview .sl-bg { position: absolute; }
.sl-page--preview .sl-wrap { min-height: 100%; }

.sl-wrap {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
  padding: clamp(22px, 6vw, 40px) clamp(16px, 5vw, 28px);
  padding-top: max(clamp(22px, 6vw, 40px), env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- หัวเว็บ ---- */
.sl-head { text-align: center; }
.sl-logo-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(230px, 62vw);
  aspect-ratio: 1.4 / 1;
  padding: 16px 22px;
  background: #FFFFFF;
  border-radius: var(--r-lg);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 18px 50px rgba(0,0,0,.18), 0 2px 10px rgba(0,0,0,.10);
}
.sl-page--light .sl-logo-card { box-shadow: 0 0 0 1px rgba(24,24,27,.06), 0 12px 32px rgba(0,0,0,.08); }
.sl-logo-card img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
/* ไม่มีโลโก้: กล่องกว้างตามชื่อร้าน (เดิมกว้างคงที่ ชื่อไทยถูกตัดกลางคำ เช่น "เมดิ / คอล") · ไม่เว้นช่องไฟตัวอักษรไทย */
.sl-logo-card--text { aspect-ratio: auto; min-height: 96px; width: auto; min-width: min(230px, 62vw); max-width: min(420px, 100%); }
.sl-logo-card + .sl-subtitle { margin-top: 12px; }
.sl-logo-text {
  margin: 0;
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--brand);
  line-height: 1.25;
  text-wrap: balance;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.sl-brand { margin: 16px 0 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.sl-subtitle { margin: 4px 0 0; font-size: 13.5px; color: var(--text-soft); }
.sl-rule {
  width: 72px;
  height: 1px;
  margin: 20px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border: 0;
}
/* ที่อยู่/สถานที่: บรรทัดข้อมูลใต้ข้อความต้อนรับ (เดิมเป็นตัวเล็กตัวพิมพ์ใหญ่เว้นช่องไฟกว้างเหนือหัวข้อ — ภาษาไทยอ่านยาก) */
.sl-venue {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  margin: 10px auto 0;
  max-width: 36ch;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-soft);
  line-height: 1.55;
  text-wrap: balance;
}
.sl-venue svg { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 3px; color: var(--accent-text); }
.sl-welcome {
  margin: 14px 0 0;
  font-family: var(--font-script);
  font-size: clamp(24px, 7vw, 30px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
}

/* ---- ปุ่มหลัก ---- */
.sl-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: clamp(26px, 7vw, 36px);
  padding: 16px 18px;
  min-height: 72px;
  border-radius: var(--r);
  background: var(--cta);
  color: var(--cta-ink);
  text-decoration: none;
  /* เงาตกลงด้านล่างแบบนุ่ม (เดิมเป็นแสงเรืองสีปุ่มรอบตัว) */
  box-shadow: 0 8px 18px -10px var(--cta-shadow), 0 1px 2px rgba(0,0,0,.14);
  position: relative;
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.sl-cta:active { transform: scale(.985); }
@media (hover: hover) { .sl-cta:hover { transform: translateY(-2px); } }
.sl-cta__icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: rgba(255,255,255,.18);
}
.sl-cta__icon svg { width: 26px; height: 26px; }
.sl-cta__text { flex: 1 1 auto; min-width: 0; }
.sl-cta__text strong { display: block; font-size: 17px; font-weight: 600; line-height: 1.35; }
.sl-cta__text small { display: block; margin-top: 2px; font-size: 13px; opacity: .92; line-height: 1.45; }
.sl-cta__arrow { flex: 0 0 auto; display: grid; opacity: .9; }
.sl-cta__arrow svg, .sl-link__arrow svg { width: 20px; height: 20px; }
.sl-cta__badge {
  position: absolute;
  top: 0; right: 0;
  padding: 4px 12px 5px;
  border-radius: 0 var(--r) 0 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* ---- รายการลิงก์ ---- */
.sl-links { display: flex; flex-direction: column; gap: 11px; margin-top: 14px; }
.sl-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  min-height: 66px;
  border-radius: var(--r);
  text-decoration: none;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.sl-page--dark .sl-link { -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.sl-link:active { transform: scale(.985); }
@media (hover: hover) {
  .sl-link:hover { background: var(--card-hover); border-color: var(--accent-dim); transform: translateY(-2px); }
}
.sl-link__icon {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--tile-bg);
  color: var(--tile-fg);
}
.sl-link__icon svg { width: 22px; height: 22px; }
.sl-link__text { flex: 1 1 auto; min-width: 0; }
.sl-link__text strong { display: block; font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.sl-link__text small {
  display: block;
  margin-top: 1px;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sl-link__arrow { flex: 0 0 auto; display: grid; opacity: .45; }
.sl-empty { margin: 30px 0 0; text-align: center; font-size: 14px; color: var(--text-faint); }

/* ---- ท้ายหน้า ---- */
.sl-foot {
  margin-top: auto;
  padding-top: 30px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-faint);
}
.sl-foot a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 2px; }
.sl-foot__tagline { font-family: var(--font-script); font-size: 17px; color: var(--accent-text); display: block; margin-bottom: 4px; }
.sl-foot__by { display: block; }

/* ---- แอนิเมชัน ---- */
@keyframes sl-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
/* จังหวะเดียว: หัวหน้าและปุ่มหลักเลื่อนขึ้นเบา ๆ รายการลิงก์/ท้ายหน้าแสดงทันที
   (เดิมทุกแถวค่อย ๆ โผล่ทีละอันแบบเดียวกัน ลูกค้ารอเกือบวินาทีกว่าจะกดได้) */
.sl-anim { opacity: 0; animation: sl-in .45s var(--ease) forwards; }
.sl-link.sl-anim, .sl-foot.sl-anim { opacity: 1; animation: none; }
.sl-page--preview .sl-anim { animation: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .sl-anim { animation: none; opacity: 1; }
  .sl-page * { transition: none !important; }
}

@media (min-width: 768px) and (min-height: 760px) {
  .sl-page:not(.sl-page--preview) .sl-wrap { justify-content: center; }
  .sl-page:not(.sl-page--preview) .sl-foot { margin-top: 40px; padding-top: 0; }
}
@media (min-width: 768px) {
  .sl-page:not(.sl-page--preview) .sl-link { padding: 15px 18px; min-height: 72px; }
  .sl-page:not(.sl-page--preview) .sl-cta { min-height: 80px; padding: 18px 20px; }
}

.sl-page a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* แถบแจ้งเจ้าของ (เห็นเฉพาะเจ้าของตอนหน้ายังไม่เผยแพร่) */
.sl-owner-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  background: #fff3cd;
  color: #6b4e00;
  font-family: 'Sarabun', sans-serif;
}
.sl-owner-bar a { color: #6b4e00; font-weight: 600; }

/* ---- หน้าปิดใช้งาน / ไม่พบ ---- */
.sl-notice {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: #f5f7fa;
  font-family: 'Sarabun', sans-serif;
  color: #333;
}
.sl-notice__card {
  max-width: 420px;
  width: 100%;
  text-align: center;
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px;
  box-shadow: 0 10px 40px rgba(0,0,0,.1);
}
.sl-notice__card h1 { font-size: 22px; margin: 0 0 10px; }
.sl-notice__card p { font-size: 15px; color: #666; line-height: 1.6; margin: 0; }
.sl-notice__card a.sl-notice__btn {
  display: inline-block;
  margin-top: 22px;
  padding: 12px 28px;
  border-radius: 30px;
  background: #1f2937;
  color: #fff;
  text-decoration: none;
}
