/*
 * Home page (Midnight Terminal, brand register).
 * Replaces the generic "phone mockup + floating coins" SaaS-crypto template
 * with a trading-instrument identity: a live price ticker as the hero's
 * signature visual, confident single-column typography, restrained but
 * committed cobalt/gold color use. Scoped to classes only used on this
 * page, loaded on every public page but inert everywhere else.
 */

.home-page main { overflow-x: hidden; }

/* ============ Hero ============ */

.home-hero {
  position: relative;
  padding: clamp(64px, 12vw, 128px) 0 clamp(48px, 8vw, 88px);
  background: var(--color-bg);
  overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 560px at 12% -10%, var(--color-primary-soft), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, var(--color-accent-soft), transparent 55%);
  pointer-events: none;
}
.home-hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 64px);
  align-items: center;
}
@media (max-width: 991px) {
  .home-hero-grid { grid-template-columns: 1fr; }
}
.home-hero-inner {
  min-width: 0;
  max-width: 620px;
}

/* Entrance choreography: runs on load (not scroll-gated), so it can never
   get stuck invisible the way the previous AOS-driven reveals did. Each
   element is visible-by-default the instant CSS/animation support is
   absent; the animation only ever adds motion on top of that. */
.home-eyebrow, .home-hero-title, .home-hero-subtitle, .home-signup-form, .home-form-note {
  animation: home-rise 0.7s var(--ease-out-quart) both;
}
.home-eyebrow { animation-delay: 0s; }
.home-hero-title { animation-delay: 0.08s; }
.home-hero-subtitle { animation-delay: 0.16s; }
.home-signup-form { animation-delay: 0.24s; }
.home-form-note { animation-delay: 0.3s; }
.home-hero-visual { animation: home-rise-fade 0.9s var(--ease-out-quart) 0.2s both; }
@keyframes home-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes home-rise-fade {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .home-eyebrow, .home-hero-title, .home-hero-subtitle, .home-signup-form, .home-form-note, .home-hero-visual {
    animation: none;
  }
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border: 1px solid oklch(0.86 0.10 85 / 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}
.home-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px var(--color-success-soft);
  animation: home-pulse 2s ease-in-out infinite;
}
@keyframes home-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--color-success-soft); }
  50% { box-shadow: 0 0 0 6px var(--color-success-soft); }
}
@media (prefers-reduced-motion: reduce) {
  .home-eyebrow .dot { animation: none; }
}

/* Hero visual: a real product screenshot (the actual dashboard, not a
   generic stock phone mockup) framed as a browser window. */
.home-hero-visual { min-width: 0; }
.browser-mockup {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  transform: perspective(1400px) rotateY(-4deg) rotateX(1deg);
  transition: transform var(--duration-slow) var(--ease-out-quart);
}
.browser-mockup:hover { transform: perspective(1400px) rotateY(0deg) rotateX(0deg); }
.browser-mockup-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}
.browser-mockup-bar span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-border-strong);
}
.browser-mockup-bar .url {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 3px 12px;
  flex: 1;
  max-width: 220px;
}
.browser-mockup img { display: block; width: 100%; height: auto; }
.browser-mockup-glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  box-shadow: var(--shadow-glow-primary);
  pointer-events: none;
  opacity: 0.6;
}
@media (max-width: 991px) {
  .browser-mockup { transform: none; }
}

.home-hero-title {
  font-size: clamp(2.5rem, 1.9rem + 3vw, 4.25rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--color-ink);
  text-wrap: balance;
  margin: 0 0 22px;
}
.home-hero-title .accent { color: var(--color-primary); }

.home-hero-subtitle {
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.25rem);
  line-height: 1.6;
  color: var(--color-ink-secondary);
  max-width: 58ch;
  margin: 0 0 36px;
}

.home-signup-form {
  display: flex;
  gap: 10px;
  max-width: 520px;
  flex-wrap: wrap;
}
.home-signup-form .form-control {
  flex: 1;
  min-width: 220px;
  height: 54px;
  font-size: 1rem;
}
.home-signup-form .btn {
  height: 54px;
  padding: 0 28px;
  white-space: nowrap;
  font-size: 1rem;
}
.home-form-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--color-muted);
  font-size: 13.5px;
}
.home-form-note i { color: var(--color-success); }

/* Live ticker — the hero's signature visual. Real data (same CoinGecko
   fetch that feeds the market table below), not decoration. A continuous
   marquee row of symbol / price / 24h change. */
