/* AgriPricePH — Shared landing-page navbar (fixed size, all pages) */

:root {
  --lp-green-900: #162e20;
  --lp-green-700: #2a5c3f;
  --lp-green-600: #357350;
  --lp-green-400: #52b07a;
  --lp-green-50: #edf8f3;
  --lp-text-primary: #0f1e14;
  --lp-text-secondary: #3a5045;
  --lp-bg: #f8faf7;
  --lp-border: rgba(53, 115, 80, 0.14);
  --lp-border-md: rgba(53, 115, 80, 0.22);
  --lp-font-display: 'DM Serif Display', Georgia, serif;
  --lp-font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --lp-nav-height: 64px;
  --lp-nav-link-h: 32px;
  --lp-nav-btn-h: 36px;
}

/* Dark mode: this file's --lp-* vars drive the body background/text and navbar on every public
   page (via body.public-body below), independently of global.css's --bg-body/--text-* vars — so
   the theme switch needs its own override here too, or dark mode silently does nothing site-wide. */
html.theme-dark {
  --lp-green-900: #d9f0e3;
  --lp-green-50: rgba(76, 175, 110, 0.16);
  --lp-text-primary: #e8f0eb;
  --lp-text-secondary: #9bb0a4;
  --lp-bg: #0f1a14;
  --lp-border: rgba(76, 175, 110, 0.16);
  --lp-border-md: rgba(76, 175, 110, 0.26);
}

/* The host — not the <nav> inside it — is what pins. A sticky element can only travel within its
   parent, and the host is exactly the nav's height, so a sticky <nav> had nowhere to go and
   scrolled away with the page. The host is a direct child of <body> (public-shell.js inserts it
   first), so it can travel the full page. */
#public-navbar-host {
  display: block;
  width: 100%;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 200;
}

/*
 * Scrollbar lives on <html>, not <body> — hide it on all public pages.
 * (scrollbar-gutter: stable was leaving a visible gutter on the index.)
 */
html.public-site {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

/* Scroll lock while a modal is open (public-auth-modal.js, public-catalog.js). It goes on <html>
   because <html> is the scroller; locking <body> did not stop scrolling and un-pinned the nav. */
html.public-site.public-scroll-locked {
  overflow-y: hidden;
}

html.public-site::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* `clip`, not `hidden`: an overflow of `hidden` on one axis forces the other axis to `auto`, which
   made <body> a scroll container that never scrolls (the real scroller is <html>) — and sticky
   elements pin to their nearest scroll container, so nothing inside <body> could ever pin.
   `clip` hides the same horizontal overflow without creating a scroll container. `hidden` stays
   first as the fallback for browsers without `clip`. This rule also outranks global.css's plain
   `body { overflow-x: hidden }` on every public page. */
html.public-site body {
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: visible;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

html.public-site body::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Module pages: undo global.css layout/font overrides that shift the navbar */
body.public-body,
body.has-public-nav {
  display: block !important;
  font-family: var(--lp-font-body);
}

body.public-body {
  background: var(--lp-bg);
  color: var(--lp-text-primary);
}

body[data-page="home"] {
  font-family: var(--lp-font-body);
}

/* Isolate navbar from global .btn-* and root font-size */
.lp-site-nav {
  position: relative;   /* pinning is done by #public-navbar-host; relative anchors the phone menu panel */
  z-index: 200;
  width: 100%;
  flex-shrink: 0;
  background: rgba(248, 250, 247, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--lp-border);
  font-family: var(--lp-font-body);
  font-size: 13.5px;
  line-height: 1.2;
}

html.theme-dark .lp-site-nav {
  background: rgba(15, 26, 20, 0.88);
}

.lp-site-nav .nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
  height: var(--lp-nav-height);
  min-height: var(--lp-nav-height);
  max-height: var(--lp-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: nowrap;
  box-sizing: border-box;
}

.lp-site-nav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  height: var(--lp-nav-height);
}

.lp-site-nav .brand-icon.logo-icon {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  background: var(--lp-green-700);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lp-site-nav .brand-icon.logo-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  display: block;
}

.lp-site-nav .brand-name {
  font-family: var(--lp-font-display);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--lp-green-900);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.lp-site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-shrink: 1;
  min-width: 0;
}

.lp-site-nav .nav-links li {
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

.lp-site-nav .nav-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--lp-nav-link-h);
  padding: 0 14px;
  box-sizing: border-box;
  font-family: var(--lp-font-body);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1;
  color: var(--lp-text-secondary);
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}

.lp-site-nav .nav-links a:hover,
.lp-site-nav .nav-links a.active {
  background: var(--lp-green-50);
  color: var(--lp-green-700);
  font-weight: 500;
}

html.theme-dark .lp-site-nav .nav-links a:hover,
html.theme-dark .lp-site-nav .nav-links a.active {
  color: #a3d9b8;
}

.lp-site-nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  height: var(--lp-nav-btn-h);
}

.lp-site-nav .lp-nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
  flex-shrink: 0;
}

