/* ── Base ──────────────────────────────────────────────────────────────── */

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 2rem;
}

body.page-canvas {
  height: 100vh;
  overflow: hidden;
}

body.page-canvas main {
  padding: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Header ────────────────────────────────────────────────────────────── */

header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

header .navbar {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

header .navbar-brand {
  text-decoration: none;
}

/* Logo mark container */
.brand-logo-mark {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-mark img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  display: block;
}

.brand-wordmark {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.015em;
  line-height: 1.1;
  display: block;
}

.brand-byline {
  font-size: 0.62rem;
  color: var(--color-primary);
  display: block;
  letter-spacing: 0.04em;
  line-height: 1;
  margin-top: 0.1rem;
}

header .navbar-nav .nav-link {
  color: var(--color-text-muted);
  font-weight: 500;
  padding-left: 1rem;
  padding-right: 1rem;
  transition: color 0.15s;
}

@media (max-width: 999px) {
  header .navbar-nav .nav-link {
    font-size: 0.85rem;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }
}

header .navbar-nav .nav-link:hover {
  color: var(--color-accent);
}

header .navbar-nav .nav-link.active {
  color: var(--color-accent);
}

header .navbar-nav .nav-link.active::after {
  content: "";
  display: block;
  border-bottom: 2px solid var(--color-accent);
}

/* Navbar dropdowns: "Help" (signed in: Features, FAQ, Pricing) and "Admin" (admin pages) */
header .navbar-nav .nav-link--current { color: var(--color-accent); }
header .nav-dropdown-menu {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  min-width: 10rem;
  padding: 0.35rem 0;
}
header .nav-dropdown-menu .dropdown-item { color: var(--color-text-muted); font-weight: 500; padding: 0.5rem 1rem; }
header .nav-dropdown-menu .dropdown-item:hover,
header .nav-dropdown-menu .dropdown-item:focus-visible { background: var(--color-surface-alt); color: var(--color-accent); }
header .nav-dropdown-menu .dropdown-item.active { background: transparent; color: var(--color-accent); }

header .nav-cta {
  background: var(--color-primary);
  color: var(--color-bg) !important;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 0.35rem 1.1rem !important;
  transition: background 0.15s;
}

header .nav-cta:hover {
  background: var(--color-primary-hover);
  color: var(--color-bg) !important;
}

header .nav-cta.active::after {
  display: none;
}

/* ── Language toggle ───────────────────────────────────────────────────── */

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  padding: 0;
}

.lang-btn {
  all: unset;
  display: inline-block;
  box-sizing: border-box;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-sans);
  letter-spacing: 0.05em;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-alt);
}

.lang-btn.active {
  background: var(--color-primary);
  color: var(--color-bg);
}

