/* ==========================================================================
   umini.app — Flat / Pixel / Green design system
   Shared across all pages (index, coffee, founder, apps/*).
   No build step: plain CSS, loaded on every page + Tailwind CDN for utilities.
   ========================================================================== */

/* ---------- Design tokens ------------------------------------------------ */
:root {
  --green-primary:      #16a34a;
  --green-primary-dark: #15803d;
  --green-secondary:    #22c55e;
  --green-accent:       #84cc16;
  --green-50:           #f0fdf4;
  --green-100:          #dcfce7;

  --ink:      #0f172a;
  --ink-dim:  #475569;
  --border-ink: #0f172a;

  --surface:      #ffffff;
  --surface-alt:  #f0fdf4;

  --coffee-accent: #a16207;
  --coffee-cream:  #f5deb3;

  --shadow-pixel:      4px 4px 0 0 var(--border-ink);
  --shadow-pixel-sm:   2px 2px 0 0 var(--border-ink);
  --shadow-pixel-green: 4px 4px 0 0 var(--green-primary-dark);

  --font-pixel: "Press Start 2P", "Courier New", monospace;
  --font-body:  "Montserrat", system-ui, -apple-system, sans-serif;

  --container: 1140px;
}

/* ---------- Base --------------------------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--surface-alt);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  /* faint green graph-paper grid */
  background-image:
    linear-gradient(rgba(22,163,74,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,163,74,0.06) 1px, transparent 1px);
  background-size: 28px 28px;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

/* Pixel display font — ONLY for short Latin labels / headings, never VI paragraphs */
.font-pixel {
  font-family: var(--font-pixel);
  line-height: 1.5;
  letter-spacing: -0.5px;
}

h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 800; color: var(--ink); }

/* Montserrat "label" — pixel-ish uppercase for Vietnamese-safe labels */
.label, .eyebrow {
  font-family: var(--font-body);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}
/* Nhãn section kiểu chip trong ứng dụng/game pixel */
.eyebrow {
  font-size: 11px;
  color: var(--ink);
  display: inline-block;
  background: var(--green-accent);
  border: 2px solid var(--border-ink);
  box-shadow: 2px 2px 0 0 var(--border-ink);
  padding: 5px 12px;
}

.section { padding: 72px 24px; }
.container { max-width: var(--container); margin: 0 auto; }
.text-dim { color: var(--ink-dim); }
.center { text-align: center; }

/* ---------- Pixel components -------------------------------------------- */

/* Hard-edged card with offset shadow + hover "press" */
.card {
  background: var(--surface);
  border: 2px solid var(--border-ink);
  border-radius: 0;
  box-shadow: var(--shadow-pixel);
  transition: transform .12s steps(2), box-shadow .12s steps(2);
}
.card.is-interactive { cursor: pointer; }
.card.is-interactive:hover {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-pixel-sm);
}

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border: 2px solid var(--border-ink);
  border-radius: 0;
  background: var(--green-primary);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-pixel);
  transition: transform .12s steps(2), box-shadow .12s steps(2), background-color .2s;
}
.btn:hover { transform: translate(2px,2px); box-shadow: var(--shadow-pixel-sm); background: var(--green-primary-dark); }
.btn:active { transform: translate(4px,4px); box-shadow: 0 0 0 0 var(--border-ink); }
.btn--ghost { background: var(--surface); color: var(--ink); }
.btn--ghost:hover { background: var(--green-50); }
.btn--coffee { background: var(--coffee-accent); }
.btn--coffee:hover { background: #855508; }

/* Pixel badge / tag */
.tag {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 5px 8px;
  border: 2px solid var(--border-ink);
  background: var(--green-accent);
  color: var(--ink);
  display: inline-block;
}
.tag--coffee { background: var(--coffee-cream); }
.tag--secondary { background: var(--green-100); }

/* Store buttons (App Store / Google Play) */
.store-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; min-width: 210px;
  border: 2px solid var(--border-ink); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-pixel); text-decoration: none;
  transition: transform .12s steps(2), box-shadow .12s steps(2);
}
.store-btn:hover { transform: translate(2px,2px); box-shadow: var(--shadow-pixel-sm); }
.store-btn small { display:block; font-size: 10px; color: var(--ink-dim); }
.store-btn b { font-size: 15px; }

