/* ===================================================================
   Klein's AI Wealth Generator — v3
   Direction: cinematic minimalism (motionsites school). Pure neutral
   black, one statement headline (grotesk + italic serif accent with a
   soft gold glow), a living golden particle field, quiet dark cards.
   Gold appears only where it earns its place.
   =================================================================== */

:root {
  --bg: #070707;
  --card: #101010;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --text: #f4f3f0;
  --dim: #98968e;
  --gold: #e9b949;
  --gold-soft: rgba(233, 185, 73, 0.55);
  --gain: #46d483;
  --loss: #f0524a;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: #141005; }

button, input, select { font: inherit; }

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

/* ============ preloader ============ */
.loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.6s ease, visibility 0s 0.6s;
}

.loader.is-done { opacity: 0; visibility: hidden; }

.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }

.loader-count {
  font-family: var(--serif);
  font-style: italic;
  font-size: 84px;
  line-height: 1;
  color: var(--text);
}

.loader-count::after { content: "%"; font-size: 0.4em; color: var(--dim); margin-left: 4px; }

.loader-bar {
  width: 200px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.loader-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gold);
}

.loader-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ============ reveal machinery ============ */
.reveal-on-load {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}

.line-mask { display: block; overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }

.reveal-line {
  display: block;
  transform: translateY(112%);
  transition: transform 1.1s var(--ease-out);
}

body.is-loaded .reveal-on-load { opacity: 1; transform: translateY(0); }
body.is-loaded .reveal-line { transform: translateY(0); }

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}

.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ============ nav ============ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px clamp(20px, 4vw, 44px);
  background: linear-gradient(180deg, rgba(7, 7, 7, 0.8), transparent);
}

.nav-brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }

.nav-brand em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--gold); }

.nav-links { display: flex; gap: 28px; }

.nav-links a {
  font-size: 13px;
  color: var(--dim);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

.nav-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  background: rgba(7, 7, 7, 0.6);
  backdrop-filter: blur(8px);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gain);
  box-shadow: 0 0 8px var(--gain);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ============ hero ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 100px 20px 90px;
  overflow: hidden;
}

#field { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero-fade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 60% at 50% 38%, transparent 40%, rgba(7, 7, 7, 0.5) 78%, var(--bg) 100%),
    linear-gradient(180deg, rgba(7, 7, 7, 0.25) 0%, transparent 26%, transparent 72%, var(--bg) 100%);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 2; max-width: 980px; }

.hero-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  margin-bottom: clamp(26px, 4.5vh, 44px);
  background: rgba(7, 7, 7, 0.35);
  backdrop-filter: blur(6px);
}

.hero-title {
  font-weight: 650;
  font-size: clamp(58px, 12.5vw, 164px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  color: var(--text);
}

.hero-title .accent {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--gold);
  text-shadow:
    0 0 40px rgba(233, 185, 73, 0.45),
    0 0 120px rgba(233, 185, 73, 0.22);
}

.hero-sub {
  margin-top: clamp(22px, 3.6vh, 34px);
  font-size: clamp(15px, 1.8vw, 17.5px);
  font-weight: 400;
  color: var(--dim);
  line-height: 1.75;
}

.hero-stats {
  margin-top: clamp(30px, 5.5vh, 52px);
  display: inline-flex;
  align-items: center;
  gap: clamp(20px, 3.4vw, 44px);
  padding: 18px clamp(22px, 3.4vw, 40px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(12px);
}

.stat { display: flex; flex-direction: column; gap: 5px; text-align: left; }

.stat-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

.stat-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: clamp(19px, 2.6vw, 26px);
  color: var(--text);
}

.stat-value.is-gain { color: var(--gain); }
.stat-value.is-loss { color: var(--loss); }

.stat-divider { width: 1px; height: 34px; background: var(--line); }

.scroll-cue {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

.scroll-cue i {
  display: block;
  width: 1px;
  height: 42px;
  background: linear-gradient(180deg, var(--dim), transparent);
  animation: cue 2s var(--ease-out) infinite;
}

@keyframes cue {
  from { transform: scaleY(0); transform-origin: top; opacity: 1; }
  to { transform: scaleY(1); transform-origin: top; opacity: 0.15; }
}

/* ============ ticker ============ */
.tape {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.012);
  overflow: hidden;
}

.tape-track {
  display: inline-flex;
  gap: 56px;
  padding: 16px 0;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  will-change: transform;
  animation: tape-scroll 52s linear infinite;
}

.tape:hover .tape-track { animation-play-state: paused; }

@keyframes tape-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.tape-item { color: var(--dim); }
.tape-item .t-sym { color: var(--text); font-weight: 500; margin-right: 9px; }
.tape-item .t-up { color: var(--gain); }
.tape-item .t-down { color: var(--loss); }

/* ============ content ============ */
.content {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 40px);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.section-eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 12px;
}

.section-title {
  font-weight: 600;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.section-title em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
}

.board { padding-top: 110px; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }

.filter-btn {
  font-size: 13px;
  font-weight: 500;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.filter-btn:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.22); }

.filter-btn.is-active {
  color: #131313;
  background: var(--text);
  border-color: var(--text);
  font-weight: 600;
}

