/* ================================================================
   style.css — Shared theme for Mali's Universe (Chamiz)
   Hybrid: MaliBills-clean page chrome + retro arcade section.
   Page-specific styles live in a <style> block inside each page.
   ================================================================ */

/* ----------------------------------------------------------------
   FONTS
   Inter  -> clean page chrome (matches MaliBills)
   Press Start 2P / VT323 -> retro arcade + game only
   ---------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Press+Start+2P&family=VT323&display=swap');

/* ----------------------------------------------------------------
   LOCAL THAI FONT: SUKHUMVIT SET (same as MaliBills)
   ---------------------------------------------------------------- */
@font-face {
  font-family: "SukhumvitSet";
  src: url("Fonts/SukhumvitSet-Thin.woff2") format("woff2"), url("Fonts/SukhumvitSet-Thin.ttf") format("truetype");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SukhumvitSet";
  src: url("Fonts/SukhumvitSet-Light.woff2") format("woff2"), url("Fonts/SukhumvitSet-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SukhumvitSet";
  src: url("Fonts/SukhumvitSet-Text.woff2") format("woff2"), url("Fonts/SukhumvitSet-Text.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SukhumvitSet";
  src: url("Fonts/SukhumvitSet-Medium.woff2") format("woff2"), url("Fonts/SukhumvitSet-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SukhumvitSet";
  src: url("Fonts/SukhumvitSet-SemiBold.woff2") format("woff2"), url("Fonts/SukhumvitSet-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "SukhumvitSet";
  src: url("Fonts/SukhumvitSet-Bold.woff2") format("woff2"), url("Fonts/SukhumvitSet-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ----------------------------------------------------------------
   CSS VARIABLES
   ---------------------------------------------------------------- */
:root {
  /* ---- Page theme (MaliBills) ---- */
  --bg:           #fffaf0;
  --surface:      #fffdf8;
  --surface-soft: #fff4df;
  --surface-warm: #fff8ec;
  --glass-rgb:    255, 250, 240;
  --text:         #1d1d1f;
  --subtle:       #77716a;
  --accent:       #b73535;
  --accent-hover: #9f2b2b;
  --accent-soft:  rgba(183, 53, 53, 0.12);
  --accent-line:  rgba(183, 53, 53, 0.26);
  --gold:         #d9a43a;
  --card-border:  rgba(120, 84, 58, 0.16);
  --border-soft:  rgba(29, 29, 31, 0.14);
  --border-strong:#1d1d1f;
  --shadow-pixel:    4px 4px 0 rgba(183, 53, 53, 0.08);
  --shadow-pixel-lg: 6px 6px 0 rgba(183, 53, 53, 0.10);
  --radius-md: 18px;
  --radius-lg: 24px;

  /* ---- Arcade (retro) palette — used inside #game-section + game.html ---- */
  --space:       #07060b;   /* near-black space        */
  --space-2:     #0d0a1c;   /* panel surface           */
  --orange:      #ff7a18;   /* neon accent (arcade)    */
  --orange-lt:   #ffae3c;
  --orange-hi:   #ffd27a;
  --ember:       #b23a00;   /* deep offset shadow      */
  --arcade-text: #ffe9d2;
  --bg-dark:     #07060b;   /* alias kept for game.html legacy use */

  /* ---- Fonts ---- */
  --font-head: 'Press Start 2P', monospace;
  --font-arcade-body: 'VT323', monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --nav-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================
   DARK THEME — token overrides. html[data-theme="dark"] beats
   :root, so every component built on these tokens flips. Set
   on <html> by gnav.js (persisted in localStorage chamali_theme),
   with a pre-paint inline script on each page to avoid a flash.
   The arcade palette (--space/--orange…) is already dark, untouched.
   ============================================================ */
html[data-theme="dark"] {
  --bg:            #14110d;
  --surface:       #1e1a14;
  --surface-soft:  #272019;
  --surface-warm:  #241e17;
  --glass-rgb:     26, 22, 16;
  --text:          #f3ece0;
  --subtle:        #b0a596;
  --muted:         #8f8576;
  --accent:        #e2675f;
  --accent-hover:  #ec7b73;
  --accent-soft:   rgba(226, 103, 95, 0.20);
  --accent-line:   rgba(226, 103, 95, 0.34);
  --accent-deep:   #ef8d86;
  --gold:          #e6bd5c;
  --card-border:   rgba(255, 238, 214, 0.14);
  --border:        rgba(255, 238, 214, 0.16);
  --border-soft:   rgba(255, 238, 214, 0.14);
  --border-warm:   rgba(255, 238, 214, 0.14);
  --border-strong: #f3ece0;
  color-scheme: dark;
}

/* ----------------------------------------------------------------
   RESET + BASE
   ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  background:
    radial-gradient(circle at top left, rgba(183, 53, 53, 0.06), transparent 30%),
    radial-gradient(circle at bottom right, rgba(217, 164, 58, 0.10), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  animation: pageEnter 420ms var(--ease);
}

/* Fade only — no transform on <body> (a transform would make position:fixed
   elements like the bottom tab bar anchor to the body instead of the viewport). */
@keyframes pageEnter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* Pixel-font helper — only used inside the arcade */
.pf { font-family: var(--font-head); }

/* ----------------------------------------------------------------
   NAV — MaliBills full-width sticky bar
   ---------------------------------------------------------------- */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: rgba(var(--glass-rgb), 0.88);
  border-bottom: 2px solid rgba(29, 29, 31, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Panda icon + brand name together on the left */
.nav-logo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--text);
  text-shadow: none;
  text-decoration: none;
  -webkit-font-smoothing: antialiased;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}
.nav-logo:hover { opacity: 0.85; }
.nav-logo svg { width: 30px; height: 30px; }
.nav-logo .logo-accent { color: #f4a261; }

/* Menu pushed to the right; lang pill sits after it.
   The `nav > ul.gnav` selector also beats ui-kit.css's `ul.gnav`
   (which omits margin), so the global menu stays right-aligned here. */
nav ul,
nav > ul.gnav {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

nav .language-switch {
  flex: 0 0 auto;
  justify-content: flex-end;
}

nav ul a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--subtle);
  -webkit-font-smoothing: antialiased;
  transition: color 160ms var(--ease);
}

nav ul a:hover { color: var(--text); }

/* ---- "Mali" dropdown ---- */
.nav-dd { position: relative; }

.nav-dd-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--subtle);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 160ms var(--ease);
}

.nav-dd:hover .nav-dd-toggle,
.nav-dd:focus-within .nav-dd-toggle,
.nav-dd.open .nav-dd-toggle { color: var(--text); }

.nav-dd-caret {
  font-size: 10px;
  transition: transform 160ms var(--ease);
}

.nav-dd:hover .nav-dd-caret,
.nav-dd:focus-within .nav-dd-caret,
.nav-dd.open .nav-dd-caret { transform: rotate(180deg); }

.nav-dd-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(45, 28, 20, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease), visibility 160ms;
  z-index: 200;
}

.nav-dd:hover .nav-dd-menu,
.nav-dd:focus-within .nav-dd-menu,
.nav-dd.open .nav-dd-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dd-menu a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--subtle);
  padding: 9px 12px;
  border-radius: 9px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}

.nav-dd-menu a:hover {
  color: var(--text);
  background: var(--surface-soft);
}

/* ----------------------------------------------------------------
   LANGUAGE SWITCH — single EN/TH pill (matches MaliBills)
   ---------------------------------------------------------------- */
.language-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.single-lang-toggle {
  width: auto;
  min-width: 50px;
  min-height: 38px;
  margin: 0;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid rgba(120, 84, 58, 0.18);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(45, 28, 20, 0.06);
  -webkit-font-smoothing: antialiased;
  transition: background 160ms var(--ease), border-color 160ms var(--ease),
              color 160ms var(--ease), box-shadow 160ms var(--ease), transform 120ms var(--ease);
}

.single-lang-toggle:hover,
.single-lang-toggle:focus-visible {
  background: var(--surface-soft);
  border-color: rgba(183, 53, 53, 0.28);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(45, 28, 20, 0.07);
  outline: none;
}

.single-lang-toggle:active {
  transform: translateY(1px) scale(0.99);
}

/* ----------------------------------------------------------------
   BUTTON — MaliBills red, chunky pixel-shadow base
   ---------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1;
  color: #fff;
  background: linear-gradient(180deg, #dc5656, var(--accent));
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-md);
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  box-shadow: 0 4px 0 #7f2020, 0 10px 20px rgba(183, 53, 53, 0.12);
  transition: transform 160ms var(--ease), box-shadow 160ms var(--ease), filter 160ms var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 5px 0 #7f2020, 0 12px 24px rgba(183, 53, 53, 0.14);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 2px 0 #7f2020, 0 7px 14px rgba(183, 53, 53, 0.10);
}

/* ----------------------------------------------------------------
   LAYOUT
   ---------------------------------------------------------------- */
.wrap {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

section { padding: clamp(48px, 8vw, 84px) 0; }

.section-header { text-align: center; margin-bottom: 2.8rem; }

.section-title {
  font-family: var(--font-body);
  font-weight: 900;
  font-size: clamp(28px, 4.5vw, 46px);
  letter-spacing: -0.04em;
  color: var(--text);
  text-shadow: none;
  margin-bottom: 12px;
}

.section-desc {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--subtle);
  line-height: 1.65;
  max-width: 560px;
  margin: 0 auto;
}

/* Premium gradient accent divider */
.pixel-divider {
  width: 48px;
  height: 4px;
  margin: 14px auto 16px;
  background: linear-gradient(90deg, var(--accent), var(--orange, #ff7a18));
  border-radius: 999px;
}

/* ----------------------------------------------------------------
   SCROLL FADE-IN
   ---------------------------------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ----------------------------------------------------------------
   CARDS — MaliBills clean
   ---------------------------------------------------------------- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;   /* one full-width card per row */
  gap: 24px;
}

/* Full-width card: text column on the left, preview visual on the right.
   Pure grid-template-areas layout so no markup change is needed — the
   panda / name / desc / button stack in the left column while the preview
   spans all rows on the right, vertically centered. Collapses to a
   centered single column on narrow screens (see media query below). */
.site-card {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 400px);
  grid-template-areas:
    "panda   preview"
    "name    preview"
    "desc    preview"
    "steps   preview"
    "gap     preview"
    "button  preview";
  /* The 'gap' row soaks up any extra height so the button always sits at the
     card's bottom edge — even when the preview visual is taller than the text. */
  grid-template-rows: auto auto auto auto 1fr auto;
  align-content: stretch;
  justify-items: start;
  column-gap: 48px;
  row-gap: 16px;
  text-align: left;
  padding: 44px 52px;
  background: var(--surface);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pixel);
  transition: transform 160ms var(--ease), box-shadow 260ms var(--ease);
}
.site-card > .card-panda   { grid-area: panda; }
.site-card > .card-name    { grid-area: name; }
.site-card > .card-desc    { grid-area: desc; max-width: 56ch; }
.site-card > .how-steps    { grid-area: steps; width: 100%; max-width: 56ch; margin-top: 4px; }
.site-card > .btn          { grid-area: button; justify-self: start; margin-top: 6px; }
.site-card > .card-preview {
  grid-area: preview;
  align-self: center;
  justify-self: center;
}

