/* =========================================================================
   home.css — the homepage's look, built from the logo's own palette (deep
   navy, cyan, gold). Loaded AFTER layout.css, so it only overrides. Homepage
    only; the other pages still use the indigo accent from app.css.
   ========================================================================= */

:root {
  --navy: #021631;
  --navy-2: #0a2a52;
  --cyan: #22d3ee;
  --gold: #cdb473;

  /* Re-point the design system's accent from indigo to the logo's cyan. */
  --brand: #0891b2;
  --brand-hover: #0e7490;
  --brand-light: #ecfeff;
  --shadow-card: 0 1px 2px rgba(2, 22, 49, 0.05), 0 10px 28px rgba(2, 22, 49, 0.06);
}

body { background: #f4f7fb; }

/* ---- header ---- */
.logo-img { width: 36px; height: 36px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.35); }
.brand-text { letter-spacing: -0.02em; }
.data-badge { background: #fff; }

/* ---- hero ---- */
.hero-v2 {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 24px;
  align-items: center;
  margin: 0 0 22px;
  padding: 26px 30px 22px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(900px 260px at 85% -20%, rgba(34, 211, 238, 0.28), transparent 60%),
    radial-gradient(600px 220px at 0% 120%, rgba(205, 180, 115, 0.16), transparent 60%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  box-shadow: 0 14px 40px rgba(2, 22, 49, 0.28);
}
.hero-logo {
  width: 96px; height: 96px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.45), 0 0 34px rgba(34, 211, 238, 0.35);
}
.hero-eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px;
}
.hero-v2 h1 { font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; margin: 0 0 8px; color: #fff; }
.hero-v2 h1 em { font-style: normal; color: var(--cyan); }
.hero-sub { font-size: 15px; line-height: 1.55; color: rgba(226, 238, 255, 0.82); max-width: 62ch; margin: 0; }

.trust {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.chip {
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
}
.chip b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--gold); line-height: 1.1; }
.chip span { font-size: 11.5px; color: rgba(226, 238, 255, 0.75); }

