/* ============================================================================
   LUNACORN home page.
   Colours are sampled from design/Lunacorn_Home_Light.pdf and _Dark.pdf rather
   than invented. Three theme states are supported, which is what "OS
   preference on first visit + instant toggle" actually requires:
     :root                        -> the light palette (the default)
     prefers-color-scheme: dark   -> dark, unless the user picked light
     [data-theme="dark"|"light"]  -> an explicit choice always wins
   Only token VALUES are redefined per theme; every component reads tokens, so
   no colour is ever declared inside a media query.
   ========================================================================== */
:root {
  --bg:          #fbfcfe;
  --bg-alt:      #f6f7fb;
  --header:      #ffffff;
  --card:        #ffffff;
  --border:      #e6e9ef;
  --border-soft: #eef1f6;
  --text:        #0b1220;
  --text-2:      #3c404c;
  --muted:       #6b7280;
  --brand:       #256cf6;
  --brand-2:     #1b5de5;
  --brand-ink:   #1d4ed8;
  --badge-bg:    #e4edfc;
  --badge-ink:   #163f8f;
  --up:          #16a34a;
  --down:        #dc2626;
  --shadow-sm:   0 1px 2px rgba(11, 18, 32, .05);
  --shadow:      0 10px 34px -14px rgba(11, 18, 32, .22);
  --shadow-lg:   0 30px 70px -30px rgba(11, 18, 32, .35);
  /* the product preview keeps dark chrome in BOTH themes, as the designs show */
  --side:        #04183c;
  --side-ink:    #c7d4ea;
  --side-active: #1d4ed8;
}
@media (prefers-color-scheme: dark) {
  /* :not(sepia) too — Comfort renders home as light (no sepia palette here) */
  :root:not([data-theme="light"]):not([data-theme="sepia"]) {
    --bg:          #000815;
    --bg-alt:      #010a1a;
    --header:      #010510;
    --card:        #0d1725;
    --border:      #16263c;
    --border-soft: #0f1c2e;
    --text:        #ffffff;
    --text-2:      #bac2cf;
    --muted:       #8892a3;
    --brand:       #1c64ee;
    --brand-2:     #2f74e8;
    --brand-ink:   #6595e9;
    --badge-bg:    rgba(31, 60, 118, .45);
    --badge-ink:   #82aaf2;
    --up:          #5ec98a;
    --down:        #e26d75;
    --shadow-sm:   0 1px 2px rgba(0, 0, 0, .5);
    --shadow:      0 10px 34px -14px rgba(0, 0, 0, .7);
    --shadow-lg:   0 30px 70px -30px rgba(0, 0, 0, .9);
    --side:        #010b17;
    --side-ink:    #9fb0c8;
    --side-active: #14306a;
  }
}
:root[data-theme="dark"] {
  --bg:          #000815;
  --bg-alt:      #010a1a;
  --header:      #010510;
  --card:        #0d1725;
  --border:      #16263c;
  --border-soft: #0f1c2e;
  --text:        #ffffff;
  --text-2:      #bac2cf;
  --muted:       #8892a3;
  --brand:       #1c64ee;
  --brand-2:     #2f74e8;
  --brand-ink:   #6595e9;
  --badge-bg:    rgba(31, 60, 118, .45);
  --badge-ink:   #82aaf2;
  --up:          #5ec98a;
  --down:        #e26d75;
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, .5);
  --shadow:      0 10px 34px -14px rgba(0, 0, 0, .7);
  --shadow-lg:   0 30px 70px -30px rgba(0, 0, 0, .9);
  --side:        #010b17;
  --side-ink:    #9fb0c8;
  --side-active: #14306a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:where(a, button, input):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}
