/* ==========================================================================
   meshbook marketing pages — public-facing layout.
   Reads from the v2 SPA's --nv-* token system (loaded ahead of this file)
   so server-rendered marketing chrome matches the in-app SPA visually.

   The token aliases below let legacy marketing classes (.m-tier, .m-hero,
   .m-section, .m-footer-grid, etc) keep their old --bg / --text / --panel
   / --border / --muted / --accent / --radius names while resolving against
   the v2 token system. Avoids a wide search-and-replace.
   ========================================================================== */
:root {
  --bg:       var(--nv-bg);
  --text:     var(--nv-text);
  --panel:    var(--nv-surface-solid);
  --panel-2:  var(--nv-bg-elevated);
  --border:   var(--nv-border);
  --muted:    var(--nv-text-secondary);
  --accent:   var(--nv-accent);
  --radius:   var(--nv-radius-md);
}

body.nv-body.marketing,
body.marketing {
  background: var(--nv-bg);
  color: var(--nv-text);
  line-height: 1.6;
  /* Whole-page scroll. The body is the scroll container; the topbar
     stays visible via position:sticky on .m-topbar-v2; the footer
     scrolls naturally to the bottom of the page like any other
     content.

     IMPORTANT: base.css applies `overflow: hidden` and `height: 100%`
     to .nv-body / `html, body` (designed for the SPA's sidebar+main
     split-scroll model). Marketing pages explicitly opt out so the
     viewport scrolls naturally — without these overrides the page
     content is clipped at 100vh with no scrollbar at all. */
  margin: 0;
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

/* The `html` element also gets `height: 100%` from base.css. On
   marketing pages we want it to grow with content so body's
   natural height isn't capped at the viewport. The :has() selector
   targets only documents whose body is a marketing page, leaving
   the SPA shell unaffected. */
html:has(body.marketing) {
  height: auto;
}

.m-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar pinned at the top of the viewport while the rest of the
   page scrolls underneath. Sticky (not fixed) so the layout doesn't
   need a content-area top-padding hack. */
.m-shell > .m-topbar-v2,
.m-shell > .nv-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.m-shell > .m-main {
  flex: 1 0 auto;          /* Grow to fill space when content is short */
}

/* ---------- v2-styled marketing topbar ---------- */

.m-topbar-v2 {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  padding: 0 1.25rem;
}

.m-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--nv-text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.m-brand-link:hover {
  color: var(--nv-text);
  text-decoration: none;
}

.m-brand-logo {
  width: 28px;
  height: 28px;
  display: block;
}

.m-brand-name {
  font-family: 'Inter', system-ui, sans-serif;
}

/* Wordmark gradients — pulled from the hexagon logo's own colour stops so the
   brand reads as one piece. Dark uses the bright cyan core; light uses the
   deep-navy outer ring. California + retro keep their themed text colour. */
[data-theme="dark"] .m-brand-name {
  background: linear-gradient(135deg, #b0f1ff 0%, #5fdcff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
[data-theme="light"] .m-brand-name {
  background: linear-gradient(135deg, #04124e 0%, #1976d2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.m-topnav-v2 {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 1.5rem;
  flex: 1;
}

.m-nav-link {
  padding: 0.4rem 0.75rem;
  border-radius: var(--nv-radius-md);
  color: var(--nv-text-secondary);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background-color var(--nv-duration-fast), color var(--nv-duration-fast);
}
.m-nav-link:hover {
  background-color: var(--nv-surface);
  color: var(--nv-text);
  text-decoration: none;
}
.m-nav-link.is-active {
  background-color: var(--nv-surface-solid);
  color: var(--nv-text);
}

/* ---------- Theme swatches — visual match to v2 SPA's nv-theme-switch ----------
   Same pill container, same circular button, same radial-gradient previews.
   Marketing pages keep the single-button markup (built by app-chrome.js) and
   render the swatch via a ::before pseudo-element so we don't have to touch
   the DOM-builder JS. */

.m-theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  background-color: var(--nv-surface);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius-pill);
}

.m-theme-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--nv-duration-fast),
              border-color var(--nv-duration-fast);
}
.m-theme-swatch::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
  background-image: var(--m-swatch-bg, transparent);
}
.m-theme-swatch:hover {
  border-color: var(--nv-border-strong);
  transform: translateY(-1px);
}
.m-theme-swatch.is-active {
  border-color: var(--nv-accent);
  box-shadow: var(--nv-glow-accent);
}
.m-theme-swatch[data-theme="dark"]       { --m-swatch-bg: radial-gradient(circle at 30% 30%, #b432ff 0%, #00d4ff 50%, #050505 100%); }
.m-theme-swatch[data-theme="light"]      { --m-swatch-bg: radial-gradient(circle at 30% 30%, #7c3aed 0%, #0284c7 55%, #ffffff 100%); }
.m-theme-swatch[data-theme="california"] { --m-swatch-bg: radial-gradient(circle at 30% 30%, #ff6b6b 0%, #ffa502 55%, #fff4ea 100%); }
.m-theme-swatch[data-theme="retro"]      { --m-swatch-bg: radial-gradient(circle at 30% 30%, #ffcc00 0%, #ff6b35 55%, #0a0600 100%); }

/* ---------- Language pills (EN / PL / ZH) ---------------------------------
   Mirrors the SPA's .nv-lang-switch — same pill container, same chip
   sizing — so the marketing topbar reads as one design system across
   server-rendered + SPA pages. */

.m-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.2rem;
  background-color: var(--nv-surface);
  border: 1px solid var(--nv-border);
  border-radius: var(--nv-radius-pill);
}

.m-lang-pill {
  min-width: 32px;
  height: 26px;
  padding: 0 0.5rem;
  border-radius: var(--nv-radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--nv-text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color var(--nv-duration-fast),
              background-color var(--nv-duration-fast),
              border-color var(--nv-duration-fast),
              transform var(--nv-duration-fast);
}
.m-lang-pill:hover {
  color: var(--nv-text);
  border-color: var(--nv-border-strong);
  transform: translateY(-1px);
}
.m-lang-pill.is-active {
  color: var(--nv-text);
  background-color: var(--nv-surface-2);
  border-color: var(--nv-accent);
  box-shadow: var(--nv-glow-accent);
}

/* ---------- Sign-in CTA + me chip slot ---------- */

/* Subscribe-as-button needs to read identically to the <a class="m-cta">. */
button.m-cta {
  font: inherit;
  cursor: pointer;
}
button.m-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.m-signin-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #b432ff 0%, #00d4ff 100%);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--nv-radius-pill);
  text-decoration: none;
  transition: transform var(--nv-duration-fast), box-shadow var(--nv-duration-fast);
}
.m-signin-cta:hover {
  transform: translateY(-1px);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(180, 50, 255, 0.35);
}

/* Retro theme — the default purple→cyan reads as alien against retro's
   amber palette. Swap to retro's own accent gradient with dark text so it
   feels native to the theme. Other themes keep the rhomboid-era gradient
   which Chris confirmed reads fine in dark/light/california. */
[data-theme="retro"] .m-signin-cta {
  background: linear-gradient(135deg, #ffcc00 0%, #ff6b35 100%);
  color: #0a0600;
}
[data-theme="retro"] .m-signin-cta:hover {
  color: #0a0600;
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.45);
}

/* ---------- Top bar ---------- */

.m-topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 2rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.m-topbar .brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.m-nav {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.m-nav a {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
}

.m-nav a:hover,
.m-nav a.active {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.m-cta-secondary {
  border: 1px solid var(--nv-border);
}

/* ---------- Main + sections ---------- */

.m-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

.m-section {
  padding: 4rem 0;
  border-bottom: 1px solid var(--border);
}

.m-section:last-of-type {
  border-bottom: none;
}

.m-section--alt {
  background: var(--panel);
  margin: 0 -2rem;
  padding: 4rem 2rem;
  border-radius: var(--radius);
}

.m-section--centered {
  text-align: center;
}
.m-section--centered p {
  max-width: 56ch;
  margin-left: auto;
  margin-right: auto;
}

.m-section h2 {
  font-size: 1.75rem;
  margin: 0 0 1rem 0;
  letter-spacing: -0.01em;
}

.m-section h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem 0;
}

.m-section p,
.m-section li {
  font-size: 1.05rem;
}

/* ---------- Hero ---------- */

.m-hero {
  padding: 4rem 0 2rem 0;
  text-align: center;
}

.m-hero--narrow {
  max-width: 720px;
  margin: 0 auto;
}

.m-hero h1 {
  font-size: 2.75rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem 0;
  line-height: 1.15;
}

.m-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.m-lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 0.5rem auto;
}

.m-lead-meta {
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ---------- Pricing grid ---------- */

.m-pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem 0 4rem 0;
}

.m-tier {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.m-tier--featured {
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: var(--shadow);
  position: relative;
}

.m-tier-badge {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.m-tier-badge.m-tier-badge--talk {
  background: var(--nv-bg-elevated, #f4f3ef);
  color: var(--nv-text-secondary, #5a5a5a);
  border: 1px solid var(--nv-border, #d8d6d0);
}

.m-tier h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
}

.m-tier-price {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.m-price-num {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.m-price-unit {
  color: var(--muted);
  font-size: 0.95rem;
}

.m-tier-tag {
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
}

.m-tier-features {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.m-tier-features li {
  margin-bottom: 0.4rem;
  font-size: 0.98rem;
}

.m-tier-budget {
  font-size: 0.9rem;
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: var(--panel-2);
  border-radius: 6px;
}

.m-tier-fineprint {
  font-size: 0.85rem;
  margin: 0.5rem 0 0 0;
}

/* ---------- CTAs ---------- */

.m-cta {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  font-weight: 600;
  text-align: center;
  transition: transform 0.1s ease, background 0.15s ease;
  margin-top: auto;
}

.m-cta:hover {
  text-decoration: none;
  transform: translateY(-1px);
  background: var(--border);
}

.m-cta--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.m-cta--primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: white;
}

.m-cta--large {
  padding: 1rem 2rem;
  font-size: 1.05rem;
}

/* ---------- Two-column ---------- */

.m-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin: 1.5rem 0;
}

.m-pos {
  color: var(--success);
}

.m-neg {
  color: var(--danger);
}

/* ---------- Lists with icons ---------- */

.m-list-checked,
.m-list-x {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.m-list-checked li,
.m-list-x li {
  position: relative;
  padding-left: 1.85rem;
  margin-bottom: 0.6rem;
}

.m-list-checked li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--success);
  font-weight: 700;
  font-size: 1.1rem;
}

.m-list-x li::before {
  content: "✗";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--danger);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ---------- FAQ ---------- */

.m-faq {
  margin: 1.5rem 0;
}

.m-faq dt {
  font-weight: 600;
  margin-top: 1.25rem;
  font-size: 1.05rem;
  color: var(--text);
}

.m-faq dd {
  margin: 0.4rem 0 0 0;
  color: var(--muted);
  padding-left: 0;
}

/* ---------- Budget table ---------- */

.m-budget-table {
  margin: 1.5rem 0;
  overflow-x: auto;
}

.m-budget-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
}

.m-budget-table th,
.m-budget-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.m-budget-table th {
  background: var(--panel-2);
  font-weight: 600;
  font-size: 0.95rem;
}

.m-budget-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- AU sovereignty section ---------- */

.m-au-sovereignty {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}

.m-au-sovereignty__card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2.25rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.m-au-sovereignty__flag {
  width: 96px;
  height: 48px;
  display: block;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Inline footer flag — small, sized to sit on text baseline. Used in
   both the marketing footer (templates/_base_marketing.html) and the
   app shell footer (templates/base.html). */
.m-footer-flag {
  display: inline-block;
  width: 18px;
  height: 11px;
  border-radius: 2px;
  margin-right: 0.4em;
  vertical-align: -2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
}

.m-au-sovereignty__copy h2 {
  font-size: 1.5rem;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.01em;
}

.m-au-sovereignty__copy p {
  margin: 0 0 1rem 0;
  color: var(--text-secondary, var(--text));
}

.m-au-sovereignty__points {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.6rem 1.5rem;
}

.m-au-sovereignty__points li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.m-au-sovereignty__points li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent, #1976d2);
  font-weight: 700;
}

.m-au-sovereignty__caveat {
  font-size: 0.825rem;
  color: var(--text-tertiary, var(--text-secondary));
  font-style: italic;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

@media (max-width: 640px) {
  .m-au-sovereignty__card {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1.5rem;
  }
  .m-au-sovereignty__flag {
    font-size: 2.5rem;
  }
  .m-au-sovereignty__points {
    text-align: left;
  }
}

/* ---------- CTA band ---------- */

.m-cta-band {
  text-align: center;
  padding: 4rem 0;
  border-top: 1px solid var(--border);
}

.m-cta-band h2 {
  font-size: 1.85rem;
  margin: 0 0 0.75rem 0;
}

.m-cta-band p {
  margin: 0 0 1.5rem 0;
}

/* ---------- Footer ---------- */

.m-footer {
  margin-top: 4rem;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 3rem 2rem 1.5rem 2rem;
}

.m-footer-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.m-footer-grid strong {
  display: block;
  margin-bottom: 0.65rem;
  color: var(--text);
}

.m-footer-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.m-footer-grid li {
  margin-bottom: 0.35rem;
}

.m-footer-grid a {
  color: var(--muted);
  font-size: 0.95rem;
}

.m-footer-grid a:hover {
  color: var(--accent);
}

.m-footer-base {
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.25rem;
}

.m-footer-sov {
  letter-spacing: 0.01em;
}

/* ---------- Code inline ---------- */

.marketing code {
  background: var(--panel-2);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .m-hero h1 {
    font-size: 2rem;
  }
  .m-section {
    padding: 2.5rem 0;
  }
  .m-section--alt {
    margin: 0 -1rem;
    padding: 2.5rem 1rem;
  }
  .m-main {
    padding: 0 1rem;
  }
  .m-topbar {
    padding: 0.75rem 1rem;
  }
}