@media (max-width: 700px) {
  /* Keep the hero short: the tool itself must stay on the first screen. The
     header already carries the logo, so it is dropped here. */
  .hero-v2 { grid-template-columns: 1fr; padding: 16px 16px 14px; margin-bottom: 16px; border-radius: 16px; }
  .hero-logo { display: none; }
  .hero-eyebrow { margin-bottom: 4px; }
  .hero-v2 h1 { font-size: 22px; margin-bottom: 6px; }
  .hero-sub { font-size: 13px; line-height: 1.5; }
  .trust { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
  .chip { padding: 8px 8px; border-radius: 10px; }
  .chip b { font-size: 16px; }
  .chip span { font-size: 10px; line-height: 1.25; display: block; }
}

/* ---- cards and controls ---- */
.controls .step, .output .step { box-shadow: var(--shadow-card); border-color: #e3eaf3; }
.testing-on { border-color: #a5f3fc; background: linear-gradient(135deg, #ecfeff, #f0f9ff); }
.runbar {
  background: linear-gradient(135deg, var(--navy) 0%, #0b3a66 100%);
  box-shadow: 0 10px 26px rgba(2, 22, 49, 0.35);
}
.runbar:hover:not(:disabled) { filter: brightness(1.12); }
.step-n { background: linear-gradient(135deg, var(--brand), #06b6d4); }
.tab.on, .tab:hover { background: #ecfeff; }
.tab.open { box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.22); }
.tab .box { border-color: #a7b4c6; }
.tab.on .box { background: var(--brand); border-color: var(--brand); background-clip: content-box; }

/* ---- results ---- */
.pattern-scroll { box-shadow: 0 1px 2px rgba(2, 22, 49, 0.04); }
.pattern-table thead th { background: #f1f6fb; }
.pattern-table tr.bench td { background: linear-gradient(90deg, #fff8e6, #fff); }
.strategy-info { box-shadow: var(--shadow-card); }

/* equity chart card, first thing in the results */
.eq-card {
  border: 1px solid #e3eaf3;
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px 10px;
  margin-bottom: 14px;
}
.eq-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 6px; }
.eq-title { font-size: 14px; font-weight: 800; letter-spacing: -0.01em; }
.eq-sub { font-size: 12px; color: var(--ink-muted); }
.eq-legend { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-secondary); }
.eq-legend i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.eq-host { width: 100%; height: 280px; }
@media (max-width: 700px) { .eq-host { height: 210px; } .eq-legend { margin-left: 0; } }

/* chart goes on its own full-width first row of the wide results grid */
@container output (min-width: 1100px) {
  #results { grid-template-rows: max-content max-content max-content max-content 1fr; }
  #results > .eq-card        { grid-column: 1 / -1; grid-row: 1; }
  #results > .pattern-scroll { grid-row: 2 / 6; }
  #results > .period-strip   { grid-row: 2; }
}

/* sample-size warning on thin results */
.thin-flag.warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }

/* ---- strategy information panel: removed from this version of the mockup ----
   Hidden with CSS only, so it is trivial to bring back. Row and tab selection
   still highlight the chart line. Before a run the message box takes the full
   width again. */
.strategy-info,
.results-empty .re-side { display: none !important; }
@container output (min-width: 1100px) {
  #resultsWrap[hidden] + .results-empty { display: block; }
}

/* ---- chart zoom controls ---- */
.eq-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.eq-btn {
  min-width: 34px; height: 28px; padding: 0 10px;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  color: var(--ink-secondary); background: #fff;
  border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
}
.eq-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-light); }
.eq-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 2px; }
.eq-hint { margin-left: auto; font-size: 11px; color: var(--ink-muted); }
.eq-toggle {
  font: inherit; font-size: 11.5px; color: var(--ink-secondary);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.eq-toggle i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.eq-toggle:hover { color: var(--brand); }
.eq-toggle.off { opacity: 0.5; text-decoration: line-through; }
.eq-host { cursor: crosshair; }
@media (max-width: 700px) { .eq-hint { display: none; } }

/* ---- results: no side column ----
   The data line and the buy-and-hold verdict are hidden (see hideSummaryBoxes in
   home.js), so the results stack in one full-width column and the table uses the
   whole width instead of the 760px column it had beside them. */
.wds-gone { display: none !important; }
@container output (min-width: 1100px) {
  #results { display: block; }
}

/* ---- strategy tabs: hide redundant "default" badge & add chevron cue ---- */
.tab {
  border-color: #cbd5e1;
  transition: all 0.15s ease;
}
.tab .state:not(.changed) { display: none; }
.tab::after {
  content: "▾";
  font-size: 11px;
  color: var(--ink-faint);
  margin-left: 2px;
  transition: transform 0.16s ease, color 0.16s ease;
}
.tab:hover::after { color: var(--brand); }
.tab.open::after { transform: rotate(180deg); color: var(--brand); }
.tab.on {
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
  border-color: #0891b2;
  color: var(--navy);
  box-shadow: 0 2px 6px rgba(8, 145, 178, 0.12);
}

/* ---- empty state card (before first Run) ---- */
.results-empty .re-msg {
  background: radial-gradient(500px 180px at 50% 0%, rgba(34, 211, 238, 0.1), transparent 70%), #ffffff;
  border: 1px solid #dbe5f0;
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 40px 28px;
  min-height: 310px;
}
.results-empty .re-icon {
  width: 64px; height: 48px;
  border-radius: 14px;
  background: var(--navy);
  display: grid; place-items: center;
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(2, 22, 49, 0.18), 0 0 0 2px rgba(34, 211, 238, 0.28);
}
.results-empty .big {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin-bottom: 8px;
}
.results-empty .small {
  font-size: 14px;
  color: var(--ink-secondary);
  max-width: 44ch;
  line-height: 1.55;
}
.results-empty .small b { color: var(--brand); }
.results-empty .re-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}
.results-empty .re-features span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  background: #f4f7fb;
  border: 1px solid #e2e8f0;
  padding: 6px 12px;
  border-radius: 999px;
}
.results-empty .re-features i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand);
}
.results-empty .re-features span:first-child i { background: var(--gold); }
.results-empty .re-features span:last-child i { background: var(--profit); }

/* ---- results verdict pill & vs-hold badges ---- */
.verdict-pill {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
}
.verdict-pill.win {
  background: var(--profit-bg);
  color: var(--profit-ink);
  border: 1px solid var(--profit-border);
}
.verdict-pill.lose {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}

.pattern-table tbody tr.sel td:first-child {
  box-shadow: inset 4px 0 0 var(--brand);
}
.pattern-table td:nth-child(3) { font-weight: 700; }

.vs-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}
.vs-pill.up {
  background: var(--profit-bg);
  color: var(--profit-ink);
  border: 1px solid var(--profit-border);
}
.vs-pill.down {
  background: var(--loss-bg);
  color: var(--loss-ink);
  border: 1px solid var(--loss-border);
}

/* ---- chart header chips, segmented toolbar & replay button ---- */
.eq-card {
  background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
  box-shadow: 0 2px 10px rgba(2, 22, 49, 0.04);
}
.eq-hover-date {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: #ecfeff;
  padding: 2px 8px;
  border-radius: 999px;
}
.eq-hover-date:empty { display: none; }

.eq-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid #e2e8f0;
  font-size: 11.5px;
}
.eq-chip.hold { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.eq-chip.sel  { background: #ecfeff; border-color: #a5f3fc; color: var(--navy); }
.eq-val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  margin-left: 2px;
}
.eq-val.up   { color: var(--profit-ink); }
.eq-val.down { color: var(--loss-ink); }

.eq-seg {
  display: inline-flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  gap: 2px;
}
.eq-seg .eq-btn {
  border: none;
  background: transparent;
  height: 26px;
  min-width: 32px;
  border-radius: 7px;
  transition: all 0.14s ease;
}
.eq-seg .eq-btn:hover {
  background: #ffffff;
  color: var(--brand);
}
.eq-seg .eq-btn.on {
  background: var(--navy);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(2, 22, 49, 0.2);
}
.eq-replay {
  color: var(--brand);
  border-color: #a5f3fc;
  background: #ecfeff;
  transition: all 0.15s ease;
}
.eq-replay:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

@keyframes wdsResultsIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
#results.wds-anim {
  animation: wdsResultsIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes wdsRowIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pattern-table tbody tr.wds-row-in {
  animation: wdsRowIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

