/* =========================================================================
   RetailIQ landing page
   Self-contained: no external fonts, no CDNs, no build step.
   Light + dark via prefers-color-scheme. Responsive down to 360px.
   Brand: primary #0f4c81, accent #12b886.
   ========================================================================= */

/* ---- Design tokens -------------------------------------------------------- */
:root {
  color-scheme: light dark;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;

  /* Fluid type scale */
  --fs-hero: clamp(2.25rem, 4.6vw + 1rem, 3.5rem);
  --fs-h2:   clamp(1.75rem, 2.6vw + 0.9rem, 2.5rem);
  --fs-h3:   clamp(1.2rem, 0.6vw + 1rem, 1.4rem);
  --fs-lead: clamp(1.05rem, 0.6vw + 0.95rem, 1.25rem);
  --fs-body: 1rem;
  --fs-sm:   0.9rem;
  --fs-xs:   0.8rem;

  /* Spacing scale (4px base) */
  --sp-3xs: 0.25rem;
  --sp-2xs: 0.5rem;
  --sp-xs:  0.75rem;
  --sp-s:   1rem;
  --sp-m:   1.5rem;
  --sp-l:   2rem;
  --sp-xl:  3rem;
  --sp-2xl: 4rem;
  --sp-3xl: 6rem;
  --section-pad: clamp(3.5rem, 7vw, 6rem);

  /* Radii */
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --radius-pill: 999px;

  /* Widths */
  --wrap-max: 72rem;

  /* Light palette */
  --bg: #ffffff;
  --bg-subtle: #f6f8fb;
  --surface: #ffffff;
  --border: #e4e9ef;
  --border-strong: #cdd6e0;
  --text: #10202e;
  --text-secondary: #3c4a57;
  --text-muted: #4f5d6b;

  --brand: #0f4c81;
  --brand-ink: #0f4c81;          /* brand-coloured text / links */
  --brand-solid: #0f4c81;        /* filled button bg */
  --brand-solid-hover: #0c3f6c;
  --brand-soft: #eaf1f8;         /* brand tint surface */
  --on-brand: #ffffff;

  --accent: #12b886;             /* vivid accent for fills / dots */
  --accent-ink: #0b6b4f;         /* accent-coloured text (AA on light) */
  --accent-soft: #e7f6f0;

  --chart-grid: #eef2f7;
  --chart-band: rgba(18, 184, 134, 0.15);

  --focus-ring: #1a73c2;

  --shadow-sm: 0 1px 2px rgba(16, 32, 46, 0.05);
  --shadow-md: 0 8px 28px rgba(16, 32, 46, 0.08);
  --hero-glow: radial-gradient(70% 120% at 78% 0%, rgba(18, 184, 134, 0.10), transparent 60%),
               radial-gradient(80% 120% at 0% 0%, rgba(15, 76, 129, 0.10), transparent 55%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --bg-subtle: #0e1626;
    --surface: #121d30;
    --border: #223049;
    --border-strong: #33425e;
    --text: #e8eef6;
    --text-secondary: #c2cddb;
    --text-muted: #93a2b4;

    --brand: #0f4c81;
    --brand-ink: #7fb2e6;
    --brand-solid: #1b60a0;
    --brand-solid-hover: #23709b;
    --brand-soft: #10233a;
    --on-brand: #ffffff;

    --accent: #2fd6a0;
    --accent-ink: #34d399;
    --accent-soft: #103029;

    --chart-grid: #1b2740;
    --chart-band: rgba(47, 214, 160, 0.16);

    --focus-ring: #8cc0f0;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.45);
    --hero-glow: radial-gradient(70% 120% at 78% 0%, rgba(47, 214, 160, 0.10), transparent 60%),
                 radial-gradient(80% 120% at 0% 0%, rgba(31, 96, 160, 0.16), transparent 55%);
  }
}

/* ---- Reset / base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { overflow-wrap: break-word; }

/* Allow grid/flex children to shrink below their intrinsic content size so
   wide content (e.g. the hero SVG) never forces horizontal page overflow. */
.hero__grid > *,
.feature-lead > *,
.price-panel > *,
.signin > *,
.footer-grid > *,
.footer-bottom > *,
.site-header__inner > * { min-width: 0; }

h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }

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

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

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  word-break: break-word;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 100;
  background: var(--brand-solid);
  color: var(--on-brand);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-s);
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.75rem; text-decoration: none; }