.lang-sep {
  color: var(--color-border);
  font-size: 0.75rem;
  line-height: 1;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

/* ── Nav auth controls ─────────────────────────────────────────────────── */

/* Signed-in user's name, just right of the logo (pushes the menu / toggler right) */
header .nav-username {
  margin-right: auto;
  padding-left: 0.85rem;
  border-left: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16rem;
  /* Gives way first when the bar is full (long admin menu): truncates with an ellipsis */
  flex: 0 1 auto;
  min-width: 4rem;
}

@media (max-width: 599px) {
  header .nav-username { max-width: 7.5rem; padding-left: 0.6rem; }
}

.nav-logout-btn {
  white-space: nowrap;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.nav-logout-btn:hover {
  border-color: var(--color-text-secondary);
  color: var(--color-text);
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-footer {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  font-size: 0.82rem;
}

.site-footer a {
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover {
  color: var(--color-text);
}

/* Top row: brand + nav links | operated-by */
.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 0.65rem;
}

.footer-top-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer-brand-link {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--color-text) !important;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-operated {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.footer-operated-name {
  font-weight: 700;
  color: var(--color-text-secondary);
}

/* Bottom row: copyright | address | VAT */
.footer-bottom {
  display: flex;
  align-items: center;
  gap: 0.4rem 2rem;   /* tight between lines (product line / legal details), wide between items */
  flex-wrap: wrap;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* "InfoMetrIQ is a product by Lothringer…": its own line above the legal details */
.footer-product-of {
  flex-basis: 100%;
  margin: 0;
  color: var(--color-text-secondary);
}

.build-date {
  color: var(--color-border);
  font-size: 0.72rem;
}

/* ── Footer: mobile (breakpoints — see src/css/responsive.css) ───────────── */

@media (max-width: 999px) {
  .footer-top { align-items: flex-start; }

  /* Brand on top, links on their own centred line below */
  .footer-top-left {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
  }

  .footer-nav {
    flex-wrap: wrap;
    justify-content: center;
    -moz-column-gap: 1.25rem;
         column-gap: 1.25rem;
  }

  /* Wrap instead of running off-screen (was the cause of sideways scrolling):
     "Operated by…" and "Also from…" on two centred lines */
  .footer-operated {
    flex-wrap: wrap;
    white-space: normal;
    justify-content: center;
    width: 100%;
    row-gap: 0;
  }

  /* The "·" separator becomes an invisible full-width line break */
  .footer-sibling-sep {
    flex-basis: 100%;
    height: 0;
    overflow: hidden;
  }

  .footer-nav a,
  .footer-operated a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  /* Copyright, address, VAT and build date: centred, smaller, one per line
     (build date last, slightly apart) */
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.2rem;
    font-size: 0.72rem;
  }

  .footer-bottom .build-date {
    margin-top: 0.35rem;
    font-size: 0.68rem;
  }
}

/* ── Collapsed nav menu (Bootstrap's own collapse, below 768px) ────────────
   Keyed off the collapse state classes rather than a width, so it applies
   exactly when the menu is collapsed and never to the expanded desktop nav. */

header .navbar-toggler {
  min-width: 44px;
  min-height: 44px;
}

header .navbar-collapse:is(.show, .collapsing) .nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 1rem;
}

header .navbar-collapse:is(.show, .collapsing) .nav-dropdown-menu {
  border: 0;
  background: transparent;
  padding: 0 0 0 0.75rem;
}
header .navbar-collapse:is(.show, .collapsing) .nav-dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  min-height: 44px;
}

header .navbar-collapse:is(.show, .collapsing) .nav-cta {
  justify-content: center;
  margin: 0.5rem 0;
}

header .navbar-collapse:is(.show, .collapsing) .lang-toggle {
  width: -moz-max-content;
  width: max-content;
  margin: 0.25rem 0 0.75rem;
}

header .navbar-collapse:is(.show, .collapsing) .lang-btn {
  min-width: 56px;
  min-height: 44px;
}

header .navbar-collapse:is(.show, .collapsing) .nav-logout-btn {
  min-height: 44px;
}

/* ── Cookie banner ─────────────────────────────────────────────────────── */

.cookie-banner[hidden] {
  display: none;
}


.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem 1.5rem;
  font-size: 0.87rem;
  z-index: 1050;
  flex-wrap: wrap;
}

.cookie-banner-text {
  margin: 0;
  line-height: 1.5;
  flex: 1;
}

.cookie-banner-text a {
  color: var(--color-accent);
  text-decoration: none;
}

.cookie-banner-text a:hover {
  color: var(--color-text);
}

.cookie-accept-btn {
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s;
}

.cookie-accept-btn:hover {
  background: var(--color-primary-hover);
}

/* Accept / Decline pair (shown when analytics is configured). Decline is an
   equally easy, equally visible choice — outline instead of filled. */
.cookie-banner-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.cookie-decline-btn {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s;
}

.cookie-decline-btn:hover {
  border-color: var(--color-text-secondary);
}

/* ── Plan qualifier pill (partials/paid-plans.hbs) ─────────────────────── */

.plan-pill {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--color-primary);
  border-radius: 999px;
  color: var(--color-primary-light);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
}

/* ── Shared button utilities ───────────────────────────────────────────── */

.lp-btn-primary {
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  padding: 0.7rem 1.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.97rem;
  transition: background 0.15s;
}

.lp-btn-primary:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.lp-btn-ghost {
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 0.7rem 1.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.97rem;
  transition: border-color 0.15s, color 0.15s;
}

.lp-btn-ghost:hover {
  color: var(--color-text);
  border-color: var(--color-text-secondary);
}

/* ── Channel colour swatch (PROMPTS/17) ────────────────────────────────── */