/* ---------- Nav (injected) ---------------------------------------------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 2px solid var(--border-ink);
}
.site-nav__inner {
  max-width: var(--container); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo .brand {
  font-family: var(--font-body); font-weight: 800; font-size: 20px;
  color: var(--green-primary-dark); letter-spacing: -0.5px;
}
.logo .brand b { color: var(--green-primary); }
.logo .brand .dot { color: var(--ink-dim); }
.nav-links { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav-links a {
  font-family: var(--font-body); font-weight: 800; font-size: 13px; letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--ink-dim); text-decoration: none; padding: 8px 8px;
  border: 2px solid transparent;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.is-active {
  color: var(--green-primary-dark);
  border-bottom: 2px solid var(--green-primary);
}
.nav-toggle { display: none; border: 2px solid var(--border-ink); background: var(--surface); padding: 8px 10px; cursor: pointer; }
.nav-toggle span { display:block; width: 18px; height: 2px; background: var(--ink); margin: 3px 0; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 2px solid var(--border-ink);
    padding: 8px 16px 16px;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { padding: 12px 6px; }
}

/* ---------- App tab bar (thanh điều hướng dưới — kiểu ứng dụng) --------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: stretch;
  background: var(--surface);
  border-top: 2px solid var(--border-ink);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px 9px; text-decoration: none;
  font-family: var(--font-body); font-weight: 700; font-size: 10px;
  color: var(--ink-dim); border-top: 3px solid transparent;
}
.tabbar a .px { line-height: 0; }
.tabbar a.is-active { color: var(--green-primary-dark); border-top-color: var(--green-primary); background: var(--green-50); }
@media (min-width: 901px) { .tabbar { display: none; } }
@media (max-width: 900px) { body { padding-bottom: 62px; } }

/* HUD nhỏ kiểu game trên thanh nav (coin + tim) */
.hud { display: flex; align-items: center; gap: 8px; }
.hud .hud-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 2px solid var(--border-ink); background: var(--green-50);
  padding: 3px 8px; font-family: var(--font-body); font-weight: 800; font-size: 11px;
  color: var(--ink);
}
@media (max-width: 560px) { .hud { display: none; } }

/* ---------- Footer (injected) ------------------------------------------- */
.site-footer {
  background: var(--surface);
  border-top: 2px solid var(--border-ink);
  padding: 48px 24px 28px;
}
.site-footer__grid {
  max-width: var(--container); margin: 0 auto;
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px;
}
.site-footer h4 { font-family: var(--font-body); font-weight: 800; font-size: 13px; letter-spacing: .5px; text-transform: uppercase; margin: 0 0 14px; color: var(--ink); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: var(--ink-dim); text-decoration: none; font-size: 14px; }
.site-footer a:hover { color: var(--green-primary-dark); }
.site-footer__copy {
  max-width: var(--container); margin: 28px auto 0; padding-top: 18px;
  border-top: 2px solid var(--border-ink);
  font-family: var(--font-body); font-weight: 700; font-size: 11px;
  letter-spacing: .5px; color: var(--ink-dim); text-align: center;
}
@media (max-width: 780px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .site-footer__grid { grid-template-columns: 1fr; } }

/* ---------- Hero shared -------------------------------------------------- */
.hero {
  padding: 64px 24px 72px;
  border-bottom: 2px solid var(--border-ink);
  background: var(--surface-alt);
}
.hero__inner {
  max-width: var(--container); margin: 0 auto;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center;
}
.hero h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.1; margin: 12px 0 16px; }
.hero p.lead { font-size: 17px; color: var(--ink-dim); max-width: 32em; }
.hero__cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 26px; }
@media (max-width: 860px) { .hero__inner { grid-template-columns: 1fr; } .hero__art { order: -1; } }