.home-ticker {
  position: relative;
  z-index: 1;
  margin-top: clamp(48px, 8vw, 80px);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: 18px 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.home-ticker-track {
  display: flex;
  width: max-content;
  gap: 40px;
  animation: home-ticker-scroll 32s linear infinite;
}
.home-ticker[data-loading="true"] .home-ticker-track { animation-play-state: paused; }
@keyframes home-ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.home-ticker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 14px;
  white-space: nowrap;
  color: var(--color-ink-secondary);
}
.home-ticker-item .sym { font-weight: 600; color: var(--color-ink); }
.home-ticker-item .px { font-variant-numeric: tabular-nums; }
.home-ticker-item .chg { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.home-ticker-item .chg.up { color: var(--color-success); }
.home-ticker-item .chg.down { color: var(--color-danger); }
@media (prefers-reduced-motion: reduce) {
  .home-ticker-track { animation: none; }
  .home-ticker { overflow-x: auto; }
}

/* ============ Section shell ============ */

.home-section { padding: clamp(56px, 9vw, 104px) 0; }
.home-section-head { max-width: 640px; margin: 0 0 clamp(32px, 5vw, 52px); }
.home-section-title {
  font-size: clamp(1.75rem, 1.5rem + 1.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  margin: 0 0 12px;
  text-wrap: balance;
}
.home-section-subtitle {
  font-size: 1.05rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin: 0;
}
.home-section-head.center { max-width: 620px; margin-left: auto; margin-right: auto; text-align: center; }

/* ============ Market ticker table ============ */

.home-market-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.home-market-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.home-market-card .table { margin: 0; min-width: 640px; }
.home-market-card thead th {
  background: var(--color-surface-2);
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  padding: 16px 20px;
}
.home-market-card tbody td {
  padding: 16px 20px;
  vertical-align: middle;
  border-top: 1px solid var(--color-border);
  color: var(--color-ink-secondary);
  font-size: 14.5px;
}
.home-market-card tbody tr:hover { background: var(--color-surface-2); }
.home-market-card .crypto-icon { width: 28px; height: 28px; border-radius: 50%; margin-right: 10px; vertical-align: middle; }
.home-market-card .crypto-name { color: var(--color-ink); font-weight: 600; }
.home-market-card .crypto-symbol { color: var(--color-muted); font-size: 12.5px; margin-left: 6px; text-transform: uppercase; }
.home-market-card td:nth-child(2), .home-market-card td:nth-child(4), .home-market-card td:nth-child(5) {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.home-market-card .price-change {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums;
}
.home-market-card .price-change.positive { background: var(--color-success-soft); color: var(--color-success); }
.home-market-card .price-change.negative { background: var(--color-danger-soft); color: var(--color-danger); }
.home-market-card .loader {
  width: 32px; height: 32px; margin: 24px auto;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: home-spin 0.8s linear infinite;
}
@keyframes home-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .home-market-card .loader { animation-duration: 2.4s; } }

/* ============ Feature grid (asymmetric — not 4 identical tiles) ============ */

.home-features-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
}
.home-feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: transform var(--duration-base) var(--ease-out-quart), box-shadow var(--duration-base) var(--ease-out-quart);
}
.home-feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.home-feature-card.featured { grid-column: span 3; }
.home-feature-card:not(.featured) { grid-column: span 3; }
@media (min-width: 992px) {
  .home-feature-card.featured { grid-column: span 3; }
  .home-feature-card:nth-child(2) { grid-column: span 3; }
  .home-feature-card:nth-child(3), .home-feature-card:nth-child(4) { grid-column: span 2; }
}
.home-feature-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 20px;
}
.home-feature-card:nth-child(1) .home-feature-icon { background: var(--color-primary-soft); color: var(--color-primary); }
.home-feature-card:nth-child(2) .home-feature-icon { background: var(--color-accent-soft); color: var(--color-accent); }
.home-feature-card:nth-child(3) .home-feature-icon { background: var(--color-success-soft); color: var(--color-success); }
.home-feature-card:nth-child(4) .home-feature-icon { background: var(--color-primary-soft); color: var(--color-primary); }
.home-feature-title { font-size: 1.15rem; font-weight: 700; color: var(--color-ink); margin: 0 0 10px; }
.home-feature-description { color: var(--color-muted); line-height: 1.6; margin: 0; font-size: 14.5px; }

@media (max-width: 991px) {
  .home-features-grid { grid-template-columns: 1fr; }
  .home-feature-card, .home-feature-card.featured { grid-column: auto; }
}

/* ============ Trade Anywhere (PWA) ============ */

.home-pwa-copy { max-width: 640px; margin: 0 auto; text-align: center; }
.home-pwa-copy .home-section-subtitle { margin-left: auto; margin-right: auto; }

.home-app-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 32px 0 36px;
  text-align: left;
}
.home-app-feature {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; color: var(--color-ink-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.home-app-feature i { color: var(--color-success); font-size: 16px; flex-shrink: 0; }

.home-pwa-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

@media (max-width: 575px) {
  .home-app-features { grid-template-columns: 1fr; }
}

/* ============ Supported assets ============ */

.home-assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}
.home-asset-logo {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  transition: border-color var(--duration-fast) var(--ease-out-quart), transform var(--duration-fast) var(--ease-out-quart);
}
.home-asset-logo:hover { border-color: var(--color-primary); transform: translateY(-2px); }
.home-asset-logo img { max-width: 44px; max-height: 44px; object-fit: contain; }

/* ============ CTA ============ */

.home-cta-section {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}
.home-cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 700px 400px at 50% 0%, var(--color-primary-soft), transparent 65%);
  pointer-events: none;
}
.home-cta-title {
  position: relative; z-index: 1;
  font-size: clamp(1.85rem, 1.5rem + 1.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  margin: 0 0 14px;
  text-wrap: balance;
}
.home-cta-subtitle {
  position: relative; z-index: 1;
  color: var(--color-muted);
  font-size: 1.05rem;
  max-width: 520px;
  margin: 0 auto 32px;
}
.home-cta-section .btn { position: relative; z-index: 1; padding: 16px 36px; font-size: 1.05rem; }

@media (max-width: 575px) {
  .home-signup-form { flex-direction: column; }
  .home-signup-form .form-control, .home-signup-form .btn { width: 100%; }
}
