/* The landing page, /welcome (backend/routers/landing.py, issue #89), in the
   Lumen look (docs/design/lumen.md). It follows the device's light or dark
   setting, or the theme picked with the header switch (shared with the
   app: localStorage circuitlens-theme). The header and hero follow it too (light page, the dark video in
   its frame); only the closing band stays dark, because it is a photo.

   The colour values are the app's Lumen tokens (frontend/styles.css), copied
   because this page does not load the app's stylesheet: keep both in step.
   Every text pair is one measured in lumen.md. Logical properties only, so
   the Arabic page mirrors on its own. */
:root {
  color-scheme: light;
  --color-bg: #f6f6fb;
  --color-surface: #ffffff;
  --color-fill: #f0eff6;
  --color-text: #16142a;
  --color-text-dim: #3d3956;
  --color-text-muted: #625e7a;
  /* Controls' own edge: 3:1 against every ground (SC 1.4.11). */
  --color-border: #8d84b7;
  --color-divider: #e4e2ee;
  --color-accent: #6a4be0;
  --color-accent-hover: #5a3dd0;
  --color-accent-text: #ffffff;
  /* The dark bands, the same in both themes. */
  --band-bg: #0b0a15;
  --band-glow: #b79cff;
  --band-glow-text: #0b0b0b;
  --band-text: #ffffff;
  --band-dim: rgba(255, 255, 255, 0.78);
  --band-muted: rgba(255, 255, 255, 0.66);
  --band-glass: rgba(255, 255, 255, 0.1);
  --band-glass-line: rgba(255, 255, 255, 0.34);
  /* Header and hero: the page in light, the dark band in dark. */
  --hero-bg: var(--color-bg);
  --hero-glow: rgba(106, 75, 224, 0.16);
  --hero-text: var(--color-text);
  --hero-dim: var(--color-text-dim);
  --hero-muted: var(--color-text-muted);
  --hero-focus: var(--color-accent);
  --hero-btn: var(--color-accent);
  --hero-btn-text: var(--color-accent-text);
  --hero-glass: var(--color-fill);
  --hero-glass-text: var(--color-text);
  --hero-glass-line: var(--color-border);
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-button: 14px;
  --shadow-plan: 0 1px 0 rgba(22, 20, 42, 0.04);
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --track-display: -0.03em;
  --track-heading: -0.02em;
  --gutter: clamp(16px, 5vw, 64px);
  --target-min: 44px;
  --theme-moon: block;
  --theme-sun: none;
}

/* Dark: the device setting, unless the visitor picked light with the header
   switch; or the switch itself. The two blocks carry the same values. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #0e0c1a;
    --color-surface: #16132a;
    --color-fill: #1d1a34;
    --color-text: #f1eeff;
    --color-text-dim: #cdc6ef;
    --color-text-muted: #a59fc6;
    --color-border: #665eae;
    --color-divider: #29254a;
    --color-accent: #b79cff;
    --color-accent-hover: #cdb9ff;
    --color-accent-text: #16142a;
    --shadow-plan: none;
    --hero-bg: var(--band-bg);
    --hero-glow: rgba(124, 92, 255, 0.32);
    --hero-text: var(--band-text);
    --hero-dim: var(--band-dim);
    --hero-muted: var(--band-muted);
    --hero-focus: var(--band-glow);
    --hero-btn: var(--band-glow);
    --hero-btn-text: var(--band-glow-text);
    --hero-glass: var(--band-glass);
    --hero-glass-text: var(--band-text);
    --hero-glass-line: var(--band-glass-line);
    --theme-moon: none;
    --theme-sun: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #0e0c1a;
  --color-surface: #16132a;
  --color-fill: #1d1a34;
  --color-text: #f1eeff;
  --color-text-dim: #cdc6ef;
  --color-text-muted: #a59fc6;
  --color-border: #665eae;
  --color-divider: #29254a;
  --color-accent: #b79cff;
  --color-accent-hover: #cdb9ff;
  --color-accent-text: #16142a;
  --shadow-plan: none;
  --hero-bg: var(--band-bg);
  --hero-glow: rgba(124, 92, 255, 0.32);
  --hero-text: var(--band-text);
  --hero-dim: var(--band-dim);
  --hero-muted: var(--band-muted);
  --hero-focus: var(--band-glow);
  --hero-btn: var(--band-glow);
  --hero-btn-text: var(--band-glow-text);
  --hero-glass: var(--band-glass);
  --hero-glass-text: var(--band-text);
  --hero-glass-line: var(--band-glass-line);
  --theme-moon: none;
  --theme-sun: block;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: 16px/1.55 var(--font-sans);
  -webkit-text-size-adjust: 100%;
}
img, video, svg { display: block; max-width: 100%; }
a { color: var(--color-accent-hover); }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-weight: 600; letter-spacing: var(--track-heading); }
/* Arabic letters join and Devanagari hangs from its line: negative tracking
   breaks both (lumen.md). */
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) .lp-price, :lang(ar) .lp-logo, :lang(ar) .lp-tool b,
:lang(hi) h1, :lang(hi) h2, :lang(hi) h3, :lang(hi) .lp-price, :lang(hi) .lp-logo, :lang(hi) .lp-tool b {
  letter-spacing: normal;
}