.wrap {
  width: 100%;
  max-width: var(--wrap-max);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2rem);
}

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  padding: 0.72rem 1.15rem;
  border-radius: var(--radius-s);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brand-solid);
  color: var(--on-brand);
  border-color: var(--brand-solid);
}
.btn--primary:hover {
  background: var(--brand-solid-hover);
  border-color: var(--brand-solid-hover);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--brand-soft); border-color: var(--brand); }

/* ---- Brand / logo --------------------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand__mark { display: inline-flex; color: var(--brand-ink); }
.brand__word { font-size: 1.15rem; }
.brand__word-accent { color: var(--accent-ink); }

.mark-bar  { fill: currentColor; }
.mark-dot  { fill: var(--accent); }
.mark-base { stroke: currentColor; stroke-width: 1.5; opacity: 0.35; stroke-linecap: round; }

.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius-m);
  background: var(--brand-soft);
  color: var(--brand-ink);
  margin-bottom: var(--sp-s);
}

/* ---- Header --------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg); /* fallback if color-mix unsupported */
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-m);
  min-height: 4rem;
}
.site-nav { margin-inline: auto; }
.site-nav__list { display: flex; gap: var(--sp-m); }
.site-nav__list a {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.4rem 0.2rem;
}
.site-nav__list a:hover { color: var(--brand-ink); text-decoration: none; }
.site-header__actions { display: flex; align-items: center; gap: var(--sp-2xs); }

/* ---- Kicker / section heads ---------------------------------------------- */
.kicker {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: var(--sp-xs);
}
.section { padding-block: var(--section-pad); }
.section--muted { background: var(--bg-subtle); }
.section__head { max-width: 46rem; margin-bottom: var(--sp-xl); }
.section__title {
  font-size: var(--fs-h2);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
.section__intro {
  margin-top: var(--sp-s);
  font-size: var(--fs-lead);
  color: var(--text-secondary);
}

/* Anchor offset for the sticky header */
:where(section[id], main[id]) { scroll-margin-top: 5rem; }

/* ---- Hero ----------------------------------------------------------------- */
.hero {
  background: var(--hero-glow);
  border-bottom: 1px solid var(--border);
  padding-block: clamp(3rem, 6vw, 5.5rem);
}
.hero__grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: center;
}
.hero__title {
  font-size: var(--fs-hero);
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: var(--sp-m);
}
.hero__lead {
  font-size: var(--fs-lead);
  color: var(--text-secondary);
  max-width: 38rem;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin-top: var(--sp-l);
}
.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2xs);
  margin-top: var(--sp-l);
}
.hero__chips li {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.35rem 0.75rem;
}

/* ---- Hero visualisation --------------------------------------------------- */
.hero__viz { margin: 0; }
.viz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-md);
  padding: var(--sp-m);
}
.viz-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-xs);
}
.viz-card__title { font-weight: 600; color: var(--text); }
.viz-card__tag {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.15rem 0.55rem;
}
.viz-chart { width: 100%; height: auto; }
.viz-card__caption {
  margin-top: var(--sp-xs);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* Chart element styling */
.ch-grid { stroke: var(--chart-grid); stroke-width: 1; }
.ch-axis { stroke: var(--border-strong); stroke-width: 1; }
.ch-actual {
  fill: none;
  stroke: var(--brand-ink);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ch-forecast {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2.5;
  stroke-dasharray: 6 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ch-band { fill: var(--chart-band); stroke: none; }
.ch-divider { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 4; }
.ch-node { fill: var(--accent); }
.ch-label { fill: var(--text-muted); font-size: 11px; font-family: var(--font-sans); }

.legend { display: block; margin-top: var(--sp-2xs); }
.dot {
  display: inline-block;
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  vertical-align: middle;
  margin: 0 0.3rem 0 0.9rem;
}
.legend .dot:first-of-type { margin-left: 0; }
.dot-actual { background: var(--brand-ink); }
.dot-forecast { background: var(--accent-ink); }
.dot-band { background: var(--chart-band); border: 1px solid var(--accent-ink); }

/* ---- Features ------------------------------------------------------------- */
.feature-lead {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-l);
}
.feature-lead__title { font-size: var(--fs-h3); color: var(--text); margin-bottom: var(--sp-xs); }
.feature-lead__copy p { color: var(--text-secondary); }
.feature-lead__aside {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--sp-m);
}
.mini-chart { width: 100%; height: auto; }
.mini-bar { fill: var(--brand-ink); opacity: 0.85; }
.mini-bar--fc { fill: var(--accent); opacity: 0.55; }

.ticks { margin-top: var(--sp-s); display: grid; gap: var(--sp-2xs); }
.ticks li {
  position: relative;
  padding-left: 1.65rem;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}
.ticks li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.28em;
  width: 1.05rem; height: 1.05rem;
  border-radius: 50%;
  background: var(--accent-soft);
  /* checkmark drawn with a rotated box border */
}
.ticks li::after {
  content: "";
  position: absolute;
  left: 0.36rem; top: 0.5em;
  width: 0.3rem; height: 0.55rem;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ticks--tight li { font-size: var(--fs-sm); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--sp-m);
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--sp-l);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.feature-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.feature-card__title { font-size: var(--fs-h3); color: var(--text); margin-bottom: var(--sp-2xs); }
.feature-card p { color: var(--text-secondary); font-size: var(--fs-sm); }