/* Pixel stage (holds a character on a little platform) */
.stage {
  border: 2px solid var(--border-ink);
  background:
    linear-gradient(rgba(22,163,74,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,163,74,0.10) 1px, transparent 1px),
    var(--surface);
  background-size: 20px 20px, 20px 20px, auto;
  box-shadow: var(--shadow-pixel);
  display: flex; align-items: flex-end; justify-content: center;
  min-height: 300px; padding: 24px 24px 30px; position: relative; overflow: hidden;
}
.stage__ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26px;
  background: var(--green-primary); border-top: 2px solid var(--border-ink);
}

/* ==========================================================================
   Pixel characters — the umini BUFFALO (con trâu) mascot + animations
   All SVG rect-grid, self-contained, crisp at any DPI.
   ========================================================================== */
.px { display: inline-block; image-rendering: pixelated; line-height: 0; }
.px svg { display: block; }

/* Idle bob (whole character gently breathes) */
@keyframes px-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.px--bob { animation: px-bob 1.6s steps(3) infinite; }

/* Blink (eyes) */
@keyframes px-blink { 0%,92%,100% { opacity: 1; } 95% { opacity: 0; } }
.px .eye { animation: px-blink 3.2s steps(1) infinite; }

/* Tail wag */
@keyframes px-tail { 0%,100% { transform: rotate(0); } 50% { transform: rotate(18deg); } }
.px .tail { transform-origin: 2px 2px; animation: px-tail 1s steps(2) infinite; }

/* Waving arm/hoof */
@keyframes px-wave { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-38deg); } }
.px .wave { animation: px-wave .5s steps(3) infinite; }

/* Pour (coffee) — arm tips forward and holds */
@keyframes px-pour { 0%,60%,100% { transform: rotate(0); } 20%,50% { transform: rotate(28deg); } }
.px .pour { transform-origin: 3px 4px; animation: px-pour 2.4s steps(4) infinite; }

/* Pickaxe swing */
@keyframes px-swing { 0%,100% { transform: rotate(-10deg); } 45% { transform: rotate(40deg); } }
.px .swing { transform-origin: 4px 6px; animation: px-swing .7s steps(3) infinite; }

/* Rising steam / floating particles */
@keyframes px-steam {
  0% { transform: translateY(6px) scale(1); opacity: 0; }
  30% { opacity: .9; }
  100% { transform: translateY(-16px) scale(1.2); opacity: 0; }
}
.px-steam span {
  position: absolute; width: 6px; height: 6px; background: var(--ink-dim);
  animation: px-steam 2.2s steps(6) infinite;
}

/* Falling coin */
@keyframes px-coin {
  0% { transform: translateY(-22px); opacity: 0; }
  20% { opacity: 1; }
  90% { transform: translateY(0); opacity: 1; }
  100% { opacity: 1; }
}
.px-coin { animation: px-coin 1.4s steps(6) infinite; }

/* Bounce-in tile (word game) */
@keyframes px-flip { 0% { transform: scaleY(0); } 55% { transform: scaleY(1.15); } 100% { transform: scaleY(1); } }
.px-flip { transform-origin: center; animation: px-flip .6s steps(4) infinite alternate; }

/* Checkmark pop (planner) */
@keyframes px-pop { 0%,70% { transform: scale(0); } 85% { transform: scale(1.2); } 100% { transform: scale(1); } }
.px-pop { transform-origin: center; animation: px-pop 2s steps(3) infinite; }