.lp-in { max-width: 1240px; margin-inline: auto; padding-inline: var(--gutter); }

.lp-skip {
  position: absolute; inset-inline-start: 12px; top: -100px; z-index: 10;
  padding: 12px 16px; border-radius: var(--radius-button);
  background: var(--band-glow); color: var(--band-glow-text); font-weight: 600;
}
.lp-skip:focus { top: 12px; }

/* ---------- buttons ---------- */
.lp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--target-min); padding: 12px 20px;
  border: 1px solid transparent; border-radius: var(--radius-button);
  font: 600 17px/1.15 var(--font-sans); letter-spacing: -0.005em; text-align: center;
  text-decoration: none;
}
.lp-btn:hover { filter: brightness(1.07); }
.lp-btn-sm { font-size: 15px; padding: 10px 16px; }
.lp-btn-pri { background: var(--color-accent); color: var(--color-accent-text); }
.lp-btn-sec { background: var(--color-fill); color: var(--color-text); border-color: var(--color-border); }
.lp-btn-glow { background: var(--band-glow); color: var(--band-glow-text); }
.lp-btn-glass { background: var(--band-glass); color: var(--band-text); border-color: var(--band-glass-line); }

/* ---------- header and hero follow the theme; the closing band is dark ---------- */
.lp-head, .lp-hero { background: var(--hero-bg); color: var(--hero-text); }
.lp-head :focus-visible, .lp-hero :focus-visible { outline-color: var(--hero-focus); }
.lp-head .lp-btn-glow, .lp-hero .lp-btn-glow { background: var(--hero-btn); color: var(--hero-btn-text); }
.lp-head .lp-btn-glass, .lp-hero .lp-btn-glass { background: var(--hero-glass); color: var(--hero-glass-text); border-color: var(--hero-glass-line); }
.lp-end { background: var(--band-bg); color: var(--band-text); }
.lp-end :focus-visible { outline-color: var(--band-glow); }
.lp-top { display: flex; align-items: center; gap: 22px; padding-block: 14px; }
.lp-logo {
  display: flex; align-items: center; gap: 10px; margin-inline-end: auto; min-height: var(--target-min);
  color: var(--hero-text); text-decoration: none;
  font-size: 19px; font-weight: 600; letter-spacing: var(--track-display);
}
.lp-logo svg { width: auto; height: 26px; display: block; }
.lp-logo-frame { fill: var(--color-accent); }
.lp-links { display: flex; gap: 6px; }
.lp-links a {
  display: inline-flex; align-items: center; min-height: var(--target-min); padding-inline: 10px;
  color: var(--hero-dim); text-decoration: none; font-size: 15px;
}
.lp-links a:hover { color: var(--hero-text); }
.lp-theme {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  inline-size: var(--target-min); block-size: var(--target-min); padding: 0;
  border: 1px solid var(--hero-glass-line); border-radius: 99px;
  background: var(--hero-glass); color: var(--hero-glass-text); cursor: pointer;
}
.lp-theme:hover { filter: brightness(1.07); }
.lp-theme[hidden] { display: none; }
.lp-theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.lp-theme-moon { display: var(--theme-moon); }
.lp-theme-sun { display: var(--theme-sun); }

/* The promise first, then the scan video as the proof; text never over it. */
.lp-hero {
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse 70% 55% at 50% 78%, var(--hero-glow), transparent 70%), var(--hero-bg);
}
.lp-hero-copy { text-align: center; max-width: 920px; padding-block: clamp(36px, 7vw, 88px) clamp(28px, 4vw, 48px); }
.lp-hero h1 {
  font-size: clamp(34px, 5.4vw, 66px); line-height: 1.04; letter-spacing: var(--track-display);
  margin: 0 0 18px; text-wrap: balance;
}
.lp-hero-copy > p { font-size: clamp(17px, 1.6vw, 20px); line-height: 1.5; color: var(--hero-dim); margin: 0 auto 26px; max-width: 50ch; }
.lp-row { display: flex; flex-wrap: wrap; gap: 12px; }
.lp-hero .lp-row { justify-content: center; }
.lp-hero-copy > .lp-offer { margin: 16px auto 0; max-width: 64ch; font-size: 14px; color: var(--hero-muted); }
.lp-stage { padding-bottom: clamp(36px, 6vw, 80px); }
.lp-screen {
  position: relative; max-width: 1100px; margin-inline: auto; aspect-ratio: 16 / 9;
  border-radius: 18px; overflow: hidden; background: #141318;
  border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 50px 120px -40px rgba(124, 92, 255, 0.55);
}
.lp-poster, .lp-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lp-pause {
  position: absolute; z-index: 1; inset-inline-end: 12px; bottom: 12px;
  min-height: var(--target-min); padding: 10px 16px; border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.6); color: var(--band-text);
  font: 500 14px/1 var(--font-sans); cursor: pointer;
}
.lp-pause[hidden] { display: none; }