.wrap { width: min(1400px, 100% - 56px); margin-inline: auto; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- header ---------- */
/* The master logo carries its own opaque navy, so the header takes that same
   navy in BOTH themes — a light header would frame the asset in a visible dark
   rectangle. Everything inside it is therefore coloured for a dark ground
   rather than inheriting the page tokens. */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand-ground);
  border-bottom: 1px solid rgba(113, 147, 226, .22);
}
.site-header .site-nav a { color: #c3cbe0; }
.site-header .site-nav a:hover { color: var(--lunacorn-blue-light); }
.site-header .link-signin { color: #eef2fb; }
.site-header .link-signin:hover { color: var(--lunacorn-blue-light); }
.site-nav .nav-auth-link { display: none; }
.site-header .theme-toggle,
.site-header .nav-toggle {
  color: #c3cbe0; border-color: rgba(113, 147, 226, .30);
}
.site-header .theme-toggle:hover,
.site-header .nav-toggle:hover {
  color: var(--lunacorn-blue-light); border-color: var(--lunacorn-blue);
}
.site-header .wrap {
  display: flex; align-items: center; gap: 30px;
  min-height: 78px; position: relative;
}
.brand { flex: 0 1 auto; min-width: 0; }
/* The lockup itself is the BrandLogo component in brand.css — the sizing
   lives there so no page can drift from it. */
.site-nav { display: flex; align-items: center; gap: 34px; margin-inline: auto; }
.site-nav a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15.5px; color: var(--text-2); font-weight: 500;
}
.site-nav a:hover { color: var(--brand-ink); }
.site-nav .caret { width: 10px; height: 10px; opacity: .6; }
.header-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.link-signin { font-size: 15.5px; font-weight: 600; color: var(--text); padding: 8px 6px; }
.link-signin:hover { color: var(--brand-ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: inherit; font-weight: 700; cursor: pointer;
  border-radius: 10px; border: 1px solid transparent;
  padding: 12px 22px; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: transparent; color: var(--brand-ink); border-color: var(--brand); }
.btn-ghost:hover { background: var(--badge-bg); }
.btn-lg { padding: 15px 28px; font-size: 16.5px; border-radius: 11px; }
.btn:active { transform: translateY(1px); }

/* language toggle: styled like the theme button, labelled in the language it
   switches TO, so the person who needs it can read it */
.lang-chip {
  height: 40px; flex: none; padding: 0 14px;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px;
}
.lang-chip:hover { color: var(--brand-ink); border-color: var(--brand); }

/* theme toggle: one button, the icon swaps with the resolved theme */
.theme-toggle {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--text-2);
  border: 1px solid var(--border); border-radius: 10px;
}
.theme-toggle:hover { color: var(--brand-ink); border-color: var(--brand); }
.theme-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
.icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="sepia"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]):not([data-theme="sepia"]) .icon-sun  { display: block; }
}
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun  { display: block; }
:root[data-theme="light"] .icon-sun,
:root[data-theme="sepia"] .icon-sun  { display: none; }
:root[data-theme="light"] .icon-moon,
:root[data-theme="sepia"] .icon-moon { display: block; }

.nav-toggle { display: none; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(900px 420px at 78% 8%, var(--badge-bg) 0%, transparent 68%),
    var(--bg);
}
.hero .wrap {
  display: grid; grid-template-columns: minmax(0, 44fr) minmax(0, 56fr);
  gap: 46px; align-items: center;
  padding: 54px 0 0;
}
.hero-copy { padding-bottom: 58px; }
.badge {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--badge-bg); color: var(--badge-ink);
  border: 1px solid var(--brand);
  border-radius: 999px; padding: 8px 17px;
  font-size: 12.5px; font-weight: 700; letter-spacing: .9px; text-transform: uppercase;
}
.badge svg { width: 14px; height: 14px; }
h1.hero-title {
  margin: 26px 0 0;
  font-size: clamp(38px, 4.2vw, 63px);
  line-height: 1.06; font-weight: 800; letter-spacing: -1.6px;
  text-wrap: balance;
}
h1.hero-title .line2 { color: var(--brand-ink); display: block; }
.hero-lede {
  margin: 22px 0 0; max-width: 34em;
  font-size: 17.5px; color: var(--text-2);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 32px; }
.trust {
  display: flex; flex-wrap: wrap; gap: 12px 30px; margin-top: 42px;
  font-size: 14.5px; color: var(--text-2);
}
.trust span { display: inline-flex; align-items: center; gap: 9px; }
.trust svg { width: 17px; height: 17px; color: var(--brand-ink); }