/* ---- Profession actions (central control via classes) ---- */
/* Typing — both forearms tap, alternating */
@keyframes px-type { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(1px) rotate(-8deg); } }
.px .type { animation: px-type .34s steps(2) infinite; }
.px .type.type--alt { animation-delay: .17s; }
/* Painting — brush/arm dabs in an arc */
@keyframes px-paint { 0%,100% { transform: rotate(-22deg); } 50% { transform: rotate(14deg); } }
.px .paint { animation: px-paint .5s steps(3) infinite; }
/* Surveyor — arm holds ruler out (static rotate) */
.px .hold-out { transform: rotate(-72deg); }
/* Presenting — arm raises a sign */
@keyframes px-present { 0%,100% { transform: rotate(-24deg); } 50% { transform: rotate(-44deg); } }
.px .present { animation: px-present 1s steps(3) infinite; }
/* Growing sprout */
@keyframes px-sprout { 0% { transform: scaleY(.25); } 60% { transform: scaleY(1.12); } 100% { transform: scaleY(1); } }
.px .sprout { animation: px-sprout 2.2s steps(4) infinite; }
/* Watering can tilt */
@keyframes px-pourcan { 0%,100% { transform: rotate(0); } 50% { transform: rotate(-18deg); } }
.px .pour-can { animation: px-pourcan 2.2s steps(3) infinite; }
/* Bending body (gardener) */
@keyframes px-bend { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(2px) rotate(-3deg); } }
.px--bend { transform-origin: 10px 20px; animation: px-bend 1.8s steps(3) infinite; }
/* Screen flicker (monitors, laptops, servers) */
@keyframes px-scr { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.px .screen-blink { animation: px-scr 1.4s steps(2) infinite; }
/* Vehicle wheels jitter */
@keyframes px-wheel { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }
.px .wheel { animation: px-wheel .4s steps(2) infinite; }

/* Walk cycle (leg swap via steps window) */
@keyframes px-legs { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* Parallax ground drift */
@keyframes px-scroll-x { from { background-position-x: 0; } to { background-position-x: -160px; } }

/* Reveal helpers (GSAP-driven, but CSS fallback keeps content visible) */
.reveal { opacity: 1; }

/* Founder storytelling paragraphs */
.story-paragraph { opacity: .25; transform: translateY(12px); transition: opacity .5s, transform .5s; }
.story-paragraph.is-active { opacity: 1; transform: none; }

/* Diễn hoạt luôn bật trên mọi thiết bị (kể cả khi hệ điều hành bật
   Reduce Motion) — theo yêu cầu: mobile diễn hoạt như bình thường. */

/* ---------- Scenes ------------------------------------------------------- */
.coffee-scene { position: relative; display: flex; align-items: flex-end; }
.coffee-scene .px-steam { position: absolute; left: 8px; top: 30px; width: 30px; height: 40px; }

/* App page scene */
.app-scene { position: relative; display: flex; align-items: flex-end; gap: 18px; }
.scene-side { display: flex; align-items: flex-end; }
@keyframes qr-scan { 0%,100% { transform: translateY(0); } 50% { transform: translateY(15px); } }
.qr-scan { animation: qr-scan 1.8s steps(8) infinite; }

/* Founder story layout */
.founder-layout { display: grid; grid-template-columns: .9fr 1.1fr; gap: 40px; align-items: start; }
.founder-sticky { position: sticky; top: 90px; }
.founder-story { display: flex; flex-direction: column; }
.founder-story .story-paragraph { min-height: 62vh; display: flex; flex-direction: column; justify-content: center; }
.founder-poses > div { display: none; }
.founder-poses .pose-1 { display: block; } /* default */
body[data-story-pose="1"] .founder-poses > div { display: none; }
body[data-story-pose="1"] .founder-poses .pose-1 { display: block; }
body[data-story-pose="2"] .founder-poses > div { display: none; }
body[data-story-pose="2"] .founder-poses .pose-2 { display: block; }
body[data-story-pose="3"] .founder-poses > div { display: none; }
body[data-story-pose="3"] .founder-poses .pose-3 { display: block; }
body[data-story-pose="4"] .founder-poses > div { display: none; }
body[data-story-pose="4"] .founder-poses .pose-4 { display: block; }
@media (max-width: 820px) {
  .founder-layout { grid-template-columns: 1fr; }
  .founder-sticky { position: static; }
  .founder-story .story-paragraph { min-height: 0; margin-bottom: 32px; }
}

/* ---------- Ecosystem bento grid ---------------------------------------- */
.eco-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(200px, auto);
}
.eco-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 24px; text-decoration: none; color: var(--ink);
}
.eco-card--wide { grid-column: span 2; }
.eco-stack { display: grid; grid-template-rows: 1fr 1fr; gap: 20px; }
.eco-card--sm { padding: 18px; min-height: 0; }
.eco-icon { flex-shrink: 0; }
.eco-link { display: inline-block; margin-top: 14px; font-family: var(--font-body); font-weight: 800; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--green-primary-dark); }
@media (max-width: 900px) {
  .eco-grid { grid-template-columns: 1fr 1fr; }
  .eco-card--wide { grid-column: span 2; }
  .eco-stack { grid-column: span 2; grid-template-rows: none; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .eco-grid { grid-template-columns: 1fr; }
  .eco-card--wide, .eco-stack { grid-column: span 1; }
  .eco-stack { grid-template-columns: 1fr; }
}

/* ---------- Rooms & work stations (the "workroom" metaphor) ------------- */
/* Cảnh mở — không khung chứa, hoà thẳng vào bối cảnh section */
.room {
  position: relative; width: 100%; min-height: 320px; overflow: hidden;
  background: transparent;
  image-rendering: pixelated;
}
.room--tall { min-height: 380px; }
.room--sm { min-height: 210px; }
.room--flush { }
.st-scene { line-height: 0; }
.st-scene > .room { width: 100%; }
/* Không còn "tường" — nhân vật đứng trực tiếp trên nền section */
.room__wall { display: none; }
.room--sm .room__wall { bottom: 40px; }
.room__floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52px;
  background: var(--green-primary); border-top: 3px solid var(--border-ink);
}
.room--sm .room__floor { height: 40px; }
.room__char { position: absolute; bottom: 0; transform-origin: bottom center; }
/* Fluid scenes: characters/props scale as % of room width (mobile-safe) */
.room__char > .px { width: 100%; display: block; }
.room__char svg { width: 100%; height: auto; }