/* ============ card grid ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 12px;
}

.asset-card {
  position: relative;
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 22px 22px 16px;
  background: linear-gradient(170deg, #121212, #0c0c0c 70%);
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.8s var(--ease-out),
    transform 0.8s var(--ease-out),
    border-color 0.25s,
    box-shadow 0.25s;
}

.asset-card.in-view { opacity: 1; transform: translateY(0); }

.asset-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(-4px);
}

.asset-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 40% at 50% 0%, rgba(233, 185, 73, 0.07), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.asset-card:hover::after { opacity: 1; }

.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

.card-sym { font-weight: 650; font-size: 21px; letter-spacing: -0.02em; }

.card-tag {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}

.card-name { font-size: 13px; color: var(--dim); margin-top: 1px; }

.card-price {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 23px;
  margin-top: 16px;
}

.card-change {
  display: inline-block;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
}

.card-change.is-gain { color: var(--gain); }
.card-change.is-loss { color: var(--loss); }

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-caret {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  margin-top: 6px;
  transition: transform 0.35s var(--ease-out), color 0.2s, border-color 0.2s;
}

.asset-card:hover .card-caret { color: var(--text); border-color: rgba(255, 255, 255, 0.25); }
.asset-card.is-open .card-caret { transform: rotate(45deg); color: var(--gold); border-color: rgba(233, 185, 73, 0.4); }

.card-spark { margin: 14px -8px 0; }
.card-spark svg { display: block; width: 100%; height: 46px; }

.asset-card { cursor: pointer; }

.card-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.55s var(--ease-out);
}

.asset-card.is-open .card-details { max-height: 460px; }

.cd-inner {
  border-top: 1px solid var(--line-soft);
  margin-top: 16px;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cd-about { font-size: 13.5px; line-height: 1.6; color: var(--text); }

.cd-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 6px;
}

.cd-text { font-size: 13px; line-height: 1.6; color: var(--dim); }

.cd-news {
  align-self: flex-start;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 15px;
  transition: border-color 0.2s, color 0.2s;
}

.cd-news:hover { border-color: rgba(233, 185, 73, 0.5); color: var(--gold); }

.board-loading, .empty-note {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--dim);
  padding: 30px 4px;
}

.board-updated {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  text-align: right;
}

/* ============ positions ============ */
.positions { padding-top: 120px; padding-bottom: 20px; }

.operator { display: flex; align-items: center; gap: 12px; }

.op-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}

#operator-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  width: 170px;
  transition: border-color 0.2s;
}

#operator-name:focus { border-color: rgba(255, 255, 255, 0.3); }

.positions-panel {
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  padding: clamp(22px, 3.4vw, 38px);
  background: linear-gradient(170deg, #111111, #0b0b0b 70%);
}

.panel-note { font-size: 14px; color: var(--dim); max-width: 60ch; margin-bottom: 26px; }

.add-form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.9fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 26px;
}

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.field label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.add-form select,
.add-form input {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  width: 100%;
  transition: border-color 0.2s;
}

.add-form select:focus, .add-form input:focus { border-color: rgba(255, 255, 255, 0.3); }

.add-form select option { background: #141414; }

.add-btn {
  font-weight: 600;
  font-size: 14px;
  color: #131313;
  background: var(--text);
  border: none;
  border-radius: 999px;
  padding: 13px 26px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s var(--ease-out), box-shadow 0.2s;
}

.add-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(255, 255, 255, 0.12); }
.add-btn:active { transform: translateY(1px); }

.pos-table {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
}

.pos-row {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 0.9fr 1fr 1.2fr 36px;
  gap: 12px;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}

.pos-row:last-child { border-bottom: none; }

.pos-head {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.02);
}

.pos-sym { font-weight: 600; }
.pos-gain.is-gain { color: var(--gain); }
.pos-gain.is-loss { color: var(--loss); }

.remove-btn {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.remove-btn:hover { color: var(--loss); border-color: var(--line); }

.totals {
  display: flex;
  gap: 48px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.total-cell { display: flex; flex-direction: column; gap: 7px; }

.total-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: clamp(24px, 3.4vw, 34px);
}

.total-num.is-gain { color: var(--gain); }
.total-num.is-loss { color: var(--loss); }

/* ============ footer ============ */
.footer {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  padding: 120px clamp(20px, 4vw, 40px) 46px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 44px;
  font-size: 13.5px;
  color: var(--dim);
  padding-top: 34px;
  border-top: 1px solid var(--line-soft);
}

.footer-line {
  margin-top: 44px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ============ responsive ============ */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .hero-stats { flex-direction: column; align-items: stretch; gap: 14px; padding: 20px 26px; }
  .stat { text-align: center; align-items: center; }
  .stat-divider { width: 100%; height: 1px; }
  .add-form { grid-template-columns: 1fr 1fr; }
  .add-form .field:first-child { grid-column: 1 / -1; }
  .add-btn { grid-column: 1 / -1; }
  .pos-row { grid-template-columns: 1fr 0.7fr 1fr 32px; font-size: 12.5px; }
  .pos-row span:nth-child(3), .pos-head span:nth-child(3) { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
}

/* ============ reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .loader { display: none; }
  .tape-track, .live-dot, .scroll-cue i { animation: none; }
  #field { display: none; }
  .reveal-on-load, .reveal, .asset-card { opacity: 1; transform: none; transition: none; }
  .reveal-line { transform: none; transition: none; }
  * { transition-duration: 0.01ms !important; }
}