/* ---- How it works --------------------------------------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--sp-m);
  counter-reset: step;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  padding: var(--sp-l);
  box-shadow: var(--shadow-sm);
}
.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem; height: 2.4rem;
  border-radius: 50%;
  background: var(--brand-solid);
  color: var(--on-brand);
  font-weight: 700;
  margin-bottom: var(--sp-s);
}
.step__title { font-size: var(--fs-h3); color: var(--text); margin-bottom: var(--sp-2xs); }
.step p { color: var(--text-secondary); font-size: var(--fs-sm); }

/* ---- Pricing -------------------------------------------------------------- */
.price-panel {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) 2fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-sm);
  padding: clamp(1.5rem, 3vw, 2.5rem);
}
.price-panel__lead {
  border-right: 1px solid var(--border);
  padding-right: clamp(1rem, 3vw, 2rem);
}
.price-panel__amount { margin: 0; }
.price-panel__custom {
  font-size: clamp(2rem, 3vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-ink);
}
.price-panel__unit { color: var(--text-muted); font-size: var(--fs-sm); }
.price-panel__note { color: var(--text-secondary); margin-bottom: var(--sp-s); }
.price-panel__body .btn { margin-top: var(--sp-m); }

/* ---- Security ------------------------------------------------------------- */
.secure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--sp-m);
}
.secure-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-m);
  padding: var(--sp-l);
  box-shadow: var(--shadow-sm);
}
.secure-card__title { font-size: var(--fs-h3); color: var(--text); margin-bottom: var(--sp-2xs); }
.secure-card p { color: var(--text-secondary); font-size: var(--fs-sm); }

/* ---- Footer --------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
  padding-block: var(--section-pad);
}
.signin {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-l);
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-2xl);
}
.signin__title { font-size: var(--fs-h3); color: var(--text); margin-bottom: var(--sp-2xs); }
.signin__copy p { color: var(--text-secondary); max-width: 44rem; }
.signin__copy code {
  white-space: nowrap;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--sp-l);
  padding-bottom: var(--sp-l);
  border-bottom: 1px solid var(--border);
}
.footer-brand__tag {
  margin-top: var(--sp-s);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  max-width: 22rem;
}
.footer-col__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-xs);
}
.footer-col ul { display: grid; gap: var(--sp-2xs); }
.footer-col a { color: var(--text-secondary); font-size: var(--fs-sm); }
.footer-col a:hover { color: var(--brand-ink); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2xs) var(--sp-m);
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-m);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.footer-bottom p { margin: 0; }

/* ---- Responsive ----------------------------------------------------------- */
@media (min-width: 60rem) {
  .hero__grid { grid-template-columns: 1.05fr 0.95fr; }
  .feature-lead { grid-template-columns: 1.3fr 1fr; }
}

@media (max-width: 52rem) {
  .site-nav { display: none; }
  .site-header__inner { justify-content: space-between; }
}

@media (max-width: 34rem) {
  .btn--demo { display: none; }
  .price-panel { grid-template-columns: 1fr; }
  .price-panel__lead {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: var(--sp-m);
  }
  .signin { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 24rem) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---- Motion preferences --------------------------------------------------- */
@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;
  }
  .btn:active { transform: none; }
  .feature-card:hover { transform: none; }
}

/* ---- Forced-colors / high contrast --------------------------------------- */
@media (forced-colors: active) {
  .btn { border: 1px solid ButtonText; }
  .feature-card, .step, .secure-card, .viz-card, .feature-lead,
  .price-panel, .signin { border: 1px solid CanvasText; }
}
