/* =====================================================================
   CANDLE TRADE  -  main stylesheet
   ---------------------------------------------------------------------
   HOW TO CHANGE THE LOOK
   * Colours live in the ":root" blocks just below (light + dark).
     Change a value there and the whole site updates.
   * Dark/light is switched by the attribute data-theme="dark|light" on
     the <html> tag (see js/theme.js).
   * Fonts: headings use "Bricolage Grotesque", body uses "Hanken Grotesk".
     Indian-language fonts are loaded on demand by js/i18n.js.
   ===================================================================== */

/* ---------- 1. COLOUR TOKENS ---------- */
:root {
  /* LIGHT theme (default if the visitor's device prefers light) */
  --bg:        #F6F7FB;   /* page background            */
  --surface:   #FFFFFF;   /* cards, panels              */
  --surface-2: #EEF0F8;   /* inputs, table headers      */
  --line:      #DDE1EE;   /* borders, dividers          */
  --text:      #141834;   /* main text                  */
  --muted:     #5B6385;   /* secondary text             */
  --flame:     #E58A00;   /* brand accent (candle flame)*/
  --flame-2:   #D9531E;   /* accent, deeper             */
  --up:        #0E9F7A;   /* rising price               */
  --down:      #D6334F;   /* falling price              */
  --link:      #3D4FD1;
  --shadow:    0 1px 2px rgba(20,24,52,.06), 0 8px 24px rgba(20,24,52,.06);
  --radius:    14px;
  --radius-sm: 8px;
  color-scheme: light;
}
/* DARK theme: used when data-theme="dark", or automatically when the
   visitor's device prefers dark and they have not chosen manually. */
:root[data-theme="dark"] {
  --bg:        #0D1020;
  --surface:   #151A30;
  --surface-2: #1D2340;
  --line:      #2A3157;
  --text:      #EEF0FA;
  --muted:     #9AA3C7;
  --flame:     #FFB224;
  --flame-2:   #FF7A2F;
  --up:        #2DD4A7;
  --down:      #FF5C7A;
  --link:      #8FA2FF;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0D1020; --surface:#151A30; --surface-2:#1D2340; --line:#2A3157;
    --text:#EEF0FA; --muted:#9AA3C7; --flame:#FFB224; --flame-2:#FF7A2F;
    --up:#2DD4A7; --down:#FF5C7A; --link:#8FA2FF;
    --shadow:0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hanken Grotesk", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;   /* numbers line up in tables */
}
h1, h2, h3, h4 {
  font-family: "Bricolage Grotesque", "Hanken Grotesk", "Noto Sans", sans-serif;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2.2rem, 5.2vw, 4rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); font-weight: 650; }
h3 { font-size: 1.15rem; font-weight: 650; }
p  { margin: 0 0 1em; max-width: 68ch; }
a  { color: var(--link); }
img, svg, canvas { max-width: 100%; display: block; }
.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
:focus-visible { outline: 3px solid var(--flame); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 3. BUTTONS ---------- */
.btn {
  white-space: nowrap; flex-shrink: 0;      /* never wrap button text onto several lines */
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .8em 1.3em; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 650; cursor: pointer; text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--flame), var(--flame-2));
  color: #1b1200; box-shadow: 0 6px 18px rgba(229,138,0,.28);
}
.btn-primary:hover { box-shadow: 0 8px 24px rgba(229,138,0,.4); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 0 1.1em; font-size: .92rem; height: 40px; }   /* same height as the language box and theme button */