/* ---------- sections ---------- */
.lp-sec { padding-block: clamp(56px, 8vw, 104px); }
.lp-sec.lp-flush { padding-top: 0; }
.lp-sec h2 {
  font-size: clamp(28px, 3.6vw, 44px); line-height: 1.08; letter-spacing: var(--track-display);
  margin: 0 0 12px; max-width: 22ch; text-wrap: balance;
}
.lp-lede { color: var(--color-text-muted); font-size: 18px; max-width: 58ch; margin: 0 0 40px; }
.lp-lede.lp-lede-last { margin-bottom: 0; }

.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; counter-reset: step; }
.lp-step { display: grid; gap: 14px; align-content: start; min-width: 0; }
.lp-step figure { margin: 0; aspect-ratio: 4 / 3; border-radius: var(--radius-lg); overflow: hidden; background: var(--band-bg); }
.lp-step figure img { width: 100%; height: 100%; object-fit: cover; }
.lp-step h3 { font-size: 22px; margin: 0; display: flex; gap: 10px; align-items: baseline; letter-spacing: var(--track-display); }
.lp-step h3::before { counter-increment: step; content: counter(step); font: 600 14px/1 var(--font-mono); color: var(--color-accent-hover); }
.lp-step p { margin: 0; color: var(--color-text-muted); font-size: 16.5px; }

/* Step 3: a schematic that draws itself, then the LED lights. */
.lp-sch {
  width: 100%; height: 100%; background-color: var(--band-bg);
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
}
.lp-sch .w { fill: none; stroke: rgba(244, 246, 239, 0.86); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: sch-draw 9s calc(var(--i) * 0.14s) infinite both; }
.lp-sch .chip { fill: rgba(255, 255, 255, 0.03); }
.lp-sch .dot { fill: rgba(244, 246, 239, 0.86); opacity: 0; animation: sch-fade 9s calc(1.4s + var(--i) * 0.05s) infinite both; }
.lp-sch text { font: 500 9px var(--font-mono); fill: rgba(244, 246, 239, 0.62); opacity: 0; animation: sch-fade 9s calc(1.6s + var(--i) * 0.06s) infinite both; }
.lp-sch text.pin { font-size: 7.5px; fill: rgba(244, 246, 239, 0.45); }
.lp-sch text.ref { fill: var(--band-glow); font-weight: 600; }
.lp-sch text.big { font-size: 11px; font-weight: 600; fill: #f4f6ef; }
.lp-sch .led { fill: var(--band-glow); opacity: 0; animation: sch-led 9s infinite both; }
.lp-sch .glow { fill: var(--band-glow); opacity: 0; filter: blur(8px); animation: sch-led 9s infinite both; }
.lp-sch .flow { fill: none; stroke: var(--band-glow); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 0.08 1; stroke-dashoffset: 0.08; opacity: 0; animation: sch-flow 9s infinite both; }
@keyframes sch-draw { 0% { stroke-dashoffset: 1; opacity: 1; } 14% { stroke-dashoffset: 0; } 82% { stroke-dashoffset: 0; opacity: 1; } 92%, 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes sch-fade { 0% { opacity: 0; } 8%, 70% { opacity: 1; } 80%, 100% { opacity: 0; } }
@keyframes sch-led { 0%, 46% { opacity: 0; } 52%, 76% { opacity: 0.9; } 84%, 100% { opacity: 0; } }
@keyframes sch-flow { 0%, 34% { opacity: 0; stroke-dashoffset: 0.08; } 36% { opacity: 1; } 50% { stroke-dashoffset: -1; opacity: 1; } 51%, 100% { opacity: 0; stroke-dashoffset: -1; } }
@media (prefers-reduced-motion: reduce) {
  .lp-sch .w, .lp-sch .dot, .lp-sch text { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .lp-sch .led { animation: none; opacity: 0.9; }
  .lp-sch .glow { animation: none; opacity: 0.6; }
  .lp-sch .flow { animation: none; opacity: 0; }
}

.lp-who { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.lp-who article {
  position: relative; display: grid; align-items: end; min-height: 440px;
  border-radius: var(--radius-lg); overflow: hidden; background: #050806; color: #ffffff;
}
.lp-who img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lp-who article::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(0, 0, 0, 0.86) 0%, rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0) 70%); }
.lp-who div { position: relative; z-index: 1; padding: 26px; }
.lp-who h3 { font-size: 26px; line-height: 1.15; margin: 0 0 8px; letter-spacing: var(--track-display); }
.lp-who p { margin: 0; color: rgba(255, 255, 255, 0.86); max-width: 42ch; }

.lp-tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 40px; align-items: start; }
.lp-tlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--color-divider); }
.lp-tlist li { border-bottom: 1px solid var(--color-divider); }
.lp-tool { display: grid; gap: 4px; min-height: var(--target-min); padding-block: 18px; padding-inline-end: 18px; color: inherit; text-decoration: none; }
.lp-tool b { font-size: 22px; font-weight: 600; letter-spacing: var(--track-display); font-variant-numeric: tabular-nums; color: var(--color-text); }
.lp-tool span { color: var(--color-text-muted); font-size: 15px; }
.lp-tool:hover b { color: var(--color-accent-hover); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

.lp-prices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.lp-plan {
  display: flex; flex-direction: column; gap: 10px; padding: 22px;
  border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-plan);
}
.lp-plan-hl { border-color: var(--color-accent); box-shadow: 0 0 0 1px var(--color-accent); }
.lp-plan h3 { margin: 0; font-size: 17px; letter-spacing: normal; }
.lp-price { margin: 0; font-size: 34px; font-weight: 600; line-height: 1; letter-spacing: var(--track-display); font-variant-numeric: tabular-nums; }
.lp-price small { font-size: 15px; font-weight: 400; color: var(--color-text-muted); letter-spacing: 0; }
.lp-plan p:not(.lp-price) { margin: 0 0 6px; color: var(--color-text-muted); font-size: 15px; }
.lp-plan .lp-btn { margin-top: auto; }
.lp-fine { color: var(--color-text-muted); font-size: 14px; margin: 18px 0 0; max-width: 72ch; }