.channel-swatch {
  display: inline-block;
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--color-text-muted);
}
.channel-swatch--gold   { background: var(--color-channel-gold); }
.channel-swatch--sky    { background: var(--color-channel-sky); }
.channel-swatch--mint   { background: var(--color-channel-mint); }
.channel-swatch--coral  { background: var(--color-channel-coral); }
.channel-swatch--violet { background: var(--color-channel-violet); }
.channel-swatch--pink   { background: var(--color-channel-pink); }
.channel-swatch--lime   { background: var(--color-channel-lime); }
.channel-swatch--silver { background: var(--color-channel-silver); }
/* Direct (the survey's main link): neutral, hollow */
.channel-swatch--direct {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--color-text-muted);
}

/* ── Tier-locked elements ──────────────────────────────────────────────── */

[data-locked] {
  opacity: 0.6;
  cursor: pointer !important;
}

[data-locked]:hover {
  opacity: 0.8;
}

.tier-locked {
  pointer-events: auto !important;
}

/* ── Usage warning banner ──────────────────────────────────────────────── */

.usage-warning-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: #664d03;
}

.usage-warning-banner a,
.usage-warning-banner .usage-warning-btn {
  color: #664d03;
  font-weight: 600;
}

.usage-warning-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

/* ── Retroactive lock banner ───────────────────────────────────────────── */

.retroactive-lock-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 0;
  padding: 0.75rem 1.25rem;
  font-size: 0.9rem;
  color: #664d03;
}

.retroactive-lock-banner a {
  color: #664d03;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Shared auth modal / form utilities (contact, upgrade, etc.) ────────── */

.auth-modal-content {
  border-radius: var(--radius-md);
  padding: 0.5rem 0.5rem 1rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.auth-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--color-error-text);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.auth-success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--color-success-text);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.auth-submit {
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  margin-top: 0.25rem;
  transition: background 0.15s;
}

.auth-submit:hover {
  background: var(--color-primary-hover);
}

/* ── Cookie banner: mobile (after the base banner rules so these win) ───── */

@media (max-width: 999px) {
  /* Reserve the banner's height (set by main.hbs) so it never covers the page end */
  body.has-cookie-banner {
    padding-bottom: var(--cookie-banner-h, 0px);
  }
}

@media (max-width: 599px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
  }

  .cookie-accept-btn {
    width: 100%;
    min-height: 44px;
  }

  .cookie-banner-actions .cookie-accept-btn,
  .cookie-decline-btn {
    flex: 1;
    min-height: 44px;
  }
}

/* ── Waiting animation (client/flow-loader.js / partials/flow-loader.hbs) ── */

.flow-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 0;
  text-align: center;
}

.flow-loader-img {
  display: block;
  border-radius: 14px;
  /* The navy tile needs an edge on navy pages (its first frame is plain navy) */
  box-shadow: 0 0 0 1px var(--color-border), 0 4px 14px rgba(0, 0, 0, 0.25);
}

.flow-loader-text {
  font-size: 0.88rem;
  color: inherit;
  opacity: 0.85;
}

/* ── Response cap usage banner (PROMPTS/20) — survey info + canvas results ── */

.cap-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.cap-banner-usage { font-weight: 600; color: var(--color-text); }
.cap-banner--warning {
  border-color: color-mix(in srgb, var(--color-warning) 55%, transparent);
  background: color-mix(in srgb, var(--color-warning) 12%, transparent);
  color: var(--color-warning-text);
}
.cap-banner--full {
  border-color: color-mix(in srgb, var(--color-error) 55%, transparent);
  background: color-mix(in srgb, var(--color-error) 12%, transparent);
  color: var(--color-error-text);
}
.cap-banner--warning .cap-banner-usage { color: var(--color-warning-text); }
.cap-banner--full .cap-banner-usage { color: var(--color-error-text); }
.cap-banner-cta {
  margin-left: auto;
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.8rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.cap-banner-cta:hover, .cap-banner-cta:focus-visible { background: color-mix(in srgb, currentColor 12%, transparent); }
/* On the canvas page the banner is a full-width strip above the toolbar */
.page-canvas .cap-banner { border-radius: 0; margin-bottom: 0; border-left: 0; border-right: 0; }
