/* =========================================================================
   Phopy ERP — Marketing site styles
   Design tokens from colors_and_type.css (inlined, remote webfont import removed —
   using a Thai-friendly system font stack; no remote font requests).
   ========================================================================= */

:root {
  /* ---------------- Brand ---------------- */
  --brand-indigo:        #3949E5;
  --brand-indigo-600:    #2F3DC4;
  --brand-indigo-700:    #2632A8;
  --brand-indigo-50:     #EEF0FE;
  --brand-indigo-100:    #DDE1FD;
  --brand-mango:         #F5A524;
  --brand-mango-600:     #D9881A;
  --brand-mango-50:      #FEF4E2;

  /* ---------------- Neutrals (Sand -> Ink) ---------------- */
  --sand-50:   #FBF8F1;
  --sand-100:  #F5F0E2;
  --sand-200:  #ECE6D8;
  --sand-300:  #D9D2C0;
  --sand-400:  #A8A294;
  --ink-500:   #6B6658;
  --ink-700:   #383426;
  --ink-900:   #1E1B16;
  --white:     #FFFFFF;

  /* ---------------- Semantic ---------------- */
  --success:        #16A34A;
  --success-soft:   #DCFCE7;
  --warning:        #F5A524;
  --warning-soft:   #FEF4E2;
  --danger:         #DC2626;
  --danger-soft:    #FEE2E2;
  --info:           #3949E5;
  --info-soft:      #EEF0FE;

  /* ---------------- Surface roles ---------------- */
  --bg:               var(--sand-50);
  --surface:          var(--white);
  --surface-2:        var(--sand-100);
  --surface-sunken:   var(--sand-200);
  --border:           var(--sand-200);
  --border-subtle:    color-mix(in oklab, var(--sand-200) 70%, white);
  --border-strong:    var(--sand-300);

  /* ---------------- Text roles ---------------- */
  --fg:               var(--ink-900);
  --fg-1:             var(--ink-900);
  --fg-2:             var(--ink-700);
  --fg-3:             var(--ink-500);
  --fg-4:             var(--sand-400);
  --fg-on-brand:      #FFFFFF;
  --link:             var(--brand-indigo);

  /* ---------------- Primary action ---------------- */
  --primary:           var(--brand-indigo);
  --primary-hover:     var(--brand-indigo-600);
  --primary-press:     var(--brand-indigo-700);
  --primary-soft:      var(--brand-indigo-50);

  /* ---------------- Type ---------------- */
  /* Webfonts removed for offline/self-contained hosting.
     Thai-friendly system stack; named fonts kept as opportunistic fallbacks. */
  --font-sans:    -apple-system, BlinkMacSystemFont, "Segoe UI", "IBM Plex Sans Thai", "Sarabun", "Noto Sans Thai", system-ui, sans-serif;
  --font-thai:    var(--font-sans);
  --font-mono:    ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --fs-display: 40px;  --lh-display: 48px;
  --fs-h1:      32px;  --lh-h1:      40px;
  --fs-h2:      24px;  --lh-h2:      32px;
  --fs-h3:      20px;  --lh-h3:      28px;
  --fs-lg:      18px;  --lh-lg:      28px;
  --fs-base:    16px;  --lh-base:    24px;
  --fs-sm:      14px;  --lh-sm:      20px;
  --fs-xs:      12px;  --lh-xs:      16px;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* ---------------- Radii ---------------- */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* ---------------- Shadows ---------------- */
  --shadow-1:     0 1px 2px rgba(30, 27, 22, 0.05);
  --shadow-2:     0 4px 12px -2px rgba(30, 27, 22, 0.08);
  --shadow-3:     0 12px 32px -8px rgba(30, 27, 22, 0.16);
  --shadow-focus: 0 0 0 4px rgba(57, 73, 229, 0.18);

  /* ---------------- Spacing ---------------- */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-14: 56px; --sp-18: 72px;

  /* ---------------- Motion ---------------- */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in:  cubic-bezier(0.4, 0, 1, 1);
  --dur-fast: 120ms; --dur-med: 200ms; --dur-slow: 320ms;

  /* ---------------- Layout ---------------- */
  --header-h:  64px;
  --content-max: 1120px;
  --touch-min: 44px;
}

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

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg-2);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; }
h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-semibold); color: var(--fg-1); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-semibold); color: var(--fg-1); letter-spacing: -0.005em; }
h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-semibold); color: var(--fg-1); }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

::selection { background: var(--primary-soft); color: var(--fg-1); }

/* Visible focus states for keyboard users */
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--radius-sm);
}

/* =========================================================================
   Layout helpers
   ========================================================================= */
.container { max-width: var(--content-max); margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.hero-grid,
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.modules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.pricing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; align-items: stretch; }