/* ---------- 4. HEADER ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-family: "Bricolage Grotesque", sans-serif; font-weight: 700; font-size: 1.25rem; letter-spacing: -.02em; }
.brand svg { width: 28px; height: 34px; }
.nav { display: flex; gap: 6px; margin-left: 12px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 550; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.select, .icon-btn {
  background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; font: inherit; padding: 0 .7em; cursor: pointer; height: 40px;
}
.header-tools .select { max-width: 120px; }
.icon-btn { width: 40px; display: grid; place-items: center; padding: 0; }
.nav-toggle { display: none; }
.nav-cta { display: none; }               /* login / trial links inside the phone menu */
/* Menu collapses into the ☰ button on tablets and phones */
@media (max-width: 1180px) {
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 16px 14px; margin: 0; gap: 2px; }
  .nav.open { display: flex; }
  .nav-toggle { display: grid; }
}
/* On small phones the two buttons move into the menu so the header stays tidy */
@media (max-width: 640px) {
  .header-tools .btn { display: none; }
  .nav-cta { display: block; }
  .nav .nav-cta.primary { background: linear-gradient(135deg, var(--flame), var(--flame-2)); color: #1b1200; font-weight: 700; text-align: center; margin-top: 6px; }
  .header-tools .select { max-width: 96px; }
}

/* ---------- 5. HERO ---------- */
.hero { padding: clamp(36px, 7vw, 88px) 0 clamp(28px, 5vw, 56px); }
.hero .wrap { display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 10px; }
.fineprint { font-size: .88rem; color: var(--muted); }
.chart-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 14px; position: relative; overflow: hidden;
}
.chart-card canvas { width: 100%; height: 340px; }
.chart-card .chart-top { display: flex; justify-content: space-between; align-items: center;
  font-size: .85rem; color: var(--muted); padding: 4px 6px 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: .8rem; font-weight: 600; color: var(--text); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); }
.pill.demo .dot { background: var(--flame); }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; } .chart-card canvas { height: 260px; } }

/* ---------- 6. SECTIONS & CARDS ---------- */
.section { padding: clamp(40px, 6vw, 84px) 0; }
.section-head { margin-bottom: 28px; }
.grid { display: grid; gap: 16px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h3 { margin-bottom: .3em; }
.card p { color: var(--muted); margin: 0; font-size: .96rem; }
.feature-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 40px; }
.feature-row { display: grid; grid-template-columns: 56px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.feature-row .glyph { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2);
  display: grid; place-items: center; font-size: 1.3rem; }
.feature-row p { margin: 0; color: var(--muted); font-size: .96rem; }
@media (max-width: 760px) { .feature-list { grid-template-columns: 1fr; } }

/* flow steps (how broker connect works) */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.steps .card { position: relative; padding-top: 52px; }
.steps .card::before { counter-increment: step; content: counter(step); position: absolute; top: 14px; left: 18px;
  width: 28px; height: 28px; border-radius: 50%; background: var(--flame); color: #1b1200; font-weight: 800;
  display: grid; place-items: center; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; }