.lp-site-nav .lp-nav-user-name {
  font-family: var(--lp-font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--lp-text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Dedicated classes — not .btn-ghost / .btn-primary (global.css conflicts) */
.lp-site-nav .lp-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: var(--lp-nav-btn-h);
  min-height: var(--lp-nav-btn-h);
  max-height: var(--lp-nav-btn-h);
  margin: 0;
  padding: 0 16px;
  border-radius: 8px;
  font-family: var(--lp-font-body);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}

.lp-site-nav .lp-nav-btn--ghost {
  color: var(--lp-text-secondary);
  background: transparent;
  border: 1px solid var(--lp-border-md);
}

.lp-site-nav .lp-nav-btn--ghost:hover {
  background: var(--lp-green-50);
  border-color: var(--lp-green-400);
  color: var(--lp-text-secondary);
}

.lp-site-nav .lp-nav-btn--primary {
  color: #fff;
  background: var(--lp-green-700);
  border: none;
  padding: 0 20px;
}

.lp-site-nav .lp-nav-btn--primary:hover {
  background: var(--lp-green-600);
  color: #fff;
  transform: translateY(-1px);
}

.lp-site-nav .lp-nav-user[hidden],
.lp-site-nav a.lp-nav-btn[hidden],
.lp-site-nav button.lp-nav-btn[hidden],
.lp-site-nav .lp-nav-hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#public-app .public-module-main {
  width: 100%;
  margin: 0;
}

#public-app .page-content {
  /* width:100% matters: `margin: 0 auto` inside the column-flex shell makes the box shrink-wrap
     to its content, so a wide table (Rice Catalog, 720px min, meant to scroll in its own
     wrapper) stretched the page to ~750px on phones. max-width still centres it on desktop. */
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px;
}

@media (max-width: 900px) {
  .lp-site-nav .nav-inner {
    height: auto;
    min-height: var(--lp-nav-height);
    max-height: none;
    flex-wrap: wrap;
    padding: 12px 20px;
    gap: 12px;
  }

  .lp-site-nav .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ── Phone menu (public-shell.js bindMobileMenu) ── */
.lp-site-nav .lp-nav-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--lp-border-md, #cfe0d4);
  background: var(--lp-bg, #fff);
  color: var(--lp-text-primary, #1f3d2c);
  cursor: pointer;
  flex-shrink: 0;
}
.lp-site-nav .lp-nav-mobile-toggle[aria-expanded="true"] {
  background: var(--lp-green-50, #e8f3ec);
  color: var(--lp-green-700, #1f5a3d);
}
html.theme-dark .lp-site-nav .lp-nav-mobile-toggle[aria-expanded="true"] { color: #a3d9b8; }
.lp-site-nav .lp-nav-mobile-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--lp-bg, #fff);
  border-bottom: 1px solid var(--lp-border, #e2ece5);
  box-shadow: 0 16px 30px rgba(20, 50, 34, 0.12);
  padding: 10px 16px 16px;
  max-height: calc(100vh - 70px);
  overflow-y: auto;
}
.lp-site-nav .lp-nav-mobile-panel[hidden] { display: none; }
.lp-site-nav .lp-nav-mobile-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lp-site-nav .lp-nav-mobile-links a {
  display: block;
  padding: 12px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--lp-text-primary, #1f3d2c);
  text-decoration: none;
}
.lp-site-nav .lp-nav-mobile-links a.active,
.lp-site-nav .lp-nav-mobile-links a:hover { background: var(--lp-green-50, #e8f3ec); color: var(--lp-green-700, #1f5a3d); font-weight: 600; }
html.theme-dark .lp-site-nav .lp-nav-mobile-links a.active,
html.theme-dark .lp-site-nav .lp-nav-mobile-links a:hover { color: #a3d9b8; }
.lp-site-nav .lp-nav-mobile-auth {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--lp-border, #e2ece5);
}
.lp-site-nav .lp-nav-mobile-user { flex-basis: 100%; font-size: 12.5px; color: var(--lp-text-secondary, #5a7060); }
.lp-site-nav .lp-nav-mobile-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--lp-border-md, #cfe0d4);
  font-size: 14px;
  font-weight: 600;
  color: var(--lp-text-primary, #1f3d2c);
  text-decoration: none;
  background: var(--lp-bg, #fff);
}
.lp-site-nav .lp-nav-mobile-btn.primary { background: var(--lp-green-600, #2d6a4f); border-color: var(--lp-green-600, #2d6a4f); color: #fff; }

@media (max-width: 640px) {
  .lp-site-nav .nav-links,
  .lp-site-nav .lp-nav-btn--ghost {
    display: none;
  }

  /* The phone menu now carries Log in / Sign up and Profile/Settings, so the inline sign-up
     button, the user's name, and the signed-in icon pair step aside to keep the bar on one line. */
  .lp-site-nav .lp-nav-mobile-toggle { display: inline-flex; }
  .lp-site-nav .lp-nav-btn--primary,
  .lp-site-nav .lp-nav-user-name,
  .lp-site-nav .lp-nav-burger,
  .lp-site-nav .lp-nav-menu { display: none !important; }
  .lp-site-nav .nav-actions { gap: 8px; }

  #public-app .page-content {
    padding: 20px 16px;
  }
}