.lp-end { position: relative; overflow: hidden; }
.lp-end > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 75% 50%; }
.lp-end::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11, 10, 21, 0.95) 0%, rgba(11, 10, 21, 0.72) 42%, rgba(11, 10, 21, 0.15) 100%); }
/* Right to left the text starts on the right: the board and the shade swap sides. */
[dir="rtl"] .lp-end > img { transform: scaleX(-1); }
[dir="rtl"] .lp-end::after { background: linear-gradient(270deg, rgba(11, 10, 21, 0.95) 0%, rgba(11, 10, 21, 0.72) 42%, rgba(11, 10, 21, 0.15) 100%); }
.lp-end .lp-in { position: relative; z-index: 1; display: grid; justify-items: start; gap: 16px; padding-block: clamp(70px, 10vw, 130px); }
.lp-end h2 { font-size: clamp(30px, 4.4vw, 54px); line-height: 1.04; letter-spacing: var(--track-display); margin: 0; max-width: 18ch; }
.lp-end p { margin: 0; color: var(--band-dim); font-size: 18px; max-width: 46ch; }
.lp-end .lp-row { margin-top: 6px; }

.lp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; padding-block: 18px; border-top: 1px solid var(--color-divider); color: var(--color-text-muted); font-size: 14px; }
.lp-foot-brand { margin-inline-end: auto; }
.lp-foot a { display: inline-flex; align-items: center; justify-content: center; min-height: var(--target-min); min-width: var(--target-min); color: var(--color-text-muted); }
.lp-foot a:hover { color: var(--color-text); }
.lp-langs { display: flex; flex-wrap: wrap; gap: 0 14px; width: 100%; }
.lp-langs a[aria-current="page"] { color: var(--color-text); font-weight: 600; text-decoration: none; }

@media (max-width: 1000px) {
  .lp-prices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .lp-links { display: none; }
  .lp-steps, .lp-who, .lp-tools, .lp-tlist { grid-template-columns: minmax(0, 1fr); }
  .lp-tools { gap: 24px; }
  .lp-screen { border-radius: 12px; }
  .lp-who article { min-height: 380px; }
  .lp-end::after, [dir="rtl"] .lp-end::after { background: rgba(11, 10, 21, 0.8); }
  .lp-foot-brand { flex-basis: 100%; padding-block: 8px 4px; }
}
@media (max-width: 460px) {
  .lp-prices { grid-template-columns: minmax(0, 1fr); }
  .lp-top .lp-btn { display: none; }
  .lp-hero .lp-row .lp-btn { flex: 1 1 100%; }
}