/* ---------- product preview: real markup, not a screenshot ---------- */
.preview {
  align-self: end;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  min-width: 0;
}
.pv-top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft);
}
.pv-brand { display: flex; align-items: center; gap: 8px; }
.pv-brand img { width: 26px; }
.pv-brand b { font-size: 13px; letter-spacing: 2.4px; font-weight: 800; }
.pv-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 11px; min-width: 230px; color: var(--muted); font-size: 11.5px;
}
.pv-search svg { width: 12px; height: 12px; }
.pv-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
}
.pv-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); }
.pv-side { background: var(--side); padding: 12px 10px; }
.pv-side a {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 7px;
  font-size: 12px; color: var(--side-ink);
}
.pv-side a.on { background: var(--side-active); color: #fff; font-weight: 600; }
.pv-side svg { width: 13px; height: 13px; opacity: .85; }
.pv-main { padding: 15px 16px; min-width: 0; }
.pv-head { display: flex; align-items: flex-start; gap: 12px; }
.pv-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.pv-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
.pv-ranges { margin-left: auto; display: flex; gap: 3px; }
.pv-ranges span {
  font-size: 10px; padding: 3px 7px; border-radius: 5px; color: var(--muted);
}
.pv-ranges span.on { background: var(--badge-bg); color: var(--badge-ink); font-weight: 700; }
.pv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.stat {
  border: 1px solid var(--border); border-radius: 9px; padding: 9px 10px;
  min-width: 0;
}
.stat .k { font-size: 9.5px; letter-spacing: .7px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.stat .v { font-size: 15px; font-weight: 700; margin-top: 3px; }
.stat .row { display: flex; align-items: flex-end; gap: 6px; }
.stat .d { font-size: 10px; font-weight: 600; }
.stat svg { margin-left: auto; flex: none; }
.pv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 9px; margin-top: 9px; }
.pv-chart {
  border: 1px solid var(--border); border-radius: 9px; overflow: hidden;
  display: flex; flex-direction: column;
}
.pv-chart-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-bottom: 1px solid var(--border-soft);
  font-size: 10px; color: var(--muted);
}
.pv-ohlc { padding: 7px 10px 0; font-size: 10px; color: var(--muted); }
.pv-ohlc b { font-weight: 700; color: var(--text); }
/* direct child only: the toolbar icon is also an svg inside .pv-chart and
   must not be stretched to full width */
.pv-chart > svg { display: block; width: 100%; flex: 1 1 auto; min-height: 150px; }
.pv-aside { display: grid; gap: 9px; align-content: start; min-width: 0; }
.panel { border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px; }
.panel h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; }
.wl { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.wl th { color: var(--muted); font-weight: 600; text-align: right; padding-bottom: 4px; }
.wl th:first-child, .wl td:first-child { text-align: left; }
.wl td { padding: 3px 0; text-align: right; }
.wl td:first-child { font-weight: 700; }
.wl-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 10.5px; color: var(--brand-ink); font-weight: 600; }
.gauge { display: grid; place-items: center; }
.gauge svg { width: 100%; max-width: 168px; height: auto; }

/* ---------- feature cards ---------- */
.features { padding: 46px 0; background: var(--bg); }
.features .wrap {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px;
}
.f-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 13px; padding: 24px 24px 20px;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px;
  align-content: start; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.f-card:hover { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.f-icon {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--badge-bg); color: var(--brand-ink);
  display: grid; place-items: center;
}
.f-icon svg { width: 23px; height: 23px; }
.f-card h3 { margin: 2px 0 8px; font-size: 17.5px; font-weight: 700; }
.f-card p { margin: 0; font-size: 14.5px; color: var(--text-2); }
.f-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 14px; font-weight: 600; color: var(--brand-ink);
}
.f-link svg { width: 15px; height: 15px; transition: transform .15s; }
.f-card:hover .f-link svg { transform: translateX(3px); }