/* Pixel speech bubble (Montserrat — VN-safe) with a "talking" pop loop */
.bubble {
  display: inline-block; position: relative;
  font-family: var(--font-body); font-weight: 800; font-size: 12px;
  background: var(--surface); color: var(--ink);
  border: 2px solid var(--border-ink); box-shadow: 2px 2px 0 0 var(--border-ink);
  padding: 6px 10px; white-space: nowrap;
  animation: bubble-talk 4s steps(1) infinite;
}
.bubble::after {
  content: ""; position: absolute; left: 16px; bottom: -8px;
  width: 8px; height: 8px; background: var(--surface);
  border-right: 2px solid var(--border-ink); border-bottom: 2px solid var(--border-ink);
}
@keyframes bubble-talk { 0%,100% { opacity: 1; } 45% { opacity: 1; } 55% { opacity: 0; } 90% { opacity: 0; } }
@media (max-width: 640px) { .bubble { font-size: 10px; padding: 4px 7px; } }

/* Bubble gắn ngay trên đầu nhân vật — bám theo container nên tự đúng vị trí
   ở mọi kích thước màn hình */
.bubble--attached {
  position: absolute; bottom: 100%; margin-bottom: 8px;
  left: 50%; transform: translateX(-50%);
}
.bubble--attached::after { left: 50%; margin-left: -5px; }

/* Responsive grids (replace inline repeat(3,1fr) that crushed mobile) */
.grid-3 { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .station--wide { grid-column: span 1; }
}
@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Work-station card: a mini room + label, replaces flat product cards */
.station {
  border: 2px solid var(--border-ink); background: var(--surface);
  box-shadow: var(--shadow-pixel); text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; overflow: hidden;
  transition: transform .12s steps(2), box-shadow .12s steps(2);
}
.station:hover { transform: translate(2px,2px); box-shadow: var(--shadow-pixel-sm); }
.station__body { padding: 18px 20px 20px; }
.station__body h3 { margin: 10px 0 6px; font-size: 18px; }
.station--wide { grid-column: span 2; }
@media (max-width: 900px) { .station--wide { grid-column: span 1; } }

/* ---------- Small utilities --------------------------------------------- */
.grid { display: grid; gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.mt-4 { margin-top: 24px; } .mt-2 { margin-top: 12px; } .mb-2 { margin-bottom: 12px; }