.site-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-pixel-lg);
}

/* ----------------------------------------------------------------
   HOW IT WORKS — condensed app intros (what + 3 steps)
   ---------------------------------------------------------------- */
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.how-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 28px;
  background: var(--surface);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pixel);
}
.how-head { display: flex; align-items: center; gap: 14px; }
.how-badge {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 22px;
}
.how-badge.bills { background: rgba(6, 199, 85, 0.14); }
.how-badge.trip  { background: rgba(255, 122, 24, 0.16); }
.how-name { font-family: var(--font-body); font-size: 20px; font-weight: 800; color: var(--accent); }
.how-tag  { font-family: var(--font-body); font-size: 14px; color: #6f625a; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; flex: 1; }
.how-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.how-steps li > span {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--surface-soft, #fff4df); color: var(--accent, #b73535);
  font-family: var(--font-body);
}
.how-steps li > p { font-family: var(--font-body); font-size: 15px; line-height: 1.55; color: #5f544c; margin: 0; }
.how-card .btn { align-self: flex-start; }
html[data-theme="dark"] .how-steps li > p { color: #c9bdb0; }
html[data-theme="dark"] .how-tag { color: #b7a998; }

.card-name {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--accent);
}

.card-desc {
  font-family: var(--font-body);
  font-size: 16px;
  color: #6f625a;
  line-height: 1.65;
}

/* ----------------------------------------------------------------
   Mini in-card previews — a small stylized mock of each site's
   signature UI. References MaliBills' "on LINE" chat promo
   (malibills/index.html .line-chat-mock) and MaliTrip's floating
   "Trip Overview" card (malitrip/index.html .floating-trip-card).
   ---------------------------------------------------------------- */
.card-preview {
  width: 100%;
  max-width: 400px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 18px;
  box-shadow: 0 10px 26px -14px rgba(75, 44, 28, 0.42);
}

/* MaliBills — LINE chat bubbles (brand blue backdrop in both themes) */
.line-preview { background: #8fb7d9; }
.mini-bubble {
  max-width: 90%;
  padding: 9px 13px;
  border-radius: 13px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
}
.mini-bubble.bot {
  /* Fixed light bubble in both themes — like a real LINE "received"
     message; it sits on the blue chat backdrop, not the card surface. */
  justify-self: start;
  background: #f6f5f1;
  color: #2b2b2b;
  border-bottom-left-radius: 3px;
}
.mini-bubble.me {
  justify-self: end;
  background: #06c755;
  color: #fff;
  border-bottom-right-radius: 3px;
}

/* MaliTrip — Trip Overview card */
.trip-preview {
  justify-items: start;
  text-align: left;
  gap: 3px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #fff4e2, #ffe9cf);
  border: 1.5px solid rgba(255, 122, 24, 0.28);
}
.trip-preview .mini-trip-eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cf6a1a;
}
.trip-preview strong {
  font-family: var(--font-body);
  font-size: 19px;
  color: #3a2c22;
}
.trip-preview small {
  font-family: var(--font-body);
  font-size: 14px;
  color: #7a6a5c;
}

/* Full-width cards collapse to a centered single column on narrow screens */
@media (max-width: 820px) {
  .site-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "panda"
      "name"
      "preview"
      "desc"
      "steps"
      "button";
    justify-items: center;
    text-align: center;
    padding: 34px 24px;
    row-gap: 14px;
  }
  /* Full column width so paragraphs wrap and center instead of sizing to
     max-content (which would overflow the card under justify-items:center). */
  .site-card > .card-name,
  .site-card > .card-desc { width: 100%; max-width: none; }
  /* Steps keep their left-aligned number+text rows even when the card centers. */
  .site-card > .how-steps { width: 100%; max-width: none; text-align: left; }
  .site-card > .btn { justify-self: center; }
}

html[data-theme="dark"] .line-preview { background: #3c4b59; }
html[data-theme="dark"] .trip-preview {
  background: linear-gradient(160deg, #2a2118, #201811);
  border-color: rgba(255, 122, 24, 0.32);
}
html[data-theme="dark"] .trip-preview strong { color: #f3ece0; }
html[data-theme="dark"] .trip-preview small  { color: #b7a998; }

/* ----------------------------------------------------------------
   FOOTER — MaliBills clean
   ---------------------------------------------------------------- */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1rem;
  border-top: 2px solid var(--border-soft);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--subtle);
}

footer span  { color: var(--accent); font-weight: 700; }
footer a     { color: var(--accent); font-weight: 700; }
footer a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------
   MOBILE NAV
   The original markup has no hamburger button, so keep the links
   visible and wrapping on small screens (avoids an unusable menu).
   ---------------------------------------------------------------- */
.menu-toggle { display: none; }

@media (max-width: 600px) {
  section { padding: 3.5rem 0; }
  .cards-grid { grid-template-columns: 1fr; }
  nav { padding: 12px 16px; gap: 10px; }
  /* Logo + language toggle share the top row, menu drops centered below */
  nav ul { order: 3; gap: 16px; width: 100%; justify-content: center; }
}

/* ----------------------------------------------------------------
   THAI VERSION TYPOGRAPHY — same SukhumvitSet setup as MaliBills.
   Overriding --font-body swaps every clean (Inter) element to the
   Thai face. The arcade keeps --font-head / --font-arcade-body, so
   the retro Press Start 2P / VT323 pixel text is left untouched.
   ---------------------------------------------------------------- */
html[lang="th"] {
  --font-body: "SukhumvitSet", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
}

html[lang="th"],
html[lang="th"] body,
html[lang="th"] button,
html[lang="th"] input,
html[lang="th"] select,
html[lang="th"] textarea {
  font-family: "SukhumvitSet", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
}

html[lang="th"] body { font-weight: 400; }

html[lang="th"] h1,
html[lang="th"] h2,
html[lang="th"] h3 { font-weight: 600; }

html[lang="th"] .btn,
html[lang="th"] nav ul a,
html[lang="th"] .single-lang-toggle { font-weight: 500; }