/* ---------- market snapshot ---------- */
.snapshot { padding: 34px 0 56px; background: var(--bg-alt); border-top: 1px solid var(--border); }
.snap-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.snap-head h2 { margin: 0; font-size: 19px; font-weight: 700; }
.snap-head p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.snap-more {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--brand-ink);
}
.snap-more svg { width: 15px; height: 15px; }
.snap-grid {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 14px; margin-top: 18px;
}
.snap-tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 11px; padding: 13px 14px 10px; min-width: 0;
  box-shadow: var(--shadow-sm);
}
.snap-tile .top { display: flex; align-items: baseline; gap: 8px; }
.snap-tile .name {
  font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.snap-tile .chg { margin-left: auto; font-size: 12px; font-weight: 700; white-space: nowrap; }
.snap-tile .val { font-size: 16px; font-weight: 700; margin-top: 2px; }
.snap-tile svg { margin-top: 8px; display: block; width: 100%; height: auto; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- footer ---------- */
.site-footer {
  padding: 26px 0; background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 13.5px; color: var(--muted);
}
.site-footer .wrap { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.site-footer a:hover { color: var(--brand-ink); }
.site-footer .spacer { margin-left: auto; }

/* ---------- Hebrew (RTL) ----------
   dir=rtl on <html> flips the flex/grid flow for free; what is left is the
   handful of physical properties, plus two decisions: the product preview is
   a product shot and keeps its own LTR inside, and "forward" arrows point
   into the reading direction. */
[dir="rtl"] .preview { direction: ltr; }
[dir="rtl"] .snap-more,
[dir="rtl"] .snap-tile .chg,
[dir="rtl"] .site-footer .spacer { margin-left: 0; margin-right: auto; }
[dir="rtl"] .hero-cta .btn svg,
[dir="rtl"] .snap-more svg,
[dir="rtl"] .f-link svg { transform: scaleX(-1); }
[dir="rtl"] .f-card:hover .f-link svg { transform: scaleX(-1) translateX(3px); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .features .wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .snap-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .wrap { width: min(1400px, 100% - 36px); }
  .hero .wrap { grid-template-columns: minmax(0, 1fr); padding-top: 40px; }
  .hero-copy { padding-bottom: 8px; }
  .preview { border-radius: 14px; margin-bottom: 40px; }
  .pv-grid { grid-template-columns: minmax(0, 1fr); }
  .pv-side { display: none; }
  .pv-body { grid-template-columns: minmax(0, 1fr); }
  .pv-search { display: none; }
  .site-nav {
    display: none; position: absolute; top: 78px; left: 0; right: 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--lunacorn-bg); border-bottom: 1px solid rgba(113, 147, 226, .22);
    padding: 8px 18px 16px; z-index: 60;
  }
  .site-nav.open { display: flex; }
  .site-nav .nav-auth-link { display: flex; }
  .site-nav a { padding: 11px 0; width: 100%; }
  .nav-toggle {
    display: grid; place-items: center; width: 40px; height: 40px;
    background: transparent; border: 1px solid var(--border); border-radius: 10px;
    color: var(--text-2); cursor: pointer;
  }
  .nav-toggle svg { width: 18px; height: 18px; }
}
@media (max-width: 720px) {
  /* drawer rows are real touch targets (the icon buttons keep the sizes the
     560px block below measured — a 44px floor there pushes the header wide) */
  .site-nav a { min-height: 44px; display: flex; align-items: center; }
  .features .wrap { grid-template-columns: minmax(0, 1fr); }
  .snap-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Keep returning users one tap from login, including when signup is open. */
  .site-header .link-signin {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 9px 13px; border-radius: 10px;
    background: var(--brand); color: #fff; font-size: 13.5px;
    white-space: nowrap;
  }
  .site-header .link-signin:hover { color: #fff; background: var(--brand-2); }
  .header-signup { display: none; }
  .pv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-cta .btn { flex: 1 1 100%; }
  .site-header .wrap { gap: 12px; }
  .header-actions { gap: 8px; }
  .btn-primary { padding: 10px 15px; font-size: 14px; }
}

/* Below this the header runs out of room: the wordmark, the CTA, the theme
   toggle and the menu button cannot all keep full size without pushing the
   page sideways. Measured at 390px, not guessed. */
@media (max-width: 560px) {
  .btn-primary { padding: 9px 13px; font-size: 13.5px; }
  .theme-toggle, .nav-toggle { width: 36px; height: 36px; }
  .site-nav { top: 66px; }
  .site-header .wrap { min-height: 66px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