/* =========================================================================
   Buttons & links (real :hover rules, converted from inline hover hints)
   ========================================================================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); cursor: pointer; border: 0; text-decoration: none;
  transition: background var(--dur-med) var(--ease-out), border-color var(--dur-med) var(--ease-out), color var(--dur-med) var(--ease-out); }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: var(--fg-on-brand); font-weight: var(--fw-semibold); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-outline { background: var(--surface); color: var(--fg-2); border: 1px solid var(--border-strong); font-weight: var(--fw-medium); }
.btn-outline:hover { background: var(--surface-2); border-color: var(--primary); }

.btn-on-dark { background: #fff; color: var(--brand-indigo-700); font-weight: var(--fw-semibold); }
.btn-on-dark:hover { background: var(--sand-50); }

.nav-link { color: var(--fg-2); }
.nav-link:hover { color: var(--primary); text-decoration: none; }

/* =========================================================================
   Header / nav
   ========================================================================= */
.site-header { position: sticky; top: 0; z-index: 50;
  background: rgba(251, 248, 241, 0.92); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); }
.header-inner { max-width: var(--content-max); margin: 0 auto; height: var(--header-h);
  padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.desktop-nav { display: flex; align-items: center; gap: 28px;
  font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.header-actions { display: flex; align-items: center; gap: 12px; }

.menu-toggle { display: none; align-items: center; justify-content: center;
  width: var(--touch-min); height: var(--touch-min); background: transparent;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  color: var(--fg-1); cursor: pointer; }
.menu-toggle:hover { background: var(--surface-2); }

.mobile-nav { display: none; border-bottom: 1px solid var(--border); background: var(--surface); }
.mobile-nav ul { list-style: none; margin: 0; padding: 8px 24px 16px; display: flex; flex-direction: column; gap: 2px; }
.mobile-nav a { display: block; padding: 14px 8px; color: var(--fg-1); font-weight: var(--fw-medium);
  border-radius: var(--radius-md); min-height: var(--touch-min); }
.mobile-nav a:hover { background: var(--surface-2); text-decoration: none; }
.mobile-nav .btn { margin-top: 8px; padding: 14px; }

/* =========================================================================
   Module cards (animations + hover from source)
   ========================================================================= */
.module-card { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column;
  gap: 12px; box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out);
  opacity: 0; animation: riseIn 500ms var(--ease-out) forwards; }
.module-card:hover { box-shadow: var(--shadow-2); transform: translateY(-4px); }
.module-card:hover .module-icon { transform: rotate(-8deg) scale(1.08); }
.module-icon { width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--primary-soft); color: var(--primary); display: flex;
  align-items: center; justify-content: center; transition: transform var(--dur-med) var(--ease-out); }

/* =========================================================================
   Demo tabs
   ========================================================================= */
.demo-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px;
  border-radius: var(--radius-md); font-size: var(--fs-sm); font-weight: var(--fw-semibold);
  font-family: var(--font-sans); cursor: pointer; background: var(--surface);
  color: var(--fg-2); border: 1px solid var(--border);
  transition: background var(--dur-med), color var(--dur-med), border-color var(--dur-med); }
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.demo-scroll { overflow-x: auto; }

/* =========================================================================
   FAQ (native <details>)
   ========================================================================= */
.faq-item { border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--bg); overflow: hidden; }
.faq-item summary { list-style: none; cursor: pointer; display: flex;
  justify-content: space-between; align-items: center; gap: 16px; padding: 18px 20px;
  font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--fg-1); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .chev { color: var(--fg-3); flex-shrink: 0; transition: transform var(--dur-med) var(--ease-out); }
.faq-item[open] summary .chev { transform: rotate(180deg); }
.faq-answer { padding: 0 20px 18px; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--fg-3); }

/* =========================================================================
   Animations
   ========================================================================= */
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bounceDown { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.floaty { animation: floaty 5s ease-in-out infinite; }
.bounce-down { animation: bounceDown 1.4s ease-in-out infinite; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1100px) {
  .pricing-grid { grid-template-columns: repeat(2, 1fr); max-width: 720px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 900px) {
  .desktop-nav { display: none; }
  .header-actions { display: none; }
  .menu-toggle { display: inline-flex; }
  /* show the mobile dropdown when the hamburger toggles the `hidden` attribute off */
  .mobile-nav:not([hidden]) { display: block; }

  .hero-grid,
  .two-col { grid-template-columns: 1fr; gap: 40px; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 460px; margin-left: auto; margin-right: auto; }
  .modules-grid { grid-template-columns: repeat(2, 1fr); }

  .hero-mock-wrap { padding-bottom: 72px !important; }
  .hero-h1 { font-size: 36px !important; line-height: 46px !important; }
}

@media (max-width: 600px) {
  .modules-grid { grid-template-columns: 1fr; }
  .hero-h1 { font-size: 30px !important; line-height: 40px !important; }
  .section-pad { padding-top: 48px !important; padding-bottom: 48px !important; }
  .ai-bubble { position: static !important; left: auto !important; margin-top: 16px; max-width: none !important; }
  .hero-mock-wrap { padding-bottom: 0 !important; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; }
  .module-card { opacity: 1; }
}