.plan.featured { border-color: var(--flame); box-shadow: 0 0 0 1px var(--flame), var(--shadow); }
.plan .price { font-family: "Bricolage Grotesque", sans-serif; font-size: 2.4rem; font-weight: 700; margin: 6px 0 0; }
.plan .price small { font-size: 1rem; font-weight: 500; color: var(--muted); }
.plan ul { padding-left: 1.1em; margin: 14px 0 22px; color: var(--muted); flex: 1; }
.plan li { margin-bottom: 6px; }
.plan.free { border-color: var(--up, #0E9F7A); border-style: dashed; }
.plan.free .price { color: var(--up, #0E9F7A); }
@media (max-width: 1100px) { .plans { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }

/* FAQ */
details.faq { border-top: 1px solid var(--line); padding: 14px 0; }
details.faq:last-child { border-bottom: 1px solid var(--line); }
details.faq summary { cursor: pointer; font-weight: 650; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; float: right; color: var(--muted); font-size: 1.3rem; line-height: 1; }
details.faq[open] summary::after { content: "–"; }
details.faq p { margin: 10px 0 0; color: var(--muted); }

/* ---------- 7. NOTICE BARS ---------- */
.steps + .notice, .notice + .steps, .card + .notice { margin-top: 22px; }
.notice { background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--flame);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: .92rem; color: var(--muted); }
.notice strong { color: var(--text); }

/* ---------- 8. FOOTER ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 36px 0 48px; margin-top: 40px; color: var(--muted); font-size: .92rem; }
.site-footer .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.site-footer a { color: var(--muted); text-decoration: none; display: block; padding: 3px 0; }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
.site-footer h4 { color: var(--text); font-size: 1rem; margin-bottom: .5em; }
.site-footer .risk-note { margin-top: 12px; max-width: 38ch; font-size: .85rem; }
.footer-bottom { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap; }
.footer-bottom p { margin: 0; max-width: none; }
.site-footer .credit a { display: inline; padding: 0; color: var(--flame); font-weight: 600; }
@media (max-width: 640px) { .footer-bottom { justify-content: center; text-align: center; } }
.risk-line { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); font-size: .85rem; }
@media (max-width: 900px) { .site-footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .site-footer .cols { grid-template-columns: 1fr; } }

/* ---------- 9. LEGAL / TEXT PAGES ---------- */
.doc { padding: 40px 0 20px; }
.doc .wrap { max-width: 820px; }
.doc h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.doc h2 { font-size: 1.35rem; margin-top: 1.8em; }
.doc li { margin-bottom: .4em; }
.doc .updated { color: var(--muted); font-size: .92rem; }
.doc .todo { background: color-mix(in srgb, var(--flame) 18%, transparent); padding: 0 .3em; border-radius: 4px; font-weight: 600; }

/* ---------- 10. FORMS (login / signup) ---------- */
.auth { min-height: 70vh; display: grid; place-items: center; padding: 40px 0; }
.auth .card { width: min(440px, 100% - 32px); padding: 28px; }
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], select, textarea {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: .7em .85em; font: inherit;
}
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 14px; }
.check input { margin-top: .35em; }

/* ---------- 11. APP / SCANNER DASHBOARD ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 64px); }
.sidebar { border-right: 1px solid var(--line); padding: 16px 12px; background: var(--surface); position: sticky; top: 64px; align-self: start; height: calc(100vh - 64px); overflow: auto; }
.sidebar h4 { font-size: .8rem; color: var(--muted); margin: 16px 8px 6px; font-family: "Hanken Grotesk", sans-serif; font-weight: 700; letter-spacing: .02em; }
.side-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--text);
  font: inherit; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.side-btn:hover { background: var(--surface-2); }
.side-btn.active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--flame); font-weight: 650; }
.side-btn .soon { margin-left: auto; font-size: .7rem; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; border-radius: 99px; }
.main { padding: 20px clamp(14px, 3vw, 32px) 60px; min-width: 0; }
.ticker { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 14px; scrollbar-width: thin; }
.tick { flex: 0 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; min-width: 150px; }
.tick b { display: block; font-size: .85rem; color: var(--muted); font-weight: 600; }
.tick span { font-weight: 700; font-size: 1.05rem; }
.tick small { margin-left: 6px; font-weight: 650; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.toolbar .select { min-width: 130px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 5px 12px; border-radius: 99px; font: inherit; font-size: .88rem; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; min-width: 720px; }
.t th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 650; background: var(--surface-2); padding: 10px 14px; white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 10px 14px; border-top: 1px solid var(--line); white-space: nowrap; }
.t tr.row { cursor: pointer; }
.t tr.row:hover td { background: var(--surface-2); }
.t td.num, .t th.num { text-align: right; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 650; border: 1px solid var(--line); }
.tag.up { background: color-mix(in srgb, var(--up) 14%, transparent); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.tag.down { background: color-mix(in srgb, var(--down) 14%, transparent); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.tag.flat { color: var(--muted); }
.star { background: none; border: 0; cursor: pointer; font-size: 1.1rem; color: var(--muted); padding: 0 4px; }
.star.on { color: var(--flame); }
.ad-slot { margin: 16px 0; border: 1px dashed var(--line); border-radius: var(--radius-sm); min-height: 90px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, var(--line) 35%, transparent) 10px 11px); }
.trial-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.heat div { border-radius: 10px; padding: 12px; color: #fff; font-weight: 650; min-height: 74px; }
.heat div small { display: block; font-weight: 500; opacity: .9; }
.bars .bar-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; margin: 8px 0; font-size: .92rem; }
.bars .track { background: var(--surface-2); border-radius: 99px; height: 14px; position: relative; overflow: hidden; }
.bars .fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi small { color: var(--muted); display: block; }
.kpi b { font-size: 1.5rem; font-family: "Bricolage Grotesque", sans-serif; }
.modal { position: fixed; inset: 0; background: rgba(5,8,20,.6); display: none; place-items: center; z-index: 100; padding: 16px; }
.modal.open { display: grid; }
.modal .box { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; width: min(780px, 100%); padding: 16px; box-shadow: var(--shadow); }
.modal canvas { width: 100%; height: 330px; }
.modal .box-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; gap: 6px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .sidebar h4 { display: none; }
  .side-btn { white-space: nowrap; width: auto; }
  .side-btn.active { box-shadow: inset 0 -3px 0 var(--flame); }
}
